From 178d0af82bb190f05ef950755d9f40bb08b7eaf8 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(