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. */