Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Let touch reach the message tools and close buttons

Fei241155a3f93c15c1
diff --git a/ds-bot/client.js b/ds-bot/client.js
index fa723c0f..a3f5ab8d 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -1965,6 +1965,7 @@ function runStatsOf(values) {
// src/client/motion.js
var import_react = require("react");
var reducedMotion = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
+var noHover = () => window.matchMedia?.("(hover: none)").matches === true;
function springEasing(stiffness, damping) {
const w0 = Math.sqrt(stiffness);
const zeta = damping / (2 * w0);
@@ -3123,6 +3124,17 @@ header[class*="_header"] .bt-head{flex:1 1 auto;width:100%}
.bt-voice{display:none;background:var(--bt-accent);color:var(--bt-accent-ink,#fff);animation:bt-icon-swap ${SPRING_POP.duration}ms ${SPRING_POP.easing}}
.bt-voice:hover{opacity:.9}
.bt-mic:active,.bt-voice:active{scale:.9}
+/* Touch devices never hover: tap-open toolbars (data-open on the message), always
+ visible icon buttons and 44px targets replace the hover affordances. */
+@media (hover:none){
+ .bt-tools{left:auto;right:4px;margin-left:0;border-radius:999px;padding:2px;background:var(--bt-card);box-shadow:inset 0 0 0 .5px var(--bt-line-2),0 4px 14px rgba(0,0,0,.14)}
+ .bt-tools::after{display:none}
+ .bt-tool{width:44px;height:44px}
+ .bt-menu button,.bt-menu [role=menuitem],.bt-react-strip button{min-height:44px}
+ .bt-utools[data-open]{opacity:1;visibility:visible}
+ .bt-utools button{width:44px;height:44px}
+ [data-chat-flow-kind=user] [class*="_actions"] button{width:44px;height:44px}
+}
[data-composer-card]:has(button[class*="_primary"]:disabled) .bt-voice{display:inline-grid}
body[data-bt-room] .bt-voice{display:none!important}
body[data-bt-room] [data-composer-card]:has(button[class*="_primary"]:disabled) .bt-mic:not([aria-pressed=true]){background:var(--bt-accent);color:var(--bt-accent-ink,#fff)}
@@ -3140,6 +3152,7 @@ div:has(> nav [class*="_marks"]){display:none!important}
[data-chat-flow-kind=user] [class*="_userRow"]{flex-direction:row-reverse;align-items:center;justify-content:flex-start}
[data-chat-flow-kind=user] [class*="_actions"]{display:flex!important;height:24px!important;gap:2px!important;opacity:0!important;visibility:hidden;transition:opacity .12s ease,visibility .12s!important;flex:none}
[data-chat-flow-kind=user] [class*="_userRow"]:hover [class*="_actions"],[data-chat-flow-kind=user] [class*="_userRow"]:focus-within [class*="_actions"]{opacity:1!important;visibility:visible}
+@media (hover:none){[data-chat-flow-kind=user] [class*="_actions"]{opacity:1!important;visibility:visible}}
[data-chat-flow-kind=user] [class*="_actions"] [class*="_timeStart"]{display:none}
[data-chat-flow-kind=user] [class*="_actions"] button{width:24px;height:24px;border-radius:6px;color:var(--bt-ink-2)}
[data-chat-flow-kind=user] [class*="_actions"] button:hover{background:var(--bt-hover);color:var(--bt-ink)}
@@ -4975,9 +4988,16 @@ function Bubble({ text, index, roster, selfId, actions, sessionId, msgKey, menti
const { shown, folded, control } = useFold(text, { limit: fold, whole, live });
const key = msgKey ? `${msgKey}:${index}` : void 0;
const body = (0, import_react9.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: linkMentions(shown, roster.bots, selfId), streaming: live, labels: mdLabels2(), variant: "compact", fileMentions: mentions });
+ const row = (0, import_react9.useRef)(null);
+ const [toolsOpen, setToolsOpen] = (0, import_react9.useState)(false);
+ useDismiss(toolsOpen, () => setToolsOpen(false), [row]);
+ const tapTools = (event) => {
+ if (!noHover() || event.target instanceof Element && event.target.closest("a,button,input,textarea,select,pre,code,[role=button],[role=link]")) return;
+ setToolsOpen((value) => !value);
+ };
return (0, import_react9.createElement)(
"div",
- { className: "bt-msg" },
+ { ref: row, className: "bt-msg", onClick: tapTools },
(0, import_react9.createElement)(
"div",
{ className: "bt-msg-line" },
@@ -4988,7 +5008,7 @@ function Bubble({ text, index, roster, selfId, actions, sessionId, msgKey, menti
control ? (0, import_react9.createElement)("div", { className: "bt-fold-body" }, body) : body,
control
),
- live ? null : (0, import_react9.createElement)(MessageTools, { text: folded ? text : shown, name: roster.byId[selfId]?.name ?? t("Bot"), sessionId, react: key ? (emoji) => actions.toggleReaction(msgKey, index, emoji) : void 0, actions })
+ live ? null : (0, import_react9.createElement)(MessageTools, { text: folded ? text : shown, name: roster.byId[selfId]?.name ?? t("Bot"), sessionId, react: key ? (emoji) => actions.toggleReaction(msgKey, index, emoji) : void 0, actions, open: toolsOpen })
),
picked.length ? (0, import_react9.createElement)("div", { className: "bt-reacts" }, picked.map((emoji) => (0, import_react9.createElement)("button", {
key: emoji,
@@ -5014,14 +5034,16 @@ function useDismiss(open, close, refs) {
}
};
window.addEventListener("mousedown", onDown);
+ window.addEventListener("touchstart", onDown);
window.addEventListener("keydown", onKey, true);
return () => {
window.removeEventListener("mousedown", onDown);
+ window.removeEventListener("touchstart", onDown);
window.removeEventListener("keydown", onKey, true);
};
}, [open]);
}
-function MessageTools({ text, name, sessionId, react, actions }) {
+function MessageTools({ text, name, sessionId, react, actions, open: tapped }) {
const [panel, setPanel] = (0, import_react9.useState)(null);
const [place, setPlace] = (0, import_react9.useState)(null);
const [copied, setCopied] = (0, import_react9.useState)(false);
@@ -5057,7 +5079,7 @@ function MessageTools({ text, name, sessionId, react, actions }) {
} }, (0, import_react9.createElement)(Icon), label);
return (0, import_react9.createElement)(
"div",
- { ref: tools, className: "bt-tools", "data-open": panel !== null || void 0 },
+ { ref: tools, className: "bt-tools", "data-open": panel !== null || tapped || void 0 },
react ? (0, import_react9.createElement)("button", { type: "button", className: "bt-tool", "aria-label": t("Add reaction"), title: t("Add reaction"), "aria-expanded": panel === "react", onClick: (event) => open("react", event) }, (0, import_react9.createElement)(SmileIcon)) : null,
sessionId ? (0, import_react9.createElement)("button", { type: "button", className: "bt-tool", "aria-label": t("Reply"), title: t("Reply"), onClick: () => actions.quote(sessionId, text) }, (0, import_react9.createElement)(ReplyIcon)) : null,
(0, import_react9.createElement)("button", { type: "button", className: "bt-tool", "aria-label": t("More message actions"), title: t("More"), "aria-haspopup": "menu", "aria-expanded": panel === "more", onClick: (event) => open("more", event) }, copied ? (0, import_react9.createElement)(CheckIcon) : (0, import_react9.createElement)(DotsIcon)),
@@ -14069,8 +14091,8 @@ var BROWSER_CSS = `
.bt-ptab-globe{display:inline-flex}
.bt-ptab-globe svg{width:14px;height:14px}
.bt-ptab-title{max-width:140px;overflow:hidden;text-overflow:ellipsis}
-.bt-ptab-x{flex:none;width:16px;height:16px;border-radius:5px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;line-height:1;color:var(--bt-ink-3);opacity:0;transition:opacity .12s ease,background-color .12s ease}
-.bt-ptab:hover .bt-ptab-x,.bt-ptab[aria-selected=true] .bt-ptab-x{opacity:1}
+.bt-ptab-x{flex:none;width:16px;height:16px;border-radius:5px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;line-height:1;color:var(--bt-ink-3);opacity:0;pointer-events:none;transition:opacity .12s ease,background-color .12s ease}
+.bt-ptab:hover .bt-ptab-x,.bt-ptab[aria-selected=true] .bt-ptab-x{opacity:1;pointer-events:auto}
.bt-ptab-x:hover{background:var(--bt-active);color:var(--bt-ink)}
.bt-ptab-new{position:relative;z-index:1;flex:none;width:28px;height:32px;border:0;border-radius:9px;background:none;color:var(--bt-ink-3);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.bt-ptab-new:hover{color:var(--bt-ink)}
@@ -14120,8 +14142,8 @@ var BROWSER_CSS = `
.bt-bcard-row svg.bt-bcard-fav{width:14px;height:14px}
.bt-bcard-title{flex:1;min-width:0;font-size:12.5px;line-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--bt-ink)}
.bt-bcard-host{flex:none;font-size:11px;line-height:15px;color:var(--bt-ink-3);max-width:38%;overflow:hidden;text-overflow:ellipsis}
-.bt-bcard-x{position:absolute;top:6px;right:6px;width:22px;height:22px;border:0;border-radius:7px;background:color-mix(in srgb,var(--bt-main) 88%,transparent);color:var(--bt-ink-2);display:flex;align-items:center;justify-content:center;font-size:14px;cursor:pointer;opacity:0;transition:opacity .12s ease;backdrop-filter:blur(4px)}
-.bt-bcard:hover .bt-bcard-x{opacity:1}
+.bt-bcard-x{position:absolute;top:6px;right:6px;width:22px;height:22px;border:0;border-radius:7px;background:color-mix(in srgb,var(--bt-main) 88%,transparent);color:var(--bt-ink-2);display:flex;align-items:center;justify-content:center;font-size:14px;cursor:pointer;opacity:0;pointer-events:none;transition:opacity .12s ease;backdrop-filter:blur(4px)}
+.bt-bcard:hover .bt-bcard-x{opacity:1;pointer-events:auto}
.bt-bcard-new{display:flex;align-items:center;justify-content:center;gap:6px;height:40px;border:.5px dashed var(--bt-line-2);border-radius:12px;background:none;color:var(--bt-ink-3);font:inherit;font-size:12.5px;cursor:pointer}
.bt-bcard-new:hover{color:var(--bt-ink);border-color:var(--bt-ink-3)}
.bt-bcard-new svg{width:14px;height:14px}
@@ -14130,6 +14152,12 @@ var BROWSER_CSS = `
and its close controls get a touch-sized target. */
.bt-panel[data-overlay]{width:100vw}
.bt-panel[data-overlay] .bt-ptab-close,.bt-panel[data-overlay] .bt-drawer-top .bt-round{width:44px;height:44px}
+/* Touch: the hidden-but-tappable tab and card close buttons stay visible at a
+ finger-sized target instead. */
+@media (hover:none){
+ .bt-ptab-x,.bt-bcard-x{opacity:1;pointer-events:auto;width:44px;height:44px}
+ .bt-ptab-close{width:44px;height:44px}
+}
@media (prefers-reduced-motion:reduce){.bt-ptabs,.bt-panel-view,.bt-bcard,.bt-ptab-name{animation:none}}
`;
@@ -15085,16 +15113,34 @@ function UserMessageCell({ node, sessionId, useRoster, actions, renderMessageIma
const groupTime = roster.roomsById?.[sessionId] && Number.isFinite(data.time) ? messageClock(data.time) : void 0;
const { shown, folded, control } = useFold(text, { markdown: false });
const body = (0, import_react39.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });
+ const row = (0, import_react39.useRef)(null);
+ const [toolsOpen, setToolsOpen] = (0, import_react39.useState)(false);
+ (0, import_react39.useEffect)(() => {
+ if (!toolsOpen) return void 0;
+ const onDown = (event) => {
+ if (!row.current?.contains(event.target)) setToolsOpen(false);
+ };
+ window.addEventListener("mousedown", onDown);
+ window.addEventListener("touchstart", onDown);
+ return () => {
+ window.removeEventListener("mousedown", onDown);
+ window.removeEventListener("touchstart", onDown);
+ };
+ }, [toolsOpen]);
+ const tapTools = (event) => {
+ if (!noHover() || event.target instanceof Element && event.target.closest("a,button,input,textarea,select,pre,code,[role=button],[role=link]")) return;
+ setToolsOpen((value) => !value);
+ };
return (0, import_react39.createElement)(
"div",
- { className: "bt-umsg", "data-steering": steering || void 0 },
+ { ref: row, className: "bt-umsg", "data-steering": steering || void 0 },
(0, import_react39.createElement)(
"div",
{ className: "bt-ustack" },
attachments.length > 0 ? (0, import_react39.createElement)(Attachments, { attachments, renderMessageImages }) : null,
text !== "" || rest.length > 0 ? (0, import_react39.createElement)(
"div",
- { className: "bt-ubody", title: clock3(data.time), "data-folded": folded || void 0 },
+ { className: "bt-ubody", title: clock3(data.time), "data-folded": folded || void 0, onClick: tapTools },
control ? (0, import_react39.createElement)("div", { className: "bt-fold-body" }, body) : body,
control,
rest.map((block, index) => ui.JsonBlock ? (0, import_react39.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)
@@ -15102,7 +15148,7 @@ function UserMessageCell({ node, sessionId, useRoster, actions, renderMessageIma
referenceLabels.length > 0 ? (0, import_react39.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,
groupTime ? (0, import_react39.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, groupTime) : null
),
- text === "" ? null : (0, import_react39.createElement)("div", { className: "bt-utools" }, (0, import_react39.createElement)(CopyButton, { text }))
+ text === "" ? null : (0, import_react39.createElement)("div", { className: "bt-utools", "data-open": toolsOpen || void 0 }, (0, import_react39.createElement)(CopyButton, { text }))
);
}
var USER_MESSAGE_CSS = `
diff --git a/ds-bot/src/client/browser-pane.js b/ds-bot/src/client/browser-pane.js
index 280c618b..e7d1e95a 100644
--- a/ds-bot/src/client/browser-pane.js
+++ b/ds-bot/src/client/browser-pane.js
@@ -512,8 +512,8 @@ export const BROWSER_CSS = `
.bt-ptab-globe{display:inline-flex}
.bt-ptab-globe svg{width:14px;height:14px}
.bt-ptab-title{max-width:140px;overflow:hidden;text-overflow:ellipsis}
-.bt-ptab-x{flex:none;width:16px;height:16px;border-radius:5px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;line-height:1;color:var(--bt-ink-3);opacity:0;transition:opacity .12s ease,background-color .12s ease}
-.bt-ptab:hover .bt-ptab-x,.bt-ptab[aria-selected=true] .bt-ptab-x{opacity:1}
+.bt-ptab-x{flex:none;width:16px;height:16px;border-radius:5px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;line-height:1;color:var(--bt-ink-3);opacity:0;pointer-events:none;transition:opacity .12s ease,background-color .12s ease}
+.bt-ptab:hover .bt-ptab-x,.bt-ptab[aria-selected=true] .bt-ptab-x{opacity:1;pointer-events:auto}
.bt-ptab-x:hover{background:var(--bt-active);color:var(--bt-ink)}
.bt-ptab-new{position:relative;z-index:1;flex:none;width:28px;height:32px;border:0;border-radius:9px;background:none;color:var(--bt-ink-3);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.bt-ptab-new:hover{color:var(--bt-ink)}
@@ -563,8 +563,8 @@ export const BROWSER_CSS = `
.bt-bcard-row svg.bt-bcard-fav{width:14px;height:14px}
.bt-bcard-title{flex:1;min-width:0;font-size:12.5px;line-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--bt-ink)}
.bt-bcard-host{flex:none;font-size:11px;line-height:15px;color:var(--bt-ink-3);max-width:38%;overflow:hidden;text-overflow:ellipsis}
-.bt-bcard-x{position:absolute;top:6px;right:6px;width:22px;height:22px;border:0;border-radius:7px;background:color-mix(in srgb,var(--bt-main) 88%,transparent);color:var(--bt-ink-2);display:flex;align-items:center;justify-content:center;font-size:14px;cursor:pointer;opacity:0;transition:opacity .12s ease;backdrop-filter:blur(4px)}
-.bt-bcard:hover .bt-bcard-x{opacity:1}
+.bt-bcard-x{position:absolute;top:6px;right:6px;width:22px;height:22px;border:0;border-radius:7px;background:color-mix(in srgb,var(--bt-main) 88%,transparent);color:var(--bt-ink-2);display:flex;align-items:center;justify-content:center;font-size:14px;cursor:pointer;opacity:0;pointer-events:none;transition:opacity .12s ease;backdrop-filter:blur(4px)}
+.bt-bcard:hover .bt-bcard-x{opacity:1;pointer-events:auto}
.bt-bcard-new{display:flex;align-items:center;justify-content:center;gap:6px;height:40px;border:.5px dashed var(--bt-line-2);border-radius:12px;background:none;color:var(--bt-ink-3);font:inherit;font-size:12.5px;cursor:pointer}
.bt-bcard-new:hover{color:var(--bt-ink);border-color:var(--bt-ink-3)}
.bt-bcard-new svg{width:14px;height:14px}
@@ -573,5 +573,11 @@ export const BROWSER_CSS = `
and its close controls get a touch-sized target. */
.bt-panel[data-overlay]{width:100vw}
.bt-panel[data-overlay] .bt-ptab-close,.bt-panel[data-overlay] .bt-drawer-top .bt-round{width:44px;height:44px}
+/* Touch: the hidden-but-tappable tab and card close buttons stay visible at a
+ finger-sized target instead. */
+@media (hover:none){
+ .bt-ptab-x,.bt-bcard-x{opacity:1;pointer-events:auto;width:44px;height:44px}
+ .bt-ptab-close{width:44px;height:44px}
+}
@media (prefers-reduced-motion:reduce){.bt-ptabs,.bt-panel-view,.bt-bcard,.bt-ptab-name{animation:none}}
`
diff --git a/ds-bot/src/client/cells.js b/ds-bot/src/client/cells.js
index 88522089..19f7c705 100644
--- a/ds-bot/src/client/cells.js
+++ b/ds-bot/src/client/cells.js
@@ -13,6 +13,7 @@ import { call } from './api.js'
import { failureLabel } from './diagnostics.js'
import { turnReasoning, thinkingStep } from './turn-reasoning.js'
import { FOLD_AT, FOLD_HUGE, stripLongNote, useFold } from './fold.js'
+import { noHover } from './motion.js'
import { heldCardKey } from './sources.js'
export { clockLabel }
@@ -52,13 +53,22 @@ function Bubble({ text, index, roster, selfId, actions, sessionId, msgKey, menti
const { shown, folded, control } = useFold(text, { limit: fold, whole, live })
const key = msgKey ? `${msgKey}:${index}` : undefined
const body = h(MarkdownText, { text: linkMentions(shown, roster.bots, selfId), streaming: live, labels: mdLabels(), variant: 'compact', fileMentions: mentions })
- return h('div', { className: 'bt-msg' },
+ const row = useRef(null)
+ // Touch has no hover: a tap on the bubble opens its tools, a tap elsewhere
+ // closes them. Interactive targets keep their own meaning.
+ const [toolsOpen, setToolsOpen] = useState(false)
+ useDismiss(toolsOpen, () => setToolsOpen(false), [row])
+ const tapTools = (event) => {
+ if (!noHover() || event.target instanceof Element && event.target.closest('a,button,input,textarea,select,pre,code,[role=button],[role=link]')) return
+ setToolsOpen(value => !value)
+ }
+ return h('div', { ref: row, className: 'bt-msg', onClick: tapTools },
h('div', { className: 'bt-msg-line' },
lead,
h('div', { className: 'bt-bubble', 'data-folded': folded || undefined },
control ? h('div', { className: 'bt-fold-body' }, body) : body,
control),
- live ? null : h(MessageTools, { text: folded ? text : shown, name: roster.byId[selfId]?.name ?? t('Bot'), sessionId, react: key ? emoji => actions.toggleReaction(msgKey, index, emoji) : undefined, actions })),
+ live ? null : h(MessageTools, { text: folded ? text : shown, name: roster.byId[selfId]?.name ?? t('Bot'), sessionId, react: key ? emoji => actions.toggleReaction(msgKey, index, emoji) : undefined, actions, open: toolsOpen })),
picked.length ? h('div', { className: 'bt-reacts' }, picked.map(emoji => h('button', {
key: emoji, type: 'button', className: 'bt-react', 'aria-label': t('Remove reaction {emoji}', { emoji }), onClick: () => actions.toggleReaction(msgKey, index, emoji),
}, emoji))) : null)
@@ -76,13 +86,15 @@ function useDismiss(open, close, refs) {
}
const onKey = (event) => { if (event.key === 'Escape') { event.stopPropagation(); close() } }
window.addEventListener('mousedown', onDown)
+ window.addEventListener('touchstart', onDown)
window.addEventListener('keydown', onKey, true)
- return () => { window.removeEventListener('mousedown', onDown); window.removeEventListener('keydown', onKey, true) }
+ return () => { window.removeEventListener('mousedown', onDown); window.removeEventListener('touchstart', onDown); window.removeEventListener('keydown', onKey, true) }
}, [open])
}
-// The hover toolbar beside a reply bubble: Add reaction, Reply, More.
-function MessageTools({ text, name, sessionId, react, actions }) {
+// The hover toolbar beside a reply bubble: Add reaction, Reply, More. `open` is
+// the touch fallback: a tap on the bubble toggles it (see Bubble).
+function MessageTools({ text, name, sessionId, react, actions, open: tapped }) {
const [panel, setPanel] = useState(null)
const [place, setPlace] = useState(null)
const [copied, setCopied] = useState(false)
@@ -109,7 +121,7 @@ function MessageTools({ text, name, sessionId, react, actions }) {
setTimeout(() => URL.revokeObjectURL(url), 1000)
}
const item = (label, Icon, run) => h('button', { key: label, type: 'button', role: 'menuitem', onClick: () => { close(); run() } }, h(Icon), label)
- return h('div', { ref: tools, className: 'bt-tools', 'data-open': panel !== null || undefined },
+ return h('div', { ref: tools, className: 'bt-tools', 'data-open': panel !== null || tapped || undefined },
react ? h('button', { type: 'button', className: 'bt-tool', 'aria-label': t('Add reaction'), title: t('Add reaction'), 'aria-expanded': panel === 'react', onClick: event => open('react', event) }, h(SmileIcon)) : null,
sessionId ? h('button', { type: 'button', className: 'bt-tool', 'aria-label': t('Reply'), title: t('Reply'), onClick: () => actions.quote(sessionId, text) }, h(ReplyIcon)) : null,
h('button', { type: 'button', className: 'bt-tool', 'aria-label': t('More message actions'), title: t('More'), 'aria-haspopup': 'menu', 'aria-expanded': panel === 'more', onClick: event => open('more', event) }, copied ? h(CheckIcon) : h(DotsIcon)),
diff --git a/ds-bot/src/client/motion.js b/ds-bot/src/client/motion.js
index ad48ad56..a7adc1dc 100644
--- a/ds-bot/src/client/motion.js
+++ b/ds-bot/src/client/motion.js
@@ -1,6 +1,8 @@
import { createElement as h, useEffect, useLayoutEffect, useRef, useState } from 'react'
export const reducedMotion = () => window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true
+// Touch devices never hover: controls revealed on hover need a tap path instead.
+export const noHover = () => window.matchMedia?.('(hover: none)').matches === true
// A damped spring (mass 1) sampled into a CSS linear() easing, for WAAPI glides
// and CSS transitions alike.
diff --git a/ds-bot/src/client/styles.js b/ds-bot/src/client/styles.js
index c42048a5..aae4c145 100644
--- a/ds-bot/src/client/styles.js
+++ b/ds-bot/src/client/styles.js
@@ -969,6 +969,17 @@ header[class*="_header"] .bt-head{flex:1 1 auto;width:100%}
.bt-voice{display:none;background:var(--bt-accent);color:var(--bt-accent-ink,#fff);animation:bt-icon-swap ${SPRING_POP.duration}ms ${SPRING_POP.easing}}
.bt-voice:hover{opacity:.9}
.bt-mic:active,.bt-voice:active{scale:.9}
+/* Touch devices never hover: tap-open toolbars (data-open on the message), always
+ visible icon buttons and 44px targets replace the hover affordances. */
+@media (hover:none){
+ .bt-tools{left:auto;right:4px;margin-left:0;border-radius:999px;padding:2px;background:var(--bt-card);box-shadow:inset 0 0 0 .5px var(--bt-line-2),0 4px 14px rgba(0,0,0,.14)}
+ .bt-tools::after{display:none}
+ .bt-tool{width:44px;height:44px}
+ .bt-menu button,.bt-menu [role=menuitem],.bt-react-strip button{min-height:44px}
+ .bt-utools[data-open]{opacity:1;visibility:visible}
+ .bt-utools button{width:44px;height:44px}
+ [data-chat-flow-kind=user] [class*="_actions"] button{width:44px;height:44px}
+}
[data-composer-card]:has(button[class*="_primary"]:disabled) .bt-voice{display:inline-grid}
body[data-bt-room] .bt-voice{display:none!important}
body[data-bt-room] [data-composer-card]:has(button[class*="_primary"]:disabled) .bt-mic:not([aria-pressed=true]){background:var(--bt-accent);color:var(--bt-accent-ink,#fff)}
@@ -986,6 +997,7 @@ div:has(> nav [class*="_marks"]){display:none!important}
[data-chat-flow-kind=user] [class*="_userRow"]{flex-direction:row-reverse;align-items:center;justify-content:flex-start}
[data-chat-flow-kind=user] [class*="_actions"]{display:flex!important;height:24px!important;gap:2px!important;opacity:0!important;visibility:hidden;transition:opacity .12s ease,visibility .12s!important;flex:none}
[data-chat-flow-kind=user] [class*="_userRow"]:hover [class*="_actions"],[data-chat-flow-kind=user] [class*="_userRow"]:focus-within [class*="_actions"]{opacity:1!important;visibility:visible}
+@media (hover:none){[data-chat-flow-kind=user] [class*="_actions"]{opacity:1!important;visibility:visible}}
[data-chat-flow-kind=user] [class*="_actions"] [class*="_timeStart"]{display:none}
[data-chat-flow-kind=user] [class*="_actions"] button{width:24px;height:24px;border-radius:6px;color:var(--bt-ink-2)}
[data-chat-flow-kind=user] [class*="_actions"] button:hover{background:var(--bt-hover);color:var(--bt-ink)}
diff --git a/ds-bot/src/client/user-message.js b/ds-bot/src/client/user-message.js
index 95d1c56c..ecf0cc88 100644
--- a/ds-bot/src/client/user-message.js
+++ b/ds-bot/src/client/user-message.js
@@ -1,9 +1,10 @@
-import { createElement as h, Fragment, useState } from 'react'
+import { createElement as h, Fragment, useEffect, useRef, useState } from 'react'
import * as ui from '@deepseek-ai/dsh-client-ui-primitives'
import { mentionSpans } from '../shared/mentions.js'
import { BotMark } from './mark.js'
import { CheckIcon, CopyIcon } from './icons.js'
import { dateLocale, t } from './i18n.js'
+import { noHover } from './motion.js'
import { clockLabel, messageClock } from './text.js'
import { useFold } from './fold.js'
@@ -92,16 +93,30 @@ export function UserMessageCell({ node, sessionId, useRoster, actions, renderMes
const groupTime = roster.roomsById?.[sessionId] && Number.isFinite(data.time) ? messageClock(data.time) : undefined
const { shown, folded, control } = useFold(text, { markdown: false })
const body = h(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions })
- return h('div', { className: 'bt-umsg', 'data-steering': steering || undefined },
+ const row = useRef(null)
+ // Touch has no hover: a tap on the bubble opens its copy tool, a tap elsewhere closes it.
+ const [toolsOpen, setToolsOpen] = useState(false)
+ useEffect(() => {
+ if (!toolsOpen) return undefined
+ const onDown = (event) => { if (!row.current?.contains(event.target)) setToolsOpen(false) }
+ window.addEventListener('mousedown', onDown)
+ window.addEventListener('touchstart', onDown)
+ return () => { window.removeEventListener('mousedown', onDown); window.removeEventListener('touchstart', onDown) }
+ }, [toolsOpen])
+ const tapTools = (event) => {
+ if (!noHover() || event.target instanceof Element && event.target.closest('a,button,input,textarea,select,pre,code,[role=button],[role=link]')) return
+ setToolsOpen(value => !value)
+ }
+ return h('div', { ref: row, className: 'bt-umsg', 'data-steering': steering || undefined },
h('div', { className: 'bt-ustack' },
attachments.length > 0 ? h(Attachments, { attachments, renderMessageImages }) : null,
- text !== '' || rest.length > 0 ? h('div', { className: 'bt-ubody', title: clock(data.time), 'data-folded': folded || undefined },
+ text !== '' || rest.length > 0 ? h('div', { className: 'bt-ubody', title: clock(data.time), 'data-folded': folded || undefined, onClick: tapTools },
control ? h('div', { className: 'bt-fold-body' }, body) : body,
control,
rest.map((block, index) => (ui.JsonBlock ? h(ui.JsonBlock, { key: index, label: t('Content'), payload: block }) : null))) : null,
referenceLabels.length > 0 ? h('div', { className: 'bt-urefs' }, t('Referenced {labels}', { labels: referenceLabels.join(t(', ')) })) : null,
groupTime ? h('div', { className: 'bt-utime', title: clockLabel(data.time) }, groupTime) : null),
- text === '' ? null : h('div', { className: 'bt-utools' }, h(CopyButton, { text })))
+ text === '' ? null : h('div', { className: 'bt-utools', 'data-open': toolsOpen || undefined }, h(CopyButton, { text })))
}
export const USER_MESSAGE_CSS = `