@tmustier/pi-agent-teams 0.4.0-beta.3 → 0.5.0

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 (33) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +72 -9
  3. package/WORKFLOW.md +110 -0
  4. package/docs/claude-parity.md +18 -13
  5. package/docs/hook-contract.md +183 -0
  6. package/docs/smoke-test-plan.md +26 -7
  7. package/extensions/teams/activity-tracker.ts +296 -8
  8. package/extensions/teams/cleanup.ts +216 -3
  9. package/extensions/teams/hooks.ts +57 -5
  10. package/extensions/teams/leader-attach-commands.ts +8 -4
  11. package/extensions/teams/leader-inbox.ts +162 -4
  12. package/extensions/teams/leader-info-commands.ts +105 -3
  13. package/extensions/teams/leader-lifecycle-commands.ts +205 -3
  14. package/extensions/teams/leader-messaging-commands.ts +19 -7
  15. package/extensions/teams/leader-spawn-command.ts +5 -1
  16. package/extensions/teams/leader-team-command.ts +51 -2
  17. package/extensions/teams/leader-teams-tool.ts +387 -11
  18. package/extensions/teams/leader.ts +126 -52
  19. package/extensions/teams/mailbox.ts +6 -1
  20. package/extensions/teams/model-policy.ts +117 -0
  21. package/extensions/teams/spawn-types.ts +4 -0
  22. package/extensions/teams/teammate-rpc.ts +14 -0
  23. package/extensions/teams/teams-panel.ts +117 -19
  24. package/extensions/teams/teams-ui-shared.ts +205 -2
  25. package/extensions/teams/teams-widget.ts +67 -14
  26. package/extensions/teams/worker.ts +18 -6
  27. package/extensions/teams/worktree.ts +143 -0
  28. package/package.json +4 -2
  29. package/scripts/integration-cleanup-test.mts +419 -0
  30. package/scripts/integration-hooks-remediation-test.mts +382 -0
  31. package/scripts/integration-spawn-overrides-test.mts +10 -0
  32. package/scripts/smoke-test.mts +701 -3
  33. package/skills/agent-teams/SKILL.md +28 -7
@@ -39,16 +39,19 @@ Use the **`teams` tool** (LLM-callable) for delegation, task/messaging mutations
39
39
  | `task_set_status` | `taskId`, `status` | `pending` \| `in_progress` \| `completed`. |
40
40
  | `task_dep_add` / `task_dep_rm` | `taskId`, `depId` | Dependency graph edits. |
41
41
  | `task_dep_ls` | `taskId` | Dependency/block inspection. |
42
- | `message_dm` | `name`, `message` | Mailbox DM. |
43
- | `message_broadcast` | `message` | Mailbox broadcast. |
42
+ | `message_dm` | `name`, `message` | Mailbox DM. `urgent=true` interrupts active turns. |
43
+ | `message_broadcast` | `message` | Mailbox broadcast. `urgent=true` interrupts active turns. |
44
44
  | `message_steer` | `name`, `message` | RPC steer for running teammate. |
45
45
  | `member_spawn` | `name` | Supports context/workspace/model/thinking/plan options. |
46
46
  | `member_shutdown` | `name` or `all=true` | Graceful mailbox shutdown request. |
47
47
  | `member_kill` | `name` | Force-stop RPC teammate. |
48
48
  | `member_prune` | _(none)_ | Mark stale workers offline (`all=true` to force). |
49
+ | `team_done` | _(none)_ | End team run: stop teammates, hide widget (`all=true` to force with in-progress tasks). |
49
50
  | `plan_approve` / `plan_reject` | `name` | Resolve pending plan approvals (`feedback` optional for reject). |
50
51
  | `hooks_policy_get` | _(none)_ | Read team hooks policy (configured + effective). |
51
52
  | `hooks_policy_set` | one or more: `hookFailureAction`, `hookMaxReopensPerTask`, `hookFollowupOwner` | Update team hooks policy at runtime (`hooksPolicyReset=true` clears team overrides first). |
53
+ | `model_policy_get` | _(none)_ | Inspect teammate model policy and current leader inheritance behavior. |
54
+ | `model_policy_check` | optional `model` | Validate a model override before spawn (`<provider>/<modelId>` or `<modelId>`). |
52
55
 
53
56
  Examples:
54
57
 
@@ -57,10 +60,14 @@ teams({ action: "delegate", tasks: [{ text: "Implement auth", assignee: "alice"
57
60
  teams({ action: "task_assign", taskId: "12", assignee: "alice" })
58
61
  teams({ action: "task_dep_add", taskId: "12", depId: "7" })
59
62
  teams({ action: "message_broadcast", message: "Sync: finishing this milestone" })
63
+ teams({ action: "message_dm", name: "alice", message: "Stop using lib X, use Y instead", urgent: true })
60
64
  teams({ action: "member_kill", name: "alice" })
61
65
  teams({ action: "plan_reject", name: "alice", feedback: "Include rollback strategy" })
62
66
  teams({ action: "hooks_policy_get" })
63
67
  teams({ action: "hooks_policy_set", hookFailureAction: "reopen_followup", hookMaxReopensPerTask: 2, hookFollowupOwner: "member" })
68
+ teams({ action: "model_policy_get" })
69
+ teams({ action: "model_policy_check", model: "openai-codex/gpt-5.1-codex-mini" })
70
+ teams({ action: "team_done" })
64
71
  ```
65
72
 
66
73
  This covers most day-to-day orchestration without slash commands. For nuanced/manual control, use `/team ...` commands directly.
@@ -95,12 +102,16 @@ Teammates auto-claim unassigned, unblocked tasks by default.
95
102
  ## Communication
96
103
 
97
104
  ```
98
- /team dm <name> <msg...> # direct message to one teammate
99
- /team broadcast <msg...> # message all teammates
100
- /team send <name> <msg...> # RPC-based (immediate, for spawned teammates)
105
+ /team dm <name> <msg...> # direct message to one teammate
106
+ /team dm <name> --urgent <msg...> # urgent DM — interrupts active turn via steering
107
+ /team broadcast <msg...> # message all teammates
108
+ /team broadcast --urgent <msg...> # urgent broadcast — interrupts all active turns
109
+ /team send <name> <msg...> # RPC-based (immediate, for spawned teammates)
101
110
  ```
102
111
 
103
- Teammates can also message each other directly via the `team_message` tool, with the leader CC'd.
112
+ Urgent messages (`--urgent` or `urgent=true` in tool calls) interrupt a teammate's active turn via steering instead of waiting for idle. Use sparingly — only for time-sensitive coordination like "stop using library X, it's broken".
113
+
114
+ Teammates can also message each other directly via the `team_message` tool (with optional `urgent` flag), with the leader CC'd.
104
115
 
105
116
  ## Governance modes
106
117
 
@@ -135,11 +146,21 @@ Spawning with `plan` restricts the teammate to read-only tools. After producing
135
146
  /team shutdown <name> # graceful shutdown (teammate can reject if busy)
136
147
  /team prune [--all] # hide stale manual teammates (mark offline in config)
137
148
  /team kill <name> # force-terminate one RPC teammate
138
- /team cleanup [--force] # delete team directory after all teammates stopped
149
+ /team done [--force] # end run: stop teammates + hide widget
150
+ /team cleanup [--force] # delete team directory, worktrees, and branches
151
+ /team gc [--dry-run] [--force] [--max-age-hours=N] # garbage-collect stale team dirs
139
152
  ```
140
153
 
154
+ When all tasks complete and teammates are idle, the widget shows "All tasks done." with a `/team done` hint.
141
155
  Teammates reject shutdown requests when they have an active task. Use `/team kill <name>` to force.
142
156
 
157
+ ## Cleanup
158
+
159
+ Worktrees and branches are automatically cleaned up on session shutdown and session switch. For manual cleanup:
160
+
161
+ - `/team cleanup [--force]` — removes the current team directory, including git worktrees and associated branches. Reports removal counts.
162
+ - `/team gc [--dry-run] [--force] [--max-age-hours=N]` — garbage-collects stale team directories older than `N` hours (default: 24). Skips teams with online members or in-progress tasks. Use `--dry-run` to preview.
163
+
143
164
  ## Other commands
144
165
 
145
166
  ```