@giladbarnea/pi-simple-team 1.0.24 → 1.0.25

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.
package/README.md CHANGED
@@ -17,8 +17,6 @@
17
17
 
18
18
  `pi-simple-team` spawns a small team of Pi agents that can all talk to each other, like the responsible adults they are, **and then stays out of the way.**
19
19
 
20
- Each team stays flat. When the work needs another room, an opted-in teammate can now open and manage teams of its own.
21
-
22
20
  </div>
23
21
 
24
22
  ---
@@ -26,7 +24,7 @@ Each team stays flat. When the work needs another room, an opted-in teammate can
26
24
 
27
25
  ## Why
28
26
 
29
- I've always done my best work in a small room with a few capable people, building something together.
27
+ I did my best work in a small room, together with a bunch of very capable people.
30
28
 
31
29
  > <span style="color:grey">_[shouts]_</span> Has anyone figured out how to set up auth yet?
32
30
 
@@ -38,56 +36,18 @@ Not scheduling a meeting.
38
36
 
39
37
  **That's the whole design. Not a swarm, not a company. *A room.***
40
38
 
41
- ## Using `pi-simple-team`
42
-
43
- Tell your main agent:
44
- > Spawn a team.
45
-
46
- ### Give one teammate a room of its own.
47
-
48
- Most work fits one flat team. Some work contains a second problem that needs its own people and its own coordination loop.
49
-
50
- Set `canOverseeOwnTeams: true` when you create that teammate:
51
-
52
- ```json
53
- {
54
- "name": "research-lead",
55
- "prompt": "Map the product domain. Create a team for the database investigation.",
56
- "model": "provider/model-id",
57
- "canOverseeOwnTeams": true
58
- }
59
- ```
60
-
61
- That teammate stays in the parent team and becomes main for every team it creates. It gets the same team lifecycle, messaging, status, log, and context-window tools as the original main agent.
62
-
63
- The boundary is strict. It can manage only teams created by its own Pi session. It cannot inspect or stop its parent team, sibling teams, or their teammates. The option defaults to `false`.
39
+ ## Install
64
40
 
65
- ```mermaid
66
- flowchart LR
67
- main["main"] --> A["Team A"]
68
- main --> B["Team B"]
69
- main --> C["Team C"]
70
- A --> A1["A1 · canOverseeOwnTeams"]
71
- A1 --> A1a["A1 team 1"]
72
- A1 --> A1b["A1 team 2"]
73
- A1 --> A1c["A1 team 3"]
41
+ ```sh
42
+ pi install npm:@giladbarnea/pi-simple-team
74
43
  ```
75
44
 
76
- A room can open another room. It does not get the keys to the whole building.
77
-
78
- ### Watch a live team with `/team`.
79
-
80
- `/team` is for you, not another agent tool. It gives you a live view of the room without turning the main agent into a status relay.
81
-
82
- The command opens a read-only overlay with recent statuses, messages, and a separate event log. With no teams, it shows an empty state. With one team, it opens that team directly. With several teams, it starts with a selector.
83
-
84
- The fixed layout keeps the latest content in view as work arrives, without scrolling or jumping around. It is an overview of the room, not a teammate drill-down or transcript.
85
-
86
- ### Throw a team at something hard.
45
+ ## Using `pi-simple-team`
87
46
 
88
- The team takes the shape of the mission.
47
+ Tell your main agent:
48
+ > Spawn a team.
89
49
 
90
- **Basic example: adversarial pair**
50
+ That's it. The team takes the shape of the mission:
91
51
 
92
52
  You:
93
53
  > Create an implementer-reviewer team to complete `PLAN.md`.
@@ -97,60 +57,16 @@ Main agent:
97
57
 
98
58
  <br>
99
59
 
100
- **Better example: build an agentic graph**
101
-
102
- You:
103
- > **Team goal:**
104
- > 1. Map all customer–product money streams in the database.
105
- > 2. Feed this knowledge into the harness.
106
- > 3. Prove the data analysis agent passes the new evals.
107
- >
108
- > **Note:**
109
- > - #1 and #3 are _loops._ Call them `1-map` and `3-eval`.
110
- > - `1-map` and `3-eval` each gets a teammate with `canOverseeOwnTeams: true`.
111
- > - Each teammate spawns _its own team_ to loop on its task.
112
-
113
- <br>
114
-
115
- <center>
116
- <b>Because</b> it does nothing special, <code>pi-simple-team</code> can construct any team graph you need.
117
- </center>
118
- <br>
119
- That prompt gives you this graph:
120
-
121
- ```mermaid
122
- flowchart LR
123
- subgraph map["1-map: map the money streams"]
124
- scout["`**Scout**
125
- Runs repeatedly to clear
126
- out the fog of war.`"] <--> advocate["`**Devil’s advocate**
127
- Points out what we
128
- still don’t know.`"]
129
- end
130
-
131
- harness["`**2: subagent dispatch**
132
- Feeds new understanding
133
- into the harness.`"]
134
-
135
- subgraph eval["3-eval: hill-climb the evals"]
136
- engineer["`**Engineer**
137
- Improves the harness.`"] <--> watcher["`**Performance watcher**
138
- Suggests a fresh approach
139
- when stuck. `"]
140
- end
141
-
142
- map --> harness --> eval
143
- ```
60
+ ![Spawning a designer–adversary team, checking its status, and sending both teammates a shared instruction](screenshots/1.png)
144
61
 
145
- <br>
62
+ <div align="center"><em><code>pi-simple-team</code> in the TUI.</em></div>
146
63
 
147
- ---
64
+ ### Watch a live team with `/team`.
148
65
 
149
- <br>
66
+ `/team` is for you, not another agent tool. It gives you a live view of the room without turning the main agent into a status relay.
150
67
 
151
- ![Spawning a designer–adversary team, checking its status, and sending both teammates a shared instruction](screenshots/1.png)
68
+ The command opens an overlay rolling recent statuses, messages, and a separate event log.
152
69
 
153
- <div align="center"><em><code>pi-simple-team</code> in the TUI.</em></div>
154
70
 
155
71
  ## The mechanics
156
72
 
@@ -164,9 +80,9 @@ This is both efficient and effective:
164
80
 
165
81
  - ✔ No inbox to forget.
166
82
  - ✔ Context window stays lean.
167
- - ✔ Unlocks teams doing arbitrary workflows.
83
+ - ✔ Unlocks arbitrary workflows.
168
84
 
169
- *{screenshot of Codex filling up the entire visible chat with countless* `Waiting agents to finish...`*}*
85
+ *{ironic screenshot of Codex filling up the entire visible chat with countless* `Waiting agents to finish...`*}*
170
86
 
171
87
  ### ⚡ Messages arrive _fast_.
172
88
 
@@ -177,9 +93,9 @@ This is both efficient and effective:
177
93
 
178
94
  Teammates publish a one-liner:
179
95
 
180
- > <span style="color:grey">implementer  </span> Done, 89 tests green, awaiting review.
96
+ > <span style="color:grey">implementer </span> Done, 89 tests green, awaiting review.
181
97
 
182
- > <span style="color:grey">reviewer      </span> Reading implementation, will finalize review in a few minutes.
98
+ > <span style="color:grey">reviewer </span> Reading implementation, will finalize review in a few minutes.
183
99
 
184
100
  Your main agent calls `teamstatus` and understands exactly what is going on. Main does not ask teammates for updates or clutter their context.
185
101
 
@@ -189,21 +105,21 @@ Teammates know how much free context they have left.
189
105
 
190
106
  Main agent knows its own and everyone else's too.
191
107
 
108
+ They will hand off work on their own when it's time to say goodbye.
109
+
110
+ You can stop babysitting everyone's context window.
111
+
192
112
  ### 📣 Interrupts, when justified.
193
113
 
194
- > _Situation: Late afternoon. Team has finished a production hotfix and started to wrap up._
114
+ > _Situation: Late afternoon. Team finished production hotfix and started wrap up. There is one problem though._
195
115
 
196
116
  - 17:32:00: Security scout spots a private SSH key not covered by `.gitignore`.
197
- - 17:32:01: Release teammate sets status: "Ran `git add .`, preparing commit and push."
117
+ - 17:32:01: Release teammate sets status: _Ran `git add .`, preparing commit and push._
198
118
  - 17:32:02: Scout immediately interrupts. Key never leaves the machine. Developer keeps their job.
199
119
 
200
- ### 📡 Live observability without a second history.
201
-
202
- While a team runs, `teamlog` exposes a timestamped, filterable timeline of messages, tool calls, and lifecycle events.
120
+ ### 📡 Live, zero-cost observability
203
121
 
204
- That live timeline stays in parent-process memory and starts fresh after a resume. Pi session JSONL files are the canonical conversation history.
205
-
206
- `pi-simple-team` does not persist a separate parent-runtime log or duplicate `teamlog` data.
122
+ Your main uses `teamlog` when it needs to understand the chain of events in high granularity: a timestamped, filterable timeline of messages, tool calls, and lifecycle events.
207
123
 
208
124
  <br>
209
125
 
@@ -219,40 +135,48 @@ That live timeline stays in parent-process memory and starts fresh after a resum
219
135
 
220
136
  ### 🧱 Teammates are durable Pi sessions.
221
137
 
222
- A teammate is a normal Pi session with a team attachment and an optional live runtime. The attachment adds its team prompt, roster, and communication tools.
138
+ A teammate is a normal Pi session with a team attachment.
223
139
 
224
- Each team ID is `{origin-main-session-id}-{team-name}`. `team_list` discovers active and dormant teams from the same canonical project directory.
140
+ This means every teammate can be resurrected, moved around teams and reused everywhere, anytime.
225
141
 
226
- `team_shutdown` stops every live runtime and leaves the team dormant. Its manifest expires after 30 days, but expiration never deletes Pi session files.
142
+ A teammate from one session can be added to a team in a later session.
227
143
 
228
- `team_resume` starts all stopped teammates by default, or only selected teammates. Resume uses RPC unless `showOnHerdrPanes` is explicitly set.
144
+ You can even `/resume` a teammate session directly if you ever want a cozy one-on-one.
229
145
 
230
- Pi creates a session path before it writes the session JSONL file. A teammate without a first assistant response therefore restarts empty.
146
+ The full lifecycle and persistence rules live in [ARCHITECTURE.md](ARCHITECTURE.md).
231
147
 
232
- A missing file that once held session history causes resume to fail. Persisted sessions restore their own model and thinking state from Pi.
148
+ ## When one room is not enough
233
149
 
234
- `team_add` creates new RPC teammates only for a running team owned by the current main session.
150
+ `pi-simple-team` supports teammates spawning and managing their own teams, one level down.
235
151
 
236
- The `canOverseeOwnTeams` capability persists with the teammate attachment and returns after resume.
152
+ This is opt-in: when spawning a team, ask main to turn this on for one (or more) teammates.
237
153
 
238
- For an overseeing teammate, `teamsend` and `teamstatus` use the parent team when `team` is omitted. Set `team` to operate on one of its own teams. `report_context_window` reports itself when `targets` is omitted and inspects its own teammates when `targets` is set.
154
+ That teammate stays in your team and becomes main for the teams it creates, with the same tools your main agent has. The boundary is strict: it manages only teams its own session created — never its parent team, sibling teams, or their teammates.
239
155
 
240
- RPC shutdown waits while an overseeing teammate stops its own teams.
156
+ A room can open another room. It does not get the keys to the whole building.
241
157
 
242
- **One Pi session can have only one live runtime.** Pi does not lock session files against concurrent writers.
158
+ ---
243
159
 
160
+ ## Graphs engineer themselves
244
161
 
245
- ## Install
162
+ **Because** it does nothing special, `pi-simple-team` can construct any team graph you need:
246
163
 
247
- ```sh
248
- pi install npm:@giladbarnea/pi-simple-team
249
- ```
164
+ You:
165
+ > **Team goal:**
166
+ > 1. Map all customer–product money streams in the database.
167
+ > 2. Feed this knowledge into the harness.
168
+ > 3. Prove the data analysis agent passes the new evals.
169
+ >
170
+ > **Note:**
171
+ > - #1 and #3 are _saturation loops._ Stop only when you can't find anything new.
172
+ > - Let teammates #1 and #3 create their own teams to loop until task is complete.
250
173
 
174
+ That prompt gives you this graph:
251
175
 
176
+ ![The team graph: 1-map (Scout and Devil’s advocate) feeding subagent dispatch, feeding 3-eval (Engineer and Performance watcher)](screenshots/team-graph.png)
252
177
 
253
178
  ## Tools
254
179
 
255
-
256
180
  Kept minimal:
257
181
 
258
182
 
@@ -273,7 +197,6 @@ Kept minimal:
273
197
  ---
274
198
 
275
199
 
276
-
277
200
  ## Roadmap
278
201
 
279
202
  **User involvement track:**
@@ -282,6 +205,7 @@ Kept minimal:
282
205
  - [x] `/team`: live, read-only team dashboard.
283
206
  - [ ] Teammate drill-down and transcripts.
284
207
  - [ ] Joining and steering teams from slash commands.
208
+ - [ ] Adding teammates to existing teams directly from slash commands.
285
209
  - [ ] Spawning teams directly from slash commands.
286
210
 
287
211
  **Functional:**
@@ -290,3 +214,4 @@ Kept minimal:
290
214
  - [x] Add new teammates after a team has spawned.
291
215
  - [x] Let opted-in teammates create and manage teams of their own.
292
216
  - [ ] Main forces `/compact` on select teammate.
217
+ - [ ] Teammates auto-reminded to hand off on low context.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giladbarnea/pi-simple-team",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "description": "A flat, live team of Pi agents.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -14,7 +14,7 @@ The flip side: if none of these payoffs apply, don't delegate. The anti-pattern
14
14
  - **Hivemind:** teams communicating internally in real time, as each teammate does work. Hollywood analogy: elite soldier squad or a team of spies, global channel earpieces, deployed behind enemy lines, each progresses their part, each part essential for completing the mission, global channel earpieces, consistent live updates, uncertainties surfaced to get advice, discussions to make best decisions for mission, path forward of an individual adapts in real time due to new peer finding, HQ possibly listening, warning and steering as required.
15
15
  - **De-bias:** It’s easier to spot blind spots or flaws when looking at someone else’s work (review; live or after the fact). Alternatively, sometimes a hypothesis is considered true only after it is confirmed independently by multiple actors (consensus).
16
16
 
17
- Read [`references/firstmate.md`](references/firstmate.md) when the user asks you to serve as their First Mate. See `./references/` for specific delegation shapes.
17
+ Read [`references/firstmate.md`](references/firstmate.md) when the user asks you to serve as their First Mate. Read [`references/captain.md`](references/captain.md) when the user asks you to serve as Captain of a fleet of teams. See `./references/` for specific delegation shapes.
18
18
 
19
19
  ---
20
20
 
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: captain
3
+ description: Defines Gilad's admiral–captain relationship for fleet-scale delegated work. One level above firstmate.md.
4
+ last_updated: 2026-08-15
5
+ ---
6
+
7
+ # Captain
8
+
9
+ Gilad is the admiral. You are the captain.
10
+
11
+ This is the relationship defined in [`./firstmate.md`](./firstmate.md), lifted one level. The admiral sets the mission and makes the decisions that need human judgment. The captain turns the mission into a fleet and keeps the fleet coherent. A ship is one team with one first mate at its head. The fleet is your ships together.
12
+
13
+ ## Chain of command
14
+
15
+ Admiral → captain → first mates → their crews.
16
+
17
+ You speak only to first mates. Do not dispatch, steer, or query a first mate's crew directly — that undermines the first mate and creates two sources of truth on one ship. If a ship drifts, steer its first mate. Cross-ship dependencies are yours to sequence; ships do not coordinate with each other except through you.
18
+
19
+ You do not row, and you do not do a first mate's job either. The delegation parameters in firstmate.md — shape, concurrency, context, model, thinking — are each first mate's to suggest for its own ship. In a fleet, you occupy the captain seat of that document: their suggestions come to you for approval, their escalations come to you, and you answer without waking the admiral unless the answer needs human judgment.
20
+
21
+ What is yours to decide: how the mission decomposes into ships, what each ship's mission is, and what each first mate needs to know.
22
+
23
+ By default, each ship works on an independent git worktree. Confirm this with the admiral.
24
+
25
+ ## Fleet plan
26
+
27
+ You may suggest a fleet plan — how many ships, each ship's mission, what each brings back — but the admiral must approve it before you commission anyone.
28
+
29
+ The admiral sets fleet-wide policy in one line ("all first mates on model X at thinking Y, everything below them at thinking Z"). That policy, and every shape you approve for a first mate, is a contract. Enforce it down the chain: an extra delegate nobody approved, or a wrong model or thinking level, is a violation to catch and correct — without waking the admiral.
30
+
31
+ ## Commissioning a first mate
32
+
33
+ 1. Tell it to load `ai-to-ai`, the files it references, and `firstmate.md`; inform him about the chain-of-command, and that you are its captain: direction, approvals, and escalations flow between it and you.
34
+ 2. Give it the fleet's why, the slice that is its ship's mission, and the bottom-line added value the fleet needs back from it. Do not prescribe the how — the over-fitting warnings in `ai-to-ai` apply equally all the way down, including to first mates.
35
+
36
+ ## How a captain communicates with the admiral
37
+
38
+ **The admiral does not attend the session.** He is not reading your interim messages. Interim status updates go unread. The real contract: every admiral-facing question or report is a cold entry. It must re-ground from the last true common ground — the mission he gave you and the last decisions he has actually made last time you interacted — never from your previous message.
39
+
40
+ **A question must carry its own provenance.** A good admiral question states, in product terms: the progress made since last touch-point, what the fork is, the path that produced it, the options already rejected and why, and your recommendation. "May the first mate buy asset pack X?" out of the blue is a failure. "Here is what was done since we last talked, here is the fork, here are the tradeoffs already navigated to arrive at it, here is what each route means for the final product, I recommend Y" is the bar.
41
+
42
+ **If you cannot tell that story, the question goes back down, not up.** You are a translator between decks, not a relay. When a first mate's escalation is saturated with ship-internal jargon you cannot ground in product terms, ask the first mate for the missing context first. Forwarding it upward verbatim is a chain-of-command failure even though the message flowed through the right rungs.
43
+
44
+ **The escalation bar.** The chain processes at every rung: crews surface to their first mate, first mates surface to you, and you surface to the admiral only what needs human judgment. Reversible implementation tuning is yours to decide. What legitimately reaches the admiral: product-visible behavior, money, direction and scope changes, non-trivial cross-ship decisions, and blockers.
45
+
46
+ **Batch approvals.** When you expect several approvals to arrive close together — as when every first mate is drafting its shape proposal — hold them and bring one grouped request. One decision session beats three interruptions. A lone question does not wait for company.
47
+
48
+ ## Mid-flight steering
49
+
50
+ Terse steering is normal admiral behavior — "pass that down", a bare link, "yes good". Amplify it downward faithfully, without distortion, and confirm in one line.
51
+
52
+ ## Keep the fleet afloat
53
+
54
+ Your own context window should stay lean — but you are the fleet's memory, so watch it anyway. The "Keep the ship afloat" instruction in firstmate.md — including the handoff-skill instruction for delegates heading toward their cap — is each first mate's duty on its own ship. You hold the same duty one level up: the first mates are your delegates. Trust them to inspect their crews and write handoff docs well; do not micromanage that. Instead, tell each first mate once, at commissioning: inform you when its own context runs low, referencing the handoff doc if it just wrote one. Your wide view over the fleet lets you make the right call so the purpose of that first mate's ship continues.
55
+
56
+ Any memory you persist covers only your unique scope: the in-between of ships and the link to the admiral. Reference other docs; do not repeat their contents.
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  name: firstmate
3
3
  description: Defines Gilad's captain–first mate relationship for delegated work.
4
- last_updated: 2026-08-05 09:47
4
+ last_updated: 2026-08-15
5
5
  ---
6
6
 
7
7
  # First Mate
8
8
 
9
9
  Gilad is the captain. You are the first mate.
10
10
 
11
+ In a fleet ([`captain.md`](captain.md)), a captain agent occupies the captain seat, and every "captain" below refers to it: your direction, approvals, and escalations flow between you and your captain, not Gilad.
12
+
11
13
  The captain sets direction and makes the decisions that need human judgment. The first mate turns that direction into a clear delegation shape, keeps the work coherent, and brings back the decisions and evidence that matter.
12
14
 
13
15
  Your fingers are delegation buttons. Do not row, raise sails, or scout ahead yourself unless the captain instructs you to do so. Delegate the operational work to subagents.
@@ -1,8 +1,6 @@
1
- <!-- name needs to change, not descriptive of actual purpose -->
1
+ # Colloquium Team
2
2
 
3
- # Thinktank Team
4
-
5
- Individually, each teammate is responsible for an orthogonal, parallel, read-only, think-heavy effort. The teammates would benefit from listening to the other teammates as they share their thoughts and findings in real time, exactly because each of them is doing its own thing. Sharing is fruitful for the same reason it’s fruitful for scientists to attend and listen to peers in scientific conferences: {some AI agent seeing this please insert the sentence i am looking for instead of this placeholder}.
3
+ Individually, each teammate is responsible for an orthogonal, parallel, read-only, think-heavy effort. The teammates would benefit from listening to the other teammates as they share their thoughts and findings in real time, exactly because each of them is doing its own thing. Sharing is fruitful for the same reason it’s fruitful for scientists to attend and listen to peers in scientific conferences: a peer’s finding from an adjacent problem updates your map of the shared terrain and reframes your own problem in ways you could not have generated from inside your own lane, at no cost to your own effort. Think of it as an open studio: everyone works on their own piece while absorbing the others’.
6
4
 
7
5
  ## Shape & Work flow
8
6
 
@@ -21,4 +19,3 @@ Examples (not an exhaustive list — infer the underlying principles and general
21
19
  ## When not to use
22
20
 
23
21
  When deliverable involves writing or editing.
24
-
package/team-ui.ts CHANGED
@@ -141,7 +141,8 @@ function selectNewestMessageLines(groups: string[][], height: number): MessageLi
141
141
  }
142
142
 
143
143
  class TeamOverviewOverlay implements Component {
144
- private readonly selector?: SelectList;
144
+ private selector?: SelectList;
145
+ private selectorTeamNames?: string;
145
146
  private selectedTeamName?: string;
146
147
  private refreshTimer?: ReturnType<typeof setInterval>;
147
148
  private closed = false;
@@ -152,32 +153,34 @@ class TeamOverviewOverlay implements Component {
152
153
  private readonly teamSource: TeamSnapshotSource,
153
154
  private readonly done: () => void,
154
155
  ) {
155
- const teams = teamSource();
156
- this.selectedTeamName = teams.length === 1 ? teams[0]!.name : undefined;
157
- if (teams.length > 1) {
158
- const items: SelectItem[] = teams.map((team) => ({
159
- value: team.name,
160
- label: team.name,
161
- description: `${team.roster.length} teammate${team.roster.length === 1 ? "" : "s"}`,
162
- }));
163
- this.selector = new SelectList(items, this.selectorHeight(teams.length), {
164
- selectedPrefix: (text) => theme.fg("accent", text),
165
- selectedText: (text) => theme.fg("accent", text),
166
- description: (text) => theme.fg("muted", text),
167
- scrollInfo: (text) => theme.fg("dim", text),
168
- noMatch: (text) => theme.fg("warning", text),
169
- });
170
- this.selector.onSelect = (item) => {
171
- this.selectedTeamName = item.value;
172
- this.tui.requestRender();
173
- };
174
- this.selector.onCancel = this.close;
175
- }
176
-
177
156
  this.refreshTimer = setInterval(() => this.tui.requestRender(), LIVE_REFRESH_INTERVAL_MILLISECONDS);
178
157
  this.refreshTimer.unref?.();
179
158
  }
180
159
 
160
+ /** Teams can appear or vanish while the overlay is open, so the selector follows the current snapshot. */
161
+ private refreshSelector(teams: readonly TeamSnapshot[]): void {
162
+ const teamNames = teams.map((team) => team.name).join("\n");
163
+ if (this.selector && this.selectorTeamNames === teamNames) return;
164
+ this.selectorTeamNames = teamNames;
165
+ const items: SelectItem[] = teams.map((team) => ({
166
+ value: team.name,
167
+ label: team.name,
168
+ description: `${team.roster.length} teammate${team.roster.length === 1 ? "" : "s"}`,
169
+ }));
170
+ this.selector = new SelectList(items, this.selectorHeight(teams.length), {
171
+ selectedPrefix: (text) => this.theme.fg("accent", text),
172
+ selectedText: (text) => this.theme.fg("accent", text),
173
+ description: (text) => this.theme.fg("muted", text),
174
+ scrollInfo: (text) => this.theme.fg("dim", text),
175
+ noMatch: (text) => this.theme.fg("warning", text),
176
+ });
177
+ this.selector.onSelect = (item) => {
178
+ this.selectedTeamName = item.value;
179
+ this.tui.requestRender();
180
+ };
181
+ this.selector.onCancel = this.close;
182
+ }
183
+
181
184
  handleInput(data: string): void {
182
185
  if (!this.selectedTeamName && this.selector) {
183
186
  this.selector.handleInput(data);
@@ -190,10 +193,14 @@ class TeamOverviewOverlay implements Component {
190
193
  render(width: number): string[] {
191
194
  const height = Math.max(4, Math.floor(this.tui.terminal.rows * 0.9));
192
195
  const teams = this.teamSource();
196
+ if (this.selectedTeamName && !teams.some((candidate) => candidate.name === this.selectedTeamName)) this.selectedTeamName = undefined;
197
+ if (!this.selectedTeamName && teams.length === 1) this.selectedTeamName = teams[0]!.name;
193
198
  if (this.selectedTeamName) {
194
199
  const team = teams.find((candidate) => candidate.name === this.selectedTeamName)!;
195
200
  return this.dashboard(team, width, height);
196
201
  }
202
+ if (teams.length > 1) this.refreshSelector(teams);
203
+ else this.selector = undefined;
197
204
  const innerHeight = height - 2;
198
205
  return this.frame(this.content(Math.max(1, width - 4), teams).slice(0, innerHeight), width, height);
199
206
  }