@team-agent/installer 0.5.61 → 0.5.62
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/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/crates/team-agent/src/cli/adapters.rs +5 -2
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +1 -0
- package/crates/team-agent/src/cli/diagnose.rs +1 -0
- package/crates/team-agent/src/cli/emit.rs +41 -7
- package/crates/team-agent/src/cli/helpers.rs +1 -0
- package/crates/team-agent/src/cli/leader.rs +6 -1
- package/crates/team-agent/src/cli/leaders.rs +2 -0
- package/crates/team-agent/src/cli/mod.rs +33 -3
- package/crates/team-agent/src/cli/named_address.rs +8 -1
- package/crates/team-agent/src/cli/profile.rs +2 -1
- package/crates/team-agent/src/cli/send/coordinator.rs +1 -0
- package/crates/team-agent/src/cli/send/mailbox.rs +3 -0
- package/crates/team-agent/src/cli/send/persist.rs +1 -0
- package/crates/team-agent/src/cli/send/presentation.rs +1 -0
- package/crates/team-agent/src/cli/send/resolve.rs +206 -1
- package/crates/team-agent/src/cli/send.rs +2 -1
- package/crates/team-agent/src/cli/spec.rs +1 -0
- package/crates/team-agent/src/cli/status.rs +2 -1
- package/crates/team-agent/src/cli/status_port/compact.rs +1 -0
- package/crates/team-agent/src/cli/status_port/format.rs +1 -0
- package/crates/team-agent/src/cli/status_port/inbox.rs +1 -0
- package/crates/team-agent/src/cli/tests/verb_profile.rs +38 -0
- package/crates/team-agent/src/cli/types.rs +3 -2
- package/crates/team-agent/src/communication_mode/mod.rs +1 -0
- package/crates/team-agent/src/compiler.rs +1 -0
- package/crates/team-agent/src/conpty/backend.rs +1 -0
- package/crates/team-agent/src/conpty/mod.rs +1 -0
- package/crates/team-agent/src/coordinator/backoff.rs +5 -8
- package/crates/team-agent/src/coordinator/conpty_shim.rs +3 -2
- package/crates/team-agent/src/coordinator/health.rs +1 -0
- package/crates/team-agent/src/coordinator/mod.rs +2 -2
- package/crates/team-agent/src/coordinator/orphan.rs +4 -116
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +1 -0
- package/crates/team-agent/src/coordinator/runtime_observation.rs +1 -0
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +6 -5
- package/crates/team-agent/src/coordinator/steps/delivery.rs +1 -0
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +1 -0
- package/crates/team-agent/src/coordinator/steps/mod.rs +2 -0
- package/crates/team-agent/src/coordinator/steps/persist.rs +1 -0
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +1 -0
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +1 -0
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -174
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -9
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -184
- package/crates/team-agent/src/coordinator/tests/mod.rs +2 -17
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -42
- package/crates/team-agent/src/coordinator/tick.rs +24 -28
- package/crates/team-agent/src/coordinator/types.rs +3 -176
- package/crates/team-agent/src/db/agent_health_capture.rs +1 -0
- package/crates/team-agent/src/db/message_store.rs +2 -1
- package/crates/team-agent/src/db/migration.rs +5 -4
- package/crates/team-agent/src/db/mod.rs +1 -0
- package/crates/team-agent/src/db/schema.rs +1 -0
- package/crates/team-agent/src/diagnose/comms.rs +2 -1
- package/crates/team-agent/src/diagnose/mod.rs +1 -0
- package/crates/team-agent/src/diagnose/orphans.rs +1 -0
- package/crates/team-agent/src/layout/manager.rs +3 -7
- package/crates/team-agent/src/layout/mod.rs +2 -2
- package/crates/team-agent/src/layout/overlay.rs +6 -1
- package/crates/team-agent/src/layout/placement.rs +1 -0
- package/crates/team-agent/src/layout/recovery.rs +3 -0
- package/crates/team-agent/src/layout/runtime_sessions.rs +8 -3
- package/crates/team-agent/src/layout/sessions.rs +8 -1
- package/crates/team-agent/src/layout/tmux_endpoint.rs +3 -0
- package/crates/team-agent/src/layout/worker_env.rs +3 -0
- package/crates/team-agent/src/layout/worker_window_helpers.rs +2 -0
- package/crates/team-agent/src/leader/helpers.rs +1 -0
- package/crates/team-agent/src/leader/incident.rs +1 -0
- package/crates/team-agent/src/leader/lease.rs +27 -22
- package/crates/team-agent/src/leader/mod.rs +2 -3
- package/crates/team-agent/src/leader/owner_bind.rs +13 -3
- package/crates/team-agent/src/leader/provider_attribution.rs +1 -0
- package/crates/team-agent/src/leader/rediscover.rs +4 -17
- package/crates/team-agent/src/leader/registry.rs +3 -15
- package/crates/team-agent/src/leader/start.rs +373 -125
- package/crates/team-agent/src/leader/takeover.rs +10 -232
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +544 -0
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +624 -0
- package/crates/team-agent/src/leader/tests/identity.rs +7 -2
- package/crates/team-agent/src/leader/tests/idle.rs +0 -193
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -45
- package/crates/team-agent/src/leader/tests/mod.rs +4 -41
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +83 -0
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +1273 -0
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +417 -0
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +22 -103
- package/crates/team-agent/src/leader/types.rs +1 -28
- package/crates/team-agent/src/lib.rs +3 -0
- package/crates/team-agent/src/lifecycle/display.rs +7 -1
- package/crates/team-agent/src/lifecycle/helpers.rs +3 -1
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +2 -2
- package/crates/team-agent/src/lifecycle/launch/fork_agent/completion.rs +1 -0
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +1 -0
- package/crates/team-agent/src/lifecycle/launch/fork_finalize.rs +1 -0
- package/crates/team-agent/src/lifecycle/launch/plan.rs +2 -2
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +4 -26
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -27
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +1 -27
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +4 -32
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +1 -0
- package/crates/team-agent/src/lifecycle/launch.rs +11 -12
- package/crates/team-agent/src/lifecycle/mod.rs +2 -1
- package/crates/team-agent/src/lifecycle/restart/agent.rs +3 -3
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +2 -2
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +13 -5
- package/crates/team-agent/src/lifecycle/restart/remove.rs +1 -1
- package/crates/team-agent/src/lifecycle/restart/selection.rs +3 -3
- package/crates/team-agent/src/lifecycle/restart.rs +13 -11
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +1007 -0
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +265 -0
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +459 -0
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +849 -0
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +323 -0
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +423 -0
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +737 -0
- package/crates/team-agent/src/lifecycle/tests/codex_mcp_approval_inheritance_red.rs +1187 -0
- package/crates/team-agent/src/lifecycle/tests/codex_weak_window_attribution_red.rs +683 -0
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +394 -0
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +1856 -0
- package/crates/team-agent/src/lifecycle/tests/core_034_real_red.rs +917 -0
- package/crates/team-agent/src/lifecycle/tests/display_adaptive_red.rs +481 -0
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +301 -0
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +516 -0
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +986 -0
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +651 -0
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +2 -0
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +332 -0
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +846 -0
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +648 -0
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +910 -0
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +630 -0
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +1083 -0
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +1677 -0
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +410 -0
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +428 -0
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +1032 -0
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +869 -0
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +1249 -0
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +342 -0
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +542 -0
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +1103 -0
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +1276 -0
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +145 -0
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +603 -0
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +837 -0
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +928 -0
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +951 -0
- package/crates/team-agent/src/lifecycle/tests/worker_dangerous_bypass_argv_red.rs +327 -0
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +760 -0
- package/crates/team-agent/src/lifecycle/tests.rs +59 -0
- package/crates/team-agent/src/lifecycle/types.rs +0 -9
- package/crates/team-agent/src/mcp_server/helpers.rs +1 -0
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +1 -0
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +1 -0
- package/crates/team-agent/src/mcp_server/mod.rs +1 -0
- package/crates/team-agent/src/mcp_server/normalize.rs +4 -3
- package/crates/team-agent/src/mcp_server/tools.rs +1 -0
- package/crates/team-agent/src/mcp_server/types.rs +1 -18
- package/crates/team-agent/src/mcp_server/wire.rs +5 -5
- package/crates/team-agent/src/messaging/activity.rs +1 -0
- package/crates/team-agent/src/messaging/address.rs +1 -0
- package/crates/team-agent/src/messaging/delivery.rs +4 -3
- package/crates/team-agent/src/messaging/helpers.rs +2 -1
- package/crates/team-agent/src/messaging/leader_channel.rs +1 -0
- package/crates/team-agent/src/messaging/leader_receiver.rs +2 -1
- package/crates/team-agent/src/messaging/mod.rs +10 -14
- package/crates/team-agent/src/messaging/peers.rs +2 -0
- package/crates/team-agent/src/messaging/persist.rs +3 -1
- package/crates/team-agent/src/messaging/presentation.rs +2 -1
- package/crates/team-agent/src/messaging/results.rs +1 -0
- package/crates/team-agent/src/messaging/scheduler.rs +1 -0
- package/crates/team-agent/src/messaging/selftest.rs +1 -1
- package/crates/team-agent/src/messaging/send.rs +41 -8
- package/crates/team-agent/src/messaging/tests/mod.rs +5 -0
- package/crates/team-agent/src/messaging/types.rs +2 -2
- package/crates/team-agent/src/messaging/watchers.rs +19 -13
- package/crates/team-agent/src/model/enums.rs +1 -0
- package/crates/team-agent/src/model/errors.rs +1 -0
- package/crates/team-agent/src/model/ids.rs +1 -0
- package/crates/team-agent/src/model/mod.rs +1 -0
- package/crates/team-agent/src/model/name_similarity.rs +1 -0
- package/crates/team-agent/src/model/pane_authority_refusal.rs +1 -0
- package/crates/team-agent/src/model/paths.rs +1 -0
- package/crates/team-agent/src/model/permissions.rs +3 -2
- package/crates/team-agent/src/model/routing.rs +1 -0
- package/crates/team-agent/src/model/spec.rs +1 -0
- package/crates/team-agent/src/model/task_graph.rs +1 -0
- package/crates/team-agent/src/model/yaml/tests.rs +1 -0
- package/crates/team-agent/src/model/yaml.rs +1 -0
- package/crates/team-agent/src/packaging/install.rs +9 -147
- package/crates/team-agent/src/packaging/migrate.rs +2 -0
- package/crates/team-agent/src/packaging/mod.rs +1 -0
- package/crates/team-agent/src/packaging/repair.rs +2 -0
- package/crates/team-agent/src/packaging/tests.rs +29 -218
- package/crates/team-agent/src/packaging/types.rs +8 -15
- package/crates/team-agent/src/platform/argv.rs +4 -0
- package/crates/team-agent/src/platform/errors.rs +10 -1
- package/crates/team-agent/src/platform/file_lock.rs +4 -157
- package/crates/team-agent/src/platform/mod.rs +0 -61
- package/crates/team-agent/src/platform/process.rs +1 -0
- package/crates/team-agent/src/provider/adapter.rs +1 -0
- package/crates/team-agent/src/provider/adapters/claude.rs +1 -0
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +1 -0
- package/crates/team-agent/src/provider/adapters/codex.rs +1 -0
- package/crates/team-agent/src/provider/adapters/copilot.rs +1 -0
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +1 -0
- package/crates/team-agent/src/provider/adapters/fake.rs +1 -0
- package/crates/team-agent/src/provider/adapters/mod.rs +1 -0
- package/crates/team-agent/src/provider/approvals/mod.rs +1 -0
- package/crates/team-agent/src/provider/approvals/parsing.rs +2 -5
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +6 -5
- package/crates/team-agent/src/provider/classify.rs +1 -0
- package/crates/team-agent/src/provider/faults.rs +1 -26
- package/crates/team-agent/src/provider/helpers.rs +1 -0
- package/crates/team-agent/src/provider/mod.rs +1 -1
- package/crates/team-agent/src/provider/session/capture.rs +1 -4
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +1 -0
- package/crates/team-agent/src/provider/session/context_fork/codex.rs +1 -0
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +1 -0
- package/crates/team-agent/src/provider/session/context_fork.rs +1 -0
- package/crates/team-agent/src/provider/session/mod.rs +2 -4
- package/crates/team-agent/src/provider/session/resume.rs +2 -209
- package/crates/team-agent/src/provider/session_scan/claude.rs +1 -0
- package/crates/team-agent/src/provider/session_scan/codex.rs +1 -0
- package/crates/team-agent/src/provider/session_scan/common.rs +1 -0
- package/crates/team-agent/src/provider/session_scan/copilot.rs +1 -0
- package/crates/team-agent/src/provider/session_scan.rs +1 -42
- package/crates/team-agent/src/provider/startup_prompt.rs +1 -0
- package/crates/team-agent/src/provider/types.rs +1 -0
- package/crates/team-agent/src/provider/wire.rs +1 -0
- package/crates/team-agent/src/state/identity.rs +16 -5
- package/crates/team-agent/src/state/identity_keys.rs +1 -0
- package/crates/team-agent/src/state/mod.rs +2 -0
- package/crates/team-agent/src/state/owner_gate.rs +5 -0
- package/crates/team-agent/src/state/ownership.rs +10 -4
- package/crates/team-agent/src/state/paths.rs +12 -0
- package/crates/team-agent/src/state/persist.rs +9 -3
- package/crates/team-agent/src/state/projection.rs +15 -2
- package/crates/team-agent/src/state/repository/intent.rs +1 -0
- package/crates/team-agent/src/state/repository/tests.rs +1 -0
- package/crates/team-agent/src/state/repository.rs +7 -0
- package/crates/team-agent/src/state/selector.rs +1 -0
- package/crates/team-agent/src/tmux_backend/tests.rs +39 -0
- package/crates/team-agent/src/tmux_backend.rs +63 -0
- package/crates/team-agent/src/transport.rs +15 -0
- package/package.json +4 -4
- package/crates/team-agent/src/leader/inject.rs +0 -33
- package/crates/team-agent/src/provider/command.rs +0 -80
|
@@ -0,0 +1,648 @@
|
|
|
1
|
+
//! Real-machine residual defects G1-G4.
|
|
2
|
+
//!
|
|
3
|
+
//! Anchors:
|
|
4
|
+
//! `.team/artifacts/macmini-e2e/6eeb968-clusterfix-confirm-20260605T051800Z/six-fail-triage.md`.
|
|
5
|
+
//! These are MUST-15 canonical command behaviors; the framework changes rather than weakening the
|
|
6
|
+
//! command files.
|
|
7
|
+
|
|
8
|
+
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
9
|
+
|
|
10
|
+
#[path = "../../../tests/support/hermetic.rs"]
|
|
11
|
+
mod hermetic_guard;
|
|
12
|
+
#[allow(dead_code)]
|
|
13
|
+
fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
14
|
+
|
|
15
|
+
use std::collections::{BTreeMap, HashSet};
|
|
16
|
+
use std::path::{Path, PathBuf};
|
|
17
|
+
use std::process::{Command, Output};
|
|
18
|
+
use std::sync::atomic::{AtomicU64, Ordering};
|
|
19
|
+
use std::sync::Mutex;
|
|
20
|
+
|
|
21
|
+
use serde_json::{json, Value};
|
|
22
|
+
use team_agent::lifecycle::{
|
|
23
|
+
add_agent_with_transport, remove_agent_with_transport, restart_with_transport,
|
|
24
|
+
};
|
|
25
|
+
use team_agent::messaging::{send_message, MessageTarget, SendOptions};
|
|
26
|
+
use team_agent::model::ids::AgentId;
|
|
27
|
+
use team_agent::transport::{
|
|
28
|
+
AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
|
|
29
|
+
InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, SessionName, SetEnvOutcome,
|
|
30
|
+
SpawnResult, SubmitVerification, Target, Transport, TransportError, TurnVerification,
|
|
31
|
+
WindowName,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
fn bin() -> &'static str {
|
|
35
|
+
crate::lifecycle::tests::test_binary_path()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
fn tmp_dir(tag: &str) -> PathBuf {
|
|
39
|
+
static N: AtomicU64 = AtomicU64::new(0);
|
|
40
|
+
let dir = std::env::temp_dir().join(format!(
|
|
41
|
+
"ta-rs-rm-residual-{tag}-{}-{}",
|
|
42
|
+
std::process::id(),
|
|
43
|
+
N.fetch_add(1, Ordering::Relaxed)
|
|
44
|
+
));
|
|
45
|
+
let _ = std::fs::remove_dir_all(&dir);
|
|
46
|
+
std::fs::create_dir_all(&dir).unwrap();
|
|
47
|
+
std::fs::canonicalize(dir).unwrap()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fn run(args: &[&str], cwd: &Path) -> Output {
|
|
51
|
+
Command::new(bin())
|
|
52
|
+
.args(args)
|
|
53
|
+
.current_dir(cwd)
|
|
54
|
+
.output()
|
|
55
|
+
.unwrap()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fn stdout_json(out: &Output) -> Value {
|
|
59
|
+
serde_json::from_slice(&out.stdout).unwrap_or_else(|_| {
|
|
60
|
+
panic!(
|
|
61
|
+
"stdout must be JSON; code={:?} stdout={} stderr={}",
|
|
62
|
+
out.status.code(),
|
|
63
|
+
String::from_utf8_lossy(&out.stdout),
|
|
64
|
+
String::from_utf8_lossy(&out.stderr)
|
|
65
|
+
)
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#[test]
|
|
70
|
+
#[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
|
|
71
|
+
fn g1_shutdown_after_stopped_runtime_is_idempotent_when_tmux_server_is_absent() {
|
|
72
|
+
let fixture = seed_active_team_fixture("g1-shutdown");
|
|
73
|
+
clear_coordinator_markers(&fixture.root);
|
|
74
|
+
|
|
75
|
+
let out = run(
|
|
76
|
+
&[
|
|
77
|
+
"shutdown",
|
|
78
|
+
"--workspace",
|
|
79
|
+
fixture.root.to_str().unwrap(),
|
|
80
|
+
"--keep-logs",
|
|
81
|
+
"--json",
|
|
82
|
+
],
|
|
83
|
+
&fixture.root,
|
|
84
|
+
);
|
|
85
|
+
let stdout = String::from_utf8_lossy(&out.stdout);
|
|
86
|
+
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
87
|
+
let combined = format!("{stdout}\n{stderr}");
|
|
88
|
+
|
|
89
|
+
assert_eq!(
|
|
90
|
+
out.status.code(),
|
|
91
|
+
Some(0),
|
|
92
|
+
"CR-005/G1: shutdown after a prior stop must be idempotent/no-op even when the socketed tmux server is already absent; got code={:?} stdout={stdout:?} stderr={stderr:?}",
|
|
93
|
+
out.status.code()
|
|
94
|
+
);
|
|
95
|
+
assert!(
|
|
96
|
+
!combined.contains("no server running"),
|
|
97
|
+
"CR-005/G1: absent tmux server must not surface as kill-session failure; got {combined:?}"
|
|
98
|
+
);
|
|
99
|
+
let value = stdout_json(&out);
|
|
100
|
+
assert!(
|
|
101
|
+
value["ok"].as_bool().unwrap_or(true),
|
|
102
|
+
"CR-005/G1: idempotent shutdown should return a shaped success/no-op envelope; got {value}"
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#[test]
|
|
107
|
+
#[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
|
|
108
|
+
fn g2_restart_replaces_or_reuses_existing_team_current_session_in_all_real_machine_contexts() {
|
|
109
|
+
let mut failures = Vec::new();
|
|
110
|
+
for context in [
|
|
111
|
+
RestartContext::Bare,
|
|
112
|
+
RestartContext::AfterAcknowledgeIdle,
|
|
113
|
+
RestartContext::CoordinatorPendingRecovery,
|
|
114
|
+
] {
|
|
115
|
+
let fixture = seed_restart_fixture(context);
|
|
116
|
+
let transport = DuplicateSessionTrapTransport::new_existing("team-current");
|
|
117
|
+
let result = restart_with_transport(&fixture.root, false, None, &transport);
|
|
118
|
+
|
|
119
|
+
if result.is_err() {
|
|
120
|
+
failures.push(format!(
|
|
121
|
+
"{context:?}: restart must not attempt tmux new-session while team-current already exists; result={result:?}; calls={:?}",
|
|
122
|
+
transport.calls()
|
|
123
|
+
));
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
let calls = transport.calls();
|
|
128
|
+
let kill_before_first = calls
|
|
129
|
+
.iter()
|
|
130
|
+
.position(|call| *call == "kill_session")
|
|
131
|
+
.zip(calls.iter().position(|call| *call == "spawn_first"))
|
|
132
|
+
.is_some_and(|(kill, spawn)| kill < spawn);
|
|
133
|
+
let reused_existing = calls
|
|
134
|
+
.iter()
|
|
135
|
+
.position(|call| *call == "has_session")
|
|
136
|
+
.zip(calls.iter().position(|call| *call == "spawn_into"))
|
|
137
|
+
.is_some_and(|(has, spawn)| has < spawn);
|
|
138
|
+
if !(kill_before_first || reused_existing) {
|
|
139
|
+
failures.push(format!(
|
|
140
|
+
"{context:?}: restart must either kill the old session before rebuilding or detect/reuse it before spawning; calls={calls:?}"
|
|
141
|
+
));
|
|
142
|
+
}
|
|
143
|
+
if transport.active_session_count("team-current") != 1 {
|
|
144
|
+
failures.push(format!(
|
|
145
|
+
"{context:?}: restart should leave exactly one active team-current session; sessions={:?}",
|
|
146
|
+
transport.sessions()
|
|
147
|
+
));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
assert!(
|
|
152
|
+
failures.is_empty(),
|
|
153
|
+
"CR-007/021/052 G2: restart must not fail with `duplicate session: team-current` in bare, acknowledge-idle, or pending-recovery contexts:\n{}",
|
|
154
|
+
failures.join("\n")
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
#[test]
|
|
159
|
+
#[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
|
|
160
|
+
fn g3_add_send_remove_readd_send_keeps_runtime_and_spec_rosters_coherent() {
|
|
161
|
+
let fixture = seed_active_team_fixture("g3-add-remove");
|
|
162
|
+
let role_file = fixture.root.join(".team").join("roles").join("worker_b.md");
|
|
163
|
+
let transport = DuplicateSessionTrapTransport::new_existing("team-current");
|
|
164
|
+
let worker_b = AgentId::new("worker_b");
|
|
165
|
+
|
|
166
|
+
let add = add_agent_with_transport(
|
|
167
|
+
&fixture.teamdir,
|
|
168
|
+
&worker_b,
|
|
169
|
+
&role_file,
|
|
170
|
+
false,
|
|
171
|
+
None,
|
|
172
|
+
&transport,
|
|
173
|
+
);
|
|
174
|
+
assert!(
|
|
175
|
+
add.is_ok(),
|
|
176
|
+
"CR-030/G3 fixture sanity: add-agent worker_b should succeed before send/remove; got {add:?}"
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
let first_send = send_message(
|
|
180
|
+
&fixture.root,
|
|
181
|
+
&MessageTarget::Single("worker_b".to_string()),
|
|
182
|
+
"first ping",
|
|
183
|
+
&SendOptions {
|
|
184
|
+
wait_visible: false,
|
|
185
|
+
block_until_delivered: false,
|
|
186
|
+
..SendOptions::default()
|
|
187
|
+
},
|
|
188
|
+
)
|
|
189
|
+
.unwrap();
|
|
190
|
+
assert!(
|
|
191
|
+
first_send.ok,
|
|
192
|
+
"CR-030/G3: send after add-agent must route to worker_b, proving runtime roster recognizes the new worker; got {first_send:?}"
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
let remove =
|
|
196
|
+
remove_agent_with_transport(&fixture.root, &worker_b, true, true, None, &transport);
|
|
197
|
+
assert!(
|
|
198
|
+
remove.is_ok(),
|
|
199
|
+
"CR-030/G3: remove-agent worker_b after successful add+send must succeed and must not report `unknown worker agent id: worker_b`; got {remove:?}"
|
|
200
|
+
);
|
|
201
|
+
let state_after_remove = team_agent::state::persist::load_runtime_state(&fixture.root).unwrap();
|
|
202
|
+
assert!(
|
|
203
|
+
!state_after_remove
|
|
204
|
+
.get("agents")
|
|
205
|
+
.and_then(Value::as_object)
|
|
206
|
+
.is_some_and(|agents| agents.contains_key("worker_b")),
|
|
207
|
+
"CR-030/G3: state.json roster must cleanly remove worker_b; state={state_after_remove}"
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
let readd = add_agent_with_transport(
|
|
211
|
+
&fixture.teamdir,
|
|
212
|
+
&worker_b,
|
|
213
|
+
&role_file,
|
|
214
|
+
false,
|
|
215
|
+
None,
|
|
216
|
+
&transport,
|
|
217
|
+
);
|
|
218
|
+
assert!(
|
|
219
|
+
readd.is_ok(),
|
|
220
|
+
"CR-030/G3: re-add worker_b after removal should be accepted; got {readd:?}"
|
|
221
|
+
);
|
|
222
|
+
let second_send = send_message(
|
|
223
|
+
&fixture.root,
|
|
224
|
+
&MessageTarget::Single("worker_b".to_string()),
|
|
225
|
+
"second ping",
|
|
226
|
+
&SendOptions {
|
|
227
|
+
wait_visible: false,
|
|
228
|
+
block_until_delivered: false,
|
|
229
|
+
..SendOptions::default()
|
|
230
|
+
},
|
|
231
|
+
)
|
|
232
|
+
.unwrap();
|
|
233
|
+
assert!(
|
|
234
|
+
second_send.ok,
|
|
235
|
+
"CR-030/G3: send after re-add must route to worker_b again; got {second_send:?}"
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
#[test]
|
|
240
|
+
#[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
|
|
241
|
+
fn g4_help_only_short_circuits_before_validation_for_residual_commands() {
|
|
242
|
+
let cwd = tmp_dir("g4-help");
|
|
243
|
+
let mut failures = Vec::new();
|
|
244
|
+
|
|
245
|
+
for command in [
|
|
246
|
+
"attach-leader",
|
|
247
|
+
"add-agent",
|
|
248
|
+
"stop-agent",
|
|
249
|
+
"reset-agent",
|
|
250
|
+
"claim-leader",
|
|
251
|
+
] {
|
|
252
|
+
let out = run(&[command, "--help"], &cwd);
|
|
253
|
+
let stdout = String::from_utf8_lossy(&out.stdout);
|
|
254
|
+
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
255
|
+
let combined = format!("{stdout}\n{stderr}");
|
|
256
|
+
let validation_leaked = [
|
|
257
|
+
"invalid choice:",
|
|
258
|
+
"missing agent",
|
|
259
|
+
"missing --role-file",
|
|
260
|
+
"caller_not_leader_shaped",
|
|
261
|
+
"team_owner_mismatch",
|
|
262
|
+
"missing TEAM.md",
|
|
263
|
+
"spec compile failed",
|
|
264
|
+
]
|
|
265
|
+
.iter()
|
|
266
|
+
.any(|needle| combined.contains(needle));
|
|
267
|
+
|
|
268
|
+
if out.status.code() != Some(0)
|
|
269
|
+
|| validation_leaked
|
|
270
|
+
|| !(combined.contains("usage") && combined.contains(command))
|
|
271
|
+
{
|
|
272
|
+
failures.push(format!(
|
|
273
|
+
"{command}: expected zero-token help-only exit 0 before validation; code={:?} stdout={stdout:?} stderr={stderr:?}",
|
|
274
|
+
out.status.code()
|
|
275
|
+
));
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if cwd.join(".team").exists() {
|
|
280
|
+
failures.push(format!(
|
|
281
|
+
"help-only commands created runtime state/logs under cwd: {}",
|
|
282
|
+
cwd.join(".team").display()
|
|
283
|
+
));
|
|
284
|
+
}
|
|
285
|
+
assert!(
|
|
286
|
+
failures.is_empty(),
|
|
287
|
+
"CR-063/G4: every subcommand --help must short-circuit before argument, leader, or runtime validation:\n{}",
|
|
288
|
+
failures.join("\n")
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
#[derive(Debug, Clone, Copy)]
|
|
293
|
+
enum RestartContext {
|
|
294
|
+
Bare,
|
|
295
|
+
AfterAcknowledgeIdle,
|
|
296
|
+
CoordinatorPendingRecovery,
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
#[derive(Debug)]
|
|
300
|
+
struct Fixture {
|
|
301
|
+
root: PathBuf,
|
|
302
|
+
teamdir: PathBuf,
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
fn seed_restart_fixture(context: RestartContext) -> Fixture {
|
|
306
|
+
let tag = match context {
|
|
307
|
+
RestartContext::Bare => "g2-bare",
|
|
308
|
+
RestartContext::AfterAcknowledgeIdle => "g2-idle",
|
|
309
|
+
RestartContext::CoordinatorPendingRecovery => "g2-pending",
|
|
310
|
+
};
|
|
311
|
+
let fixture = seed_active_team_fixture(tag);
|
|
312
|
+
let mut state = team_agent::state::persist::load_runtime_state(&fixture.root).unwrap();
|
|
313
|
+
if let Some(obj) = state.as_object_mut() {
|
|
314
|
+
match context {
|
|
315
|
+
RestartContext::Bare => {}
|
|
316
|
+
RestartContext::AfterAcknowledgeIdle => {
|
|
317
|
+
obj.insert(
|
|
318
|
+
"idle_acknowledgements".to_string(),
|
|
319
|
+
json!({"worker_a": {"acknowledged": true, "acknowledged_at": "2026-06-05T05:18:00+00:00"}}),
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
RestartContext::CoordinatorPendingRecovery => {
|
|
323
|
+
obj.insert(
|
|
324
|
+
"coordinator".to_string(),
|
|
325
|
+
json!({"status": "recovering", "pending_messages": 1}),
|
|
326
|
+
);
|
|
327
|
+
obj.insert(
|
|
328
|
+
"tasks".to_string(),
|
|
329
|
+
json!([{
|
|
330
|
+
"id": "task_pending",
|
|
331
|
+
"title": "Pending recovery task",
|
|
332
|
+
"assignee": "worker_a",
|
|
333
|
+
"status": "running"
|
|
334
|
+
}]),
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
team_agent::state::persist::save_runtime_state(&fixture.root, &state).unwrap();
|
|
340
|
+
fixture
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
fn seed_active_team_fixture(tag: &str) -> Fixture {
|
|
344
|
+
let root = tmp_dir(tag);
|
|
345
|
+
let teamdir = root.join("teamdir");
|
|
346
|
+
std::fs::create_dir_all(teamdir.join("agents")).unwrap();
|
|
347
|
+
std::fs::create_dir_all(root.join(".team").join("roles")).unwrap();
|
|
348
|
+
std::fs::write(
|
|
349
|
+
teamdir.join("TEAM.md"),
|
|
350
|
+
"---\nname: current\nobjective: Real-machine residual fixture.\nprovider: fake\n---\n\nTeam.\n",
|
|
351
|
+
)
|
|
352
|
+
.unwrap();
|
|
353
|
+
std::fs::write(
|
|
354
|
+
teamdir.join("agents").join("worker_a.md"),
|
|
355
|
+
role_doc("worker_a", "Worker A"),
|
|
356
|
+
)
|
|
357
|
+
.unwrap();
|
|
358
|
+
std::fs::write(
|
|
359
|
+
root.join(".team").join("roles").join("worker_b.md"),
|
|
360
|
+
role_doc("worker_b", "Worker B"),
|
|
361
|
+
)
|
|
362
|
+
.unwrap();
|
|
363
|
+
|
|
364
|
+
let spec = team_agent::compiler::compile_team(&teamdir).unwrap();
|
|
365
|
+
let spec_path = teamdir.join("team.spec.yaml");
|
|
366
|
+
std::fs::write(&spec_path, team_agent::model::yaml::dumps(&spec)).unwrap();
|
|
367
|
+
|
|
368
|
+
let state = json!({
|
|
369
|
+
"active_team_key": "current",
|
|
370
|
+
"spec_path": spec_path.to_string_lossy().to_string(),
|
|
371
|
+
"team_dir": teamdir.to_string_lossy().to_string(),
|
|
372
|
+
"session_name": "team-current",
|
|
373
|
+
"leader": {"id": "leader"},
|
|
374
|
+
"agents": {
|
|
375
|
+
"worker_a": running_agent("worker_a", "%1", "sess-worker-a")
|
|
376
|
+
},
|
|
377
|
+
"tasks": [{
|
|
378
|
+
"id": "task_initial",
|
|
379
|
+
"title": "Initial task",
|
|
380
|
+
"assignee": "worker_a",
|
|
381
|
+
"status": "running"
|
|
382
|
+
}],
|
|
383
|
+
"teams": {
|
|
384
|
+
"current": {
|
|
385
|
+
"status": "alive",
|
|
386
|
+
"spec_path": spec_path.to_string_lossy().to_string(),
|
|
387
|
+
"team_dir": teamdir.to_string_lossy().to_string(),
|
|
388
|
+
"session_name": "team-current",
|
|
389
|
+
"leader": {"id": "leader"},
|
|
390
|
+
"agents": {
|
|
391
|
+
"worker_a": running_agent("worker_a", "%1", "sess-worker-a")
|
|
392
|
+
},
|
|
393
|
+
"tasks": [{
|
|
394
|
+
"id": "task_initial",
|
|
395
|
+
"title": "Initial task",
|
|
396
|
+
"assignee": "worker_a",
|
|
397
|
+
"status": "running"
|
|
398
|
+
}]
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
team_agent::state::persist::save_runtime_state(&root, &state).unwrap();
|
|
403
|
+
seed_healthy_coordinator(&root);
|
|
404
|
+
Fixture { root, teamdir }
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
fn role_doc(name: &str, role: &str) -> String {
|
|
408
|
+
format!(
|
|
409
|
+
"---\nname: {name}\nrole: {role}\nprovider: fake\ntools:\n - mcp_team\n---\n\n{role}.\n"
|
|
410
|
+
)
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
fn running_agent(id: &str, pane: &str, session_id: &str) -> Value {
|
|
414
|
+
json!({
|
|
415
|
+
"agent_id": id,
|
|
416
|
+
"provider": "fake",
|
|
417
|
+
"role": id,
|
|
418
|
+
"status": "running",
|
|
419
|
+
"session_id": session_id,
|
|
420
|
+
"first_send_at": "2026-06-05T05:18:00+00:00",
|
|
421
|
+
"pane_id": pane,
|
|
422
|
+
"window": id
|
|
423
|
+
})
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
fn seed_healthy_coordinator(workspace: &Path) {
|
|
427
|
+
let workspace = team_agent::coordinator::WorkspacePath::new(workspace.to_path_buf());
|
|
428
|
+
std::fs::create_dir_all(team_agent::model::paths::runtime_dir(workspace.as_path())).unwrap();
|
|
429
|
+
let _ = team_agent::message_store::MessageStore::open(workspace.as_path()).unwrap();
|
|
430
|
+
let pid = team_agent::coordinator::Pid::new(std::process::id());
|
|
431
|
+
team_agent::coordinator::write_coordinator_metadata(
|
|
432
|
+
&workspace,
|
|
433
|
+
pid,
|
|
434
|
+
team_agent::coordinator::MetadataSource::Boot,
|
|
435
|
+
)
|
|
436
|
+
.unwrap();
|
|
437
|
+
std::fs::write(
|
|
438
|
+
team_agent::coordinator::coordinator_pid_path(&workspace),
|
|
439
|
+
pid.to_string(),
|
|
440
|
+
)
|
|
441
|
+
.unwrap();
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
fn clear_coordinator_markers(workspace: &Path) {
|
|
445
|
+
let workspace = team_agent::coordinator::WorkspacePath::new(workspace.to_path_buf());
|
|
446
|
+
let _ = std::fs::remove_file(team_agent::coordinator::coordinator_pid_path(&workspace));
|
|
447
|
+
let _ = std::fs::remove_file(team_agent::coordinator::coordinator_meta_path(&workspace));
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
#[derive(Debug)]
|
|
451
|
+
struct DuplicateSessionTrapTransport {
|
|
452
|
+
sessions: Mutex<HashSet<String>>,
|
|
453
|
+
windows: Mutex<HashSet<String>>,
|
|
454
|
+
calls: Mutex<Vec<&'static str>>,
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
impl DuplicateSessionTrapTransport {
|
|
458
|
+
fn new_existing(session: &str) -> Self {
|
|
459
|
+
let mut sessions = HashSet::new();
|
|
460
|
+
sessions.insert(session.to_string());
|
|
461
|
+
let mut windows = HashSet::new();
|
|
462
|
+
windows.insert("worker_a".to_string());
|
|
463
|
+
Self {
|
|
464
|
+
sessions: Mutex::new(sessions),
|
|
465
|
+
windows: Mutex::new(windows),
|
|
466
|
+
calls: Mutex::new(Vec::new()),
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
fn calls(&self) -> Vec<&'static str> {
|
|
471
|
+
self.calls.lock().unwrap().clone()
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
fn sessions(&self) -> Vec<String> {
|
|
475
|
+
self.sessions.lock().unwrap().iter().cloned().collect()
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
fn active_session_count(&self, session: &str) -> usize {
|
|
479
|
+
usize::from(self.sessions.lock().unwrap().contains(session))
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
fn record(&self, call: &'static str) {
|
|
483
|
+
self.calls.lock().unwrap().push(call);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
fn spawn_result(
|
|
487
|
+
&self,
|
|
488
|
+
kind: &'static str,
|
|
489
|
+
session: &SessionName,
|
|
490
|
+
window: &WindowName,
|
|
491
|
+
) -> SpawnResult {
|
|
492
|
+
self.record(kind);
|
|
493
|
+
self.sessions
|
|
494
|
+
.lock()
|
|
495
|
+
.unwrap()
|
|
496
|
+
.insert(session.as_str().to_string());
|
|
497
|
+
self.windows
|
|
498
|
+
.lock()
|
|
499
|
+
.unwrap()
|
|
500
|
+
.insert(window.as_str().to_string());
|
|
501
|
+
SpawnResult {
|
|
502
|
+
pane_id: PaneId::new(format!("%{kind}-{}", window.as_str())),
|
|
503
|
+
session: session.clone(),
|
|
504
|
+
window: window.clone(),
|
|
505
|
+
child_pid: None,
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
impl Transport for DuplicateSessionTrapTransport {
|
|
511
|
+
fn kind(&self) -> BackendKind {
|
|
512
|
+
BackendKind::Tmux
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
fn spawn_first(
|
|
516
|
+
&self,
|
|
517
|
+
session: &SessionName,
|
|
518
|
+
window: &WindowName,
|
|
519
|
+
_argv: &[String],
|
|
520
|
+
_cwd: &Path,
|
|
521
|
+
_env: &BTreeMap<String, String>,
|
|
522
|
+
) -> Result<SpawnResult, TransportError> {
|
|
523
|
+
if self.sessions.lock().unwrap().contains(session.as_str()) {
|
|
524
|
+
self.record("spawn_first_duplicate");
|
|
525
|
+
return Err(TransportError::Subprocess {
|
|
526
|
+
argv: vec![
|
|
527
|
+
"tmux".to_string(),
|
|
528
|
+
"new-session".to_string(),
|
|
529
|
+
"-s".to_string(),
|
|
530
|
+
session.as_str().to_string(),
|
|
531
|
+
],
|
|
532
|
+
code: Some(1),
|
|
533
|
+
stderr: format!("duplicate session: {}", session.as_str()),
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
Ok(self.spawn_result("spawn_first", session, window))
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
fn spawn_into(
|
|
540
|
+
&self,
|
|
541
|
+
session: &SessionName,
|
|
542
|
+
window: &WindowName,
|
|
543
|
+
_argv: &[String],
|
|
544
|
+
_cwd: &Path,
|
|
545
|
+
_env: &BTreeMap<String, String>,
|
|
546
|
+
) -> Result<SpawnResult, TransportError> {
|
|
547
|
+
Ok(self.spawn_result("spawn_into", session, window))
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
fn inject(
|
|
551
|
+
&self,
|
|
552
|
+
_target: &Target,
|
|
553
|
+
_payload: &InjectPayload,
|
|
554
|
+
_submit: Key,
|
|
555
|
+
_bracketed: bool,
|
|
556
|
+
) -> Result<InjectReport, TransportError> {
|
|
557
|
+
self.record("inject");
|
|
558
|
+
Ok(InjectReport {
|
|
559
|
+
stage_reached: InjectStage::Submit,
|
|
560
|
+
inject_verification: InjectVerification::CaptureContainsToken,
|
|
561
|
+
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
562
|
+
turn_verification: TurnVerification::NotYetObserved,
|
|
563
|
+
attempts: 1,
|
|
564
|
+
submit_diagnostics: None,
|
|
565
|
+
})
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
|
|
569
|
+
self.record("send_keys");
|
|
570
|
+
Ok(())
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
fn capture(
|
|
574
|
+
&self,
|
|
575
|
+
_target: &Target,
|
|
576
|
+
range: CaptureRange,
|
|
577
|
+
) -> Result<CapturedText, TransportError> {
|
|
578
|
+
self.record("capture");
|
|
579
|
+
Ok(CapturedText {
|
|
580
|
+
text: String::new(),
|
|
581
|
+
range,
|
|
582
|
+
})
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
fn query(&self, _target: &Target, _field: PaneField) -> Result<Option<String>, TransportError> {
|
|
586
|
+
self.record("query");
|
|
587
|
+
Ok(None)
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
fn liveness(
|
|
591
|
+
&self,
|
|
592
|
+
_pane: &PaneId,
|
|
593
|
+
) -> Result<team_agent::transport::PaneLiveness, TransportError> {
|
|
594
|
+
self.record("liveness");
|
|
595
|
+
Ok(team_agent::transport::PaneLiveness::Live)
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
599
|
+
self.record("list_targets");
|
|
600
|
+
Ok(Vec::new())
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
fn has_session(&self, session: &SessionName) -> Result<bool, TransportError> {
|
|
604
|
+
self.record("has_session");
|
|
605
|
+
Ok(self.sessions.lock().unwrap().contains(session.as_str()))
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
609
|
+
self.record("list_windows");
|
|
610
|
+
Ok(self
|
|
611
|
+
.windows
|
|
612
|
+
.lock()
|
|
613
|
+
.unwrap()
|
|
614
|
+
.iter()
|
|
615
|
+
.cloned()
|
|
616
|
+
.map(WindowName::new)
|
|
617
|
+
.collect())
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
fn set_session_env(
|
|
621
|
+
&self,
|
|
622
|
+
_session: &SessionName,
|
|
623
|
+
_key: &str,
|
|
624
|
+
_value: &str,
|
|
625
|
+
) -> Result<SetEnvOutcome, TransportError> {
|
|
626
|
+
self.record("set_session_env");
|
|
627
|
+
Ok(SetEnvOutcome::Applied)
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
fn kill_session(&self, session: &SessionName) -> Result<(), TransportError> {
|
|
631
|
+
self.record("kill_session");
|
|
632
|
+
self.sessions.lock().unwrap().remove(session.as_str());
|
|
633
|
+
Ok(())
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
fn kill_window(&self, target: &Target) -> Result<(), TransportError> {
|
|
637
|
+
self.record("kill_window");
|
|
638
|
+
if let Target::SessionWindow { window, .. } = target {
|
|
639
|
+
self.windows.lock().unwrap().remove(window.as_str());
|
|
640
|
+
}
|
|
641
|
+
Ok(())
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
645
|
+
self.record("attach_session");
|
|
646
|
+
Ok(AttachOutcome::Attached)
|
|
647
|
+
}
|
|
648
|
+
}
|