@team-agent/installer 0.5.42 → 0.5.44

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 (156) 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 +126 -16
  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 +51 -56
  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/db/message_store.rs +138 -30
  51. package/crates/team-agent/src/db/migration.rs +249 -61
  52. package/crates/team-agent/src/db/schema.rs +303 -82
  53. package/crates/team-agent/src/diagnose/comms.rs +9 -2
  54. package/crates/team-agent/src/diagnose/mod.rs +1 -3
  55. package/crates/team-agent/src/diagnose/orphans.rs +79 -61
  56. package/crates/team-agent/src/event_log.rs +70 -16
  57. package/crates/team-agent/src/layout/manager.rs +15 -4
  58. package/crates/team-agent/src/layout/mod.rs +4 -4
  59. package/crates/team-agent/src/layout/overlay.rs +10 -3
  60. package/crates/team-agent/src/layout/placement.rs +5 -1
  61. package/crates/team-agent/src/layout/recovery.rs +4 -2
  62. package/crates/team-agent/src/layout/runtime_sessions.rs +7 -7
  63. package/crates/team-agent/src/layout/sessions.rs +17 -9
  64. package/crates/team-agent/src/layout/tmux_endpoint.rs +1 -1
  65. package/crates/team-agent/src/layout/worker_env.rs +87 -19
  66. package/crates/team-agent/src/leader/helpers.rs +7 -1
  67. package/crates/team-agent/src/leader/lease.rs +199 -89
  68. package/crates/team-agent/src/leader/owner_bind.rs +55 -22
  69. package/crates/team-agent/src/leader/provider_attribution.rs +25 -6
  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/registry.rs +1 -1
  73. package/crates/team-agent/src/leader/start.rs +75 -54
  74. package/crates/team-agent/src/leader/takeover.rs +46 -11
  75. package/crates/team-agent/src/leader/tests/basics.rs +320 -167
  76. package/crates/team-agent/src/leader/tests/byte_findings.rs +361 -219
  77. package/crates/team-agent/src/leader/tests/identity.rs +428 -356
  78. package/crates/team-agent/src/leader/tests/idle.rs +285 -254
  79. package/crates/team-agent/src/leader/tests/lease_api.rs +338 -274
  80. package/crates/team-agent/src/leader/tests/lease_claim.rs +643 -593
  81. package/crates/team-agent/src/leader/tests/mod.rs +115 -99
  82. package/crates/team-agent/src/leader/tests/rediscover.rs +74 -22
  83. package/crates/team-agent/src/leader/tests/wake_start_owner.rs +237 -211
  84. package/crates/team-agent/src/lib.rs +4 -4
  85. package/crates/team-agent/src/lifecycle/display.rs +7 -3
  86. package/crates/team-agent/src/lifecycle/launch.rs +55 -15
  87. package/crates/team-agent/src/lifecycle/mod.rs +9 -1
  88. package/crates/team-agent/src/lifecycle/profile_launch.rs +77 -34
  89. package/crates/team-agent/src/lifecycle/profile_smoke.rs +3 -1
  90. package/crates/team-agent/src/lifecycle/restart/agent.rs +1 -6
  91. package/crates/team-agent/src/lifecycle/restart/common.rs +6 -2
  92. package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +1 -4
  93. package/crates/team-agent/src/lifecycle/restart/preflight.rs +6 -5
  94. package/crates/team-agent/src/lifecycle/restart/rebuild.rs +26 -22
  95. package/crates/team-agent/src/lifecycle/restart/remove.rs +45 -35
  96. package/crates/team-agent/src/lifecycle/restart/team_state.rs +63 -17
  97. package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +251 -84
  98. package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +198 -48
  99. package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +2 -1
  100. package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +152 -32
  101. package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +1 -5
  102. package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +3 -0
  103. package/crates/team-agent/src/lifecycle/tests.rs +2 -2
  104. package/crates/team-agent/src/main.rs +4 -4
  105. package/crates/team-agent/src/mcp_server/lifecycle_tools/agent_ops.rs +47 -20
  106. package/crates/team-agent/src/mcp_server/mod.rs +11 -2
  107. package/crates/team-agent/src/mcp_server/types.rs +14 -3
  108. package/crates/team-agent/src/mcp_server/wire.rs +230 -68
  109. package/crates/team-agent/src/messaging/delivery.rs +20 -18
  110. package/crates/team-agent/src/messaging/helpers.rs +25 -4
  111. package/crates/team-agent/src/messaging/leader_receiver.rs +4 -5
  112. package/crates/team-agent/src/messaging/mod.rs +2 -3
  113. package/crates/team-agent/src/messaging/selftest.rs +46 -26
  114. package/crates/team-agent/src/messaging/tests/main_preserved.rs +47 -12
  115. package/crates/team-agent/src/messaging/tests/runtime.rs +57 -22
  116. package/crates/team-agent/src/messaging/tests/spine.rs +154 -40
  117. package/crates/team-agent/src/messaging/tests/wave2.rs +31 -32
  118. package/crates/team-agent/src/messaging/trust.rs +25 -2
  119. package/crates/team-agent/src/messaging/watchers.rs +37 -9
  120. package/crates/team-agent/src/model/enums.rs +65 -16
  121. package/crates/team-agent/src/model/ids.rs +12 -3
  122. package/crates/team-agent/src/model/paths.rs +28 -7
  123. package/crates/team-agent/src/model/permissions.rs +176 -33
  124. package/crates/team-agent/src/model/routing.rs +66 -20
  125. package/crates/team-agent/src/model/spec.rs +365 -69
  126. package/crates/team-agent/src/model/task_graph.rs +36 -9
  127. package/crates/team-agent/src/model/yaml/tests.rs +24 -6
  128. package/crates/team-agent/src/model/yaml.rs +7 -6
  129. package/crates/team-agent/src/packaging/install.rs +23 -9
  130. package/crates/team-agent/src/packaging/migrate.rs +5 -7
  131. package/crates/team-agent/src/packaging/mod.rs +9 -1
  132. package/crates/team-agent/src/packaging/repair.rs +13 -6
  133. package/crates/team-agent/src/packaging/tests.rs +63 -16
  134. package/crates/team-agent/src/packaging/types.rs +22 -7
  135. package/crates/team-agent/src/platform/argv.rs +4 -1
  136. package/crates/team-agent/src/platform/file_lock.rs +22 -8
  137. package/crates/team-agent/src/platform/process.rs +54 -24
  138. package/crates/team-agent/src/provider/adapters/claude.rs +1 -3
  139. package/crates/team-agent/src/provider/approvals/parsing.rs +134 -26
  140. package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +13 -3
  141. package/crates/team-agent/src/provider/classify.rs +127 -42
  142. package/crates/team-agent/src/provider/faults.rs +17 -5
  143. package/crates/team-agent/src/provider/helpers.rs +6 -5
  144. package/crates/team-agent/src/provider/startup_prompt.rs +75 -27
  145. package/crates/team-agent/src/state/persist.rs +28 -0
  146. package/crates/team-agent/src/state/repository.rs +8 -3
  147. package/crates/team-agent/src/tmux_backend/tests.rs +1637 -1398
  148. package/crates/team-agent/src/tmux_backend.rs +80 -44
  149. package/crates/team-agent/src/topology.rs +40 -20
  150. package/crates/team-agent/src/transport/test_support.rs +20 -23
  151. package/crates/team-agent/src/transport/tests/behavior.rs +292 -293
  152. package/crates/team-agent/src/transport/tests/mod.rs +178 -187
  153. package/crates/team-agent/src/transport/tests/wire.rs +561 -525
  154. package/crates/team-agent/src/transport.rs +12 -17
  155. package/crates/team-agent/src/transport_factory.rs +29 -14
  156. package/package.json +4 -4
@@ -34,11 +34,17 @@ fn init_profile(args: &ProfileArgs) -> Result<Value, CliError> {
34
34
  let mut obj = Map::new();
35
35
  obj.insert("ok".to_string(), Value::Bool(true));
36
36
  obj.insert("profile".to_string(), Value::String(args.name.clone()));
37
- obj.insert("auth_mode".to_string(), Value::String(auth_mode.to_string()));
37
+ obj.insert(
38
+ "auth_mode".to_string(),
39
+ Value::String(auth_mode.to_string()),
40
+ );
38
41
  obj.insert("path".to_string(), path_value(&path));
39
42
  obj.insert("template_path".to_string(), path_value(&template_path));
40
43
  obj.insert("created_profile".to_string(), Value::Bool(created_profile));
41
- obj.insert("created_template".to_string(), Value::Bool(created_template));
44
+ obj.insert(
45
+ "created_template".to_string(),
46
+ Value::Bool(created_template),
47
+ );
42
48
  obj.insert("secret_written".to_string(), Value::Bool(created_profile));
43
49
  obj.insert(
44
50
  "safe_inspection_command".to_string(),
@@ -116,7 +122,10 @@ fn show_profile(args: &ProfileArgs) -> Result<Value, CliError> {
116
122
  );
117
123
  obj.insert("auth_mode".to_string(), Value::String(auth_mode));
118
124
  obj.insert("values".to_string(), redacted_values(&values));
119
- obj.insert("keys_present".to_string(), string_array(sorted_keys(&values)));
125
+ obj.insert(
126
+ "keys_present".to_string(),
127
+ string_array(sorted_keys(&values)),
128
+ );
120
129
  obj.insert("secret_keys_present".to_string(), string_array(secret_keys));
121
130
  obj.insert("missing_common".to_string(), string_array(missing_common));
122
131
  obj.insert("safe_for_agent_context".to_string(), Value::Bool(true));
@@ -134,7 +143,10 @@ fn show_profile(args: &ProfileArgs) -> Result<Value, CliError> {
134
143
 
135
144
  fn profile_dir(args: &ProfileArgs) -> PathBuf {
136
145
  let _ = &args.team;
137
- args.workspace.join(".team").join("current").join("profiles")
146
+ args.workspace
147
+ .join(".team")
148
+ .join("current")
149
+ .join("profiles")
138
150
  }
139
151
 
140
152
  fn validate_auth_mode(auth_mode: &str) -> Result<(), CliError> {
@@ -274,9 +286,9 @@ fn secret_keys_present(values: &Map<String, Value>) -> Vec<String> {
274
286
  }
275
287
 
276
288
  fn credential_present(values: &Map<String, Value>) -> bool {
277
- values.iter().any(|(key, value)| {
278
- is_secret_key(key) && value.as_str().is_some_and(|raw| !raw.is_empty())
279
- })
289
+ values
290
+ .iter()
291
+ .any(|(key, value)| is_secret_key(key) && value.as_str().is_some_and(|raw| !raw.is_empty()))
280
292
  }
281
293
 
282
294
  fn missing_common_keys(values: &Map<String, Value>, auth_mode: &str) -> Vec<String> {
@@ -375,9 +375,15 @@ fn coordinator_health_status_wire(
375
375
  /// F1 (0.3.26): direct pane-id send — bypasses agent-name routing + team
376
376
  /// membership check. Constructs `Target::Pane`, renders the message with
377
377
  /// the standard protocol block (Team Agent message from sender + token),
378
- /// injects via the default tmux backend, and surfaces the inject report as
379
- /// a JSON result. Cross-team capable: no restriction on which tmux session
380
- /// or socket the pane belongs to.
378
+ /// injects via the selected team's endpoint-local tmux transport, and
379
+ /// surfaces the inject report as a JSON result.
380
+ ///
381
+ /// 0.5.43 debt-sweep (§6.2): the pre-0.5.43 comment overstated the
382
+ /// scope. pane_id is inherently endpoint-local —
383
+ /// `lifecycle_worker_tmux_backend_for_selected_state` below builds the
384
+ /// transport from the SELECTED team's persisted endpoint. For cross-
385
+ /// workspace delivery, use `--to-name` / `--to-leader` instead; there
386
+ /// is intentionally no `--socket` flag.
381
387
  fn send_to_pane_direct(
382
388
  workspace: &Path,
383
389
  pane_id: &str,
@@ -9,8 +9,7 @@ use super::*;
9
9
  pub fn classify_agent_bucket(raw_status: &str, health_status: &str) -> SummaryBucket {
10
10
  let raw = raw_status.to_ascii_lowercase();
11
11
  let health = health_status.to_ascii_lowercase();
12
- if matches!(raw.as_str(), "failed" | "error") || matches!(health.as_str(), "failed" | "error")
13
- {
12
+ if matches!(raw.as_str(), "failed" | "error") || matches!(health.as_str(), "failed" | "error") {
14
13
  SummaryBucket::Failed
15
14
  } else if matches!(raw.as_str(), "stopped" | "done") || health == "done" {
16
15
  SummaryBucket::Stopped
@@ -43,10 +42,7 @@ pub fn agent_summary_counts(agents: &Value, health: &Value) -> SummaryCounts {
43
42
  }
44
43
  continue;
45
44
  }
46
- let raw = agent
47
- .get("status")
48
- .and_then(Value::as_str)
49
- .unwrap_or("");
45
+ let raw = agent.get("status").and_then(Value::as_str).unwrap_or("");
50
46
  let hstatus = health
51
47
  .get(agent_id)
52
48
  .and_then(|v| v.get("status"))
@@ -136,17 +132,13 @@ pub fn format_status_summary(data: &Value) -> String {
136
132
  "stopped",
137
133
  );
138
134
  let schema_ok = python_truthy(
139
- data
140
- .get("coordinator")
141
- .and_then(|v| v.get("schema_ok"))
135
+ data.get("coordinator")
136
+ .and_then(|v| v.get("schema_ok"))
142
137
  .unwrap_or(&Value::Null),
143
138
  );
144
139
  let tmux = python_truthy(data.get("tmux_session_present").unwrap_or(&Value::Null));
145
140
  let receiver = data.get("leader_receiver").unwrap_or(&Value::Null);
146
- let pane = non_empty_str(
147
- receiver.get("pane_id").and_then(Value::as_str),
148
- "-",
149
- );
141
+ let pane = non_empty_str(receiver.get("pane_id").and_then(Value::as_str), "-");
150
142
  let cmd = first_non_empty_str(
151
143
  &[
152
144
  receiver.get("pane_current_command").and_then(Value::as_str),
@@ -266,17 +258,8 @@ fn csv_agent_status(
266
258
  /// `_latest_result_line`(`commands.py:333-337`):agent_id/summary/created_at 渲染单行。
267
259
  /// summary `\n`→` ` 后 [:80] 截断、空 → `-`;agent_id 空 → `-`;created_at 经 age_text。
268
260
  pub(crate) fn format_latest_result(value: &Value) -> String {
269
- let agent = non_empty_str(
270
- value
271
- .get("agent_id")
272
- .and_then(Value::as_str)
273
- ,
274
- "-",
275
- );
276
- let raw_summary = value
277
- .get("summary")
278
- .and_then(Value::as_str)
279
- .unwrap_or("");
261
+ let agent = non_empty_str(value.get("agent_id").and_then(Value::as_str), "-");
262
+ let raw_summary = value.get("summary").and_then(Value::as_str).unwrap_or("");
280
263
  let summary_flat = raw_summary.replace('\n', " ");
281
264
  let summary = prefix_chars(&summary_flat, 80);
282
265
  let summary = if summary.is_empty() {
@@ -284,12 +267,7 @@ pub(crate) fn format_latest_result(value: &Value) -> String {
284
267
  } else {
285
268
  summary
286
269
  };
287
- let created = age_text(
288
- value
289
- .get("created_at")
290
- .and_then(Value::as_str)
291
- ,
292
- );
270
+ let created = age_text(value.get("created_at").and_then(Value::as_str));
293
271
  format!("{agent} -> {summary} @ {created}")
294
272
  }
295
273