Skip to content

ui-sdk: an ask_user_rank tool — the user puts a list of items in order, by drag or without it #584

Closed

Description

@schlessera

Context

Implementation is on main through PR #721, squash 35fb78d4. This issue remains open for the physical-device and live-agent checks listed below.

The original problem:

The agent sometimes needs the user's order of preference over a set of items. Examples:

  • which of these five trips to do first
  • rank these talk ideas for the next submission
  • order these films by how much you want to see them
  • prioritise these backlog items

Before this change, neither structured-input tool could express this:

  • ask_user (ASK_USER_INPUT_SCHEMA, packages/ui-sdk/src/tool-contracts/bridge.ts:77-78) only offers single-select or multi-select over 2–4 options per question (bridge.ts:63-67). A multi-select answer comes back as an unordered comma-separated label string (packages/ui-sdk/src/protocol.ts:1367-1371), so picking in a particular order carries no meaning.
  • The bulk list tool shipped by ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583 applies one shared scale to many items. That gives buckets, not an order, and ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583 lists ranking as out of scope.
  • The kit and PWA previously had no reorderable-list primitive. packages/ui-kit and packages/ui-react have no drag or sortable dependency, and the earlier pointer-drag code was in the image viewer (packages/ui-react/src/components/images/image-viewer.tsx).

The agent therefore had to ask for the order in prose, and has to parse "3 first, then 1, then … actually swap the last two".

Scope

  • Tool: a new bridge tool, ask_user_rank , defined next to ask_user in packages/ui-sdk/src/tool-contracts/bridge.ts. Input:
    • prompt
    • items: 2–15 entries, each with a stable id, a label, and optional detail and link, given in the agent's suggested starting order
    • optional cutoff: "only the top N matter", after which the rest may stay unranked
  • Protocol: ServerAskUserRankRequest / ClientAskUserRankResponse in @schlessera/brain-ui-sdk, with schemas. The response has order, a list of every item id top to bottom, and unchanged: boolean. If the user submits the starting order untouched, that is recorded explicitly so the agent can tell agreement from indifference.
  • Card: a kit component plus its ui-react binding. It shows a reorderable list with one Submit. Reordering follows the posted design: touch drag on the handle, tap a row then tap its target, and focus-scoped keyboard controls, so it works for keyboard and screen-reader users. The answered state shows the final numbered order.
  • Both backends: the Claude bridge and the pi bridge (packages/ui-backend-pi/src/bridge-tools.ts) expose the tool.
  • Replay: the exchange survives a reload like an ask_user_list exchange does. Composer text remains an ordinary message, as for bulk lists and grouped questions; no typed ranking is inferred. Dismiss uses ask_user_cancel.

Out of scope

Acceptance criteria

  • The agent sends 6 items in one call, and the tool result carries the full order of all 6 ids plus unchanged. A ui-sdk contract test covers this.
  • Every reorder done by dragging can also be done without dragging, and a test reorders a list using only keyboard or the button controls.
  • Each row's control has an accessible name that includes the item label and its current position ("Arrival, position 2 of 6"), and moves are announced.
  • At 320px width, 15 items reorder without horizontal scroll, and drag handles meet the D34 touch-target reach. Checked by a visual baseline.
  • Dragging a row does not scroll or pull-to-refresh the page underneath it on a touch device.
  • With cutoff: N, the card marks the line after position N, and the response still lists every id.
  • Submitting the untouched starting order returns unchanged: true.
  • Reloading the session shows the answered exchange as its final numbered list.
  • Tool schema token cost is measured and stated in the PR, since the bridge surface is budgeted (ui-sdk: show_block's input schema is 5270 tokens — 72% of the whole bridge surface #155, ui-sdk: the bridge briefs cost 655 tokens a turn and their reason expired with D44 — re-measure them #157). Live count completed: rank 597 tokens; brief 54 tokens / 1 line; all seven always-loaded schemas 10,322 tokens and briefs 792 tokens / 32 lines against the 682-token measured floor, using claude-sonnet-5 and the actual registered MCP schemas on 2026-09-30. This was a free token-count request, without model generation.

Verification

  • ui-sdk contract and schema tests; a ui-kit story and visual baseline at 320px and desktop; ui-react interaction tests for pointer drag, keyboard reorder, cutoff and replay.
  • Manual on a phone: ask the agent to "rank these five weekend trips", drag two, move one with the buttons, submit, and check the agent's reply follows exactly that order.

Contract impact

Additive: a new bridge tool, new protocol frames, schemas and a kit component. The integration contract lists them. ask_user is unchanged.

Related: #583 (bulk scale over a list, now shipped). The two should share row anatomy (label, detail, link) so a list looks the same whether it is being rated or ranked.

2026-09-30 readiness correction: verified citations on main a01c3895, updated the moved response lines and shipped #583 context, linked the decided tap/drag/keyboard design, and reconciled composer behavior with the existing list exchange. The design’s Android Chrome and iOS Safari check and the requested phone/agent exercise remain required; automated emulation does not replace them.

Required human verification

Desktop Chromium validation is complete: both themes, native touch reorder/cancel and transcript scrolling, 320px with fifteen items, keyboard paths, accessible names/live announcements, cutoff, kept order, replay, and composer focus. The PR records the exact automated and mutation evidence. Physical Android/iOS sessions and an authorized live phone-agent session were unavailable in this work environment.

  1. On Android Chrome and iOS Safari, drag a handle through a fifteen-item card toward both transcript edges. Confirm scrolling stops at the card edge, no pull-to-refresh occurs, and touching the row body scrolls normally. Cancel a moved row with pointer cancellation, Escape where applicable, and a second finger; confirm restoration of the prior order and the cancellation announcement.
  2. On a phone with an authorized live agent, ask it to rank five fictional weekend trips, drag two items, tap one into place, submit, and confirm the agent reply follows the exact submitted id order. Check an unchanged order and top-N cutoff as well; all ids must remain in the result.
  3. Record browser/OS versions, submitted and returned id orders, and sanitized results for scrolling/cancellation and the agent reply. Public evidence must exclude credentials and deployment details.

After those results satisfy the unchanged criteria and chosen design, remove needs: human and close this issue with the completion evidence. Restore agent-ready only if a scoped implementation fix remains.

2026-10-01 implementation handoff: recorded the merged implementation and completed live schema-token count; retained physical Android Chrome/iOS Safari and phone-agent verification as required. Follow-up findings are #719 (date mismatch), #724 (duplicate-id emission ordering), and #725 (scrape-browser test budgets/cleanup).

2026-10-01 triage: refreshed the ordinary ask_user schema, option bounds and answer-semantics pointers against main 0c0c9dfb. The recorded seven-tool token count remains a historical measurement from 2026-09-30, before the form tool landed; it is not the current eight-tool roster budget. Required physical-device/live-agent verification remains unchanged.

2026-10-01 triage at d9e64c9e40e8eab45e60197603c785b416725ff7: Repaired the existing unordered ask_user answer description. The ranking implementation is delivered; required physical-device/live-agent receipts remain needs: human.

Activity

  1. schlessera commented on Sep 29, 2026

    @schlessera
    OwnerAuthor

    Design needed: how reordering reads and works on a 320px touch screen, with and without dragging.

    The tool contract and behaviour are decided in the body. What is left is the interaction: a drag handle per row, a long-press to lift, tap-to-pick-then-tap-to-place, or up/down buttons only. That choice decides whether ranking 15 items on a phone feels quick or fiddly, and whether the non-drag path is first-class or an afterthought. The code cannot decide it.

    Read first
    - This issue (ask_user_rank) and #583 (bulk scale over a list). Rows should share anatomy with #583's card.
    - #541: ask_user's multi-question rendering, and the "one exchange, one submit, never a silent no-op" lesson.
    - packages/ui-kit/src/decisions/AskUserCard.tsx: the existing decision card: header, action row, answered state.
    - packages/ui-react/src/components/images/image-viewer.tsx: the only existing pointer-gesture code, for touch-handling precedent.
    - docs/decisions/design-kit.md: D34 (hit targets as reach past the paint), D36 (focus-scoped single-key shortcuts; a resolved decision hands focus on), D38 (the sixth drop's rulings on decision cards).
    
    The problem
    The agent proposes five weekend trips and wants them in order of preference. Today the user types "3, 1, 5, 2, 4" and hopes it is parsed right. The card must make reordering 5 items effortless and 15 items still manageable, one-handed on a phone, with a path that never needs dragging.
    
    Design (answer each)
    1. Primary gesture: a drag handle, long-press anywhere on the row, or tap-to-select then tap-a-slot. Which one, and why, given that the chat transcript itself scrolls?
    2. Non-drag path: up/down per row, "move to top", or a position picker. Is it always visible, or revealed on focus?
    3. Row anatomy shared with #583: position number, label, detail, link. What truncates at 320px?
    4. Cutoff: how "only the top N matter" is drawn, and whether items below it look secondary.
    5. Unchanged-submit: does Submit on an untouched list need different wording ("Keep this order")?
    6. Answered state: the final numbered list, collapsed or full, at 15 items.
    7. Keyboard: D36 shortcuts for move up/down within a focused card.
    
    Requirements to hold
    - One dialog header and one action row per exchange (#541).
    - D34 touch-target reach for handles and buttons, 320px with no horizontal scroll, light and dark themes.
    - Accessible names carry the label and position, and moves are announced.
    - Dragging never scrolls the page or triggers pull-to-refresh underneath.
    - Do not change the tool contract in the issue body. If the design needs a change, state it as a finding.
    
    Deliverable
    ASCII mocks at 320px and desktop for: 5 items (untouched, mid-drag, submitted), 15 items with cutoff 3, and the keyboard or button-only path. Give a one-paragraph rationale per question. "Buttons only, no drag" is an acceptable outcome if the mocks show it is faster.
    
  2. added
    type: featA new capability or a change in user-visible behaviour.
    area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.
    area: ui-reactReact chat/files/voice components, stores, WebSocket transport.
    area: ui-kitThe presentational design kit: components, tokens, Storybook, visual baselines.
    area: backendsAgentBackend implementations and the seam they share.
    needs: designBlocked on a design drop or a visual answer.
    on Sep 29, 2026
  3. schlessera commented on Sep 29, 2026

    @schlessera
    OwnerAuthor

    #585 originally proposed replacing this standalone tool with a node kind of ask_user_form. Superseded by the maintainer decision of 2026-09-29: this remains a standalone tool, usable individually. The form can reuse its row controls as a node kind; it does not replace its tool contract.

    Updated 2026-09-29 to reflect the decision.

  4. schlessera commented on Sep 29, 2026

    @schlessera
    OwnerAuthor

    Ranked ask_user — put a list in order (ask_user_rank)

    The agent proposes some items and wants them in order of preference. The
    example is five weekend trips. Today the user types "3, 1, 5, 2, 4" and hopes
    it gets parsed right. This card makes reordering 5 items effortless and 15
    items manageable, one-handed on a phone, with a way to do all of it without
    dragging.

    Rows share the anatomy of the bulk scale card (#583,
    docs/bulk-ask-user.md). They have one header, one action row, and a Submit
    that never does nothing silently (#541).

    Sources read: ui-kit/src/decisions/AskUserCard.tsx (header, action row,
    answered well), ui-react/.../images/image-viewer.tsx →
    viewer/zoom-viewer.tsx (the only pointer code), design-kit.md D34, D35,
    D36 + addendum, D37 §6, D38 §1, §4, §10, and docs/bulk-ask-user.md.

    Contract (issue body, checked 2026-09-29): ask_user_rank with
    prompt, items[] {id, label, detail?, link?} (2–15, in the agent's
    suggested order) and an optional cutoff. The response is order (every
    id, top to bottom, even with a cutoff) plus unchanged: boolean. §9 has
    the reconciliation. One scope line ("up/down controls or move to top per
    row") is met differently, see R5.

    Precedent taken from ZoomViewer: hand-rolled pointer events,
    setPointerCapture on pointerdown, and touch-action: none on the gesture
    surface only. That last one is why the browser hands over every pointer
    instead of scrolling the page, with no preventDefault on the touch path.
    The difference here is that the surface is a handle, not the whole card.
    The card sits in a transcript that scrolls, so the rest of the card has to
    keep scrolling it.


    1. Primary gesture: tap-to-move, with a drag handle as the accelerator

    Ruling: both are always there, and they're equal. Neither one is
    "advanced".

    • Tap a row to pick it up. The row lifts: raised fill, accent hairline,
      and the gutter number becomes ●. Then tap the row whose place it
      should take
      . It moves into that position, and everything between shifts
      by one. Tapping the picked-up row again puts it back. There are no extra
      "drop here" slots: the target is the whole row, as big as a row.
    • Drag the handle (⠿, at the end of the row) to move a row in one
      gesture. The handle alone has touch-action: none. It lifts on
      pointerdown with no long-press delay, because it only does one thing.

    Rationale. The transcript scrolls, so the row body has to stay a scroll
    surface. That rules out long-press anywhere: it has to fight the
    scroller for every touch, and it collides with text selection and the
    iOS/Android context menu. It's also invisible until you know it's there.
    A drag handle is the gesture people expect, and it's precise for short
    moves. But a long move at 320px needs edge autoscroll under a thumb, and
    that's the hardest part of any drag to get right. Tap-to-move costs two
    taps for any distance. It needs no precision or autoscroll. It works the
    same with a mouse, a finger, a switch device or a screen reader, and it
    is the path that never needs dragging (§2). So it can't be hidden behind
    the handle.

    Cost to get from A B C D E to C A E B D (the "3, 1, 5, 2, 4" example):

    path actions notes
    tap-to-move 4 taps C→A, then E→B
    drag handle 2 drags each drag needs aim at the drop point
    ▲▼ per row 4 taps C ▲▲, E ▲▲; shown for comparison only
    worst case at 15 (last → first) tap 2 · drag 1 + autoscroll · ▲ 14

    Drag is the faster gesture only for moves you can see. Tap-to-move is never
    slower than 2 per move. That's why it's the one that's always there, and
    why "buttons only" isn't needed.

    Drag rules ("dragging never scrolls the page"):

    • touch-action: none on the handle, and setPointerCapture on pointerdown.
      The browser never starts a scroll or pull-to-refresh, because the touch
      never becomes a pan. While a drag is active, the transcript scroller gets
      overscroll-behavior: contain as a second guard.
    • The row follows the pointer on the Y axis only, clamped to the card. The
      other rows slide 150ms to open the gap, instantly under
      prefers-reduced-motion.
    • Edge autoscroll is the only scroll during a drag, and it's ours. When
      the pointer is within 48px of the transcript's visible top or bottom
      edge, we scroll the transcript at up to 12px per frame. It stops as soon
      as the card's own edge comes into view. The page never scrolls past the
      card.
    • pointercancel, Esc or a second finger cancels the drag. The row goes
      back to where it was, and the live region says "Move cancelled".
    • Release drops the row. A release outside the card drops it at the nearest
      end.

    2. Non-drag path: tap-to-move, always visible; ▲▼ only for the keyboard

    The non-drag path is tap-to-move (§1), and it's always there because it
    uses the row itself. There's nothing extra to reveal. Once a row is picked
    up, a one-line hint appears in the action row's place: Tap where Lisbon should go · Cancel. It stands in for Submit, so you can't submit
    mid-move. After the drop, Submit comes back.

    Not chosen:

    • ▲▼ per row at 320px means two 44px buttons plus the handle, which is
      132px of controls against about 190px of label. It's also O(distance) taps.
    • "Move to top" is one tap for one case, and tap-to-move covers that
      case (tap the row, tap fix(core): sync post-sync owns the caches its reindex rewrites #1).
    • A position picker (tap the number, pick from 1–15 in a sheet) is two
      taps like tap-to-move, but the picker hides the list you're ordering.

    The keyboard gets ▲▼ equivalents as keys (§7), not as buttons.

    3. Row anatomy (the same as #583's)

    1   Lisbon · 3 nights                       ⠿   ← gutter · label · handle
        flights €180 · 22° · 2h 40m  tap.pt         ← detail + host (inline-links.md)
    
    • Gutter (22px, mono 10.5px): the position number 1–15. ● when
      the row is picked up. – when it's below the cutoff (§4). The number is
      the row's state, so it's never colour-only.
    • Label (13px/600) is the record. Under D38 §10 it wraps and never
      truncates.
    • Detail (11px ink-mute) wraps and clamps at 2 lines only when the row
      has a link
      , exactly as in ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583. The full text is in aria-describedby.
    • Link is the host alone, mono, muted, last on the detail line. It
      wraps rather than ellipsising, and it's its own tap target. A tap on the
      link opens the link. It never picks the row up.
    • Handle has a painted grip 16×24 and a ::before reach to 44 × row
      height. Horizontally it can reach only half the gap to the link (D34), so
      the link always ends 16px short of the handle's column.
    • Row width at 320px: the 262px track splits into gutter 22 + label
      ~190 + handle 44 + gaps.

    What truncates at 320px: only the detail line on a row that has a link.
    Labels, positions and hosts never truncate.

    4. Cutoff: a line that says what it means, and nothing fades

    When cutoff is set, a rule sits after row N:

    3   Porto                                   ⠿
    ─── only your top 3 count ─────────────────────   ← mono 10.5px, ink-dim
    –   Seville                                 ⠿
    
    • Rows below the line keep full contrast and full size (D35: no
      opacity as de-emphasis). They're the candidates you might promote, so
      they must stay easy to read. The only difference is the gutter: – in
      place of a number, since they're not ranked. The line itself is the
      thing that reads as secondary.
    • Moving a row across the line is a normal move. The row that falls below
      is announced: "Seville is now 3. Porto dropped below the top 3."
    • Below the line, rows keep the agent's order. Nothing re-sorts behind the
      user.
    • Without a cutoff, there's no line and every row is numbered.

    5. Unchanged Submit: yes, different words

    state action row
    order untouched Dismiss · Keep this order
    order changed Dismiss · Reset · Submit order
    a row picked up Tap where Lisbon should go · Cancel

    Rationale. Submitting the agent's own order is a real answer ("your guess
    was right"). It's also the likeliest accident, because the card arrives
    already filled in. "Submit" on an untouched list reads as though something
    was done. "Keep this order" says exactly what the agent will be told. It
    sends, so it's not a no-op; the words just match the act. It is also what
    the contract's unchanged: true records: the words the user tapped are the
    fact the agent receives. "Keep this order" is shown whenever the current
    order equals the starting order, including after moving a row away and
    back, or after Reset. So the label and unchanged can never disagree.
    Reset appears
    only once the order has changed, and it puts back the agent's order in one
    tap, with an InlineToast offering Undo (D38 §4).

    6. Answered state: the final list, with the tail collapsed at 15

    ✓  ANSWERED · RANKED 5              ✓  ANSWERED · KEPT BRAIN'S ORDER
    Which weekend first?
    1  Lisbon · 3 nights
    2  Ghent
    …
    
    • The header says whether the order changed: RANKED N or KEPT BRAIN'S ORDER. That's the one fact a reader scrolling back needs.
    • Up to 7 items: the full numbered list, labels only. Detail and links
      are dropped, because the record is the order.
    • 8 or more: the top rows (the cutoff, or 5 when there's no cutoff) are
      shown in full. After them comes one disclosure row, ▸ 10 more, in order,
      which is allowed under D38 §10 because it opens the record. Opened, the
      rest wrap one per line.
    • With a cutoff: the top N are numbered, then the cutoff rule, then
      ▸ 12 not ranked.
    • At 15 items the card is about 220px tall at 320px when answered, against
      about 1,000px while pending.
    • A composer send while the card is pending is the typed answer (D38 §1).
      Dismissed is the kit's lapsed row with "Ask again".

    7. Keyboard (D36, focus-scoped)

    The list is one roving group, so it's one Tab stop, followed by Reset and
    Submit.

    key (row focused) does
    ↑ ↓ / j k move focus between rows
    Space / Enter pick up the focused row (or drop it)
    while picked up: ↑ ↓ move it one place, live
    while picked up: Home End move it to the top / bottom
    while picked up: Esc cancel, back to where it started
    Alt+↑ Alt+↓ move the focused row one place without picking it up
    1–9 move the focused row to that position; two digits within 600ms for 10–15
    • Focus stays on the row as it moves, so the next key keeps moving it.
    • After Submit, focus goes to the composer (D37 §6).
    • Keys are printed only under (any-pointer: fine) (D36 addendum), in the
      card footer: space pick up · ↑↓ move · 1–9 place. The Settings switch
      for single-key shortcuts turns off j / k and the digits. Arrows,
      Space, Enter and Alt+arrows always work.

    8. Accessible names and announcements

    control name
    list listbox-free: a list labelled by the prompt, rows are buttons in a roving group
    row "Lisbon · 3 nights, position 1 of 5" (+ ", picked up" / ", not ranked")
    handle "Reorder Lisbon · 3 nights, position 1 of 5"
    row link "Lisbon · 3 nights on tap.pt (tap.pt), new tab, link"
    Submit its visible words: "Keep this order" / "Submit order"

    A polite live region announces every move once, when the row is dropped:

    • pick up: "Lisbon picked up, position 1 of 5. Tap or arrow to where it should go."
    • move (keyboard, each step): "Position 2 of 5"
    • drop: "Lisbon moved to 2 of 5"
    • across the cutoff: "…Porto dropped below the top 3"
    • cancel: "Move cancelled. Lisbon stays at 1."

    The drag handle isn't the path for screen readers. Double-tapping the row
    picks it up, which is the same tap-to-move path.

    9. Contract: what the design reads, and findings

    The design reads prompt, items[].id, items[].label,
    items[].detail?, items[].link?, cutoff?, and the items' order as sent.
    It writes order (all ids) and unchanged.

    • Resolved by the issue: order lists every id even with a cutoff, and
      the agent knows the cutoff it sent, so order[0..N) is the ranked part.
      Below the line, order keeps the agent's sequence apart from the user's
      moves, as drawn. unchanged is covered in §5.
    • R3: same as ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583's F1. Item links go through classifyLink. The
      host shown always comes from the verdict.
    • R4: same as ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583's F5. What the tool returns on a composer (typed)
      answer has to be stated in the protocol.
    • R5: scope wording, not a contract change. The issue names "up/down
      controls or move to top per row" as the non-drag path. This design uses
      tap-to-move in their place (§1–§2): every row is a button, so a pick
      plus a target is two button presses for any distance, including to the
      top. ▲▼ exist as keys (Alt+↑↓, and ↑↓ while picked up), not as
      painted buttons. The acceptance criterion "a test reorders a list using
      only keyboard or the button controls" is met by both. If the maintainer
      wants painted ▲▼ anyway, they fit only by revealing them on the
      picked-up row, since at 320px they'd take 88px from every label.

    10. Mocks

    320px mocks are 42 columns (about 288px of card). Desktop mocks are 86
    columns (about a 640px card in the 720px transcript column). ▓ marks the
    picked-up or dragged row.

    10.1 5 items: untouched

    320px

    ╭────────────────────────────────────────╮
    │ ?  BRAIN NEEDS YOUR INPUT              │
    │ Which weekend first?                   │
    │ Drag ⠿ or tap a trip, then tap where   │
    │ it should go.                          │ ← first use only; gone after the first move
    │                                        │
    │ 1  Lisbon · 3 nights               ⠿   │
    │    flights €180 · 22° · tap.pt         │
    │ 2  Ghent                           ⠿   │
    │    train 2h 10m · canals · 14°         │
    │ 3  Porto                           ⠿   │
    │    flights €150 · 19° · 2h 20m         │
    │ 4  Copenhagen                      ⠿   │
    │    flights €210 · 12°                  │
    │ 5  Sintra & Cascais, with the coast    │
    │    road back via Cabo da Roca      ⠿   │ ← label wraps; handle sits on the last line
    │    car · 2 nights                      │
    │                                        │
    │              Dismiss  Keep this order  │
    ╰────────────────────────────────────────╯
    

    Desktop

    ╭────────────────────────────────────────────────────────────────────────────────────╮
    │ ?  BRAIN NEEDS YOUR INPUT                                                          │
    │ Which weekend first?                                                               │
    │                                                                                    │
    │ 1  Lisbon · 3 nights           flights €180 · 22° · 2h 40m        tap.pt        ⠿  │
    │ 2  Ghent                       train 2h 10m · canals · 14°                      ⠿  │
    │ 3  Porto                       flights €150 · 19° · 2h 20m                      ⠿  │
    │ 4  Copenhagen                  flights €210 · 12°                               ⠿  │
    │ 5  Sintra & Cascais, with the  car · 2 nights                                   ⠿  │
    │    coast road back                                                                 │
    │                                                                                    │
    │ space pick up · ↑↓ move · 1–5 place                  Dismiss   Keep this order    │
    ╰────────────────────────────────────────────────────────────────────────────────────╯
    

    10.2 5 items: mid-drag (Porto from 3 → 1)

    320px, with the thumb on Porto's handle, dragged up past Lisbon:

    ╭────────────────────────────────────────╮
    │ ?  BRAIN NEEDS YOUR INPUT              │
    │ Which weekend first?                   │
    │ ┌▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┐ │
    │ │● Porto                          ⠿  │ │ ← lifted: raised + accent hairline + shadow
    │ │  flights €150 · 19° · 2h 20m       │ │   follows Y only, clamped to the card
    │ └▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┘ │
    │ 2  Lisbon · 3 nights               ⠿   │ ← slid down 150ms; numbers update live
    │    flights €180 · 22° · tap.pt         │
    │ 3  Ghent                           ⠿   │
    │    train 2h 10m · canals · 14°         │
    │ 4  Copenhagen                      ⠿   │
    │ 5  Sintra & Cascais, with the …    ⠿   │
    │                                        │
    │              Dismiss  Keep this order  │ ← unchanged until drop
    ╰────────────────────────────────────────╯
      transcript: touch-action none on ⠿ · overscroll contained · no PTR
    

    Desktop: the same state. The cursor is grabbing, and the lifted row
    keeps its full width.

    │ ┌▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┐ │
    │ │● Porto                       flights €150 · 19° · 2h 20m                   ⠿ │ │
    │ └▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┘ │
    │ 2  Lisbon · 3 nights           flights €180 · 22° · 2h 40m        tap.pt        ⠿  │
    │ 3  Ghent                       train 2h 10m · canals · 14°                      ⠿  │
    │ 4  Copenhagen                  flights €210 · 12°                               ⠿  │
    │ 5  Sintra & Cascais, with the  car · 2 nights                                   ⠿  │
    

    10.3 5 items: submitted

    320px

    ╭────────────────────────────────────────╮
    │ ✓  ANSWERED · RANKED 5                 │
    │ Which weekend first?                   │
    │ ┌────────────────────────────────────┐ │
    │ │ 1  Porto                           │ │
    │ │ 2  Lisbon · 3 nights               │ │
    │ │ 3  Sintra & Cascais, with the      │ │
    │ │    coast road back via Cabo da Roca│ │ ← wraps: the list is the record
    │ │ 4  Ghent                           │ │
    │ │ 5  Copenhagen                      │ │
    │ │ you ranked 5 · 1m ago              │ │
    │ └────────────────────────────────────┘ │
    ╰────────────────────────────────────────╯
    

    Desktop. It stays one column, because a multi-column list reads in the
    wrong direction for an order:

    │ ┌────────────────────────────────────────────────────────────────────────────────┐ │
    │ │ 1  Porto                                                                       │ │
    │ │ 2  Lisbon · 3 nights                                                           │ │
    │ │ 3  Sintra & Cascais, with the coast road back via Cabo da Roca                 │ │
    │ │ 4  Ghent                                                                       │ │
    │ │ 5  Copenhagen                                                                  │ │
    │ │ you ranked 5 · 1m ago                                                          │ │
    │ └────────────────────────────────────────────────────────────────────────────────┘ │
    

    Untouched and submitted, the header reads ✓ ANSWERED · KEPT BRAIN'S ORDER.

    10.4 15 items, cutoff 3

    320px, pending (Seville picked up by tap, about to be tapped onto #2):

    ╭────────────────────────────────────────╮
    │ ?  BRAIN NEEDS YOUR INPUT              │
    │ Which 3 would you actually book?       │
    │                                        │
    │ 1  Lisbon · 3 nights               ⠿   │
    │    flights €180 · 22° · tap.pt         │
    │ 2  Ghent                           ⠿   │ ← tap here: Seville takes #2
    │    train 2h 10m · canals · 14°         │
    │ 3  Porto                           ⠿   │
    │    flights €150 · 19° · 2h 20m         │
    │ ── only your top 3 count ───────────── │
    │ ┌▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┐ │
    │ │● Seville                        ⠿  │ │ ← picked up
    │ │  flights €160 · 27°                │ │
    │ └▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┘ │
    │ –  Copenhagen                      ⠿   │ ← full contrast; only the number goes
    │ –  Bruges                          ⠿   │
    │ –  Valencia                        ⠿   │
    │ …  8 more rows, each 44–64px           │
    │                                        │
    │ Tap where Seville should go · Cancel   │ ← stands in for the action row
    ╰────────────────────────────────────────╯
     after the tap:
     1 Lisbon · 2 Seville · 3 Ghent ── only your top 3 count ── – Porto · – Copenhagen …
     live: "Seville moved to 2 of 3. Porto dropped below the top 3."
    

    Desktop, pending (one line per row):

    │ Which 3 would you actually book?                                                   │
    │                                                                                    │
    │ 1  Lisbon · 3 nights           flights €180 · 22° · 2h 40m        tap.pt        ⠿  │
    │ 2  Ghent                       train 2h 10m · canals · 14°                      ⠿  │
    │ 3  Porto                       flights €150 · 19° · 2h 20m                      ⠿  │
    │ ── only your top 3 count ───────────────────────────────────────────────────────── │
    │ –  Seville                     flights €160 · 27°                               ⠿  │
    │ –  Copenhagen                  flights €210 · 12°                               ⠿  │
    │ –  Bruges                      train 2h 30m · 13°                               ⠿  │
    │ …  12 rows · 44px each                                                             │
    │                                                                                    │
    │ space pick up · ↑↓ move · 1–9 place                  Dismiss   Keep this order    │
    

    Answered, both widths:

    ╭────────────────────────────────────────╮
    │ ✓  ANSWERED · TOP 3 CHOSEN             │
    │ Which 3 would you actually book?       │
    │ ┌────────────────────────────────────┐ │
    │ │ 1  Lisbon · 3 nights               │ │
    │ │ 2  Seville                         │ │
    │ │ 3  Ghent                           │ │
    │ │ ── only the top 3 counted ──────── │ │
    │ │ ▸ 12 not ranked                    │ │ ← opens the rest, in the agent's order
    │ │ you chose 3 · 1m ago               │ │
    │ └────────────────────────────────────┘ │
    ╰────────────────────────────────────────╯
    

    10.5 The keyboard path (desktop) and the tap-only path (320px)

    Desktop keyboard. The goal is A B C D E → C A E B D. Porto (C) is at 3.

    focus row 3 (Porto) ──── press 1 ──────────────→ Porto moves to 1
       live: "Porto moved to 1 of 5"               1 Porto  2 Lisbon  3 Ghent  4 Copenhagen  5 Sintra
    press j j j j → focus Sintra (5) ── press 3 ──→ Sintra moves to 3
       live: "Sintra moved to 3 of 5"              1 Porto  2 Lisbon  3 Sintra  4 Ghent  5 Copenhagen
    Tab → Submit order ── Enter                    focus → composer
    

    That's 7 keys, with no pick-up needed for jumps. The same thing by
    pick-up: Space ↑ ↑ Space for Porto, then j j j j Space ↑ ↑ Space for
    Sintra.

    │ 1  Porto                       flights €150 · 19° · 2h 20m                      ⠿  │
    │ 2  Lisbon · 3 nights           flights €180 · 22° · 2h 40m        tap.pt        ⠿  │
    │┏3  Sintra & Cascais, with the  car · 2 nights                                   ⠿ ┓│ ← focus ring
    │┗   coast road back                                                                ┛│
    │ 4  Ghent                       train 2h 10m · canals · 14°                      ⠿  │
    │ 5  Copenhagen                  flights €210 · 12°                               ⠿  │
    │                                                                                    │
    │ space pick up · ↑↓ move · 1–5 place       Dismiss   Reset   Submit order          │
    

    320px tap-only, the same goal in 4 taps:

     tap Porto      → ● Porto (picked up)        action row: Tap where Porto should go · Cancel
     tap Lisbon (1) → 1 Porto · 2 Lisbon · 3 Ghent · 4 Copenhagen · 5 Sintra
     tap Sintra     → ● Sintra
     tap Ghent (3)  → 1 Porto · 2 Lisbon · 3 Sintra · 4 Ghent · 5 Copenhagen
                      action row: Dismiss · Reset · Submit order
    

    11. Tokens and themes

    Everything comes from the kit (D39). The card, head and answered well are
    AskUserCard's. Rows sit on surface. The picked-up row is raised with
    an inset 0 0 0 1px accent hairline and the kit's drop shadow; there's no
    border (D34). The handle grip is ink-mute, and ink on hover through
    .bk-control:hover. The cutoff rule is a line-colour hairline with an
    ink-dim label. Below-cutoff rows keep body ink (no opacity, D35). Light
    and dark come from the same tokens, and the FourStates opacity sweep
    extends to the new stories.

    12. Acceptance criteria

    1. One header and one action row per exchange at every N, and the pick-up hint replaces the action row rather than adding one.
    2. Every row can be moved with taps alone: tap it, then tap its target.
    3. The handle alone has touch-action: none. A touch on the row body scrolls the transcript.
    4. Dragging never scrolls the page past the card, and never triggers pull-to-refresh (checked on Android Chrome and iOS Safari).
    5. Edge autoscroll stops once the card's edge is in view.
    6. pointercancel / Esc restores the row's original position and announces it.
    7. Handle reach is ≥ 44 × row height, with no border, and it never overlaps the link's reach.
    8. 320px shows no horizontal scroll at 5 and at 15 items.
    9. Labels never truncate. Detail clamps at 2 lines only when the row has a link.
    10. Below-cutoff rows keep full contrast and show – in the gutter.
    11. A move across the cutoff announces the row that dropped below.
    12. An untouched Submit reads "Keep this order" and returns unchanged: true. The label follows order equality, not whether anything was touched. After a change it reads "Submit order", and Reset appears.
    13. Reset restores the agent's order and offers Undo.
    14. Row names carry label + position + state. Handle names start with "Reorder".
    15. Every drop is announced once, as "{label} moved to {n} of {N}".
    16. Keys: arrows/j k move focus, Space/Enter pick up and drop, Alt+↑↓ nudge, 1–9 place, and Esc cancels.
    17. Hints print only under (any-pointer: fine), and the Settings switch turns off letters and digits.
    18. The answered header distinguishes "RANKED N" from "KEPT BRAIN'S ORDER".
    19. From 8 items, the answered card shows the top rows and a disclosure for the rest.
    20. After Submit, focus goes to the composer.
    21. With a cutoff, the response still lists every id in order.
    22. Reload rebuilds the answered list, and its header, from order and unchanged.

    13. Kit and story work

  5. added
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    and removed
    needs: designBlocked on a design drop or a visual answer.
    on Sep 29, 2026
  6. self-assigned this
    on Sep 30, 2026
  7. schlessera commented on Sep 30, 2026

    @schlessera
    OwnerAuthor

    Claiming #584 for a dedicated work-issue run. Claim token: 584-01a0f278. Intended branch: feat/584-ask-user-rank-01a0f278. I will verify the current citations, shared list-card anatomy and mobile verification requirements before implementation; other checkouts remain untouched.

  8. added
    contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.
    on Sep 30, 2026
  9. schlessera commented on Sep 30, 2026

    @schlessera
    OwnerAuthor

    Readiness checked on a01c3895: #583 is shipped, #541 is closed, and #585 retains ranking as a standalone tool. The body now carries current citations and the posted tap/drag/keyboard design. Composer sends stay ordinary messages, consistent with the existing list/group exchange; no order is inferred from prose. The handler will require a complete permutation of the requested IDs and derive unchanged from equality with the initial order, rather than trusting a client claim. Real Android Chrome/iOS Safari checks, the phone/agent exercise and live schema token measurement remain required verification; independent implementation and keyless checks proceed first.

  10. added
    needs: humanWaiting on an action only a human can perform. State the required action in the issue.
    and removed
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Sep 30, 2026
  11. removed their assignment
    on Sep 30, 2026
  12. schlessera commented on Sep 30, 2026

    @schlessera
    OwnerAuthor

    Merged PR #721 as 35fb78d40542426b9bac4a1c3a2a32cf43803837; verified on main. Final head cf40fce9 passed all ten CI jobs plus contract/project checks: 7,862 Bun passes / 45 skips / zero failures and 1,634 browser passes. The merged implementation and test files match the tested tree; its only additional change is main’s README-only PR #723.

    The ranked-input contract, both backends, host/socket exchange, card/binding, replay, keyboard/touch paths, API reports, shared rating/ranking text anatomy, and minor changeset are complete. Free live schema count is recorded in the PR: rank 597 tokens, brief 54; all seven always-loaded tools 10,322, briefs 792.

    Keeping #584 open with needs: human, removing agent-ready, and releasing claim 584-01a0f278. The body now specifies the remaining Android Chrome/iOS Safari scrolling/cancellation checks and the authorized live phone-agent exercise, with exact completion evidence. These requirements have not been waived. Follow-ups #719, #724 and #725 retain the unrelated findings.

  13. schlessera commented on Oct 1, 2026

    @schlessera
    OwnerAuthor

    2026-10-01 triage — Refreshed the ordinary ask_user input-schema anchor. Ranked-input implementation is present at the inspected main SHA; physical Android/iOS and live phone-agent checks remain required, with their criteria unchecked. Source inspected at main 35fb78d40542426b9bac4a1c3a2a32cf43803837.

  14. schlessera commented on Oct 1, 2026

    @schlessera
    OwnerAuthor

    2026-10-01 triage: repaired the moved ask_user schema/option/answer pointers against main 0c0c9dfb. Clarified that the recorded seven-tool token count is historical now that PR #749 adds the independent form tool. No phone or live-agent receipt has appeared; needs: human and the full remaining verification stay in place.

  15. schlessera commented on Oct 1, 2026

    @schlessera
    OwnerAuthor

    2026-10-01 triage at d9e64c9e40e8eab45e60197603c785b416725ff7: Repaired the existing unordered ask_user answer description. The ranking implementation is delivered; required physical-device/live-agent receipts remain needs: human.

  16. schlessera commented on Oct 1, 2026

    @schlessera
    OwnerAuthor

    2026-10-01 triage at main 3f0870d5338c9139f9bb53050847c23974662a00: repaired the ordinary multi-select answer-semantics citation. The ranked tool is delivered; its physical Android/iOS and phone-agent receipts remain required under needs: human. Historical schema measurements stay dated.

  17. schlessera commented on Oct 6, 2026

    @schlessera
    OwnerAuthor

    Physical-device verification: Android Chrome

    Run on an Android phone in Chrome, against a live agent session in the hosted PWA.

    Check 1: touch drag on a fifteen-item card

    • Dragging a handle toward both transcript edges: scrolling stops at the card edge, no pull-to-refresh. Pass
    • Cancelling a moved row restores the prior order. Pass

    Check 2: live agent, five fictional weekend trips

    Round Action Result
    1 Dragged two, tapped one into place, submitted order = canal, glacier, treehouse, lighthouse, vineyard, unchanged: false; agent reply restated exactly that order. Pass
    2 Submitted starting order untouched order = starting order, unchanged: true. Pass
    3 cutoff: 2 Cutoff line shown after position 2; response listed all 5 ids, unchanged: false. Pass

    Also observed: dismissing a card returns User dismissed to the agent.

    Remaining

    • iOS Safari run of both checks.
  18. schlessera commented on Oct 6, 2026

    @schlessera
    OwnerAuthor

    Closing with Android Chrome as the accepted physical-device platform: it is the primary target, and every check in the Required human verification section passed there (see the comment above). An iOS Safari run is waived for now; reopen or file a follow-up if an iOS-specific problem shows up.

  19. added this to the 0.40.0 milestone on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: backendsAgentBackend implementations and the seam they share.area: ui-kitThe presentational design kit: components, tokens, Storybook, visual baselines.area: ui-reactReact chat/files/voice components, stores, WebSocket transport.area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.needs: humanWaiting on an action only a human can perform. State the required action in the issue.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: featA new capability or a change in user-visible behaviour.

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions