diff --git a/changelog.d/added-tracker-hive-note-tuck.md b/changelog.d/added-tracker-hive-note-tuck.md new file mode 100644 index 0000000000..4faf882c95 --- /dev/null +++ b/changelog.d/added-tracker-hive-note-tuck.md @@ -0,0 +1 @@ +- Activity Monitor: a row's "Hive: …" note shows for 30 s when it is new, then slides left into a small ⬡ info icon so the list stays quiet; the icon's tooltip keeps the note and its age, a click (or Enter / Space) opens it for another 30 s, a hidden tab pauses the clock, and ⚙ → Hive notes → *Auto-collapse hive notes* (default on) turns it off. diff --git a/src/docs/dashboard-copy-inventory.md b/src/docs/dashboard-copy-inventory.md index 6ec7793fdc..30a51fe39e 100644 --- a/src/docs/dashboard-copy-inventory.md +++ b/src/docs/dashboard-copy-inventory.md @@ -143,3 +143,11 @@ Left for a follow-up under the same issue: the ⋯ decision consequences and `api_repo_item_decision.go`, `row_action_result.go`, `delegated_decision_human_merge.go`) and `STAGE_TRACKER_MERGE_PATH_WORDS.sweep` (*automerge sweep* as a merge **path** name on merged rows). + +## Hive notes, show then tuck + +| Builder | Reaches | Words | Held by | +|---|---|---:|---| +| `stageTrackerEventHtml` with auto-collapse on (`tracker-motion.js`) | the row's event line, open for 30 s then tucked into a ⬡-i button | the line itself unchanged; the button adds `aria-label` *Hive note* (2) | `TestStageTrackerNoteTuckNode` | +| `stageTrackerNoteTitle` | the button's tooltip | the line and its age: *Hive: moved to CI / Review · 2m ago* (≤ line + 3) | same | +| `stageTrackerNoteTuckSectionHtml` (`tracker-sound.js`) | ⚙ → Hive notes | title (2), hint (≈ 70), *Auto-collapse hive notes (default on)* (5) | `TestStageTrackerNoteTuckWiring` | diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 0afdfcde94..aa69b06fd3 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -1105,7 +1105,7 @@ A still chevron means **waiting**; its tooltip already says where it stands and **Event line** — one short plain sentence under the strip about the latest thing that happened to the row, from the difference between two tracker payloads (the poll / SSE refetch the tracker already makes; no extra requests): *Hive: moved to CI / Review · 12s ago*, *Hive: fell back to Claimed — a reviewer requested changes* (a lower stage number reads as a fall only when the stage table's `falls_to` — the stage engine's regression rule — says so; triage accepted 015 → 010, a decision made 085 → 080 or the author resuming 072 → 070 read *moved to*), *Hive: waiting on a person*, *Hive: hold released*, *You: approved*. -It lives two minutes, dims for its last third, and a row carries only its latest line. **Set back** — a row wearing `regressed` colours the line's lead red. **Merged** — see *Merged (the chip, the ledger, the flight)* below. The CSS class names are shared so the sibling Activity Monitor PRs (needs-human options, decision trail) compose on them: `cue-working`, `cue-acting`, `cue-event`, `cue-setback`, `cue-merged`, `cue-decision` (badge, sibling PR), `cue-spin` (the one spin keyframe), `cue-flight` / `ham-merged-count` (the glyph and the Merged chip); the colour tokens `--cue-state`, `--cue-work`, `--cue-decision` on `.ham-row` are declared in the *Cue tokens* paragraph under [Let hive decide](#let-hive-decide) below. +A row carries only its latest line. **Show, then tuck** (owner, 2026-10-29: "show the hive comments when they are new for 30s. then they should shrink to the left inside a hive-info icon … someone can click on the icon to expand the info for another 30s. then it shrinks back again"): the line opens for 30 s (`STAGE_TRACKER_CAPTION_SHOW_MS`) from the moment it is written, then the text slides a few pixels left and fades (≈400 ms ease-in-out, a wipe from the right) into a small ⬡-i button (`.cue-event-ico`, `aria-label="Hive note"`) sitting where *Hive:* sat; the line keeps one fixed height so the chevrons above never shift. The button's tooltip holds the whole note and its age (*Hive: moved to CI / Review · 2m ago*) and is the only thing hover does; a click (or Enter / Space) re-opens the line for another 30 s, a click while it is open tucks it at once (`aria-expanded` follows). Each row has its own window but one shared timer fires the next tuck; a hidden tab freezes every open window and gives the hidden time back on return, so a note is never spent unseen. Tucked notes stay with the row until a newer line replaces them or the row leaves the payload (no 2-minute expiry). Lines only arise from payload differences, so a freshly loaded page starts with no notes rather than a wall of open ones. Under `prefers-reduced-motion: reduce` the toggle is instant. ⚙ → **Hive notes** → **Auto-collapse hive notes** (default on, `hive.tracker.notetuck`) turns this off: the line then stays open, lives two minutes and dims for its last third as before, with no button. **Set back** — a row wearing `regressed` colours the line's lead red. **Merged** — see *Merged (the chip, the ledger, the flight)* below. The CSS class names are shared so the sibling Activity Monitor PRs (needs-human options, decision trail) compose on them: `cue-working`, `cue-acting`, `cue-event`, `cue-setback`, `cue-merged`, `cue-decision` (badge, sibling PR), `cue-spin` (the one spin keyframe), `cue-flight` / `ham-merged-count` (the glyph and the Merged chip); the colour tokens `--cue-state`, `--cue-work`, `--cue-decision` on `.ham-row` are declared in the *Cue tokens* paragraph under [Let hive decide](#let-hive-decide) below. Legend, in the operator's words: **working** (icon turns), **waiting on X** (still; tooltip names X), **set back by Y** (red lead on the event line), **merged** (✓ glows, a bee rises to the Merged chip or off the top of the screen). Under `prefers-reduced-motion: reduce` every cue animation stops; the words stay. diff --git a/src/pkg/dashboard/stage_tracker_note_tuck_test.go b/src/pkg/dashboard/stage_tracker_note_tuck_test.go new file mode 100644 index 0000000000..70158f138d --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_note_tuck_test.go @@ -0,0 +1,199 @@ +package dashboard + +import ( + "strings" + "testing" +) + +// The hive note under a row's chevrons shows for 30 s when it is new, then +// tucks into a ⬡-i icon; a click re-opens it for another 30 s (owner, +// 2026-10-29). These tests lift the pure pieces and the in-place sync and +// drive them against a fake clock + DOM. + +func stageTrackerNoteTuckJS(t *testing.T, html string) string { + t.Helper() + return strings.Join([]string{ + "function esc(s) { if (typeof s !== 'string') return ''; return s.replace(/&/g, '&').replace(/ clock; +let timers = []; let timerSeq = 0; +global.setTimeout = (fn, ms) => { const id = ++timerSeq; timers.push({ id, at: clock + (ms || 0), fn }); return id; }; +global.clearTimeout = id => { timers = timers.filter(x => x.id !== id); }; +function tick(ms) { const until = clock + ms; while (true) { const due = timers.filter(x => x.at <= until).sort((a, b) => a.at - b.at)[0]; if (!due) break; timers = timers.filter(x => x !== due); clock = Math.max(clock, due.at); due.fn(); } clock = until; } +const store = {}; global.localStorage = { getItem: k => (k in store ? store[k] : null), setItem(k, v) { store[k] = String(v); } }; +function el(cls, attrs) { + const e = { className: cls || '', title: '', attrs: Object.assign({}, attrs || {}), children: [], + classList: { add(c) { if (!e.className.split(' ').includes(c)) e.className = (e.className + ' ' + c).trim(); }, remove(c) { e.className = e.className.split(' ').filter(x => x && x !== c).join(' '); }, contains(c) { return e.className.split(' ').includes(c); } }, + getAttribute(k) { return k in e.attrs ? e.attrs[k] : null; }, setAttribute(k, v) { e.attrs[k] = String(v); }, + querySelector(sel) { return e.querySelectorAll(sel)[0] || null; }, + querySelectorAll(sel) { const out = []; const walk = n => { for (const c of n.children) { if (sel === '.cue-event[data-cue-key]' ? (c.classList.contains('cue-event') && c.attrs['data-cue-key'] != null) : c.classList.contains(sel.slice(1))) out.push(c); walk(c); } }; walk(e); return out; } }; + return e; +} +const panel = el('panel'); +global.document = { hidden: false, getElementById(id) { return id === 'activity-monitor-panel' ? panel : null; } }; +// Build a line element from the rendered HTML, as the page's reconcile would. +function mount(key) { + const html = stageTrackerEventHtml(key, { events: _stageTrackerEvents, nowMs: Date.now() }); + const p = el((html.match(/^

p.classList.contains('cue-event-tucked'); +` + +func TestStageTrackerNoteTuckNode(t *testing.T) { + html := indexHTML(t) + runStageTrackerRowActionsScript(t, stageTrackerNoteTuckJS(t, html)+stageTrackerNoteTuckFixture+` +assert.strictEqual(STAGE_TRACKER_CAPTION_SHOW_MS, 30000); +assert.strictEqual(stageTrackerNoteTuckSetting(), true, 'default on'); + +// A new line: open, with the ⬡-i button carrying the whole note as its tooltip. +stageTrackerNoteOwnerEvent('k', 'approved', Date.now()); +let html = stageTrackerEventHtml('k', { events: _stageTrackerEvents, nowMs: Date.now() }); +assert.ok(html.startsWith('

`; + return `

${ico}${body}

`; } const STAGE_TRACKER_CUE_TICK_MS = 15000; function stageTrackerCueAgeSync(el, nowMs) { @@ -173,6 +306,7 @@ if (n.textContent !== t) n.textContent = t; } if (typeof stageTrackerGateCountdownSync === 'function') stageTrackerGateCountdownSync(el, nowMs); + if (typeof stageTrackerNoteSync === 'function') stageTrackerNoteSync(el, nowMs); } let _stageTrackerCueTimer = null; function stageTrackerCueTick() { @@ -476,8 +610,10 @@ // -- keyed row reconcile --------------------------------------------- // Pure: a row's source with the one-render move stamp removed, so the // render after a move sees the same row and keeps its (animating) node. + // The hive note's open / tucked state is applied in place + // (stageTrackerNoteSync), so it is not a reason to swap the node either. function stageTrackerRowSrcKey(html) { - return String(html || '').replace(/ data-ham-prev-col="\d+" data-ham-col="\d+"/g, ''); + return String(html || '').replace(/ data-ham-prev-col="\d+" data-ham-col="\d+"/g, '').replace(/ cue-event-tucked"/g, '"').replace(/ aria-expanded="(?:true|false)"/g, '').replace(/ title="(?:You|Hive): [^"]*" data-action="stageTrackerNoteToggle"/g, ' data-action="stageTrackerNoteToggle"'); } // Pure: whether the stamped move attributes name this strip. function stageTrackerRowHasMove(html) { return / data-ham-prev-col="\d+"/.test(String(html || '')); } diff --git a/src/pkg/dashboard/static-src/js/tracker-sound.js b/src/pkg/dashboard/static-src/js/tracker-sound.js index d6bdff67cc..66953db747 100644 --- a/src/pkg/dashboard/static-src/js/tracker-sound.js +++ b/src/pkg/dashboard/static-src/js/tracker-sound.js @@ -402,6 +402,7 @@ + stageTrackerRepoSectionHtml(state.repoChip, state.group) + stageTrackerConfirmSectionHtml(state.skippedConfirms) + stageTrackerCelebrateSectionHtml(state.celebrate !== false, state.celebrateGlyph) + + stageTrackerNoteTuckSectionHtml(state.noteTuck !== false) + stageTrackerMotionSectionHtml(state.motion, state.stages || []); } // Pure: the Merges section — the "Celebrate merges" toggle, the glyph. @@ -415,6 +416,14 @@ `; } function stageTrackerCelebrateChange(checked) { stageTrackerSetCelebrate(!!checked); } + // Pure: the "Hive notes" section — the auto-collapse toggle. + function stageTrackerNoteTuckSectionHtml(on) { + return `
+
Hive notes
+

The "Hive: …" line under a row's chevrons shows for ${Math.round(STAGE_TRACKER_CAPTION_SHOW_MS / 1000)} s when it is new, then slides left into a small ⬡ icon so the list stays quiet; the icon's tooltip keeps the whole note and its age, and a click (or Enter / Space) opens it for another ${Math.round(STAGE_TRACKER_CAPTION_SHOW_MS / 1000)} s. A hidden tab pauses the clock. Off, the line stays open and fades out after two minutes as before.

+
+
`; + } function stageTrackerCelebrateGlyphChange(v) { stageTrackerSetCelebrateGlyph(v); } // Pure: the first row whose box is inside the viewport (top edge in // view is enough), else the first row at all — so the test plays @@ -473,7 +482,7 @@ if (!body) return; const names = {}; for (const kind of Object.keys(STAGE_TRACKER_SOUND_KINDS)) names[kind] = stageTrackerClipStatusText(kind); - setIfChanged(body, stageTrackerSettingsHtml({ on: _stageTrackerSoundOn, volume: _stageTrackerVolume, clips: _stageTrackerClips, names, motion: stageTrackerMotionSetting(), stages: (_stageTracker && _stageTracker.stages) || [], celebrate: stageTrackerCelebrateSetting(), celebrateGlyph: stageTrackerCelebrateGlyphId((() => { try { return localStorage.getItem(STAGE_TRACKER_CELEBRATE_GLYPH_KEY); } catch { return null; } })()), skippedConfirms: stageTrackerSkippedConfirms(), repoChip: stageTrackerRepoChipSetting(), group: _stageTrackerGroup })); + setIfChanged(body, stageTrackerSettingsHtml({ on: _stageTrackerSoundOn, volume: _stageTrackerVolume, clips: _stageTrackerClips, names, motion: stageTrackerMotionSetting(), stages: (_stageTracker && _stageTracker.stages) || [], celebrate: stageTrackerCelebrateSetting(), noteTuck: stageTrackerNoteTuckSetting(), celebrateGlyph: stageTrackerCelebrateGlyphId((() => { try { return localStorage.getItem(STAGE_TRACKER_CELEBRATE_GLYPH_KEY); } catch { return null; } })()), skippedConfirms: stageTrackerSkippedConfirms(), repoChip: stageTrackerRepoChipSetting(), group: _stageTrackerGroup })); const rm = document.getElementById('sts-rm-preview'); if (rm) rm.checked = document.body.classList.contains('ham-rm-preview'); } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 8e805c0719..85c89992eb 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1752,6 +1752,24 @@ .cue-event.cue-event-fading { opacity: 0.55; } .cue-setback .cue-event-who { color: var(--status-error); } .cue-merged .cue-event-who { color: var(--green); } + /* Hive note, show then tuck: with auto-collapse on the line is + [icon][body]; tucking wipes the body away from its right edge + (clip-path) while the text slides a few px left and fades, so it + reads as sliding into the ⬡-i icon. The line keeps one fixed height + either way so the chevrons above never shift. The icon is the only + click target; hover shows its tooltip (the whole note and its age). + Reduced motion: an instant toggle. */ + .cue-event.cue-event-tuckable { display: flex; align-items: center; gap: 0; height: 1.6em; line-height: 1.6em; overflow: hidden; } + .cue-event-ico { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 1.6em; height: 1.6em; margin: 0 var(--sp-1) 0 0; padding: 0; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); cursor: pointer; transition: color 200ms ease-in-out, background 200ms ease-in-out; } + .cue-event-ico:hover, .cue-event-ico:focus-visible { color: var(--text); background: color-mix(in srgb, var(--text) 10%, transparent); } + .cue-event-ico:focus-visible { outline: var(--focus-ring-width) solid var(--accent); outline-offset: 1px; } + .cue-event-ico-svg { width: 1em; height: 1em; } + .cue-event-tucked .cue-event-ico { color: var(--text); } + .cue-event-body { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; opacity: 1; transform: none; clip-path: inset(0 0 0 0); transition: clip-path 400ms ease-in-out, opacity 350ms ease-in-out, transform 400ms ease-in-out; } + .cue-event-tucked .cue-event-body { opacity: 0; transform: translateX(-8px); clip-path: inset(0 100% 0 0); pointer-events: none; } + .cue-event-tuckable .cue-event-who { margin-right: var(--sp-1); } + @media (prefers-reduced-motion: reduce) { .cue-event-body, .cue-event-ico { transition: none; } } + .ham-rm-preview .cue-event-body { transition: none; } @keyframes cue-acting-stripes { to { background-position: 34px 0; } } @keyframes cue-event-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } } /* Merged: the row is pinned for a moment, its ✓ cell glows, a small @@ -17172,9 +17190,13 @@

Where to get help

let _stageTrackerEvents = {}; // Pure: the events map after payload d at nowMs — new lines for what // changed, expired lines gone. - function stageTrackerEventsNext(events, prevStates, nextStates, stages, nowMs) { + // ttlMs (default STAGE_TRACKER_EVENT_MS) is how long a line lives + // untouched; Infinity (auto-collapse on) keeps it, tucked into its icon, + // until a newer line replaces it or its row leaves the payload. + function stageTrackerEventsNext(events, prevStates, nextStates, stages, nowMs, ttlMs) { + const ttl = typeof ttlMs === 'number' ? ttlMs : STAGE_TRACKER_EVENT_MS; const out = {}; - for (const k of Object.keys(events || {})) if (nowMs - events[k].at < STAGE_TRACKER_EVENT_MS) out[k] = events[k]; + for (const k of Object.keys(events || {})) if (nowMs - events[k].at < ttl && (!prevStates || ttl !== Infinity || nextStates[k])) out[k] = events[k]; if (!prevStates) return out; for (const k of Object.keys(nextStates)) { const text = stageTrackerEventText(prevStates[k], nextStates[k], stages); @@ -17185,9 +17207,128 @@

Where to get help

function stageTrackerNoteEvents(d, nowMs) { nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); const next = stageTrackerStateMap(d && d.items); - _stageTrackerEvents = stageTrackerEventsNext(_stageTrackerEvents, _stageTrackerStates, next, d && d.stages, nowMs); + const ttl = typeof stageTrackerNoteTuckSetting === 'function' && stageTrackerNoteTuckSetting() ? Infinity : STAGE_TRACKER_EVENT_MS; + _stageTrackerEvents = stageTrackerEventsNext(_stageTrackerEvents, _stageTrackerStates, next, d && d.stages, nowMs, ttl); _stageTrackerStates = next; } + /* ---- Hive notes: show, then tuck --------------------------------------- + Owner (2026-10-29): "show the hive comments when they are new for + 30s. then they should shrink to the left inside a hive-info icon. + someone can click on the icon to expand the info for another 30s. + then it shrinks back again." A line opens for + STAGE_TRACKER_CAPTION_SHOW_MS from the moment it is written (or + re-opened by a click), then tucks: the text slides leftward into the + ⬡-i icon that sits where "Hive:" sat; the icon's tooltip keeps the + whole line and its age. Click / Enter / Space on the icon re-opens it + for another window, or tucks it at once while open. Hover never + opens it. One shared timer (never one per row) fires the next tuck; + a hidden tab pauses every open window (stageTrackerNoteShift) so a + line is not spent unseen. The tucked state lives in the events map + and is applied in place; stageTrackerRowSrcKey ignores it so a tuck + never swaps the row's node mid-slide. The ⚙ → Hive notes toggle + ("Auto-collapse hive notes", default on) turns this off and the + line keeps the old 2-minute fade instead. */ + const STAGE_TRACKER_CAPTION_SHOW_MS = 30000; + const STAGE_TRACKER_NOTE_TUCK_KEY = 'hive.tracker.notetuck'; + const STAGE_TRACKER_NOTE_LABEL = 'Hive note'; + const STAGE_TRACKER_NOTE_ICON = ''; + function stageTrackerNoteTuckSetting() { + try { return localStorage.getItem(STAGE_TRACKER_NOTE_TUCK_KEY) !== '0'; } catch { return true; } + } + function stageTrackerSetNoteTuck(on) { + try { localStorage.setItem(STAGE_TRACKER_NOTE_TUCK_KEY, on ? '1' : '0'); } catch {} + if (typeof renderStageTracker === 'function') renderStageTracker(); + } + function stageTrackerNoteTuckChange(checked) { stageTrackerSetNoteTuck(!!checked); } + // Pure: whether the line is open (text showing) at nowMs. auto=false + // (toggle off) keeps every line open. + function stageTrackerNoteOpen(ev, nowMs, auto) { + if (!ev) return false; + if (auto === false) return true; + if (ev.tucked) return false; + return nowMs - (typeof ev.openAt === 'number' ? ev.openAt : ev.at) < STAGE_TRACKER_CAPTION_SHOW_MS; + } + // Pure: the event after a click at nowMs — tucked at once while open, + // re-opened for another window while tucked. + function stageTrackerNoteToggled(ev, nowMs, auto) { + if (!ev) return ev; + if (stageTrackerNoteOpen(ev, nowMs, auto)) return Object.assign({}, ev, { tucked: true }); + return Object.assign({}, ev, { tucked: false, openAt: nowMs }); + } + // Pure: ms until the next open line tucks; Infinity when none is open. + function stageTrackerNoteNextDue(events, nowMs, auto) { + let due = Infinity; + if (auto === false) return due; + for (const k of Object.keys(events || {})) { + const ev = events[k]; + if (!stageTrackerNoteOpen(ev, nowMs, auto)) continue; + due = Math.min(due, (typeof ev.openAt === 'number' ? ev.openAt : ev.at) + STAGE_TRACKER_CAPTION_SHOW_MS - nowMs); + } + return Math.max(0, due); + } + // Pure: every open window moved later by byMs (the time the tab was + // hidden); the age ("· 26s ago") keeps counting wall-clock time. + function stageTrackerNoteShift(events, byMs) { + const out = {}; + for (const k of Object.keys(events || {})) { + const ev = events[k]; + out[k] = ev && !ev.tucked ? Object.assign({}, ev, { openAt: (typeof ev.openAt === 'number' ? ev.openAt : ev.at) + byMs }) : ev; + } + return out; + } + // Pure: the icon's tooltip — the whole line and its age. + function stageTrackerNoteTitle(ev, nowMs) { + if (!ev) return ''; + const age = stageTrackerAgoText(ev.at, nowMs); + return (ev.who === 'you' ? 'You' : 'Hive') + ': ' + ev.text + (age ? ' · ' + age : ''); + } + let _stageTrackerNoteTimer = 0; + let _stageTrackerNoteHiddenAt = 0; + // Apply the open / tucked state to every line in place and arm the one + // shared timer for the next tuck. + function stageTrackerNoteSync(el, nowMs) { + if (!el || typeof el.querySelectorAll !== 'function') return; + nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); + const auto = stageTrackerNoteTuckSetting(); + // While the tab is hidden the open windows are frozen at the moment + // it went hidden (the age keeps counting). + const openNow = _stageTrackerNoteHiddenAt || nowMs; + for (const p of Array.from(el.querySelectorAll('.cue-event[data-cue-key]'))) { + const ev = _stageTrackerEvents[p.getAttribute('data-cue-key')]; + const open = !ev || stageTrackerNoteOpen(ev, openNow, auto); + if (open) p.classList.remove('cue-event-tucked'); else p.classList.add('cue-event-tucked'); + const btn = p.querySelector('.cue-event-ico'); + if (btn) { btn.setAttribute('aria-expanded', open ? 'true' : 'false'); const t = stageTrackerNoteTitle(ev, nowMs); if (btn.title !== t) btn.title = t; } + } + stageTrackerNoteSchedule(nowMs); + } + function stageTrackerNoteSchedule(nowMs) { + if (_stageTrackerNoteTimer) { clearTimeout(_stageTrackerNoteTimer); _stageTrackerNoteTimer = 0; } + if (document.hidden) return; + const due = stageTrackerNoteNextDue(_stageTrackerEvents, nowMs, stageTrackerNoteTuckSetting()); + if (due === Infinity) return; + _stageTrackerNoteTimer = setTimeout(() => { _stageTrackerNoteTimer = 0; stageTrackerNoteSync(document.getElementById('activity-monitor-panel'), Date.now()); }, due); + } + // The icon's click (and Enter / Space, it is a button). + function stageTrackerNoteToggle(key) { + const ev = _stageTrackerEvents[key]; + if (!ev) return; + const nowMs = Date.now(); + _stageTrackerEvents[key] = stageTrackerNoteToggled(ev, nowMs, stageTrackerNoteTuckSetting()); + stageTrackerNoteSync(document.getElementById('activity-monitor-panel'), nowMs); + } + // Hidden tab: stop the clock on every open line; visible again: give + // back the hidden time and re-arm. + function stageTrackerNoteVisibility(hidden, nowMs) { + nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); + if (hidden) { + _stageTrackerNoteHiddenAt = nowMs; + if (_stageTrackerNoteTimer) { clearTimeout(_stageTrackerNoteTimer); _stageTrackerNoteTimer = 0; } + return; + } + if (_stageTrackerNoteHiddenAt) { _stageTrackerEvents = stageTrackerNoteShift(_stageTrackerEvents, nowMs - _stageTrackerNoteHiddenAt); _stageTrackerNoteHiddenAt = 0; } + stageTrackerNoteSync(document.getElementById('activity-monitor-panel'), nowMs); + } // The owner's own action writes the row's line at once ("you: approved"). function stageTrackerNoteOwnerEvent(key, text, nowMs) { if (!key || !text) return; @@ -17195,12 +17336,22 @@

Where to get help

} // Pure: the event line markup; the age is filled in place by // stageTrackerCueAgeSync so a ticking clock never re-renders the row. + // With auto-collapse (ctx.noteTuck, else the setting) the line carries + // its ⬡-i button and the tucked class for its state at nowMs, so a + // fresh node arrives already tucked; stageTrackerNoteSync keeps the + // state and the button's tooltip current in place. function stageTrackerEventHtml(key, ctx) { const ev = ctx && ctx.events ? ctx.events[key] : null; if (!ev) return ''; const nowMs = ctx && typeof ctx.nowMs === 'number' ? ctx.nowMs : Date.now(); - const fading = nowMs - ev.at > STAGE_TRACKER_EVENT_MS * 2 / 3; - return `

${esc(ev.who === 'you' ? 'You' : 'Hive')}: ${esc(ev.text)}

`; + const auto = ctx && typeof ctx.noteTuck === 'boolean' ? ctx.noteTuck : (typeof stageTrackerNoteTuckSetting === 'function' && stageTrackerNoteTuckSetting()); + const fading = !auto && nowMs - ev.at > STAGE_TRACKER_EVENT_MS * 2 / 3; + const open = !auto || stageTrackerNoteOpen(ev, nowMs, auto); + const who = ev.who === 'you' ? 'You' : 'Hive'; + const body = `${esc(who)}: ${esc(ev.text)} `; + if (!auto) return `

${body}

`; + const ico = ``; + return `

${ico}${body}

`; } const STAGE_TRACKER_CUE_TICK_MS = 15000; function stageTrackerCueAgeSync(el, nowMs) { @@ -17211,6 +17362,7 @@

Where to get help

if (n.textContent !== t) n.textContent = t; } if (typeof stageTrackerGateCountdownSync === 'function') stageTrackerGateCountdownSync(el, nowMs); + if (typeof stageTrackerNoteSync === 'function') stageTrackerNoteSync(el, nowMs); } let _stageTrackerCueTimer = null; function stageTrackerCueTick() { @@ -17514,8 +17666,10 @@

Where to get help

// -- keyed row reconcile --------------------------------------------- // Pure: a row's source with the one-render move stamp removed, so the // render after a move sees the same row and keeps its (animating) node. + // The hive note's open / tucked state is applied in place + // (stageTrackerNoteSync), so it is not a reason to swap the node either. function stageTrackerRowSrcKey(html) { - return String(html || '').replace(/ data-ham-prev-col="\d+" data-ham-col="\d+"/g, ''); + return String(html || '').replace(/ data-ham-prev-col="\d+" data-ham-col="\d+"/g, '').replace(/ cue-event-tucked"/g, '"').replace(/ aria-expanded="(?:true|false)"/g, '').replace(/ title="(?:You|Hive): [^"]*" data-action="stageTrackerNoteToggle"/g, ' data-action="stageTrackerNoteToggle"'); } // Pure: whether the stamped move attributes name this strip. function stageTrackerRowHasMove(html) { return / data-ham-prev-col="\d+"/.test(String(html || '')); } @@ -18231,6 +18385,7 @@

All labels

const ctx = { nowMs, stages, moves: _stageTrackerMoves }; ctx.workers = stageTrackerWorkers(window._lastStatus); ctx.events = _stageTrackerEvents; + ctx.noteTuck = stageTrackerNoteTuckSetting(); ctx.sharedPRs = stageTrackerSharedPRs(d.items); // Repo chips ride the setting against how many repos the payload spans. if (stageTrackerRepoChipOn(stageTrackerRepoChipSetting(), repos.length)) ctx.repoChips = { primary: stageTrackerPrimaryRepo(), active: f.repo }; @@ -22044,6 +22199,7 @@

All labels

+ stageTrackerRepoSectionHtml(state.repoChip, state.group) + stageTrackerConfirmSectionHtml(state.skippedConfirms) + stageTrackerCelebrateSectionHtml(state.celebrate !== false, state.celebrateGlyph) + + stageTrackerNoteTuckSectionHtml(state.noteTuck !== false) + stageTrackerMotionSectionHtml(state.motion, state.stages || []); } // Pure: the Merges section — the "Celebrate merges" toggle, the glyph. @@ -22057,6 +22213,14 @@

All labels

`; } function stageTrackerCelebrateChange(checked) { stageTrackerSetCelebrate(!!checked); } + // Pure: the "Hive notes" section — the auto-collapse toggle. + function stageTrackerNoteTuckSectionHtml(on) { + return `
+
Hive notes
+

The "Hive: …" line under a row's chevrons shows for ${Math.round(STAGE_TRACKER_CAPTION_SHOW_MS / 1000)} s when it is new, then slides left into a small ⬡ icon so the list stays quiet; the icon's tooltip keeps the whole note and its age, and a click (or Enter / Space) opens it for another ${Math.round(STAGE_TRACKER_CAPTION_SHOW_MS / 1000)} s. A hidden tab pauses the clock. Off, the line stays open and fades out after two minutes as before.

+
+
`; + } function stageTrackerCelebrateGlyphChange(v) { stageTrackerSetCelebrateGlyph(v); } // Pure: the first row whose box is inside the viewport (top edge in // view is enough), else the first row at all — so the test plays @@ -22115,7 +22279,7 @@

All labels

if (!body) return; const names = {}; for (const kind of Object.keys(STAGE_TRACKER_SOUND_KINDS)) names[kind] = stageTrackerClipStatusText(kind); - setIfChanged(body, stageTrackerSettingsHtml({ on: _stageTrackerSoundOn, volume: _stageTrackerVolume, clips: _stageTrackerClips, names, motion: stageTrackerMotionSetting(), stages: (_stageTracker && _stageTracker.stages) || [], celebrate: stageTrackerCelebrateSetting(), celebrateGlyph: stageTrackerCelebrateGlyphId((() => { try { return localStorage.getItem(STAGE_TRACKER_CELEBRATE_GLYPH_KEY); } catch { return null; } })()), skippedConfirms: stageTrackerSkippedConfirms(), repoChip: stageTrackerRepoChipSetting(), group: _stageTrackerGroup })); + setIfChanged(body, stageTrackerSettingsHtml({ on: _stageTrackerSoundOn, volume: _stageTrackerVolume, clips: _stageTrackerClips, names, motion: stageTrackerMotionSetting(), stages: (_stageTracker && _stageTracker.stages) || [], celebrate: stageTrackerCelebrateSetting(), noteTuck: stageTrackerNoteTuckSetting(), celebrateGlyph: stageTrackerCelebrateGlyphId((() => { try { return localStorage.getItem(STAGE_TRACKER_CELEBRATE_GLYPH_KEY); } catch { return null; } })()), skippedConfirms: stageTrackerSkippedConfirms(), repoChip: stageTrackerRepoChipSetting(), group: _stageTrackerGroup })); const rm = document.getElementById('sts-rm-preview'); if (rm) rm.checked = document.body.classList.contains('ham-rm-preview'); } @@ -46079,6 +46243,7 @@

Configure LiteLLM

document.addEventListener('visibilitychange', function() { if (document.visibilityState === 'visible') sseWatchdogTick(true); if (document.visibilityState === 'visible') { agentLogsResumeIfSkipped(); stageTrackerResumeIfSkipped(); } + if (typeof stageTrackerNoteVisibility === 'function') stageTrackerNoteVisibility(document.visibilityState !== 'visible'); }); // Fetch persistent trends for sparklines (day/week) window._trendData = [];