@a-t-h-i/bot-lobby 0.5.1 → 0.6.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.
package/README.md CHANGED
@@ -70,15 +70,16 @@ pi install npm:@juicesharp/rpiv-ask-user-question
70
70
  It is optional for the Master. Without it `clarify` still works through Pi's
71
71
  built-in `select`/`input` prompts (or the Master asks in plain text), just with
72
72
  less structure. The lobby's planning panel uses the same questionnaire on its
73
- own — the library ships as a bot-lobby dependency, so the panel's questions
74
- arrive one at a time with options whether or not you install the tool for the
75
- Master (see [The lobby](#the-lobby)).
73
+ own — the library ships as a bot-lobby dependency, so each round's questions
74
+ arrive together in one dialog with options whether or not you install the tool
75
+ for the Master (see [The lobby](#the-lobby)).
76
76
 
77
77
  ## Usage
78
78
 
79
79
  ```
80
80
  /bot-lobby Open the lobby (alt+l): tasks, planning, quick fixes, metrics
81
81
  /bot-lobby <request> Start a task and hand it to the Master
82
+ /bot-lobby --task [--auto] <request> Start a task even when the request begins with a subcommand word
82
83
  /bot-lobby status [taskId] Active task, state, approvals, blockers, legal next states
83
84
  /bot-lobby tasks Task list (plus any unreadable task state)
84
85
  /bot-lobby pause | resume Stop or allow further workflow steps
@@ -93,6 +94,8 @@ Master (see [The lobby](#the-lobby)).
93
94
  /bot-lobby-settings Same as the settings subcommand
94
95
  /bot-lobby minimize|restore Hide or restore bot-lobby for this session (ctrl+shift+m)
95
96
  /bot-lobby claim <taskId> Take ownership of an orphaned task
97
+ /bot-lobby auto [on|off] Auto mode: the oracle drives this session's task to completion (alt+g)
98
+ /bot-lobby start-plan PLAN-… [auto] Start a saved plan here; its agreed plan needs no approval
96
99
  /bot-lobby lobby | help Open the lobby, or show this list
97
100
  ```
98
101
 
@@ -107,43 +110,63 @@ or without a task.
107
110
 
108
111
  ```
109
112
  ◆ bot-lobby │ 1 Lobby 2 Tasks 2 3 Plan 2? 4 Quick fix ⠋ 5 Metrics ⠋ TASK-add-login implementing Alt+H keys
110
- (the zen scene: the oracle, DEV · DESIGN · RESEARCH · QA, the plan checklist)
111
- ╭ Conversation · TASK-add-login ─────────────── Alt+C ╮ ╭ Activity ──────────────────────────────── Alt+A ╮
112
- │ you ▸ add a login page with email + password │ │ 12:04 MASTER ✓ scouting designer, backend │
113
- │ oracle ▸ Proposal │ │ 12:06 DEV ⠋ reading auth.ts… │
114
- │ • LoginForm component │ │ 12:06 DESIGN ⠋ editing LoginForm.tsx… │
115
- │ • POST /api/login with rate limiting │ │ 12:06 QUICK FIX ✓ done: rename getUser │
116
- ╰──────────────────────────────────────────────────────╯ ╰─────────────────────────────────────────────────╯
113
+ (the task's status: state, what the agents are doing, the plan checklist)
114
+ ╭ Conversation ──────────────────────────────── Alt+C ╮ ╭ Activity ──────────────────────────────── Alt+A ╮
115
+ │ ──────── task started · add login · 12:04 ───────── │ │ 12:04 MASTER ✓ scouting designer, backend │
116
+ │ ● You 12:04 │ │ 12:06 DEV ⠋ reading auth.ts… │
117
+ │ ▌ add a login page with email + password │ │ 12:06 DESIGN ⠋ editing LoginForm.tsx… │
118
+ │ ◆ Oracle 12:06 │ │ 12:06 QUICK FIX ✓ done: rename getUser │
119
+ │ Proposal │ │ │
120
+ │ • LoginForm component │ │ │
121
+ │ • POST /api/login with rate limiting │ │ │
122
+ ╰─────────────────────────────────────────────────────╯ ╰─────────────────────────────────────────────────╯
117
123
  ╭ Thinking ────────────────────────────────────────────────────────────────────────────────── DEV · 12s ago ╮
118
124
  │ The auth module already exposes a session helper; reuse it rather than adding a new one. │
119
125
  ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯
120
126
  ── message the oracle ───────────────────────────────────────────────────────────────────────────────────────
121
127
  _
122
- TYPE enter send shift+enter newline esc browse tab next tab alt+h keys alt+l hide
128
+ TYPE enter send esc browse alt+l hide
123
129
  ```
124
130
 
125
- - **1 Lobby** — the task's zen scene, then the conversation with the oracle
126
- (its text only: no tool rows, no thinking), an activity log that narrates
131
+ - **1 Lobby** — the task's status (its state box, what the agents are
132
+ doing and the plan checklist), then the conversation with the oracle
133
+ (its text only: no tool rows, no thinking; each turn under a `● You` or
134
+ `◆ Oracle` line with its time, your words in pi's user-message band, the
135
+ oracle's replies as Markdown, and events such as a task starting as a
136
+ rule), an activity log that narrates
127
137
  every tool call in plain words (`reading index.html…`, `searching for
128
138
  "router" in src`, `running npm test`, `delegating to backend: Step 2 …`) from
129
139
  the Master and every subagent, and a single **Thinking** pane — the one place
130
140
  thoughts show up: the oracle's live thought as it streams, and each finished
131
141
  thought from a subagent, quick fix or the planner (pi's own transcript,
132
142
  behind the lobby, still carries the oracle's thinking blocks; `ctrl+t`
133
- collapses them there). The oracle's replies render as Markdown. Every pane
134
- can be hidden and brought back — `alt+z` the scene, `alt+c` the
135
- conversation, `alt+a` the activity log, `alt+k` thinking — and the rest take
136
- its room; the choice is remembered (`lobby.panels`). Each pane scrolls on
143
+ collapses them there). The oracle's replies render as Markdown. To keep
144
+ the lobby clean, the animated oracle and agents stay out of it by default:
145
+ they show above pi's editor while the lobby is hidden, and `alt+z` brings
146
+ them into the lobby too (the status box names the key in its corner). `alt+c`, `alt+a` and `alt+k` hide or bring back the conversation,
147
+ the activity log and thinking, and the rest take their room; every choice is
148
+ remembered (`lobby.panels`). Each pane scrolls on
137
149
  its own (see **Scrolling** below), and a pane scrolled back stays on what
138
150
  you are reading while new lines arrive. The prompt talks to the
139
151
  oracle (while it works, enter steers the running turn; `esc` stops it); with
140
152
  no task, it starts one.
141
- - **2 Tasks** — every task in the project: this session's, the ones other pi
142
- sessions are driving, pending plans saved from the planner, and recently
143
- finished ones. The detail pane shows the request, the approved plan with its
144
- step checklist, your comments on it, amendments, what the task waits on and
145
- its recent runs. `c` comments on the selected task's plan (see below), `s`
146
- starts a pending plan as a task in this session, `d` twice discards one.
153
+ - **2 Tasks** — every task in the project as a checklist: this session's, the
154
+ ones other pi sessions are driving, pending plans saved from the planner, and
155
+ recently finished ones, each section under a rule with its count. A task or
156
+ plan still to do wears an empty box `☐` (coloured by its state) with its
157
+ state, auto mode and owner beneath and its plan progress as pips
158
+ (`▰▰▱▱ 2/4`); a completed task is ticked `☑`, and an abandoned one is crossed
159
+ `☒` with its title struck through. The detail pane shows the task's box,
160
+ state and progress bar, then the request, the plan's steps (`☑` done, `☐`
161
+ to do, `◂ now` on the current one), the approved plan, your comments on it,
162
+ amendments, what the task waits on and its recent runs. `c` comments on the selected task's plan (see below), `s`
163
+ starts a pending plan as a task **in a new session** and `h` starts it
164
+ here, in this window (either way its agreed plan needs no approval), `d`
165
+ twice discards one. `n` types a new task that starts in its own session, `o`
166
+ shows the session driving the selected task, `x` twice stops a background
167
+ session, and `alt+g` switches auto mode for the selected task. Rows say who
168
+ drives each task (`this session`, `background`, another session's id) and
169
+ mark auto mode `⟳ auto`.
147
170
  - **3 Plan** — task planning mode with a planning panel. Describe what you
148
171
  want and every seat grills you from its own domain, on the model and
149
172
  thinking level its settings name: **DEV** (APIs, data, errors, security,
@@ -151,15 +174,18 @@ or without a task.
151
174
  accessibility), **QA** (acceptance criteria, test strategy, edge cases,
152
175
  definition of done) and **RESEARCH** (libraries, versions, docs and prior
153
176
  art, with the web tools when `pi-web-access` is installed). The **oracle**
154
- chairs on the Planner model: it reads the seats' questions and notes, folds
155
- every answer into the draft plan (with a *Decisions by domain* section) and
156
- asks only what no single seat owns. Each round the seats run in parallel,
157
- read-only, then the oracle. Every question comes with two to four options,
158
- the seat's recommendation first, and the oracle puts them to you **one at a
159
- time** through the ask-user-question questionnaire: a tab per question
160
- labelled with the seat that asked it (`QA`, `DEV`…), its options with what
161
- each means, and a row to type your own answer or add a note (four questions
162
- per questionnaire; more follow in the next one). It opens by itself when a
177
+ chairs on the Planner model: it reads the seats' questions and notes and
178
+ folds every answer into the draft plan (with a *Decisions by domain*
179
+ section). Each round the seats run in parallel, read-only, then the oracle,
180
+ which **chooses at most four questions** for you from the seats' and its own
181
+ — merged, in plain words, the most decisive first — and decides the rest
182
+ with the recommended option, listed under *Assumptions* in the draft so you
183
+ can see and overrule them (comment on the line). The round's questions come
184
+ in **one** ask-user-question dialog: a tab per question labelled with the
185
+ seat it serves (`QA`, `DEV`…), two to four options with what each means,
186
+ the recommendation first (so `enter` on each accepts it), a row to type your
187
+ own answer or add a note, and a Submit tab that reviews everything and lets
188
+ you leave a question blank (the oracle then takes its recommendation). It opens by itself when a
163
189
  round ends while the Plan tab is showing (`lobby.autoAsk`), and otherwise
164
190
  when you press `enter` on the empty prompt or `a` while browsing; `esc` puts
165
191
  it away with your answers so far kept, and `enter` resumes. Your answers go
@@ -176,8 +202,7 @@ or without a task.
176
202
  line is marked `◆` with your comment beneath it, and the comment goes to the
177
203
  panel with your answers — or starts a round by itself when no question is
178
204
  open. While browsing, `1`–`4` seat or unseat DEV, DESIGN, QA and RESEARCH
179
- for the next round, `s` saves the plan to the pending tasks list, `n` starts
180
- over, `r` retries a round that failed or lost a seat, `x` stops one, and `m`
205
+ for the next round, `n` starts over, `r` retries a round that failed or lost a seat, `x` stops one, and `m`
181
206
  opens the oracle's (Planner) settings.
182
207
  - **4 Quick fix** — a direct prompt, the way you would ask pi, that skips the
183
208
  whole workflow: one coding agent (full tools) makes the change right away
@@ -214,13 +239,19 @@ typing). These work in both modes:
214
239
  | `alt+h` (or `?` while browsing) | show every key, and the current tab's |
215
240
  | `alt+s` | bot-lobby settings: every agent's model, thinking and time limit, and the lobby's switches |
216
241
  | `ctrl+f` (or `/` while browsing) | search the current tab |
242
+ | `ctrl+s` | save the plan from the Plan tab to the pending tasks — while typing too, from any tab |
243
+ | `alt+o` | the session switcher: this window, its background sessions, and tasks other terminals drive |
244
+ | `alt+n` | type a new task that starts in its own session, named after it |
245
+ | `alt+g` | auto mode on or off for the task in view (the selected one on Tasks) |
217
246
  | `tab` / `shift+tab`, `alt+1`…`alt+5` | switch tabs |
218
- | `alt+z` / `alt+c` / `alt+a` / `alt+k` | show or hide the zen scene / conversation / activity log / thinking |
247
+ | `alt+z` | show or hide the oracle and agent animations in the lobby (off by default; the task's status always shows) |
248
+ | `alt+c` / `alt+a` / `alt+k` | show or hide the conversation / activity log / thinking |
219
249
  | `pageup` / `pagedown` | scroll the focused pane a page |
220
250
  | `ctrl+c` | clear the prompt, or hide the lobby when it is empty |
221
251
 
222
252
  Every shortcut can be rebound under `lobby.keys` in the config, by action name:
223
- `hide`, `help`, `settings`, `search`, `nextTab`, `prevTab`, `toggleScene`,
253
+ `hide`, `help`, `settings`, `search`, `savePlan`, `sessions`, `newSession`,
254
+ `toggleAuto`, `nextTab`, `prevTab`, `toggleScene`,
224
255
  `toggleConversation`, `toggleActivity`, `toggleThinking`, `scrollUp`,
225
256
  `scrollDown` — e.g. `"keys": { "toggleThinking": "alt+t" }`. Pick keys that
226
257
  never type a character (`alt+…`, `ctrl+…`, `f1`…).
@@ -268,6 +299,70 @@ approved plan while implementing or reviewing, keeps finished steps done and
268
299
  marks the comments addressed (`○` waiting, `◐` sent to the oracle, `✓` plan
269
300
  amended). Before a plan exists, a comment asks for a revised proposal instead.
270
301
 
302
+ ## Several sessions from one window
303
+
304
+ Start a task in a new session without leaving your terminal, and switch
305
+ between sessions from the lobby.
306
+
307
+ - **Start one.** `alt+n` (or `n` on the Tasks tab) opens the prompt for a new
308
+ task; `enter` starts it in its own pi session. `s` on a saved plan does the
309
+ same for the plan. The new session is a headless pi (`pi --mode rpc`) this
310
+ window launches with the same pi build, model and extensions, and it is an
311
+ ordinary saved session **named after its task** — `/resume` lists it by
312
+ that name. Sessions a task starts are named after it too (`/bot-lobby
313
+ <request>` in a fresh session names that session).
314
+ - **Watch and talk to it.** The Lobby tab then shows that session: its task's
315
+ status, its conversation, activity log and thoughts, live. The tab bar names
316
+ the session in view (`◆ add signup form · working`), the prompt messages
317
+ its oracle (steering it while it works) and `esc` stops its running turn.
318
+ - **Answer it.** When a background session asks something — an approval, a
319
+ clarifying question — the tab bar shows `● 1 waiting`, and `enter` on the
320
+ empty prompt puts the question to you in this window with pi's own dialog
321
+ (`esc` there cancels it, as it would in that session). With the lobby
322
+ hidden, a notice says who is waiting.
323
+ - **Switch.** `alt+o` opens the switcher: this window, every background
324
+ session it started (working, idle, ended; `⟳ auto`; questions waiting), and
325
+ tasks that sessions in other terminals drive. `enter` shows one in the Lobby
326
+ tab, `n` starts a new one, `x` twice stops a background session. For a task
327
+ another terminal drives, the Lobby shows its conversation from its session
328
+ file, and your messages go to its task inbox (`inbox.jsonl`) — its own
329
+ session passes them to its oracle within a few seconds — while its live
330
+ activity stays in that terminal.
331
+
332
+ Background sessions belong to the window that started them: they keep running
333
+ while you switch pi sessions there, and stop when that pi exits. Their tasks
334
+ keep their state, so `/resume` (by the task's name) or `/bot-lobby claim`
335
+ picks one up later.
336
+
337
+ ## Auto mode
338
+
339
+ Auto mode lets the oracle drive a task to completion without asking you
340
+ anything. Switch it with `alt+g` — in the lobby for the task in view (or the
341
+ one selected on Tasks), outside it for this session's task — or with
342
+ `/bot-lobby auto [on|off]`; `/bot-lobby --task --auto <request>` and
343
+ `/bot-lobby start-plan PLAN-… auto` start a task with it on. The tab bar shows
344
+ `⟳ AUTO`. While it is on:
345
+
346
+ - clarifying questions are not asked: the oracle decides from the request,
347
+ the plan and its reconnaissance, and each decision is recorded
348
+ (`Not asked (auto mode): …`); the ask-user-question tool is blocked with the
349
+ same instruction;
350
+ - the proposal is approved without asking, and dependency and architecture
351
+ approvals a worker asks for are granted and recorded;
352
+ - when the oracle's turn ends before the task is done, the session nudges it
353
+ to keep going. A nudge that changes nothing counts; after three in a row
354
+ auto mode pauses and says the task needs you, and it resumes as soon as the
355
+ task moves again.
356
+
357
+ The switch lives beside the task (`auto.json`), so any session can flip it for
358
+ any task and the session that drives it follows within a few seconds.
359
+
360
+ **Agreed plans skip approval.** A task started from a plan saved in the Plan
361
+ tab (`s`/`h` on Tasks, or `/bot-lobby start-plan`) records the plan it came
362
+ from, and its proposal is approved without asking you again — you agreed the
363
+ plan with the panel already. Clarifying questions are still decided by the
364
+ oracle for such a task, since the plan answered them.
365
+
271
366
  ## Sessions and ownership
272
367
 
273
368
  A task is owned by the pi session that started it (`ctx.sessionManager` id,
@@ -293,8 +388,8 @@ every in-flight subagent process.
293
388
 
294
389
  While the owning session has a task active, its transcript switches to a zen view: `orchestrate` rows
295
390
  and the built-in spinner are hidden, and a widget above the editor animates the
296
- task (the same scene heads the lobby's first tab; the widget shows while the
297
- lobby is hidden). At 72 columns and wider it draws a large scene: a header box with the task
391
+ task (the widget shows while the lobby is hidden; inside the lobby the same
392
+ scene shows only with `alt+z`, its status box otherwise). At 72 columns and wider it draws a large scene: a header box with the task
298
393
  title and state in its top border, a progress bar, and a metadata row with
299
394
  elapsed time, quiet-mode hint and task id; an oracle tower with a twinkling
300
395
  aura (drifting z's while dormant), a radiant orb crown, two window eyes, a
@@ -572,7 +667,7 @@ flips its switches, and key rebinding lives in the file:
572
667
  "autoAsk": true,
573
668
  "issues": false,
574
669
  "mouse": true,
575
- "panels": { "scene": true, "conversation": true, "activity": true, "thinking": true },
670
+ "panels": { "animations": false, "conversation": true, "activity": true, "thinking": true },
576
671
  "keys": { "toggleThinking": "alt+t" }
577
672
  }
578
673
  ```
@@ -583,7 +678,9 @@ by itself when this session starts or resumes a task; `autoAsk` puts the
583
678
  panel's questions to you as soon as a round ends while the Plan tab is
584
679
  showing (otherwise `enter` on the empty prompt does); `issues` shows the
585
680
  GitHub Issues tab (off for now); `mouse` turns clicks and the wheel on;
586
- `panels` is which Lobby panes show (the pane keys update it); `keys` rebinds
681
+ `panels` is which Lobby panes show, with `animations: true` bringing the
682
+ animated oracle and agents into the lobby (off by default; the older
683
+ `scene` key is no longer read, and the pane keys update it); `keys` rebinds
587
684
  shortcuts by action name.
588
685
 
589
686
  `thinking` must be one of `off`, `minimal`, `low`, `medium`, `high`, `xhigh`,
@@ -634,6 +731,8 @@ and the output contract — and an empty layer is dropped.
634
731
  └── tasks/TASK-<stamp>/
635
732
  ├── state.json the task record (kept after completion)
636
733
  ├── comments.jsonl your lobby comments on the plan and their delivery (append-only)
734
+ ├── inbox.jsonl messages for the oracle from other sessions and their delivery (append-only)
735
+ ├── auto.json auto mode, when switched on for the task
637
736
  ├── proposal.md scratchpads: deleted on completion
638
737
  ├── plan.md
639
738
  ├── designer.md backend.md qa.md
@@ -682,8 +781,10 @@ src/
682
781
  ├── knowledge/ Paths, store (single write path), selector, compactor
683
782
  ├── prompts/ Layer loader + compiler
684
783
  ├── lobby/
685
- │ ├── runtime.ts Mounts the full-screen lobby on pi's TUI, dialogs hand-off, comment delivery, Master metrics
686
- │ ├── view.ts The tabbed view: tab bar, per-tab prompt, typing/browsing modes, search, help, mouse
784
+ │ ├── runtime.ts Mounts the full-screen lobby on pi's TUI, dialogs hand-off, background sessions, Master metrics
785
+ │ ├── view.ts The tabbed view: tab bar, per-tab prompt, typing/browsing modes, session switcher, search, help, mouse
786
+ │ ├── sessions.ts Background sessions: headless pi children driven over RPC, their feeds and questions
787
+ │ ├── session-files.ts Other sessions' conversations, read from their saved session files
687
788
  │ ├── keys.ts The shortcut table and its config overrides
688
789
  │ ├── ask.ts The panel's questions through the ask-user-question questionnaire (or pi's dialogs)
689
790
  │ ├── markdown.ts Markdown through pi's renderer, cached per theme and width
@@ -693,9 +794,9 @@ src/
693
794
  │ ├── planner.ts The planning panel: seats and the oracle per round, reply parsing, saving a plan
694
795
  │ ├── issues.ts GitHub issues through the gh CLI
695
796
  │ └── layout.ts Boxes, exact-width columns, wrapping, highlights, bars, meters and sparklines
696
- ├── state/ Project root, config, task persistence, state mutation, comments, backlog, metrics
797
+ ├── state/ Project root, config, task persistence, state mutation, comments, inbox, auto mode, backlog, metrics
697
798
  ├── schemas/ Task, agent, findings, configuration types
698
- └── pi/ Commands, lifecycle, orchestrate tool, status widget
799
+ └── pi/ Commands, lifecycle, orchestrate tool, status widget, the owner's clock (deliveries, auto mode)
699
800
  prompts/ global, master, designer, backend, qa, scout, worker, reviewer, researcher, quickfix, planner, panel
700
801
  ```
701
802
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a-t-h-i/bot-lobby",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Structured multi-agent software engineering orchestrator for Pi",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
package/prompts/panel.md CHANGED
@@ -16,10 +16,14 @@ questions and the user's answers, and the oracle's current draft plan.
16
16
  - Ask only what your seat owns (below), and only what would change how the
17
17
  task is built or verified. Never repeat a question that has been answered,
18
18
  or one another member already asked this round.
19
- - Ask at most two questions, the most important first. Make each specific and
20
- answerable, and give it two to four options the user can pick from, your
19
+ - Ask at most two questions, the most important first. They go to the
20
+ oracle, who picks at most four for the user each round across the whole
21
+ panel and decides the rest with your recommendation, so make each one
22
+ short, plain and specific, and give it two to four options, your
21
23
  recommendation first with `(Recommended)` after its label. The user can
22
24
  always type their own answer instead, so do not add an "Other" option.
25
+ - Read the draft's Assumptions: if one the oracle made for your seat is
26
+ wrong, say so under Notes and ask about it again.
23
27
  - If an answer from the user is vague or conflicts with what you see in the
24
28
  repository, say so and ask again.
25
29
  - Report what the plan must respect from your seat under Notes: facts from
@@ -3,9 +3,11 @@
3
3
  You are the oracle chairing a planning panel: you help the user turn an idea
4
4
  (or a GitHub issue) into a task plan that the team of agents can execute
5
5
  without guessing. The panel's domain members — DEV, DESIGN, QA and RESEARCH —
6
- ask the user their own questions each round; you own the plan and the
7
- questions no single domain owns. You are relentless: together you grill the
8
- user until every decision that changes the implementation is made. You never
6
+ bring you their questions each round, and you decide which ones reach the
7
+ user: you own the plan and the questions. You are thorough but you spare the
8
+ user: every decision that changes the implementation gets made, either by the
9
+ user or by you with the recommended option, written down as an assumption the
10
+ user can overrule. You never
9
11
  write code and never change files; you may read the repository to ask
10
12
  informed questions and to ground the plan in what exists.
11
13
 
@@ -17,16 +19,24 @@ and notes. Read the repository when it helps, then reply in the output format
17
19
  below.
18
20
 
19
21
  - Fold every member's notes and every answer into the draft plan, so each
20
- domain's decisions are written down where all agents will read them. When
21
- members disagree, say so and ask the user to decide.
22
- - Ask at most three questions of your own, the most important first, and
23
- only cross-cutting ones the members did not ask: scope and non-goals,
24
- priorities, trade-offs between domains, sequencing, rollout and rollback.
25
- Never repeat a member's question. Each one must be specific and answerable.
26
- - Give every question two to four options the user can pick from, your
27
- recommendation first with `(Recommended)` after its label. The user answers
28
- the panel's questions one at a time and can always type their own answer,
29
- so never add an "Other" option.
22
+ domain's decisions are written down where all agents will read them.
23
+ - Choose the round's questions: **at most four in all**, from the members'
24
+ questions and your own cross-cutting ones (scope and non-goals, priorities,
25
+ trade-offs between domains, sequencing, rollout). Merge duplicates, drop
26
+ what the repository or an earlier answer already settles, and keep only the
27
+ ones whose answer changes what gets built. Put the most important first and
28
+ start each with the seat it serves — `[DEV]`, `[DESIGN]`, `[QA]`,
29
+ `[RESEARCH]`, or `[ORACLE]` for your own. When members disagree, make that
30
+ one of the questions.
31
+ - Keep each question short and plain: one line the user can answer at a
32
+ glance. Give it two to four options — labels of one to five words and a
33
+ short clause on what each means — your recommendation first with
34
+ `(Recommended)` after its label. The user answers all of them together in
35
+ one dialog and can type their own answer, so never add an "Other" option.
36
+ - Decide every question you do not ask, and any the user leaves unanswered,
37
+ with its recommended option, and list those decisions under
38
+ `### Assumptions` in the plan, one line each, so the user can see and
39
+ overrule them.
30
40
  - Challenge answers that are vague, contradictory or risky, and ask again.
31
41
  Do not accept "whatever you think" for a decision with real trade-offs:
32
42
  propose one and ask the user to confirm it.
@@ -46,13 +56,14 @@ GRILLING or READY
46
56
  Three to six words naming the task.
47
57
 
48
58
  ## Questions
49
- 1. The most important open question?
59
+ 1. [DEV] The most important open question?
50
60
  - Short label (Recommended) — what choosing it means
51
61
  - Another label — what choosing it means
52
62
  2. …
53
63
 
54
- (Two to four options per question, labels of one to five words. Omit the
55
- Questions section when READY.)
64
+ (At most four questions, each tagged with its seat; two to four options per
65
+ question, labels of one to five words. Omit the Questions section when READY
66
+ or when you decided everything yourself.)
56
67
 
57
68
  ## Plan
58
69
  The current draft, in Markdown:
@@ -64,6 +75,8 @@ The current draft, in Markdown:
64
75
  (files, modules and domains: designer, backend, qa)
65
76
  ### Decisions by domain
66
77
  (what the user decided for DEV, DESIGN, QA and RESEARCH, one bullet each)
78
+ ### Assumptions
79
+ (what you decided without asking, each with its seat: "[QA] Test in evergreen browsers only")
67
80
  ### Steps
68
81
  1. …
69
82
  ### Risks and open points
@@ -348,7 +348,7 @@ export function parsePiStream(stdout: string): ParsedStream {
348
348
  * every child process, including test runners and scripts, where argv[1] is
349
349
  * not pi at all.
350
350
  */
351
- function resolvePiInvocation(args: string[]): { command: string; args: string[] } {
351
+ export function resolvePiInvocation(args: string[]): { command: string; args: string[] } {
352
352
  const launcher = process.argv[1];
353
353
  if (launcher && existsSync(launcher) && isPiLauncher(launcher)) {
354
354
  return { command: launcher, args };
package/src/index.ts CHANGED
@@ -3,16 +3,18 @@ import { registerCommands } from "./pi/commands.ts";
3
3
  import { registerLifecycle } from "./pi/events.ts";
4
4
  import { registerOrchestrateTool } from "./pi/tools.ts";
5
5
  import { onTransition } from "./state/task-state.ts";
6
- import { ping } from "./pi/notify.ts";
6
+ import { pingTransition } from "./pi/notify.ts";
7
7
  import { isSubagentProcess } from "./pi/quiet.ts";
8
8
  import { registerDeskClient } from "./desk/client-extension.ts";
9
9
  import { registerLobbyEvents } from "./lobby/runtime.ts";
10
+ import { registerOwner } from "./pi/owner.ts";
10
11
 
11
12
  export default function (pi: ExtensionAPI): void {
12
13
  registerLifecycle(pi, CONFIG_DIR_NAME);
13
14
  // After the lifecycle, so the lobby opens over a task the widget state already knows.
14
15
  registerLobbyEvents(pi, CONFIG_DIR_NAME);
15
- onTransition((task) => ping(task.state, task.title));
16
+ registerOwner(pi, CONFIG_DIR_NAME);
17
+ onTransition((task) => pingTransition(task));
16
18
  registerCommands(pi, CONFIG_DIR_NAME);
17
19
  registerOrchestrateTool(pi, CONFIG_DIR_NAME);
18
20
  // Parallel workers share files through the master's file desk.
package/src/lobby/feed.ts CHANGED
@@ -225,15 +225,19 @@ export function textOf(content: unknown): string {
225
225
  }
226
226
 
227
227
  /** The long kickoff message bot-lobby sends reads as a short note in the conversation. */
228
- export function chatText(role: "user" | "assistant", text: string): { role: ChatRole; text: string } | undefined {
228
+ export function chatText(role: "user" | "assistant", text: string): Array<{ role: ChatRole; text: string }> {
229
229
  const body = text.trim();
230
- if (!body) return undefined;
231
- if (role === "assistant") return { role: "oracle", text: body };
230
+ if (!body) return [];
231
+ if (role === "assistant") return [{ role: "oracle", text: body }];
232
+ // bot-lobby's kickoff: the task starting, then what the user asked for, in their words.
232
233
  const kickoff = /^A bot-lobby task is active: (\S+)\nTitle: (.*)/.exec(body);
233
- if (kickoff) return { role: "note", text: `task ${kickoff[1]} started — ${kickoff[2]}` };
234
+ if (kickoff) {
235
+ const request = /\nRequest: ([\s\S]*?)(?:\nState: |$)/.exec(body)?.[1]?.trim();
236
+ return [{ role: "note", text: `task started · ${kickoff[2]}` }, ...(request ? [{ role: "you" as const, text: request }] : [])];
237
+ }
234
238
  const comment = /^The user left (?:a comment|\d+ comments) on (the approved plan|the proposal) of (\S+) from the lobby:/.exec(body);
235
- if (comment) return { role: "note", text: `plan comment sent to the oracle for ${comment[2]}` };
236
- return { role: "you", text: body };
239
+ if (comment) return [{ role: "note", text: `your comment on ${comment[1]} went to the oracle` }];
240
+ return [{ role: "you", text: body }];
237
241
  }
238
242
 
239
243
  /** Session entries (`{ type: "message", message }`) as conversation entries, oldest first. */
@@ -244,10 +248,62 @@ export function chatFromEntries(entries: readonly unknown[], max = MAX_CHAT): Ar
244
248
  if (record?.type !== "message") continue;
245
249
  const role = record.message?.role;
246
250
  if (role !== "user" && role !== "assistant") continue;
247
- const line = chatText(role, textOf(record.message?.content));
248
- if (!line) continue;
249
251
  const at = record.timestamp ? Date.parse(record.timestamp) : undefined;
250
- chat.push({ ...line, ...(at !== undefined && Number.isFinite(at) ? { at } : {}) });
252
+ for (const line of chatText(role, textOf(record.message?.content))) chat.push({ ...line, ...(at !== undefined && Number.isFinite(at) ? { at } : {}) });
251
253
  }
252
254
  return chat.slice(-max);
253
255
  }
256
+
257
+ /** The parts of pi's agent events the lobby narrates; the same shape in process and over RPC. */
258
+ export interface AgentEventLike {
259
+ type: string;
260
+ toolName?: string;
261
+ args?: unknown;
262
+ toolCallId?: string;
263
+ isError?: boolean;
264
+ assistantMessageEvent?: { type: string; delta?: string; content?: string };
265
+ message?: { role?: string; content?: unknown; stopReason?: string; errorMessage?: string };
266
+ }
267
+
268
+ /**
269
+ * One of a Master's agent events into a feed: tool calls become plain-words
270
+ * activity, thinking goes to the thinking pane, the reply streams, and
271
+ * finished messages join the conversation (a failed turn says so there too).
272
+ */
273
+ export function narrateEvent(feed: LobbyFeed, event: AgentEventLike, describe: (toolName: string, args: unknown) => string): void {
274
+ switch (event.type) {
275
+ case "tool_execution_start":
276
+ feed.begin("MASTER", describe(event.toolName ?? "tool", event.args), event.toolCallId);
277
+ return;
278
+ case "tool_execution_end":
279
+ if (event.toolCallId) feed.end(event.toolCallId, event.isError === true);
280
+ return;
281
+ case "message_update": {
282
+ const update = event.assistantMessageEvent;
283
+ if (update?.type === "thinking_delta" && update.delta) feed.thinkDelta("MASTER", update.delta);
284
+ else if (update?.type === "thinking_end") feed.thinkEnd("MASTER", update.content);
285
+ else if (update?.type === "text_delta" && update.delta) feed.replyDelta(update.delta);
286
+ return;
287
+ }
288
+ case "message_end": {
289
+ const message = event.message ?? {};
290
+ if (message.role === "assistant") {
291
+ feed.replyEnd();
292
+ feed.thinkEnd("MASTER");
293
+ if (message.stopReason === "error") {
294
+ const error = (message.errorMessage ?? "the model call failed").split("\n")[0]!;
295
+ feed.say("note", `✗ the oracle's turn failed: ${error}`);
296
+ feed.log("MASTER", `turn failed — ${error}`, "error");
297
+ }
298
+ }
299
+ if (message.role !== "user" && message.role !== "assistant") return;
300
+ for (const line of chatText(message.role, textOf(message.content))) feed.say(line.role, line.text);
301
+ return;
302
+ }
303
+ case "agent_end":
304
+ feed.replyEnd();
305
+ return;
306
+ default:
307
+ return;
308
+ }
309
+ }
package/src/lobby/keys.ts CHANGED
@@ -11,9 +11,13 @@ export const LOBBY_ACTIONS = {
11
11
  help: { key: "alt+h", help: "show or hide these keys" },
12
12
  settings: { key: "alt+s", help: "bot-lobby settings: each agent's model and thinking, the lobby" },
13
13
  search: { key: "ctrl+f", help: "search the current tab" },
14
+ savePlan: { key: "ctrl+s", help: "save the plan being made in the Plan tab to the pending tasks" },
15
+ sessions: { key: "alt+o", help: "switch session: this window, background sessions, other terminals" },
16
+ newSession: { key: "alt+n", help: "start a task in a new session, named after it" },
17
+ toggleAuto: { key: "alt+g", help: "auto mode: the oracle drives the task to completion without asking" },
14
18
  nextTab: { key: "tab", help: "next tab" },
15
19
  prevTab: { key: "shift+tab", help: "previous tab" },
16
- toggleScene: { key: "alt+z", help: "show or hide the zen scene" },
20
+ toggleScene: { key: "alt+z", help: "show or hide the oracle and agent animations" },
17
21
  toggleConversation: { key: "alt+c", help: "show or hide the conversation" },
18
22
  toggleActivity: { key: "alt+a", help: "show or hide the activity log" },
19
23
  toggleThinking: { key: "alt+k", help: "show or hide thinking" },
@@ -20,15 +20,18 @@ export type LobbyColor =
20
20
  | "borderMuted"
21
21
  | "toolTitle"
22
22
  | "mdHeading"
23
- | "mdCode";
23
+ | "mdCode"
24
+ | "userMessageText";
24
25
 
25
26
  export interface LobbyTheme {
26
27
  fg(color: LobbyColor, text: string): string;
27
28
  bold(text: string): string;
28
29
  italic?(text: string): string;
29
- bg?(color: "selectedBg" | "searchMatchBg", text: string): string;
30
+ bg?(color: "selectedBg" | "searchMatchBg" | "userMessageBg", text: string): string;
30
31
  /** Render Markdown to styled lines; plain wrapping without it (tests). */
31
32
  markdown?(text: string, width: number): string[];
33
+ /** Strike text through (an abandoned task's title); plain without it (tests). */
34
+ strike?(text: string): string;
32
35
  }
33
36
 
34
37
  /** Paint only when a theme is present; tests without one get plain text. */
@@ -44,6 +47,18 @@ export function italic(theme: LobbyTheme | undefined, text: string): string {
44
47
  return theme?.italic && text ? theme.italic(text) : text;
45
48
  }
46
49
 
50
+ export function strike(theme: LobbyTheme | undefined, text: string): string {
51
+ return theme?.strike && text ? theme.strike(text) : text;
52
+ }
53
+
54
+ /** `left` and `right` on one line of exactly `width` columns: the left side gives way first. */
55
+ export function spread(left: string, right: string, width: number): string {
56
+ if (!right) return fit(left, width);
57
+ const room = width - visibleWidth(right) - 1;
58
+ if (room < 4) return fit(left, width);
59
+ return `${fit(left, room)} ${right}`;
60
+ }
61
+
47
62
  /** Exactly `width` columns: truncated with an ellipsis, or padded with spaces. */
48
63
  export function fit(text: string, width: number): string {
49
64
  if (width <= 0) return "";