@team-agent/installer 0.5.99 → 0.5.101

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 (47) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/crates/team-agent/src/cli/adapters.rs +1 -156
  4. package/crates/team-agent/src/cli/diagnose.rs +32 -10
  5. package/crates/team-agent/src/cli/emit.rs +6 -185
  6. package/crates/team-agent/src/cli/mod.rs +32 -182
  7. package/crates/team-agent/src/cli/send/coordinator.rs +2 -2
  8. package/crates/team-agent/src/cli/spec.rs +41 -67
  9. package/crates/team-agent/src/cli/tests/main_preserved.rs +2 -185
  10. package/crates/team-agent/src/cli/tests/missing_subcommands.rs +9 -9
  11. package/crates/team-agent/src/cli/triage.rs +1 -1
  12. package/crates/team-agent/src/cli/types.rs +0 -49
  13. package/crates/team-agent/src/compiler.rs +3 -0
  14. package/crates/team-agent/src/leader/lease.rs +1 -1
  15. package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +211 -16
  16. package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +1 -0
  17. package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +15 -5
  18. package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +89 -6
  19. package/crates/team-agent/src/lifecycle/launch/role_source.rs +168 -32
  20. package/crates/team-agent/src/lifecycle/launch.rs +11 -3
  21. package/crates/team-agent/src/lifecycle/profile_launch.rs +23 -8
  22. package/crates/team-agent/src/lifecycle/restart/agent.rs +2 -2
  23. package/crates/team-agent/src/lifecycle/restart/avatar.rs +1806 -0
  24. package/crates/team-agent/src/lifecycle/restart/common.rs +114 -1
  25. package/crates/team-agent/src/lifecycle/restart/rebuild.rs +14 -8
  26. package/crates/team-agent/src/lifecycle/restart/selection.rs +14 -2
  27. package/crates/team-agent/src/lifecycle/restart.rs +11 -4
  28. package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +2 -2
  29. package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +1 -1
  30. package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +9 -2
  31. package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +1398 -0
  32. package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -60
  33. package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +2 -2
  34. package/crates/team-agent/src/lifecycle/tests.rs +1 -0
  35. package/crates/team-agent/src/lifecycle/types.rs +10 -2
  36. package/crates/team-agent/src/messaging/send.rs +2 -2
  37. package/crates/team-agent/src/model/spec.rs +1 -0
  38. package/crates/team-agent/src/provider/types.rs +3 -1
  39. package/crates/team-agent/src/state/persist.rs +58 -2
  40. package/crates/team-agent/src/state/projection.rs +5 -1
  41. package/crates/team-agent/src/state/repository.rs +125 -9
  42. package/crates/team-agent/src/transport/test_support.rs +23 -3
  43. package/package.json +4 -4
  44. package/skills/team-agent/SKILL.md +17 -46
  45. package/skills/team-agent/references/recovery-runbook.md +2 -2
  46. package/skills/team-agent/references/team-agent-operator.md +4 -2
  47. package/skills/team-agent/references/team-in-team.md +0 -6
@@ -4,65 +4,36 @@ description: Use only when the user explicitly asks to start, operate, inspect,
4
4
  requires_team_agent: ">=0.5.0"
5
5
  last_verified_against: "0.5.66"
6
6
  ---
7
-
8
7
  # Team Agent
9
-
10
8
  Sealed appliance for someone who just got the CLI. Operator handbook (permissions, models, routing, recovery): `references/team-agent-operator.md`.
11
-
12
- If `team-agent --version` does not match `last_verified_against`, do not copy examples as current truth. Learn from the live CLI:
13
-
9
+ If `team-agent --version` differs from `last_verified_against`, learn from the live CLI before copying examples:
14
10
  ```bash
15
11
  team-agent --version
16
12
  team-agent --help
17
13
  team-agent doctor --help
18
14
  ```
19
-
20
- **Launch** from a tmux-addressable pane: `team-agent claude` or `team-agent codex`, then `team-agent quick-start .team/current`. Do not start a real team from a naked terminal. Workers always run in independent background windows on the workspace-scoped tmux server.
21
-
15
+ **Launch** from a tmux-addressable pane: `team-agent claude` or `team-agent codex`, then `team-agent quick-start .team/current`. Do not start a real team from a naked terminal; workers use independent background windows on the workspace-scoped tmux server.
22
16
  **Operate**
23
-
24
- - Dispatch: `team-agent send TO MESSAGE` (positional TO; `--watch-result` is deprecated). After success, do not poll with `sleep` / `status` / `inbox` / `collect`.
25
- TO has two co-equal logical forms: an **in-team short name** (`team-agent send reviewer "..."`) and a fully qualified `<workspace>::<team>/<agent>`. Use the qualified form across workspaces.
26
- - Inspect: `team-agent status` / `status --json`. `ok: true` plus `ready: false` is not a crash.
27
- - Lifecycle: `restart .` resumes a stopped team; `add-agent NAME --role-file FILE` adds or `--force` recreates one worker; `shutdown --workspace .` stops. Do not shutdown the whole team to add a worker.
28
- - Roles: every `agents/*.md` must declare boolean `dangerously_skip_permissions`. Never rewrite a user-supplied model id. Never read `.env` files.
29
-
30
- **On failure:** if the CLI prints a structured `action`, run that `action` first, then stop. Do not guess flags. `coordinator.session_missing` is a self-healing transient — re-check `status --json`; do not shutdown because of it.
31
-
17
+ - Dispatch: `team-agent send TO MESSAGE` (positional TO; `--watch-result` is deprecated). After success, do not poll with `sleep` / `status` / `inbox` / `collect`. TO has two co-equal logical forms: an in-team short name (`team-agent send reviewer "..."`) and a fully qualified `<workspace>::<team>/<agent>`. Use the qualified form across workspaces.
18
+ - Inspect: `team-agent status` / `status --json`; `ok: true` plus `ready: false` is not a crash.
19
+ - Lifecycle: `restart .` resumes a stopped team; `add-agent NAME --role-file FILE` adds or `--force` recreates one worker; `shutdown --workspace .` stops. Do not shutdown the team to add a worker.
20
+ - Roles: every `agents/*.md` must declare boolean `dangerously_skip_permissions`. Never rewrite user-supplied model ids or read `.env` files.
21
+ - On a structured failure `action`, run that action first, then stop. Do not guess flags. `coordinator.session_missing` is self-healing; re-check `status --json`, do not shutdown.
32
22
  The current user-facing agent is the leader (orchestrate only). Workers call `report_result` exactly once. Nested teams: `references/team-in-team.md`.
33
-
34
23
  ## Provider Capability Matrix
35
-
36
- Claude / Codex / Copilot / Gemini / fake: `references/team-agent-operator.md`. These two are in the runtime but were missing from that table:
37
- `quick-start` / `restart` / `claim-leader` JSON is compact by default (`ok`, `status`/`reason`, next action, attach/send, and `readiness.all_workers_spawned`); pass `--detail` only for internal diagnostics.
38
-
39
- | Provider | Resume | Turn-state detection | Per-worker model override | Native session fork |
24
+ See `references/team-agent-operator.md` for Claude / Codex / Copilot / Gemini / fake. `quick-start` / `restart` / `claim-leader` JSON is compact by default; pass `--detail` only for internal diagnostics.
25
+ | Provider | Resume | Turn-state detection | Per-worker model override | Team Agent fork |
40
26
  |---|---|---|---|---|
41
27
  | `grok` | yes (`--resume <id>`, archive-gated) | no | yes (role `model` required) | yes (`--fork-session` + new `--session-id`) |
42
- | `cursor_agent` | yes (argv `--resume <chatId>`, archive-gated) | no | required on role; same-family catalog id can take effect; unknown id silent-fallback; pane chrome ≠ proven live | **no — `CapabilityUnsupported`** |
43
-
44
- Grok / `cursor_agent` have no JSONL turn-state reader (classify → Unknown).
45
-
28
+ | `cursor_agent` | yes (`--resume <chatId>`, archive-gated) | no | required on role; same-family catalog id may take effect; unknown id silent-fallback; pane chrome ≠ proof | **no — `CapabilityUnsupported`** |
29
+ | `pi` | yes (exact `--session <backing-path>`, not selector/continue) | Unknown (no JSONL turn-state reader) | yes (role `model` / `effort`, catalog-validated) | yes (full snapshot into separate seat/session; exact backing resume) |
30
+ Grok / `cursor_agent` have no JSONL turn-state reader (classify → Unknown). Pi `fork-agent SOURCE --as TARGET` requires a captured Pi subscription source and reports both session ids plus the target backing path; it does not mutate the source session.
46
31
  ## Provider Prep
47
-
48
32
  ### Cursor provider notes
49
-
50
- Frontmatter: `provider: cursor_agent` (not `cursor`; launcher verb is `team-agent cursor`), `auth_mode: subscription`, `name:` required (omit → `missing front matter field name`). Also required: `role:`, `tools:`, `dangerously_skip_permissions:` (bool). Subscription needs no `profile`.
51
-
52
- `model:` is required (omit compile-fails; blocks a silent builtin `sonnet-4-thinking`). The flag stays on argv. Same-family catalog ids can change pane chrome. An id not in that provider's catalog silent-falls back (landing not stable; no events/stderr/pane warning). Pick names from the catalog; after spawn, `capture-pane` once for chrome. Do not treat the role field or pane chrome as proof of the live model.
53
-
54
- One `cursor_agent` per workspace. A second seat (including `add-agent --force` of a different id) fail-closes:
55
-
56
- ```
57
- error: cursor_agent seat already occupies this workspace
58
- reason: <workspace>/.cursor/mcp.json is directory-scoped; a second seat overwrites TEAM_AGENT_ID (last-writer)
59
- action: do not add another CursorAgent in this workspace until per-seat MCP identity is isolated
60
- ```
61
-
62
- Several cursor seats → one workspace directory each. Same seat, fresh context → `reset-agent --discard-session`.
63
-
64
- `clone-agent` copies the source role (provider unchanged). Runtime add: `clone-agent` → `stop-agent` → `remove-agent --confirm` (deletes `.team/dynamic-role-files/`) → write the role file → `add-agent --role-file` → dispatch.
65
-
66
- - Restart emits `--resume <chatId>` when `store.db`/`meta.json` exist; the gate does not read chat text. Persist anything that must survive restart.
33
+ Frontmatter: `provider: cursor_agent` (not `cursor`; launcher verb `team-agent cursor`), `auth_mode: subscription`, `name:` required, plus `role:`, `tools:`, and boolean `dangerously_skip_permissions:`. Subscription needs no `profile`.
34
+ `model:` is required. The flag stays on argv; same-family catalog ids can change pane chrome, while unknown ids silent-fallback without warning. Pick a catalog id; after spawn, `capture-pane` once for chrome. The role field and pane chrome do not prove the live model.
35
+ One `cursor_agent` per workspace; a second seat fail-closes because `.cursor/mcp.json` is directory-scoped and overwrites `TEAM_AGENT_ID`. Several Cursor seats need separate workspace directories. Same seat, fresh context: `reset-agent --discard-session`.
36
+ `clone-agent` copies the source role but starts fresh. Runtime role replacement: `clone-agent` → `stop-agent` → `remove-agent --confirm` (deletes `.team/dynamic-role-files/`) → write role file → `add-agent --role-file` → dispatch.
37
+ - Restart emits `--resume <chatId>` when `store.db` / `meta.json` exist; the gate does not read chat text. Persist anything that must survive restart.
67
38
  - Delivery sends one Enter; a second Enter interrupts the turn.
68
39
  - After spawn, the pane footer should show `Cursor Agent v<version>`. Do not use `strings` to probe the binary.
@@ -157,10 +157,10 @@ Resume/repair:
157
157
  team-agent restart "$WORKSPACE" --team "$TEAM" --json
158
158
  ```
159
159
 
160
- For a single worker where the leader has explicitly selected that worker:
160
+ A single-worker clean-context reset is not a resume operation. Only after the user explicitly approves discarding that worker's session, use:
161
161
 
162
162
  ```bash
163
- team-agent restart-agent "$AGENT_ID" --workspace "$WORKSPACE" --team "$TEAM" --json
163
+ team-agent reset-agent "$AGENT_ID" --workspace "$WORKSPACE" --team "$TEAM" --discard-session --json
164
164
  ```
165
165
 
166
166
  Validate:
@@ -122,11 +122,12 @@ Run `claim-leader` only from the **leader** pane. From a worker pane it refuses
122
122
 
123
123
  ## Provider Capability Matrix
124
124
 
125
- | Provider | Resume | Turn-state detection | Per-worker model override | Native session fork |
125
+ | Provider | Resume | Turn-state detection | Per-worker model override | Team Agent fork |
126
126
  |---|---|---|---|---|
127
127
  | `claude` / `claude_code` | yes (`--resume <id>`, transcript-verified) | yes (JSONL stream) | yes (role `model` overrides `provider_models`) | yes (snapshot copy + only `--resume <snapshot-id>`) |
128
128
  | `codex` | yes (`codex resume <id>`, session-store-verified) | yes (turn JSONL) | yes (role `model`) | yes (`codex fork`) |
129
129
  | `copilot` | yes (`copilot --resume <id|name>`, sqlite `sessions` row) | not yet (phase 1: `provider.classify.unsupported` event) | yes (role `model`) | yes (isolated `COPILOT_HOME` store fork) |
130
+ | `pi` | yes (exact `--session <backing-path>`, not selector/continue) | Unknown (no JSONL turn-state reader) | yes (role `model` / `effort`, catalog-validated) | yes (full snapshot into separate seat/session; exact backing resume) |
130
131
  | `gemini_cli` | no | no | yes | no |
131
132
  | `fake` (testing only) | no | no | n/a | no |
132
133
 
@@ -134,6 +135,7 @@ Notes:
134
135
  - Per-worker model override means a role-doc `model:` value wins over `TEAM.md` `provider_models.<provider>` at **compile** time; subscription defaults still fill blanks when there is no profile-deferred null.
135
136
  - Copilot fork copies the source session into an isolated `COPILOT_HOME` and rekeys its SQLite session references atomically. Missing or incomplete backing fails closed; it never falls back to a fresh spawn.
136
137
  - Copilot phase-1 idle/turn detection is intentionally Unknown; tick emits a single explicit `provider.classify.unsupported` event per state change (P4 dedup), never a silent default.
138
+ - `pi` `fork-agent SOURCE --as TARGET` requires a captured Pi subscription source. It copies the complete JSONL history into a distinct target session with a new id and exact `--session <path>` resume; it does not alter the source file or fall back to a fresh session.
137
139
 
138
140
  ## Provider Prep
139
141
 
@@ -567,7 +569,7 @@ Semantic distinction:
567
569
  - `team-agent add-agent <agent> --role-file <file>` — add a **new** worker not yet in team state.
568
570
  - `team-agent add-agent <agent> --role-file <file> --force` — force-recreate that worker from the role file.
569
571
  - `team-agent clone-agent <source> --as <new>` — reread the source worker's latest role file and start a fresh provider seat. It never copies conversation context. Success is initially honest `capture_state: pending_first_turn` with `session_id`, `new_session_id`, and `backing_path` all null; after the first turn, canonical capture changes the state to `captured` and fills the backing tuple.
570
- - `team-agent fork-agent <source> --as <new>` — reread the same latest role file and create a distinct, verified provider session that forks the source context. If the provider backing cannot be verified, the command fails and rolls back instead of silently cloning fresh.
572
+ - `team-agent fork-agent <source> --as <new>` — reread the source's latest role file and create a distinct provider session carrying its context. Pi subscription forks a verified full snapshot into a separate target seat/backing and reports source id, target id, and backing path; supported non-Pi providers keep their existing fork behavior. Unverified backing fails closed instead of silently cloning fresh.
571
573
  - `team-agent start-agent <agent>` — (re)launch a worker that **already exists** in team state but whose window is missing.
572
574
  - `team-agent reset-agent <agent> --discard-session` — keep the same seat and deliberately start it with fresh context.
573
575
  - `team-agent restart .` — resume a fully **stopped** team from stored worker sessions.
@@ -112,12 +112,6 @@ For an existing worker that should restart with a blank provider context, the le
112
112
  team-agent reset-agent "$AGENT_ID" --workspace "$WORKSPACE" --team "$TEAM" --discard-session --json
113
113
  ```
114
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
115
  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
116
 
123
117
  ## Framework Gaps To Track