@team-agent/installer 0.5.41 → 0.5.43

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.
Files changed (152) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/crates/team-agent/src/cli/adapters.rs +129 -54
  4. package/crates/team-agent/src/cli/diagnose.rs +1 -2
  5. package/crates/team-agent/src/cli/emit.rs +1 -7
  6. package/crates/team-agent/src/cli/helpers.rs +3 -1
  7. package/crates/team-agent/src/cli/leader.rs +2 -1
  8. package/crates/team-agent/src/cli/mod.rs +27 -7
  9. package/crates/team-agent/src/cli/named_address.rs +14 -5
  10. package/crates/team-agent/src/cli/profile.rs +19 -7
  11. package/crates/team-agent/src/cli/send.rs +9 -3
  12. package/crates/team-agent/src/cli/status.rs +8 -30
  13. package/crates/team-agent/src/cli/status_port.rs +1341 -1272
  14. package/crates/team-agent/src/cli/tests/base.rs +738 -660
  15. package/crates/team-agent/src/cli/tests/compile.rs +45 -18
  16. package/crates/team-agent/src/cli/tests/divergence.rs +462 -444
  17. package/crates/team-agent/src/cli/tests/lane_c.rs +365 -282
  18. package/crates/team-agent/src/cli/tests/leader_watch.rs +356 -329
  19. package/crates/team-agent/src/cli/tests/main_preserved.rs +672 -564
  20. package/crates/team-agent/src/cli/tests/missing_subcommands.rs +284 -224
  21. package/crates/team-agent/src/cli/tests/mod.rs +17 -7
  22. package/crates/team-agent/src/cli/tests/named_address.rs +8 -2
  23. package/crates/team-agent/src/cli/tests/peer_allow.rs +10 -2
  24. package/crates/team-agent/src/cli/tests/run_delegation.rs +314 -273
  25. package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +26 -15
  26. package/crates/team-agent/src/cli/tests/status_send.rs +707 -629
  27. package/crates/team-agent/src/cli/tests/verb_install_skill.rs +20 -4
  28. package/crates/team-agent/src/cli/tests/verb_profile.rs +46 -17
  29. package/crates/team-agent/src/cli/tests/verb_validate.rs +15 -3
  30. package/crates/team-agent/src/codex_app_server.rs +2 -5
  31. package/crates/team-agent/src/compiler/tests.rs +139 -33
  32. package/crates/team-agent/src/compiler.rs +55 -22
  33. package/crates/team-agent/src/conpty/backend.rs +23 -33
  34. package/crates/team-agent/src/coordinator/backoff.rs +2 -7
  35. package/crates/team-agent/src/coordinator/conpty_shim.rs +55 -67
  36. package/crates/team-agent/src/coordinator/health.rs +46 -31
  37. package/crates/team-agent/src/coordinator/mod.rs +3 -3
  38. package/crates/team-agent/src/coordinator/orphan.rs +22 -10
  39. package/crates/team-agent/src/coordinator/steps/abnormal.rs +47 -52
  40. package/crates/team-agent/src/coordinator/tests/abnormal.rs +55 -19
  41. package/crates/team-agent/src/coordinator/tests/basics.rs +179 -41
  42. package/crates/team-agent/src/coordinator/tests/daemon.rs +53 -13
  43. package/crates/team-agent/src/coordinator/tests/health_sync.rs +78 -19
  44. package/crates/team-agent/src/coordinator/tests/main_preserved.rs +61 -11
  45. package/crates/team-agent/src/coordinator/tests/mod.rs +33 -39
  46. package/crates/team-agent/src/coordinator/tests/spine.rs +52 -12
  47. package/crates/team-agent/src/coordinator/tests/takeover.rs +73 -15
  48. package/crates/team-agent/src/coordinator/tests/tick_core.rs +50 -15
  49. package/crates/team-agent/src/coordinator/tests/watch.rs +74 -20
  50. package/crates/team-agent/src/coordinator/tick.rs +19 -1
  51. package/crates/team-agent/src/db/message_store.rs +138 -30
  52. package/crates/team-agent/src/db/migration.rs +249 -61
  53. package/crates/team-agent/src/db/schema.rs +303 -82
  54. package/crates/team-agent/src/diagnose/comms.rs +9 -2
  55. package/crates/team-agent/src/diagnose/mod.rs +1 -3
  56. package/crates/team-agent/src/diagnose/orphans.rs +79 -61
  57. package/crates/team-agent/src/event_log.rs +70 -16
  58. package/crates/team-agent/src/layout/manager.rs +15 -4
  59. package/crates/team-agent/src/layout/mod.rs +4 -4
  60. package/crates/team-agent/src/layout/overlay.rs +10 -3
  61. package/crates/team-agent/src/layout/placement.rs +5 -1
  62. package/crates/team-agent/src/layout/recovery.rs +4 -2
  63. package/crates/team-agent/src/layout/runtime_sessions.rs +7 -7
  64. package/crates/team-agent/src/layout/sessions.rs +17 -9
  65. package/crates/team-agent/src/layout/tmux_endpoint.rs +1 -1
  66. package/crates/team-agent/src/layout/worker_env.rs +52 -19
  67. package/crates/team-agent/src/leader/helpers.rs +7 -1
  68. package/crates/team-agent/src/leader/lease.rs +195 -82
  69. package/crates/team-agent/src/leader/owner_bind.rs +55 -22
  70. package/crates/team-agent/src/leader/rediscover/tests.rs +88 -24
  71. package/crates/team-agent/src/leader/rediscover.rs +74 -25
  72. package/crates/team-agent/src/leader/start.rs +75 -54
  73. package/crates/team-agent/src/leader/takeover.rs +46 -11
  74. package/crates/team-agent/src/leader/tests/basics.rs +320 -167
  75. package/crates/team-agent/src/leader/tests/byte_findings.rs +361 -219
  76. package/crates/team-agent/src/leader/tests/identity.rs +428 -356
  77. package/crates/team-agent/src/leader/tests/idle.rs +285 -254
  78. package/crates/team-agent/src/leader/tests/lease_api.rs +338 -274
  79. package/crates/team-agent/src/leader/tests/lease_claim.rs +643 -593
  80. package/crates/team-agent/src/leader/tests/mod.rs +115 -99
  81. package/crates/team-agent/src/leader/tests/rediscover.rs +74 -22
  82. package/crates/team-agent/src/leader/tests/wake_start_owner.rs +237 -211
  83. package/crates/team-agent/src/lib.rs +4 -4
  84. package/crates/team-agent/src/lifecycle/display.rs +7 -3
  85. package/crates/team-agent/src/lifecycle/launch.rs +6 -1
  86. package/crates/team-agent/src/lifecycle/mod.rs +9 -1
  87. package/crates/team-agent/src/lifecycle/profile_launch.rs +77 -34
  88. package/crates/team-agent/src/lifecycle/profile_smoke.rs +3 -1
  89. package/crates/team-agent/src/lifecycle/restart/agent.rs +1 -6
  90. package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +1 -4
  91. package/crates/team-agent/src/lifecycle/restart/preflight.rs +6 -5
  92. package/crates/team-agent/src/lifecycle/restart/rebuild.rs +26 -22
  93. package/crates/team-agent/src/lifecycle/restart/remove.rs +45 -35
  94. package/crates/team-agent/src/lifecycle/restart/team_state.rs +63 -17
  95. package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +251 -84
  96. package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +198 -48
  97. package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +2 -1
  98. package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +152 -32
  99. package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +1 -5
  100. package/crates/team-agent/src/lifecycle/tests.rs +2 -2
  101. package/crates/team-agent/src/main.rs +4 -4
  102. package/crates/team-agent/src/mcp_server/lifecycle_tools/agent_ops.rs +47 -20
  103. package/crates/team-agent/src/mcp_server/mod.rs +11 -2
  104. package/crates/team-agent/src/mcp_server/types.rs +14 -3
  105. package/crates/team-agent/src/mcp_server/wire.rs +230 -68
  106. package/crates/team-agent/src/messaging/delivery.rs +20 -18
  107. package/crates/team-agent/src/messaging/helpers.rs +25 -4
  108. package/crates/team-agent/src/messaging/leader_receiver.rs +4 -5
  109. package/crates/team-agent/src/messaging/mod.rs +2 -3
  110. package/crates/team-agent/src/messaging/selftest.rs +46 -26
  111. package/crates/team-agent/src/messaging/tests/main_preserved.rs +47 -12
  112. package/crates/team-agent/src/messaging/tests/runtime.rs +57 -22
  113. package/crates/team-agent/src/messaging/tests/spine.rs +154 -40
  114. package/crates/team-agent/src/messaging/tests/wave2.rs +31 -32
  115. package/crates/team-agent/src/messaging/trust.rs +25 -2
  116. package/crates/team-agent/src/messaging/watchers.rs +37 -9
  117. package/crates/team-agent/src/model/enums.rs +65 -16
  118. package/crates/team-agent/src/model/ids.rs +12 -3
  119. package/crates/team-agent/src/model/paths.rs +28 -7
  120. package/crates/team-agent/src/model/permissions.rs +176 -33
  121. package/crates/team-agent/src/model/routing.rs +66 -20
  122. package/crates/team-agent/src/model/spec.rs +365 -69
  123. package/crates/team-agent/src/model/task_graph.rs +36 -9
  124. package/crates/team-agent/src/model/yaml/tests.rs +24 -6
  125. package/crates/team-agent/src/model/yaml.rs +7 -6
  126. package/crates/team-agent/src/packaging/install.rs +23 -9
  127. package/crates/team-agent/src/packaging/migrate.rs +5 -7
  128. package/crates/team-agent/src/packaging/mod.rs +9 -1
  129. package/crates/team-agent/src/packaging/repair.rs +13 -6
  130. package/crates/team-agent/src/packaging/tests.rs +63 -16
  131. package/crates/team-agent/src/packaging/types.rs +22 -7
  132. package/crates/team-agent/src/platform/argv.rs +4 -1
  133. package/crates/team-agent/src/platform/file_lock.rs +22 -8
  134. package/crates/team-agent/src/platform/process.rs +21 -22
  135. package/crates/team-agent/src/provider/adapters/claude.rs +1 -3
  136. package/crates/team-agent/src/provider/approvals/parsing.rs +134 -26
  137. package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +13 -3
  138. package/crates/team-agent/src/provider/classify.rs +127 -42
  139. package/crates/team-agent/src/provider/faults.rs +17 -5
  140. package/crates/team-agent/src/provider/helpers.rs +6 -5
  141. package/crates/team-agent/src/provider/startup_prompt.rs +75 -27
  142. package/crates/team-agent/src/state/repository.rs +27 -14
  143. package/crates/team-agent/src/tmux_backend/tests.rs +1637 -1398
  144. package/crates/team-agent/src/tmux_backend.rs +80 -44
  145. package/crates/team-agent/src/topology.rs +27 -20
  146. package/crates/team-agent/src/transport/test_support.rs +20 -23
  147. package/crates/team-agent/src/transport/tests/behavior.rs +292 -293
  148. package/crates/team-agent/src/transport/tests/mod.rs +178 -187
  149. package/crates/team-agent/src/transport/tests/wire.rs +561 -525
  150. package/crates/team-agent/src/transport.rs +12 -17
  151. package/crates/team-agent/src/transport_factory.rs +29 -14
  152. package/package.json +4 -4
@@ -1,203 +1,194 @@
1
- #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
2
- use super::*;
3
- use std::collections::BTreeMap;
4
- use std::path::Path;
1
+ #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
2
+ use super::*;
3
+ use std::collections::BTreeMap;
4
+ use std::path::Path;
5
5
 
6
- // —— 每个 daemon 可达方法 `unimplemented!()` 的 stub:驱动 trait 即 RED ——
7
- struct StubBackend(BackendKind);
6
+ // —— 每个 daemon 可达方法 `unimplemented!()` 的 stub:驱动 trait 即 RED ——
7
+ struct StubBackend(BackendKind);
8
8
 
9
- impl Transport for StubBackend {
10
- fn kind(&self) -> BackendKind {
11
- self.0
12
- }
13
- fn spawn_first(
14
- &self,
15
- session: &SessionName,
16
- window: &WindowName,
17
- argv: &[String],
18
- cwd: &Path,
19
- env: &BTreeMap<String, String>,
20
- ) -> Result<SpawnResult, TransportError> {
21
- let _ = (argv, cwd, env);
22
- Ok(SpawnResult {
23
- pane_id: PaneId::new(format!("%{}-{}", session.as_str(), window.as_str())),
24
- session: session.clone(),
25
- window: window.clone(),
26
- child_pid: Some(1000),
27
- })
28
- }
29
- fn spawn_into(
30
- &self,
31
- session: &SessionName,
32
- window: &WindowName,
33
- argv: &[String],
34
- cwd: &Path,
35
- env: &BTreeMap<String, String>,
36
- ) -> Result<SpawnResult, TransportError> {
37
- let _ = (argv, cwd, env);
38
- Ok(SpawnResult {
39
- pane_id: PaneId::new(format!("%{}-{}", session.as_str(), window.as_str())),
40
- session: session.clone(),
41
- window: window.clone(),
42
- child_pid: Some(1001),
43
- })
44
- }
45
- fn inject(
46
- &self,
47
- target: &Target,
48
- payload: &InjectPayload,
49
- submit: Key,
50
- bracketed: bool,
51
- ) -> Result<InjectReport, TransportError> {
52
- let _ = (target, bracketed);
53
- let (inject_verification, turn_verification) = match payload {
54
- InjectPayload::Empty => (
55
- InjectVerification::EmptyTextSendKeys,
56
- TurnVerification::NotRequired,
57
- ),
58
- InjectPayload::Text(text) | InjectPayload::TextSkipConsumptionPoll(text)
59
- if text.contains("[team-agent-token:") =>
9
+ impl Transport for StubBackend {
10
+ fn kind(&self) -> BackendKind {
11
+ self.0
12
+ }
13
+ fn spawn_first(
14
+ &self,
15
+ session: &SessionName,
16
+ window: &WindowName,
17
+ argv: &[String],
18
+ cwd: &Path,
19
+ env: &BTreeMap<String, String>,
20
+ ) -> Result<SpawnResult, TransportError> {
21
+ let _ = (argv, cwd, env);
22
+ Ok(SpawnResult {
23
+ pane_id: PaneId::new(format!("%{}-{}", session.as_str(), window.as_str())),
24
+ session: session.clone(),
25
+ window: window.clone(),
26
+ child_pid: Some(1000),
27
+ })
28
+ }
29
+ fn spawn_into(
30
+ &self,
31
+ session: &SessionName,
32
+ window: &WindowName,
33
+ argv: &[String],
34
+ cwd: &Path,
35
+ env: &BTreeMap<String, String>,
36
+ ) -> Result<SpawnResult, TransportError> {
37
+ let _ = (argv, cwd, env);
38
+ Ok(SpawnResult {
39
+ pane_id: PaneId::new(format!("%{}-{}", session.as_str(), window.as_str())),
40
+ session: session.clone(),
41
+ window: window.clone(),
42
+ child_pid: Some(1001),
43
+ })
44
+ }
45
+ fn inject(
46
+ &self,
47
+ target: &Target,
48
+ payload: &InjectPayload,
49
+ submit: Key,
50
+ bracketed: bool,
51
+ ) -> Result<InjectReport, TransportError> {
52
+ let _ = (target, bracketed);
53
+ let (inject_verification, turn_verification) = match payload {
54
+ InjectPayload::Empty => (
55
+ InjectVerification::EmptyTextSendKeys,
56
+ TurnVerification::NotRequired,
57
+ ),
58
+ InjectPayload::Text(text) | InjectPayload::TextSkipConsumptionPoll(text)
59
+ if text.contains("[team-agent-token:") =>
60
+ {
60
61
  (
61
62
  InjectVerification::CaptureContainsToken,
62
63
  TurnVerification::NotYetObserved,
63
- ),
64
- InjectPayload::Text(_) | InjectPayload::TextSkipConsumptionPoll(_) => (
65
- InjectVerification::NoToken,
66
- TurnVerification::NotYetObserved,
67
- ),
68
- };
69
- let submit_verification = match submit {
70
- Key::Enter => SubmitVerification::EnterSentWithoutPlaceholderCheck,
71
- key => SubmitVerification::KeySentAfterVisibleToken { key },
72
- };
73
- Ok(InjectReport {
74
- stage_reached: InjectStage::Submit,
75
- inject_verification,
76
- submit_verification,
77
- turn_verification,
78
- attempts: 1,
79
- submit_diagnostics: None,
80
- })
81
- }
82
- fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
83
- Ok(())
84
- }
85
- fn capture(
86
- &self,
87
- target: &Target,
88
- range: CaptureRange,
89
- ) -> Result<CapturedText, TransportError> {
90
- let _ = target;
91
- Ok(CapturedText {
92
- text: normalize_capture("line one \nbusy\u{a0}marker \n \n"),
93
- range,
94
- })
95
- }
96
- fn query(
97
- &self,
98
- _target: &Target,
99
- field: PaneField,
100
- ) -> Result<Option<String>, TransportError> {
101
- if self.0 != BackendKind::Tmux && field == PaneField::PaneMode {
102
- return Ok(None);
103
- }
104
- let value = match field {
105
- PaneField::PaneId => "%7",
106
- PaneField::PaneMode => "0",
107
- PaneField::PaneWidth => "120",
108
- PaneField::PaneCurrentCommand => "sh",
109
- PaneField::PaneCurrentPath => "/tmp/ws",
110
- PaneField::SessionName => "team-sess",
111
- PaneField::PaneTty => "/dev/ttys000",
112
- };
113
- Ok(Some(value.to_string()))
114
- }
115
- fn liveness(&self, pane: &PaneId) -> Result<PaneLiveness, TransportError> {
116
- if self.0 == BackendKind::ConPty && pane.as_str() == "foreign-leader" {
117
- return Ok(PaneLiveness::Unknown);
64
+ )
118
65
  }
119
- Ok(PaneLiveness::Live)
120
- }
121
- fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
122
- Ok(vec![
123
- PaneInfo {
124
- pane_id: PaneId::new("%team-sess-win-1"),
125
- session: SessionName::new("team-sess"),
126
- window_index: Some(0),
127
- window_name: Some(WindowName::new("win-1")),
128
- pane_index: Some(0),
129
- tty: Some("/dev/ttys001".to_string()),
130
- current_command: Some("sh".to_string()),
131
- current_path: Some(PathBuf::from("/tmp/ws")),
132
- active: true,
133
- pane_pid: Some(1000),
134
- leader_env: BTreeMap::new(),
135
- },
136
- PaneInfo {
137
- pane_id: PaneId::new("%team-sess-worker-2"),
138
- session: SessionName::new("team-sess"),
139
- window_index: Some(1),
140
- window_name: Some(WindowName::new("worker-2")),
141
- pane_index: Some(0),
142
- tty: Some("/dev/ttys002".to_string()),
143
- current_command: Some("sh".to_string()),
144
- current_path: Some(PathBuf::from("/tmp/ws")),
145
- active: true,
146
- pane_pid: Some(1001),
147
- leader_env: BTreeMap::new(),
148
- },
149
- ])
150
- }
151
- fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
152
- Ok(true)
153
- }
154
- fn list_windows(
155
- &self,
156
- _session: &SessionName,
157
- ) -> Result<Vec<WindowName>, TransportError> {
158
- Ok(vec![WindowName::new("win-1"), WindowName::new("worker-2")])
159
- }
160
- fn set_session_env(
161
- &self,
162
- _session: &SessionName,
163
- _key: &str,
164
- _value: &str,
165
- ) -> Result<SetEnvOutcome, TransportError> {
166
- match self.0 {
167
- BackendKind::Tmux => Ok(SetEnvOutcome::Applied),
168
- BackendKind::WezTerm | BackendKind::ConPty => Ok(SetEnvOutcome::InternalizedAtSpawn),
169
- }
170
- }
171
- fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
172
- Ok(())
66
+ InjectPayload::Text(_) | InjectPayload::TextSkipConsumptionPoll(_) => (
67
+ InjectVerification::NoToken,
68
+ TurnVerification::NotYetObserved,
69
+ ),
70
+ };
71
+ let submit_verification = match submit {
72
+ Key::Enter => SubmitVerification::EnterSentWithoutPlaceholderCheck,
73
+ key => SubmitVerification::KeySentAfterVisibleToken { key },
74
+ };
75
+ Ok(InjectReport {
76
+ stage_reached: InjectStage::Submit,
77
+ inject_verification,
78
+ submit_verification,
79
+ turn_verification,
80
+ attempts: 1,
81
+ submit_diagnostics: None,
82
+ })
83
+ }
84
+ fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
85
+ Ok(())
86
+ }
87
+ fn capture(
88
+ &self,
89
+ target: &Target,
90
+ range: CaptureRange,
91
+ ) -> Result<CapturedText, TransportError> {
92
+ let _ = target;
93
+ Ok(CapturedText {
94
+ text: normalize_capture("line one \nbusy\u{a0}marker \n \n"),
95
+ range,
96
+ })
97
+ }
98
+ fn query(&self, _target: &Target, field: PaneField) -> Result<Option<String>, TransportError> {
99
+ if self.0 != BackendKind::Tmux && field == PaneField::PaneMode {
100
+ return Ok(None);
173
101
  }
174
- fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
175
- Ok(())
102
+ let value = match field {
103
+ PaneField::PaneId => "%7",
104
+ PaneField::PaneMode => "0",
105
+ PaneField::PaneWidth => "120",
106
+ PaneField::PaneCurrentCommand => "sh",
107
+ PaneField::PaneCurrentPath => "/tmp/ws",
108
+ PaneField::SessionName => "team-sess",
109
+ PaneField::PaneTty => "/dev/ttys000",
110
+ };
111
+ Ok(Some(value.to_string()))
112
+ }
113
+ fn liveness(&self, pane: &PaneId) -> Result<PaneLiveness, TransportError> {
114
+ if self.0 == BackendKind::ConPty && pane.as_str() == "foreign-leader" {
115
+ return Ok(PaneLiveness::Unknown);
176
116
  }
177
- fn attach_session(
178
- &self,
179
- _session: &SessionName,
180
- ) -> Result<AttachOutcome, TransportError> {
181
- match self.0 {
182
- BackendKind::Tmux => Ok(AttachOutcome::Attached),
183
- BackendKind::WezTerm => Ok(AttachOutcome::GuiAttachIsImplicit),
184
- BackendKind::ConPty => Ok(AttachOutcome::Unsupported {
185
- reason: "conpty has no attach concept".to_string(),
186
- }),
187
- }
117
+ Ok(PaneLiveness::Live)
118
+ }
119
+ fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
120
+ Ok(vec![
121
+ PaneInfo {
122
+ pane_id: PaneId::new("%team-sess-win-1"),
123
+ session: SessionName::new("team-sess"),
124
+ window_index: Some(0),
125
+ window_name: Some(WindowName::new("win-1")),
126
+ pane_index: Some(0),
127
+ tty: Some("/dev/ttys001".to_string()),
128
+ current_command: Some("sh".to_string()),
129
+ current_path: Some(PathBuf::from("/tmp/ws")),
130
+ active: true,
131
+ pane_pid: Some(1000),
132
+ leader_env: BTreeMap::new(),
133
+ },
134
+ PaneInfo {
135
+ pane_id: PaneId::new("%team-sess-worker-2"),
136
+ session: SessionName::new("team-sess"),
137
+ window_index: Some(1),
138
+ window_name: Some(WindowName::new("worker-2")),
139
+ pane_index: Some(0),
140
+ tty: Some("/dev/ttys002".to_string()),
141
+ current_command: Some("sh".to_string()),
142
+ current_path: Some(PathBuf::from("/tmp/ws")),
143
+ active: true,
144
+ pane_pid: Some(1001),
145
+ leader_env: BTreeMap::new(),
146
+ },
147
+ ])
148
+ }
149
+ fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
150
+ Ok(true)
151
+ }
152
+ fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
153
+ Ok(vec![WindowName::new("win-1"), WindowName::new("worker-2")])
154
+ }
155
+ fn set_session_env(
156
+ &self,
157
+ _session: &SessionName,
158
+ _key: &str,
159
+ _value: &str,
160
+ ) -> Result<SetEnvOutcome, TransportError> {
161
+ match self.0 {
162
+ BackendKind::Tmux => Ok(SetEnvOutcome::Applied),
163
+ BackendKind::WezTerm | BackendKind::ConPty => Ok(SetEnvOutcome::InternalizedAtSpawn),
188
164
  }
189
165
  }
190
-
191
- fn tmux() -> StubBackend {
192
- StubBackend(BackendKind::Tmux)
166
+ fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
167
+ Ok(())
193
168
  }
194
- fn wezterm() -> StubBackend {
195
- StubBackend(BackendKind::WezTerm)
169
+ fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
170
+ Ok(())
196
171
  }
197
- fn conpty() -> StubBackend {
198
- StubBackend(BackendKind::ConPty)
172
+ fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
173
+ match self.0 {
174
+ BackendKind::Tmux => Ok(AttachOutcome::Attached),
175
+ BackendKind::WezTerm => Ok(AttachOutcome::GuiAttachIsImplicit),
176
+ BackendKind::ConPty => Ok(AttachOutcome::Unsupported {
177
+ reason: "conpty has no attach concept".to_string(),
178
+ }),
179
+ }
199
180
  }
181
+ }
200
182
 
183
+ fn tmux() -> StubBackend {
184
+ StubBackend(BackendKind::Tmux)
185
+ }
186
+ fn wezterm() -> StubBackend {
187
+ StubBackend(BackendKind::WezTerm)
188
+ }
189
+ fn conpty() -> StubBackend {
190
+ StubBackend(BackendKind::ConPty)
191
+ }
201
192
 
202
- mod wire;
203
193
  mod behavior;
194
+ mod wire;