Merge "idle" into "waiting"

"Idle" was set by SessionStart and by nothing else, and there was no path
back into it. So it never meant "sitting unused" -- it meant "opened and
never asked anything yet", a state a few seconds long that you would
almost never catch. Meanwhile a session that finished an hour ago and was
forgotten showed as waiting, which is correct but leaves the fourth state
with nothing to describe.

A session that has just opened is waiting for your first prompt exactly
as one that finished a turn is waiting for your next. They are the same
thing, and now they are the same state. Three glyphs instead of four,
which also gives the remaining three more room to be told apart in a
monochrome panel.

Files written by the previous hook still say "idle", and a session open
across the upgrade must not disappear, so unrecognised states now read as
waiting rather than being treated as unknown. Covered by a test that
feeds an "idle" file to the store and asserts it comes back as waiting,
sorted by age among the others.

The "hide when nothing is running" setting goes with it. Its condition
was "no sessions, or all of them idle"; with idle gone the second half is
unreachable and the first was already unconditional, so the switch could
no longer change anything. A control that does nothing is worse than no
control.

The compaction test also got stronger in passing: it now checks that a
mid-turn SessionStart leaves a *busy* session alone, which is the case
that matters. It used to assert from waiting, where the state it was
guarding against happened to be the state already stored.
This commit is contained in:
av
2026-08-09 19:14:34 +03:00
parent 839c6f6b52
commit 626c2b6d2c
10 changed files with 48 additions and 41 deletions
+11 -5
View File
@@ -10,12 +10,12 @@ Code ждёт меня прямо сейчас?**
имя проекта:
```
◉ ds ● dc ● ds2 ○ pps umb 9:41
│ │ │ │ └ umbar, тихо
◉ ds ● dc ● ds2 ○ pps umb 9:41
│ │ │ │ └ umbar, работает
│ │ │ └ pet-project-server, работает
│ │ └ вторая сессия в dev-skills, ждёт
│ └ dev-conventions, ждёт
└ dev-skills, упёрлась в разрешение
└ dev-skills, спрашивает
```
## Состояния
@@ -25,12 +25,18 @@ Code ждёт меня прямо сейчас?**
| диск в кольце | `blocked` | спрашивает — разрешение или вопрос с вариантами; строка ввода занята |
| закрашенный диск | `waiting` | ход закончен, строка ввода свободна |
| кольцо | `busy` | работает |
| тусклое пунктирное кольцо | `idle` | запущена, но ничего не просили |
`blocked` и `waiting` разведены намеренно. Слитые в одно «требует внимания»,
законченная задача выглядит так же срочно, как заблокированная, — а именно это
различие и решает, переключаться сейчас или после текущей мысли.
Состояний ровно три. Четвёртое, «тихо», было и убрано: оно ставилось только
событием `SessionStart` и в него не было возврата, так что означало не «давно
без дела», а «сессию открыли и ещё ни разу ничего не спросили» — состояние
длиной в несколько секунд, занимавшее форму в панели. Свежая сессия ждёт
первого промпта ровно так же, как доделавшая ход ждёт следующего, и теперь обе
называются `waiting`.
Дальше этого деление не идёт, и не по лени: запрос разрешения и вопрос с
вариантами приходят под одним и тем же `notification_type`, с одинаковым родовым
текстом `«Claude needs your permission»`. Различить их можно было бы только через
@@ -112,7 +118,7 @@ gnome-extensions enable claude-code-status@git.vakhrushev.me
| Хук | Действие |
|---|---|
| `SessionStart` | сессия появляется как `idle`, мёртвые подчищаются |
| `SessionStart` | сессия появляется как `waiting`, мёртвые подчищаются |
| `UserPromptSubmit` | `busy` |
| `PostToolUse` | `busy` |
| `PreCompact` | `busy` |