@team-agent/installer 0.3.21 → 0.3.23

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 (31) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/crates/team-agent/src/cli/emit.rs +9 -1
  4. package/crates/team-agent/src/cli/mod.rs +158 -2
  5. package/crates/team-agent/src/cli/status.rs +61 -0
  6. package/crates/team-agent/src/cli/status_port.rs +2 -2
  7. package/crates/team-agent/src/cli/tests/base.rs +26 -0
  8. package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +233 -9
  9. package/crates/team-agent/src/coordinator/tests/energy.rs +548 -0
  10. package/crates/team-agent/src/coordinator/tests/mod.rs +1 -0
  11. package/crates/team-agent/src/coordinator/tick.rs +452 -17
  12. package/crates/team-agent/src/lifecycle/display.rs +23 -302
  13. package/crates/team-agent/src/lifecycle/launch.rs +38 -0
  14. package/crates/team-agent/src/lifecycle/restart/agent.rs +27 -6
  15. package/crates/team-agent/src/lifecycle/restart/common.rs +179 -0
  16. package/crates/team-agent/src/lifecycle/restart/rebuild.rs +295 -13
  17. package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +30 -0
  18. package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +89 -5
  19. package/crates/team-agent/src/messaging/delivery.rs +324 -95
  20. package/crates/team-agent/src/messaging/scheduler.rs +95 -73
  21. package/crates/team-agent/src/messaging/send.rs +10 -0
  22. package/crates/team-agent/src/messaging/tests/runtime.rs +460 -0
  23. package/crates/team-agent/src/messaging/tests/spine.rs +51 -2
  24. package/crates/team-agent/src/session_capture.rs +261 -1
  25. package/crates/team-agent/src/tmux_backend/tests.rs +97 -1
  26. package/crates/team-agent/src/tmux_backend.rs +138 -2
  27. package/crates/team-agent/src/transport/test_support.rs +25 -0
  28. package/crates/team-agent/src/transport.rs +11 -0
  29. package/package.json +4 -4
  30. package/skills/team-agent/SKILL.md +2 -1
  31. package/skills/team-agent/references/team-in-team.md +127 -0
@@ -33,6 +33,7 @@ struct OfflineState {
33
33
  default_liveness: PaneLiveness,
34
34
  calls: Vec<&'static str>,
35
35
  spawns: Vec<SpawnRecord>,
36
+ pane_titles: Vec<(String, String, String, String)>,
36
37
  inject_targets: Vec<Target>,
37
38
  inject_payloads: Vec<String>,
38
39
  tmux_endpoint: Option<String>,
@@ -52,6 +53,7 @@ impl Default for OfflineState {
52
53
  default_liveness: PaneLiveness::Unknown,
53
54
  calls: Vec::new(),
54
55
  spawns: Vec::new(),
56
+ pane_titles: Vec::new(),
55
57
  inject_targets: Vec::new(),
56
58
  inject_payloads: Vec::new(),
57
59
  tmux_endpoint: None,
@@ -149,6 +151,10 @@ impl OfflineTransport {
149
151
  })
150
152
  }
151
153
 
154
+ pub fn pane_title_records(&self) -> Vec<(String, String, String, String)> {
155
+ self.with_state(|state| state.pane_titles.clone())
156
+ }
157
+
152
158
  pub fn inject_targets(&self) -> Vec<Target> {
153
159
  self.with_state(|state| state.inject_targets.clone())
154
160
  }
@@ -350,6 +356,25 @@ impl Transport for OfflineTransport {
350
356
  }))
351
357
  }
352
358
 
359
+ fn configure_adaptive_pane_title(
360
+ &self,
361
+ session: &SessionName,
362
+ window: &WindowName,
363
+ pane: &PaneId,
364
+ title: &str,
365
+ ) -> Result<(), TransportError> {
366
+ self.with_state(|state| {
367
+ state.calls.push("configure_adaptive_pane_title");
368
+ state.pane_titles.push((
369
+ session.as_str().to_string(),
370
+ window.as_str().to_string(),
371
+ pane.as_str().to_string(),
372
+ title.to_string(),
373
+ ));
374
+ });
375
+ Ok(())
376
+ }
377
+
353
378
  fn set_session_env(
354
379
  &self,
355
380
  _session: &SessionName,
@@ -530,6 +530,17 @@ pub trait Transport: Send + Sync {
530
530
  session: &SessionName,
531
531
  ) -> Result<Vec<WindowName>, TransportError>;
532
532
 
533
+ fn configure_adaptive_pane_title(
534
+ &self,
535
+ session: &SessionName,
536
+ window: &WindowName,
537
+ pane: &PaneId,
538
+ title: &str,
539
+ ) -> Result<(), TransportError> {
540
+ let _ = (session, window, pane, title);
541
+ Ok(())
542
+ }
543
+
533
544
  /// tmux=`set-environment`;无 server-env 的后端(WezTerm/ConPTY)对 worker 内化为
534
545
  /// 「spawn 时注入」(`InternalizedAtSpawn`),对外部 leader pane 返回 typed 不支持
535
546
  /// (`UnsupportedForExternalPane`,§4c)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-agent/installer",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "description": "npx installer for Team Agent",
5
5
  "keywords": [
6
6
  "codex",
@@ -20,9 +20,9 @@
20
20
  "team-agent-installer": "npm/install.mjs"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@team-agent/cli-darwin-arm64": "0.3.21",
24
- "@team-agent/cli-darwin-x64": "0.3.21",
25
- "@team-agent/cli-linux-x64": "0.3.21"
23
+ "@team-agent/cli-darwin-arm64": "0.3.23",
24
+ "@team-agent/cli-darwin-x64": "0.3.23",
25
+ "@team-agent/cli-linux-x64": "0.3.23"
26
26
  },
27
27
  "scripts": {
28
28
  "postinstall": "node npm/bincheck.mjs",
@@ -158,6 +158,7 @@ For diagnosis, run `team-agent profile show deepseek --workspace . --json`; neve
158
158
  - Quick-start generated files stay inside the selected team directory, for example `.team/current/` or `.team/alpha/`; do not create or expect root `team.spec.yaml` or `team_state.md`.
159
159
  - Use `team-agent quick-start ./roles --team-id alpha` to create a second generated team under `.team/alpha/`, or pass an existing team directory directly such as `team-agent quick-start .team/alpha`.
160
160
  - `quick-start` is for fresh startup from role docs. If stored worker context already exists for that runtime session, follow the returned `team-agent restart . --team <session>` action to resume it. Use `--fresh` only when the user explicitly accepts new blank worker contexts.
161
+ - If the user explicitly asks a worker to create or operate a nested child team, first read `references/team-in-team.md`. Child teams must use an independent child workspace, never the parent `.team/current`.
161
162
  - `team-agent send --watch-result coder "Do the bounded task"` sends a direct worker message, returns after delivery, and lets the coordinator collect/report completion asynchronously.
162
163
  - After `send --watch-result` succeeds, do not run `sleep`, `status`, `inbox`, or `collect` polling loops unless the user explicitly asks for diagnosis; the coordinator will notify the leader when the result arrives.
163
164
  - `team-agent send --task task_initial "Start"` routes by task.
@@ -214,7 +215,7 @@ Removing a worker at runtime is the symmetric `team-agent remove-agent <agent> -
214
215
 
215
216
  ## Worker Protocol
216
217
 
217
- Workers do not run nested Team Agent teams. Workers only provide the target and content for progress, and a short completion summary at the end:
218
+ Workers normally do not run nested Team Agent teams. When the user or leader explicitly asks for a child team, follow `references/team-in-team.md`; otherwise workers only provide the target and content for progress, and a short completion summary at the end:
218
219
 
219
220
  ```text
220
221
  team_orchestrator.send_message(to="leader", content="short progress or blocker")
@@ -0,0 +1,127 @@
1
+ # Team-In-Team Reference
2
+
3
+ This reference is for explicitly requested nested Team Agent teams. Use it only when the user or leader asks a worker to create or operate a child team. For normal work, a worker should stay inside its parent team and report through `team_orchestrator`.
4
+
5
+ ## Safety Rules
6
+
7
+ - Use the Team Agent framework skill and `team-agent` CLI. Do not use a provider's built-in agent-team feature when the user asked for Team Agent.
8
+ - Never create a child team in the parent team's `.team/current` directory.
9
+ - Never edit, delete, or reuse files under the parent team's `.team/current`.
10
+ - Never shut down a team just because `.team/current` is already occupied. In a nested setup, that is probably the parent team; shutting it down can kill the main node.
11
+ - A child team needs its own workspace directory. The role-doc directory is not the child workspace.
12
+ - MCP tools are team-scoped. A worker must not try to widen `team_orchestrator.send_message` to another team.
13
+
14
+ ## Child Workspace
15
+
16
+ Pick an independent directory before writing `TEAM.md` or agent role docs. A safe default is a child workspace under the parent workspace, but outside the parent `.team/current`:
17
+
18
+ ```bash
19
+ PARENT_WORKSPACE="$PWD"
20
+ case "$PARENT_WORKSPACE" in
21
+ */.team/current|*/.team/current/*)
22
+ echo "Refusing to create a child team from parent .team/current; cd to the parent workspace root first." >&2
23
+ exit 1
24
+ ;;
25
+ esac
26
+ CHILD_TEAM="child-review-team"
27
+ CHILD_WORKSPACE="$PARENT_WORKSPACE/.team/children/review-$(date +%Y%m%d%H%M%S)"
28
+ mkdir -p "$CHILD_WORKSPACE"
29
+ cd "$CHILD_WORKSPACE"
30
+ mkdir -p .team/current/agents
31
+ ```
32
+
33
+ Then create the child team's files inside the child workspace:
34
+
35
+ ```bash
36
+ cat > .team/current/TEAM.md <<'EOF'
37
+ ---
38
+ name: child-review-team
39
+ objective: Run a bounded child-team task and report to the parent worker.
40
+ dangerous_auto_approve: false
41
+ fast: false
42
+ ---
43
+
44
+ Child team config only.
45
+ EOF
46
+
47
+ cat > .team/current/agents/reviewer.md <<'EOF'
48
+ ---
49
+ name: reviewer
50
+ role: Independent Reviewer
51
+ provider: codex
52
+ tools:
53
+ - fs_read
54
+ - fs_list
55
+ - mcp_team
56
+ ---
57
+
58
+ Review only the files and instructions provided by the child-team leader.
59
+ Report findings with team_orchestrator.report_result exactly once.
60
+ EOF
61
+
62
+ team-agent quick-start .team/current
63
+ ```
64
+
65
+ If `quick-start` reports that `current` or a tmux session already exists, do not run `shutdown`. Move to a new child workspace or change the child team name.
66
+
67
+ ## Parent Protection
68
+
69
+ The parent worker is also the child team's leader. Keep the two scopes separate:
70
+
71
+ - Parent team: the worker talks upward with its parent `team_orchestrator` MCP tools.
72
+ - Child team: the same worker talks downward with `team-agent send --workspace "$CHILD_WORKSPACE" --team "$CHILD_TEAM" ...`.
73
+
74
+ Do not run child lifecycle commands against the parent workspace. Always pass the child workspace and team when operating the child team from the parent worker.
75
+
76
+ ## Parent-Child Messaging
77
+
78
+ Use explicit two-hop routing.
79
+
80
+ Parent leader to child worker:
81
+
82
+ 1. Parent leader sends the child-task instruction to the parent worker that owns the child team.
83
+ 2. Parent worker sends into the child team:
84
+
85
+ ```bash
86
+ team-agent send reviewer "Review this patch and report findings" \
87
+ --workspace "$CHILD_WORKSPACE" \
88
+ --team "$CHILD_TEAM" \
89
+ --watch-result
90
+ ```
91
+
92
+ Child worker to parent leader:
93
+
94
+ 1. Child worker reports to its child leader:
95
+
96
+ ```text
97
+ team_orchestrator.send_message(to="leader", content="short progress")
98
+ team_orchestrator.report_result(summary="short completion", status="success")
99
+ ```
100
+
101
+ 2. The parent worker, acting as child leader, relays the relevant summary upward to the parent leader with its parent-team MCP tools.
102
+
103
+ Do not ask a child worker to send directly to a parent-team agent id. Current MCP scope is team-local and should refuse out-of-scope peers. Use CLI `--workspace` and `--team` only from the appropriate leader/operator side when crossing team boundaries.
104
+
105
+ ## Clean-Context Roles
106
+
107
+ Asking for a clean-context role is a normal feature request when the user wants a blind reviewer, a fresh second opinion, or a role that forgets earlier conversation. It is not the same as failure recovery.
108
+
109
+ For an existing worker that should restart with a blank provider context, the leader can use:
110
+
111
+ ```bash
112
+ team-agent reset-agent "$AGENT_ID" --workspace "$WORKSPACE" --team "$TEAM" --discard-session --json
113
+ ```
114
+
115
+ or the equivalent restart form:
116
+
117
+ ```bash
118
+ team-agent restart-agent "$AGENT_ID" --workspace "$WORKSPACE" --team "$TEAM" --discard-session --json
119
+ ```
120
+
121
+ Use this only when the user intentionally wants a clean context. For incident recovery, follow `recovery-runbook.md`, where context-preserving repair comes first.
122
+
123
+ ## Framework Gaps To Track
124
+
125
+ - Nested mode needs a way to pin the framework Team Agent skill by absolute path, so providers do not choose their built-in agent-team feature.
126
+ - A child-team worker should be prevented from shutting down the parent team by mistake.
127
+ - Child team creation should avoid defaulting to the fragile parent `current` directory.