From b8c44502cb5ebbc0066276e424c3ab1f5ec03c64 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Sun, 22 Nov 2026 01:53:04 +0100 Subject: [PATCH] feat(web/claw): fold the other keys to a working count The task: and calendar: keys sat in the sidebar at full height all the time, a block of rows most of them idle. The group folds now: by default it shows one line, the count of other sessions holding a lease (the same `leased` state the status dot paints green) beside a more button, and the button unfolds every row and becomes less. The count stays visible unfolded, so the header does not jump when it toggles. The count is gray at zero and takes the ok color only when something runs. The Sessions header still counts folded rows, and the fold state is in-memory like the rest of the page: a reload folds again. --- web/claw/app/components/SessionsSidebar.vue | 107 +++++++++++++++----- 1 file changed, 84 insertions(+), 23 deletions(-) diff --git a/web/claw/app/components/SessionsSidebar.vue b/web/claw/app/components/SessionsSidebar.vue index 1602234..780f70e 100644 --- a/web/claw/app/components/SessionsSidebar.vue +++ b/web/claw/app/components/SessionsSidebar.vue @@ -7,6 +7,10 @@ // new key lands in the inventory. The delete button asks nothing itself // — the confirmation, which names the transcript that goes with the // session, is the shell's. +// +// The non-interactive keys fold under *others*: folded (the default), +// the group shows only how many of them hold a lease, plus the +// more/less toggle; unfolded it lists every row. import { SESSION_NAME_PATTERN, isResidentKey } from '~/composables/useClaw' import type { ClawSession } from '~/composables/useClaw' @@ -28,6 +32,10 @@ const emit = defineEmits<{ interface Group { label: string rows: { key: string; name: string; session: ClawSession }[] + /** How many rows hold a lease; the others' header shows the count. */ + working: number + /** Whether the rows fold away until the toggle says otherwise. */ + collapsible: boolean } const groups = computed(() => { @@ -52,13 +60,29 @@ const groups = computed(() => { name: session.key.replace(/^interactive:/, ''), session, }) + const working = (sessions: ClawSession[]) => + sessions.filter((session) => session.state === 'leased').length const groups: Group[] = [] if (interactive.length > 0) - groups.push({ label: 'interactive', rows: interactive.map(row) }) - if (others.length > 0) groups.push({ label: 'other keys', rows: others.map(row) }) + groups.push({ + label: 'interactive', + rows: interactive.map(row), + working: working(interactive), + collapsible: false, + }) + if (others.length > 0) + groups.push({ + label: 'others', + rows: others.map(row), + working: working(others), + collapsible: true, + }) return groups }) +/** Whether the others group is folded out; it starts folded. */ +const othersOpen = ref(false) + const shownCount = computed(() => groups.value.reduce((total, group) => total + group.rows.length, 0), ) @@ -159,30 +183,45 @@ watch(

- {{ group.label }} -
- +
+ {{ group.label }} + + {{ group.working }} working +
+
@@ -287,10 +326,32 @@ watch( margin-bottom: 14px; } -.group .label { +.group-head { + display: flex; + align-items: center; + gap: 8px; padding: 0 8px 4px; } +.group-head .working { + flex: 1; + min-width: 0; + text-align: right; + font-family: var(--mono); + font-size: 11px; + color: var(--text3); +} + +.group-head .working.live { + color: var(--ok); +} + +.group-head .toggle { + flex: none; + padding: 0 6px; + font-size: 11px; +} + /* The row owns the hover and active surface: the select button fills it and the delete button sits beside it, so neither has to nest in the other. */