garage44.eu/jeroen/midas

logclone: git clone https://garage44.eu/jeroen/midas.git

cartopolis-agent · 2026-11-24T18:17:38Z

feat(web): a session's conversation reads newest first

Opening a session mostly asks what it is doing now, and that sat at the
foot of a long log. The log now runs from the newest at the top to the
start at the bottom; the message box (and with it an open question's
"type your own") moves from the foot to under the header, beside what
it answers. Each block still reads as written, so a reply sits above the
steps that led to it.

Following it live inverts too. At the top the page stays at 0 and what
comes pushes the past down: the glide down to the end is gone. Scrolled
down to read back, the browser's scroll anchoring holds the block being
read while blocks land above it, and a "New above" chip brings the
person back up. Anchoring is switched off while at the top, or it would
hold the block that was first and scroll the newest out of view.

On a phone the foldable box hangs from the header now: its handle is
under it, pulled down to grow or open, pushed up to fold.

Checked on the README's stand-in hub (docs/screens) at 390x844 with a
log message sent 4 s after connecting: at the top, scrollTop stayed 0
and the new reply was the first block; scrolled to 175 px, scrollTop
went to 343 with the block in view held at the same y, and the chip
showed. Scroll anchoring is Chrome's and Firefox's; a browser without
it scrolls by what arrives while reading back.
web/src/app.css                 |  55 ++++++++++-----
 web/src/components/fold.tsx     |  40 +++++------
 web/src/components/main.tsx     |   2 +-
 web/src/components/sessions.tsx | 153 +++++++++++++++++++---------------------
 4 files changed, 130 insertions(+), 120 deletions(-)

diff --git a/web/src/app.css b/web/src/app.css
index 2a6edd0..45b2f61 100644
--- a/web/src/app.css
+++ b/web/src/app.css
@@ -1424,15 +1424,17 @@ code {
     interpolate-size: allow-keywords;
 }
 
-/* Scrolled up while more came: a chip at the foot of the view takes the person down to it. */
+/* Scrolled down while more came: a chip at the top of the view takes the person up to it. */
 .jump-new {
     position: sticky;
-    bottom: var(--m-space-3);
+    top: var(--m-space-3);
+    z-index: 2;
     align-self: center;
     display: inline-flex;
     align-items: center;
     gap: 6px;
-    margin-top: calc(-1 * var(--m-space-5));
+    /* Hidden, it takes no room above the newest: its height and the gap after it given back. */
+    margin-bottom: calc(-1 * (1lh + 12px + var(--m-space-2)));
     padding: 6px 12px;
     border: 0;
     border-radius: var(--m-radius-full);
@@ -1444,7 +1446,7 @@ code {
     font-weight: 700;
     cursor: pointer;
     opacity: 0;
-    transform: translateY(12px) scale(0.9);
+    transform: translateY(-12px) scale(0.9);
     pointer-events: none;
     transition:
         opacity var(--dur-state) var(--ease-out),
@@ -2036,7 +2038,7 @@ code {
     font-size: 16px;
 }
 
-/* The message box's fold: a bar above it on a phone, and all that is left of it when folded. */
+/* The message box's fold: a bar under it on a phone, and all that is left of it when folded. */
 .fold__bar,
 .fold__shut {
     display: none;
@@ -2060,7 +2062,7 @@ code {
         gap: 6px;
         width: 100%;
         min-height: 24px;
-        margin: calc(-1 * var(--m-space-1)) 0 2px;
+        margin: 2px 0 calc(-1 * var(--m-space-1));
         padding: 0;
         border: 0;
         background: none;
@@ -2093,10 +2095,10 @@ code {
         background: var(--m-accent);
     }
 
-    /* Folded: a slim lifted pill, the composer's own shape, with its handle on top,
+    /* Folded: a slim lifted pill, the composer's own shape, with its handle underneath,
        and in it a field to reply in beside the header's buttons. */
     .fold--shut {
-        padding: 2px 6px 6px;
+        padding: 6px 6px 2px;
         border: 1px solid var(--m-border);
         border-radius: 22px;
         background: var(--m-surface);
@@ -2105,7 +2107,7 @@ code {
 
     .fold--shut .fold__bar {
         min-height: 14px;
-        margin: 0 0 4px;
+        margin: 4px 0 0;
     }
 
     /* Sized by the screen, never by the draft: its one unwrapped line set the page's
@@ -2191,7 +2193,7 @@ code {
         background: var(--m-accent);
     }
 
-    /* Two lines, and as much more as it was dragged up for: under the finger while dragged, gliding to rest after. */
+    /* Two lines, and as much more as it was dragged down for: under the finger while dragged, gliding to rest after. */
     .fold .session__say .session__message {
         min-height: calc(2lh + 8px + var(--fold-grow, var(--fold-grow-kept, 0px)));
         transition: min-height 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
@@ -2215,7 +2217,7 @@ code {
         display: none;
     }
 
-    /* Pulled up from folded: the box comes up under the finger, the folded field giving way to it. */
+    /* Pulled down from folded: the box comes down under the finger, the folded field giving way to it. */
     .fold--shut.fold--peek .fold__shut {
         display: none;
     }
@@ -3125,7 +3127,7 @@ code {
 @keyframes msg-enter {
     from {
         opacity: 0;
-        transform: translateY(6px);
+        transform: translateY(-6px);
     }
 }
 
@@ -4993,11 +4995,28 @@ code {
     }
 }
 
-/* The composer floats in its own box: the foot under it is the page, not a bar. */
-.m-shell__footer:has(.session__say) {
+/* A session reads newest first, so its message box (the Shell's footer) sits under the
+   header, beside the newest, and the conversation scrolls beneath it. */
+.midas--session .m-shell__main {
+    grid-template-rows: auto auto minmax(0, 1fr);
+}
+
+.midas--session .m-shell__footer {
+    grid-row: 2;
     border-top: 0;
+    border-bottom: 1px solid var(--m-border);
+}
+
+.midas--session .m-shell__content {
+    grid-row: 3;
+    padding-bottom: calc(var(--m-space-5) + env(safe-area-inset-bottom));
+}
+
+/* The composer floats in its own box: around it is the page, not a bar. */
+.m-shell__footer:has(.session__say) {
+    border-bottom: 0;
     background: var(--m-bg);
-    padding-top: var(--m-space-1);
+    padding-bottom: var(--m-space-1);
 }
 
 /* The tabs: frosted over what scrolls beneath. */
@@ -5008,7 +5027,7 @@ code {
 
 @media (max-width: 720px) {
     .m-shell__footer:has(.session__say) {
-        padding: var(--m-space-1) var(--m-space-2) calc(var(--m-space-2) + env(safe-area-inset-bottom));
+        padding: var(--m-space-2) var(--m-space-2) var(--m-space-1);
     }
 }
 
@@ -5246,13 +5265,13 @@ code {
     color: var(--m-danger);
 }
 
-/* How it gets a node (nodeline.tsx): one line under the conversation, the label then where it is. */
+/* How it gets a node (nodeline.tsx): one line over the conversation, the label then where it is. */
 .msg__node {
     display: flex;
     flex-direction: column;
     gap: var(--m-space-1);
     padding: var(--m-space-1) var(--m-space-3);
-    border-top: 1px solid var(--m-border);
+    border-bottom: 1px solid var(--m-border);
     font-size: var(--m-font-size-sm);
     color: var(--m-text-dim);
     font-variant-numeric: tabular-nums;
diff --git a/web/src/components/fold.tsx b/web/src/components/fold.tsx
index 9a49e41..7db6cb4 100644
--- a/web/src/components/fold.tsx
+++ b/web/src/components/fold.tsx
@@ -8,11 +8,11 @@ const fold = local({shut: read('midas-composer-shut') === '1', grow: Number(read
 
 /** The most the box grows by: half the screen, so the conversation keeps the rest. */
 const maxGrow = () => Math.round(window.innerHeight * 0.5)
-/** The folded field's height (app.css `.fold__reply`): a box pulled up from folded starts from it. */
+/** The folded field's height (app.css `.fold__reply`): a box pulled open from folded starts from it. */
 const FIELD = 38
 /** Dragged this far, it is a drag and not a tap: a finger wobbles more than a mouse. */
 const SLOP = 8
-/** Dragged down this far past its two lines, it folds away; up this far from folded, it opens. */
+/** Pushed up this far past its two lines, it folds away; pulled down this far from folded, it opens. */
 const SNAP = 56
 /** A flick this fast (px/ms) settles it the way it was thrown, however short. */
 const FLING = 0.4
@@ -56,8 +56,8 @@ function reveal(el: HTMLElement, from: number) {
 
 /**
  * The open box folds, and shrinks from its height (as the finger left it) to the folded
- * pill's. Folded first and then shrunk: the body slid to nothing went all the way down
- * to the page's foot, and the pill then jumped back up out of it.
+ * pill's. Folded first and then shrunk: the body slid to nothing went all the way to
+ * the edge of the page, and the pill then jumped back out of it.
  */
 function collapse(el: HTMLElement) {
     const start = el.offsetHeight
@@ -107,9 +107,9 @@ type Drag = {
     grow: number
     moved: boolean
     el: HTMLElement
-    /** The open body's height when the drag began: what folding it down squeezes. */
+    /** The open body's height when the drag began: what folding it away squeezes. */
     height: number
-    /** Where the finger is now, from where it started (up is negative). */
+    /** Where the finger is now, from where it started (down, which opens it, is negative: the box hangs under the header). */
     dy: number
     /** The last few positions, for how fast it was let go. */
     trail: {t: number; y: number}[]
@@ -123,7 +123,7 @@ let draggedAt = 0
 /** Past its end the box gives less and less, as a sheet does, rather than stopping dead. */
 const rubber = (over: number) => (over <= 0 ? 0 : Math.sqrt(over) * 4)
 
-/** How fast the finger was moving when it lifted, in px/ms (down is positive). */
+/** How fast the finger was moving when it lifted, in px/ms (up, towards folding, is positive). */
 function velocity(d: Drag): number {
     const now = performance.now()
     // A phone sends a fast flick as one or two moves: the last two are enough then.
@@ -132,14 +132,14 @@ function velocity(d: Drag): number {
     if (recent.length < 2) return 0
     const a = recent[0]
     const b = recent[recent.length - 1]
-    return b.t > a.t ? (b.y - a.y) / (b.t - a.t) : 0
+    return b.t > a.t ? (a.y - b.y) / (b.t - a.t) : 0
 }
 
 /** Where the box would settle with the finger `dy` px from where it started, thrown at `v`. */
 function settle(d: Drag, dy: number, v = 0): {shut: boolean; grow: number} {
     if (fold.shut) return dy < -SNAP || (v < -FLING && dy < 0) ? {shut: false, grow: 0} : {shut: true, grow: fold.grow}
     const grow = d.grow - dy
-    // Flicked down: a tall box goes back to its two lines, one at its two lines folds away.
+    // Flicked up: a tall box goes back to its two lines, one at its two lines folds away.
     if (grow < -SNAP || (v > FLING && grow < SNAP)) return {shut: true, grow: 0}
     if (v > FLING) return {shut: false, grow: 0}
     return {shut: false, grow: Math.max(0, Math.min(maxGrow(), Math.round(grow)))}
@@ -164,14 +164,14 @@ function follow() {
     el.classList.add('fold--dragging')
     el.classList.toggle('fold--letgo', settle(drag, dy).shut !== fold.shut)
     if (fold.shut) {
-        // Folded, the box comes up under the finger as far as it is pulled.
+        // Folded, the box comes down under the finger as far as it is pulled.
         el.classList.toggle('fold--peek', dy < 0)
         el.style.setProperty('--fold-peek', `${Math.max(0, -dy)}px`)
         return
     }
     const grow = drag.grow - dy
     const max = maxGrow()
-    // Up: the box grows with the finger, giving at its limit. Down past its two lines: it is squeezed.
+    // Down: the box grows with the finger, giving at its limit. Up past its two lines: it is squeezed.
     el.style.setProperty('--fold-grow', `${Math.max(0, Math.min(grow, max) + rubber(grow - max))}px`)
     if (!body) return
     if (grow < 0) {
@@ -202,11 +202,11 @@ const handlers = {
         const dy = e.clientY - drag.y
         if (!drag.moved && Math.abs(dy) < SLOP) return
         if (!drag.moved) {
-            // Taken up from where the finger is now, so passing the slop is not a jump.
+            // Taken from where the finger is now, so passing the slop is not a jump.
             drag.moved = true
             drag.y += Math.sign(dy) * SLOP
         }
-        drag.dy = e.clientY - drag.y
+        drag.dy = drag.y - e.clientY
         drag.trail.push({t: performance.now(), y: e.clientY})
         if (drag.trail.length > 8) drag.trail.shift()
         if (!drag.frame) drag.frame = requestAnimationFrame(follow)
@@ -219,14 +219,14 @@ const handlers = {
         // A tap: its click does it (`tapped`).
         if (!d.moved) return unpeek(d.el)
         draggedAt = performance.now()
-        d.dy = e.clientY - d.y
+        d.dy = d.y - e.clientY
         d.trail.push({t: performance.now(), y: e.clientY})
         const to = settle(d, d.dy, velocity(d))
         const body = bodyOf(d.el)
         d.el.classList.remove('fold--dragging', 'fold--letgo')
         if (fold.shut) {
             if (to.shut) {
-                // Not pulled far enough: back down into the pill.
+                // Not pulled far enough: back up into the pill.
                 if (body && d.el.classList.contains('fold--peek')) springBack(d.el, body, FIELD + Math.max(0, -d.dy), FIELD)
                 else unpeek(d.el)
                 return
@@ -268,10 +268,10 @@ const handlers = {
 }
 
 /**
- * The message box at the page's foot, foldable on a phone so the conversation
- * has the screen to be read. A handle above it, a sheet's: tapped, it folds the
- * box away or brings it back; dragged, the box follows the finger — up for
- * more room to write, down to fold it away, a flick either way enough. On a
+ * The message box under the page's header, foldable on a phone so the conversation
+ * has the screen to be read. A handle under it, a pull-down sheet's: tapped, it folds
+ * the box away or brings it back; dragged, the box follows the finger — down for
+ * more room to write, up to fold it away, a flick either way enough. On a
  * wider screen it is always open.
  *
  * Folded, it reads as a field to reply in, with the header's buttons (`tools`)
@@ -300,7 +300,6 @@ export function foldable(body: m.Children, o: {draft?: string; tools?: m.Childre
     )
     return (
         <div class={`fold${fold.shut ? ' fold--shut' : ''}`} style={{'--fold-grow-kept': `${fold.grow}px`}}>
-            {bar('fold__bar', <span class="fold__grip" aria-hidden="true" />)}
             {fold.shut ? (
                 <div class="fold__shut">
                     {bar(
@@ -315,6 +314,7 @@ export function foldable(body: m.Children, o: {draft?: string; tools?: m.Childre
                 </div>
             ) : null}
             <div class="fold__body">{body}</div>
+            {bar('fold__bar', <span class="fold__grip" aria-hidden="true" />)}
         </div>
     )
 }
diff --git a/web/src/components/main.tsx b/web/src/components/main.tsx
index 4d07818..1b75a26 100644
--- a/web/src/components/main.tsx
+++ b/web/src/components/main.tsx
@@ -426,7 +426,7 @@ export class Main extends MithrilComponent {
         return (
             <div class="app-frame">
                 <Shell
-                    class="midas"
+                    class={inSession() ? 'midas midas--session' : 'midas'}
                     navLabel="Midas hub"
                     navOpen={bind(layout, 'navOpen')}
                     navWidth={width('navWidth')}
diff --git a/web/src/components/sessions.tsx b/web/src/components/sessions.tsx
index 163baff..bec194c 100644
--- a/web/src/components/sessions.tsx
+++ b/web/src/components/sessions.tsx
@@ -769,29 +769,9 @@ function render(items: LogItem[], s: Hosted) {
         const i = out.findIndex((v) => (atOf.get(Number((v.attrs as Record<string, unknown> | undefined)?.['data-n'])) ?? 0) > mile.at)
         out.splice(i < 0 ? out.length : i, 0, mile.view)
     }
-    // Only the latest blocks, until the earlier ones are asked for: a search hit among them asks.
-    let shown = out
-    const hidden = drawn.all === s.id ? 0 : out.length - RECENT_BLOCKS
-    if (hidden > 0) {
-        const firstShown = Number((out[hidden].attrs as Record<string, unknown> | undefined)?.['data-n'] ?? 0)
-        if (jump && jump.id === s.id && jump.n < firstShown) {
-            showAll(s.id)
-            return render(items, s)
-        }
-        shown = [
-                <div key="earlier" class="msg__earlier">
-                    <Button size="sm" variant="secondary" onclick={() => showAll(s.id)}>
-                        Show {hidden} earlier
-                    </Button>
-                </div>,
-                ...out.slice(hidden),
-            ]
-    }
-    const first = opening(s, items)
-    if (first) shown.push(<div key="opening" class="msg msg--user md">{markdown(first.text ?? '')}</div>)
-    sending.list.forEach((p, i) => {
-        if (p.session === s.id && !arrived(p, items, s)) shown.push(<div key={`sending:${p.at}:${i}`} class="msg msg--user md msg--sending">{markdown(p.text)}</div>)
-    })
+    // Newest first: what it does now under the message box, the past further down. Each block
+    // reads as written, so a reply sits above the steps that led to it.
+    const shown: m.Vnode[] = []
     const doing = activity(items, s)
     if (doing)
         shown.push(
@@ -805,16 +785,41 @@ function render(items: LogItem[], s: Hosted) {
                 <Elapsed since={doing.since} typical={doing.typical} />
             </div>,
         )
-    else if (!first) {
+    const first = opening(s, items)
+    if (!doing && !first) {
         const end = endBar(s, lastEnd)
         if (end) {
             end.key = 'end'
             shown.push(end)
         }
     }
-    // How it gets a node, under it all: in line and who holds them, or the node it is on.
+    // How it gets a node, under what it is doing: in line and who holds them, or the node it is on.
     const node = nodeFoot(s)
     if (node) shown.push(node)
+    const mine: m.Vnode[] = []
+    sending.list.forEach((p, i) => {
+        if (p.session === s.id && !arrived(p, items, s)) mine.push(<div key={`sending:${p.at}:${i}`} class="msg msg--user md msg--sending">{markdown(p.text)}</div>)
+    })
+    shown.push(...mine.reverse())
+    if (first) shown.push(<div key="opening" class="msg msg--user md">{markdown(first.text ?? '')}</div>)
+    // Only the latest blocks, until the earlier ones are asked for: a search hit among them asks.
+    const hidden = drawn.all === s.id ? 0 : out.length - RECENT_BLOCKS
+    if (hidden > 0) {
+        const firstShown = Number((out[hidden].attrs as Record<string, unknown> | undefined)?.['data-n'] ?? 0)
+        if (jump && jump.id === s.id && jump.n < firstShown) {
+            showAll(s.id)
+            return render(items, s)
+        }
+    }
+    shown.push(...out.slice(Math.max(0, hidden)).reverse())
+    if (hidden > 0)
+        shown.push(
+            <div key="earlier" class="msg__earlier">
+                <Button size="sm" variant="secondary" onclick={() => showAll(s.id)}>
+                    Show {hidden} earlier
+                </Button>
+            </div>,
+        )
     return shown
 }
 
@@ -848,9 +853,9 @@ function turnCut(reason: string | undefined): string | null {
 }
 
 /**
- * Idle, at the foot of the conversation once a turn has ended and nothing runs
+ * Idle, at the head of the conversation once a turn has ended and nothing runs
  * for it: since when, how it stopped, and where its branch is. Nothing while it
- * works, asks (the card above is the signal) or has finished (its own line says so).
+ * works, asks (the card below is the signal) or has finished (its own line says so).
  */
 /** When a landed session goes live, as far as the hub has planned it: "live around 12:00". */
 function liveWhen(s: Hosted): string {
@@ -882,10 +887,10 @@ function endBar(s: Hosted, last: LogItem | undefined): m.Vnode | null {
             </span>
             <span class="hint">
                 {s.awaits
-                    ? 'It goes on once you have done what it says below.'
+                    ? 'It goes on once you have done what it says above.'
                     : s.wake
-                    ? 'midas wakes it then; reply below to go on sooner.'
-                    : `Reply below to go on${s.finish || c?.stage === 'landed' ? '' : ', or Mark done in About when it is finished'}.`}
+                    ? 'midas wakes it then; reply above to go on sooner.'
+                    : `Reply above to go on${s.finish || c?.stage === 'landed' ? '' : ', or Mark done in About when it is finished'}.`}
             </span>
         </div>
     )
@@ -934,14 +939,14 @@ function fileAsk(it: LogItem): string | null {
 
 /** What the person is writing to the open session; kept while they look elsewhere. */
 const draft = local({text: ''})
-/** Follow the conversation down as it grows, unless the person scrolled up to read. */
+/** Stay at the top, where the newest comes in, unless the person scrolled down to read back. */
 let pinned = true
 
-/** The Shell's content column scrolls, not the log: that is what follows the conversation down. */
-const followDown = {
+/** The Shell's content column scrolls, not the log: that is what stays at the newest. */
+const followNewest = {
     oncreate: (v: m.VnodeDOM) => {
-        // Opened, it is at its end at once: only what arrives after glides.
-        stick(v.dom as HTMLElement, true)
+        // Opened, it is at its newest at once.
+        stick(v.dom as HTMLElement)
         // A picture or a film grows the log after it is drawn: follow that too.
         const watch = new ResizeObserver(() => stick(v.dom as HTMLElement))
         watch.observe(v.dom)
@@ -960,74 +965,60 @@ const followDown = {
     },
 }
 
-/** Scrolled up to read while more arrived: a chip says so, and brings the person down to it. */
+/** Scrolled down to read back while more arrived: a chip says so, and brings the person up to it. */
 function showNew(dom: HTMLElement, on: boolean) {
     dom.parentElement?.querySelector('.jump-new')?.classList.toggle('is-shown', on)
 }
 
-/** To the end of the conversation, gliding. */
+/** Back up to the newest. */
 function toLatest(e: Event) {
-    const el = (e.currentTarget as HTMLElement).closest('.m-shell__content')
+    const el = (e.currentTarget as HTMLElement).closest<HTMLElement>('.m-shell__content')
     pinned = true
-    el?.scrollTo({top: el.scrollHeight, behavior: 'smooth'})
+    if (el) el.style.overflowAnchor = 'none'
+    el?.scrollTo({top: 0, behavior: reduced() ? 'auto' : 'smooth'})
     showNew(e.currentTarget as HTMLElement, false)
 }
 
-/** The conversation gliding down to its end: the frame it waits on, and where it last put the scroll. */
-const glide = {frame: 0, at: 0}
-
-/**
- * Down to the end of the conversation, a share of the way each frame. Set in one go, the
- * page jumped by a whole message as it came; chasing the end, a reply that streams in
- * chunk by chunk keeps sliding up as one movement.
- */
-function glideDown(el: HTMLElement) {
-    if (glide.frame) return
-    const step = () => {
-        const gap = el.scrollHeight - el.clientHeight - el.scrollTop
-        if (!pinned || gap < 1) {
-            glide.frame = 0
-            return
-        }
-        el.scrollTop += Math.max(1, gap * 0.18)
-        glide.at = el.scrollTop
-        glide.frame = requestAnimationFrame(step)
-    }
-    glide.frame = requestAnimationFrame(step)
-}
-
-/** A block that grew by itself (Typed pacing a reply in), with no redraw of the page: followed down as `stick` would. */
+/** A block that grew by itself (Typed pacing a reply in), with no redraw of the page: kept at the top as `stick` would. */
 function following(dom: HTMLElement) {
-    const el = dom.closest('.m-shell__content') as HTMLElement | null
-    if (el && pinned && !reduced()) glideDown(el)
+    const el = dom.closest<HTMLElement>('.m-shell__content')
+    if (el && pinned) el.scrollTop = 0
 }
 
-function stick(dom: HTMLElement, at = false) {
+/**
+ * The newest comes in at the top. At the top, the page stays there and what came pushes
+ * the past down. Scrolled down to read back, the browser's scroll anchoring holds the
+ * block being read in place while blocks arrive above it, and a chip counts that they
+ * did. Anchoring is off while at the top: it would hold the block that was first there
+ * and scroll the newest out of view above it.
+ */
+function stick(dom: HTMLElement) {
     const el = (dom.closest('.m-shell__content') as HTMLElement | null) ?? dom
     el.onscroll = () => {
-        // The glide's own scrolling, short of the end while it moves: still following.
-        if (glide.frame && el.scrollTop >= glide.at - 1) return
-        pinned = el.scrollHeight - el.scrollTop - el.clientHeight < 80
+        pinned = el.scrollTop < 80
+        el.style.overflowAnchor = pinned ? 'none' : ''
         if (pinned) showNew(dom, false)
     }
+    el.style.overflowAnchor = pinned ? 'none' : ''
     const grew = el.scrollHeight > Number(el.dataset.height ?? 0) + 8
     el.dataset.height = String(el.scrollHeight)
     if (!pinned && grew) showNew(dom, true)
     if (jump && jump.id === live.following && live.logNext >= jump.n) {
-        // The last block at or before the item: an agent's text is many items in one.
-        const at = [...dom.querySelectorAll<HTMLElement>('[data-n]')].filter((b) => Number(b.dataset.n) <= jump!.n).pop()
+        // The latest block at or before the item (an agent's text is many items in one), the
+        // innermost on a tie: the calls in a run keep their own order inside it.
+        const n = (b: HTMLElement) => Number(b.dataset.n)
+        const at = [...dom.querySelectorAll<HTMLElement>('[data-n]')].filter((b) => n(b) <= jump!.n).reduce<HTMLElement | undefined>((a, b) => (!a || n(b) >= n(a) ? b : a), undefined)
         jump = null
         if (at) {
             pinned = false
+            el.style.overflowAnchor = ''
             at.scrollIntoView({block: 'center'})
             at.classList.add('msg--found')
             setTimeout(() => at.classList.remove('msg--found'), 2400)
             return
         }
     }
-    if (!pinned) return
-    if (at || reduced()) el.scrollTop = el.scrollHeight
-    else glideDown(el)
+    if (pinned) el.scrollTop = 0
 }
 
 /** The session the address names (`/sessions/s3`), if there is one. */
@@ -1511,7 +1502,7 @@ const otherBoxes = (q: LogItem) => Object.keys(q.schema?.properties ?? {}).filte
 /** A typed message as a question's answer: its "Other", for each question it asks. */
 const typedAnswer = (q: LogItem, text: string) => Object.fromEntries(otherBoxes(q).map((k) => [k, text]))
 
-/** The message box under the conversation: in the Shell's footer, so it stays while the conversation scrolls. Folded on a phone, it carries the header's buttons (`tools`). */
+/** The message box over the conversation: in the Shell's footer, which a session's page moves under the header (app.css `.midas--session`), so it stays while the conversation scrolls. Folded on a phone, it carries the header's buttons (`tools`). */
 export function sessionFooter(tools: (m.Vnode | null)[] = []): m.Children {
     const s = openSession()
     // No session open: a new one's composer; one asked for but not known (yet): nothing.
@@ -1622,7 +1613,7 @@ export function sessionFooter(tools: (m.Vnode | null)[] = []): m.Children {
                     !steers()
                         ? 'steering takes the steer role'
                         : asked
-                        ? `pick an answer above, or type your own${keys('Mod+Enter answers')}`
+                        ? `pick an answer below, or type your own${keys('Mod+Enter answers')}`
                         : s.autopilot?.on && !busy
                         ? `say something: your word goes before the autopilot's${keys('Mod+Enter sends')}`
                         : busy
@@ -2807,15 +2798,15 @@ class SessionView extends MithrilComponent<{s: Hosted}> {
         follow(s.id)
         return (
             <div class="session">
-                <div class="session__log" {...followDown}>
-                    {live.following === s.id ? render(followedLog(), s) : null}
-                </div>
                 <button type="button" class="jump-new" onclick={toLatest}>
                     <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
-                        <path d="M12 5v14M6 13l6 6 6-6" />
+                        <path d="M12 19V5M6 11l6-6 6 6" />
                     </svg>
-                    New below
+                    New above
                 </button>
+                <div class="session__log" {...followNewest}>
+                    {live.following === s.id ? render(followedLog(), s) : null}
+                </div>
                 {sessionSheet(s)}
             </div>
         )