Skip to content

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

Polish settings layout, glass popovers, spring physics, and sidebar subscriptions

Fei24116059762c299a
diff --git a/ds-bot/client.js b/ds-bot/client.js
index 6f243504..1f4ad0d4 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -107,6 +107,7 @@ var ZH = {
"Add capability": "添加能力",
"No capabilities saved": "还没有保存能力",
Type: "类型",
+ Description: "说明",
"MCP server": "MCP 服务",
Skill: "技能",
Pack: "能力包",
@@ -1664,7 +1665,7 @@ function teamActions({ call: call2, after, partFor, roster, ui: ui2, live, cards
setFlags: (id, flags) => after(call2("set-flags", { id, ...flags })),
deleteRoom: (id) => after(call2("delete-room", { id })),
openMenu: (menu) => {
- ui2.set((state) => ({ ...state, menu }));
+ ui2.set((state) => ({ ...state, menu, palette: null }));
},
closeMenu: () => {
ui2.set((state) => state.menu ? { ...state, menu: null } : state);
@@ -2218,20 +2219,21 @@ var SPRING_STRETCH = springEasing(320, 20);
var SPRING_POP = springEasing(500, 22);
var SPRING_LEAD = springEasing(784, 48.2);
var SPRING_TRAIL = springEasing(289, 29.2);
+var SPRING_GLIDE = springEasing(1e3, 63);
var QUICK_EDGES = { lead: springEasing(900, 51), trail: springEasing(400, 34) };
var spring = (curve, ...properties) => properties.map((property) => `${property} ${curve.duration}ms ${curve.easing}`).join(",");
function liveSprings(apply2) {
const values = /* @__PURE__ */ new Map();
+ const current = {};
let frame = 0;
let last = 0;
- const read = () => Object.fromEntries([...values].map(([key, value]) => [key, value.x]));
const step = (now) => {
const dt = Math.min(0.5, Math.max(1e-3, (now - last) / 1e3));
last = now;
const steps = Math.ceil(dt * 240);
const h50 = dt / steps;
let moving = false;
- for (const value of values.values()) {
+ for (const [key, value] of values) {
for (let index = 0; index < steps; index += 1) {
value.v += (-value.k * (value.x - value.to) - value.c * value.v) * h50;
value.x += value.v * h50;
@@ -2240,23 +2242,31 @@ function liveSprings(apply2) {
value.x = value.to;
value.v = 0;
} else moving = true;
+ current[key] = value.x;
}
- apply2(read());
+ apply2(current);
frame = moving ? requestAnimationFrame(step) : 0;
};
return {
- target: () => values.size ? Object.fromEntries([...values].map(([key, value]) => [key, value.to])) : null,
+ target: () => {
+ if (!values.size) return null;
+ const out = {};
+ for (const [key, value] of values) out[key] = value.to;
+ return out;
+ },
set(targets, curves, jump) {
for (const [key, to] of Object.entries(targets)) {
const value = values.get(key);
const { stiffness: k, damping: c } = curves[key];
- if (!value || jump) values.set(key, { x: to, v: 0, to, k, c });
- else Object.assign(value, { to, k, c });
+ if (!value || jump) {
+ values.set(key, { x: to, v: 0, to, k, c });
+ current[key] = to;
+ } else Object.assign(value, { to, k, c });
}
if (jump) {
cancelAnimationFrame(frame);
frame = 0;
- apply2(read());
+ apply2(current);
return;
}
if (!frame) {
@@ -2402,6 +2412,17 @@ function useLinger(value, ms) {
}, [value]);
return [value || kept, !value && Boolean(kept)];
}
+function stepMenuFocus(menu, event) {
+ if (!menu || !["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return false;
+ const items = Array.from(menu.querySelectorAll('button[role^="menuitem"]:not(:disabled)'));
+ if (items.length === 0) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ const current = items.indexOf(document.activeElement);
+ const next = event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : event.key === "ArrowDown" ? (current + 1) % items.length : current <= 0 ? items.length - 1 : current - 1;
+ items[next]?.focus();
+ return true;
+}
// src/client/styles.js
var SHELL_CSS = `
@@ -2724,7 +2745,7 @@ button.bt-q-opt:active{background:var(--bt-active)}
.bt-admin-star{flex:none;display:inline-flex;align-items:center;justify-content:center;width:12px;height:12px;border-radius:50%;corner-shape:round;background:color-mix(in srgb,var(--bt-star) 82%,var(--bt-sidebar));vertical-align:-1px}
.bt-to-star{display:inline-flex;margin-right:-2px;animation:bt-check-pop ${SPRING_POP.duration}ms ${SPRING_POP.easing}}
.bt-to .bt-to-create{flex:none;height:28px;padding:0 12px;font-size:13px;animation:bt-q-submit-in ${SPRING_TAP.duration}ms ${SPRING_TAP.easing},bt-veil-in .16s ease-out}
-.bt-drop{position:absolute;top:48px;left:32px;width:min(550px,calc(100% - 64px));display:flex;flex-direction:column;padding:6px;max-height:min(420px,60vh);overflow-y:auto;background:var(--bt-card);border:1px solid var(--bt-line-2);border-radius:12px;box-shadow:0 6px 20px -4px rgba(0,0,0,.12);box-sizing:border-box;z-index:1;transform-origin:24px 0;animation:bt-pop-drop ${SPRING_TAP.duration}ms ${SPRING_TAP.easing},bt-veil-in .14s ease-out}
+.bt-drop{position:absolute;top:48px;left:32px;width:min(550px,calc(100% - 64px));display:flex;flex-direction:column;padding:6px;max-height:min(420px,60vh);overflow-y:auto;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);border-radius:12px;box-shadow:var(--bt-glass-shadow);box-sizing:border-box;z-index:1;transform-origin:24px 0;animation:bt-pop-drop ${SPRING_TAP.duration}ms ${SPRING_TAP.easing},bt-veil-in .14s ease-out}
.bt-option{display:flex;align-items:center;gap:10px;border:0;background:none;border-radius:8px;padding:7px 8px;min-height:36px;box-sizing:border-box;font-size:13px;line-height:18px;color:var(--bt-ink);cursor:pointer;text-align:left;width:100%}
.bt-option[aria-selected=true]{background:var(--bt-active)}
.bt-drop-list>.bt-option:not([aria-selected=true]):hover{background:var(--bt-hover)}
@@ -2825,10 +2846,10 @@ html[data-windows-titlebar]:not([data-fullscreen]) :is(.bt-pane,.bt-panel)::befo
.bt-drawer-name-input{font-size:17px;line-height:24px;text-align:center;border:.5px solid var(--bt-line-2);border-radius:6px;padding:0 6px;background:var(--bt-main);color:var(--bt-ink);outline:none;font-weight:500}
.bt-drawer-role{font-size:12px;line-height:16px;color:var(--bt-ink-3);margin-top:6px;text-align:center}
.bt-tabs{position:relative;display:flex;justify-content:center;gap:2px;margin:16px 16px 0}
-.bt-tab{position:relative;z-index:1;border:0;background:none;border-radius:9999px;padding:4px 8px;font-size:13px;line-height:20px;color:var(--bt-ink-2);cursor:pointer;white-space:nowrap}
+.bt-tab{position:relative;z-index:1;border:0;background:none;border-radius:999px;padding:4px 8px;font-size:13px;line-height:20px;color:var(--bt-ink-2);cursor:pointer;white-space:nowrap}
.bt-tab:hover{color:var(--bt-ink)}
.bt-tab[aria-selected=true]{background:var(--bt-hover);color:var(--bt-ink)}
-.bt-tabs>.bt-thumb{top:0;bottom:0;border-radius:9999px;background:var(--bt-hover)}
+.bt-tabs>.bt-thumb{top:0;bottom:0;border-radius:999px;background:var(--bt-hover)}
.bt-tabs[data-glide] .bt-tab[aria-selected=true]{background:transparent}
.bt-drawer-body{flex:1;overflow-y:auto;padding:20px 16px 16px;font-size:13px;line-height:18px;display:flex;flex-direction:column;gap:16px}
.bt-empty{text-align:center;color:var(--bt-ink-3);font-size:13px;line-height:18px;padding:8px 12px}
@@ -2858,6 +2879,7 @@ html[data-windows-titlebar]:not([data-fullscreen]) :is(.bt-pane,.bt-panel)::befo
.bt-avatar-trigger{position:relative;width:64px;height:64px;border:0;border-radius:50%;background:none;cursor:pointer;padding:0}
.bt-avatar-pencil{position:absolute;right:-2px;bottom:-2px;width:22px;height:22px;border-radius:50%;background:var(--bt-main);border:1px solid var(--bt-line-2);color:var(--bt-ink-2);display:flex;align-items:center;justify-content:center;box-shadow:0 1px 4px rgba(0,0,0,.12)}
.bt-avedit{position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);width:288px;box-sizing:border-box;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);border-radius:16px;box-shadow:var(--bt-glass-shadow),0 16px 40px rgba(0,0,0,.16);padding:12px;z-index:70;display:flex;flex-direction:column;gap:12px;color:var(--bt-ink);transform-origin:top center;animation:bt-pop-drop ${SPRING_TAP.duration}ms ${SPRING_TAP.easing},bt-veil-in .16s ease-out}
+.bt-avedit[data-leaving]{animation:bt-pop-out .12s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}
.bt-bs .bt-avedit{transform-origin:32px 0}
.bt-avedit-top{display:flex;align-items:center;justify-content:space-between}
.bt-avedit-tabs{position:relative;display:flex;gap:2px;background:var(--bt-hover);border-radius:999px;padding:2px}
@@ -2936,7 +2958,9 @@ body[data-ds-dark-theme] .bt-scrim{background:rgba(0,0,0,.5)}
.bt-settings-close{position:absolute;top:12px;right:12px;width:32px;height:32px;border-radius:50%;border:0;background:var(--bt-hover);color:var(--bt-ink-2);display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
.bt-settings-close:hover{background:var(--bt-active);color:var(--bt-ink)}
.bt-settings-form{display:flex;flex-direction:column;gap:16px}
-.bt-set-section h3{font-size:13px;line-height:18px;font-weight:600;margin:0 0 8px;padding:0 4px}
+.bt-set-section{display:flex;flex-direction:column;gap:10px}
+.bt-set-section>h3{font-size:13px;line-height:18px;font-weight:600;margin:0 0 -2px;padding:0 4px}
+.bt-browser-settings{display:flex;flex-direction:column;gap:20px}
.bt-set-card{border:1px solid var(--bt-line);border-radius:12px;background:var(--bt-card);display:flex;flex-direction:column}
.bt-set-card>*+*{border-top:.5px solid var(--bt-line)}
.bt-set-row{display:flex;align-items:center;gap:12px;padding:10px 12px;border:0;background:none;color:var(--bt-ink);font:inherit;font-size:13px;line-height:18px;text-align:left;width:100%;box-sizing:border-box;border-radius:0}
@@ -3102,7 +3126,7 @@ button:hover .bt-you{background:color-mix(in srgb,var(--bt-ink) 9%,var(--bt-side
.bt-menu-hint{flex:none;color:var(--bt-ink-3);font-size:12px;font-variant-numeric:tabular-nums}
.bt-palette-layer{position:fixed;inset:var(--dsh-frame-chrome-top,0px) 0 0;z-index:70;pointer-events:auto;font-family:var(--bt-font)}
.bt-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.46);animation:bt-fade .22s ease-out}
-.bt-palette{position:absolute;top:50%;left:50%;width:min(560px,92vw);transform:translate(-50%,-50%);display:flex;flex-direction:column;border-radius:12px;background:var(--bt-main);border:1px solid var(--bt-line-2);box-shadow:0 24px 48px -12px rgba(0,0,0,.25);overflow:hidden;color:var(--bt-ink);animation:bt-palette-in ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing},bt-veil-in .2s ease-out}
+.bt-palette{position:absolute;top:50%;left:50%;width:min(560px,92vw);transform:translate(-50%,-50%);display:flex;flex-direction:column;border-radius:16px;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(28px) saturate(180%);backdrop-filter:blur(28px) saturate(180%);border:.5px solid var(--bt-glass-rim);box-shadow:var(--bt-glass-shadow);overflow:hidden;color:var(--bt-ink);animation:bt-palette-in ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing},bt-veil-in .2s ease-out}
.bt-palette-layer[data-leaving]{pointer-events:none}
.bt-palette-layer[data-leaving] .bt-backdrop{opacity:0;transition:opacity .16s ease-in}
.bt-palette-layer[data-leaving] .bt-palette{animation:bt-dialog-sink .16s cubic-bezier(.4,0,1,1) forwards}
@@ -3156,7 +3180,10 @@ button:hover .bt-you{background:color-mix(in srgb,var(--bt-ink) 9%,var(--bt-side
.bt-pick[aria-pressed=true]{border-color:var(--bt-line-2);background:var(--bt-hover)}
.bt-pick>span:last-child:not(.bt-mark){max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bt-pick:hover .bt-mark[data-state=idle] .bt-eye{animation:bt-blink .5s linear 1}
-.bt-select{width:100%;height:34px;box-sizing:border-box;border-radius:8px;border:1px solid var(--bt-line);background:var(--bt-card);color:var(--bt-ink);padding:0 8px;font:inherit;font-size:13px}
+.bt-select{width:100%;height:34px;box-sizing:border-box;border-radius:8px;border:1px solid var(--bt-line);background:var(--bt-card);color:var(--bt-ink);padding:0 8px;font:inherit;font-size:13px;outline:none}
+:is(.bt-input,.bt-select,.bt-textarea):focus-visible{border-color:var(--bt-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--bt-accent) 22%,transparent)}
+:is(.bt-round,.bt-icon-btn,.bt-soft,.bt-send,.bt-mini,.bt-pill,.bt-plus,.bt-mic,.bt-voice,.bt-account,.bt-title-toggle,.bt-settings-close,.bt-avatar-trigger,.bt-shape,.bt-color,.bt-swatch,.bt-pick,.bt-more,.bt-mem-row,.bt-mem-send):focus-visible{outline:2px solid var(--bt-accent);outline-offset:2px}
+:is(.bt-row,.bt-tile,.bt-tab,.bt-avedit-tab,.bt-settings-item,.bt-menu button,.bt-option,.bt-palette-row,button.bt-set-row):focus-visible{outline:2px solid var(--bt-accent);outline-offset:-2px}
.bt-note{font-size:12px;line-height:16px;color:var(--bt-ink-2);margin-top:6px}
.bt-swatch-sep{width:1px;height:22px;background:var(--bt-line-2);margin:0 2px}
.bt-swatch-custom{position:relative;overflow:hidden;background:conic-gradient(#ff3e51,#ffaf38,#00c972,#1cc3b0,#2a92fe,#a97efe,#ff5eb1,#ff3e51);box-sizing:border-box}
@@ -3693,7 +3720,7 @@ var botState = (running, activity, alert) => running ? STATES.includes(activity)
var toolState = (name) => /^(message_bot|stop_bot|create_bot|update_bot|create_group|update_group|delete_group|post_to_group)$/.test(name) ? "sending" : /search|fetch|browse|read|grep|glob|list|recall/i.test(name) ? "searching" : "working";
function useGaze(ref, enabled) {
(0, import_react2.useEffect)(() => {
- if (!enabled) return void 0;
+ if (!enabled || reducedMotion()) return void 0;
let frame = 0;
let point = null;
const place = () => {
@@ -3706,6 +3733,7 @@ function useGaze(ref, enabled) {
node.style.setProperty("--bt-gy", clamp((point.y - box.top - box.height / 2) / 160).toFixed(2));
};
const onMove = (event) => {
+ if (document.body?.dataset.btMotion === "quiet") return;
point = { x: event.clientX, y: event.clientY };
if (!frame) frame = requestAnimationFrame(place);
};
@@ -7277,7 +7305,7 @@ var SECRET_CSS = `
.bt-secret-who{position:relative;flex:none;display:inline-flex}
.bt-secret-lock{position:absolute;right:-5px;bottom:-4px;width:16px;height:16px;border-radius:50%;background:var(--bt-main);color:var(--bt-ink-2);display:inline-flex;align-items:center;justify-content:center;box-shadow:0 0 0 1.5px var(--bt-bubble)}
.bt-secret-lock svg{width:11px;height:11px}
-.bt-secret-name{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:16px;padding:1px 6px;border-radius:5px;background:var(--bt-hover);color:var(--bt-ink)}
+.bt-secret-name{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:16px;padding:1px 6px;border-radius:6px;background:var(--bt-hover);color:var(--bt-ink)}
.bt-secret-body{display:flex;flex-direction:column;gap:8px}
.bt-secret-field{align-items:center;min-height:36px}
.bt-secret-input{flex:1;width:100%;min-width:0;margin:0;padding:0;border:0;outline:none;background:transparent;color:var(--bt-ink);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:14px;line-height:20px;letter-spacing:.04em}
@@ -7298,7 +7326,7 @@ var SECRET_CSS = `
@keyframes bt-secret-in{from{opacity:0;transform:translateY(-2px)}}
.bt-secret-saved{display:flex;align-items:center;gap:6px;font-size:13px;line-height:18px;color:var(--bt-ink-2)}
.bt-secret-note{font-size:12px;line-height:17px;color:var(--bt-ink-3)}
-.bt-secret-note code,.bt-secret-about code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px}
+.bt-secret-note code,.bt-secret-about code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}
.bt-secret-warn{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:8px;font-size:12px;line-height:16px;color:#b25e09;background:color-mix(in srgb,#f59e0b 12%,transparent)}
.bt-secret-error{font-size:12px;line-height:16px;color:var(--bt-danger)}
.bt-secret .bt-q-btn:disabled{opacity:.5;cursor:default}
@@ -9404,8 +9432,10 @@ var nameIfCut = (event) => {
else row.removeAttribute("title");
};
var useApproval = (useWork, match) => useWork ? useWork((work) => (work.approvals ?? []).some(match)) : false;
-var useGroupWork = (useWork, pick2) => useWork ? useWork((work) => JSON.stringify(pick2(work.rooms ?? {}))) : "[]";
-var workKeys = (text) => JSON.parse(text);
+var useGroupWork = (useWork, pick2) => {
+ const raw = useWork ? useWork((work) => JSON.stringify(pick2(work.rooms ?? {}))) : "[]";
+ return (0, import_react19.useMemo)(() => JSON.parse(raw), [raw]);
+};
var doingOf = ({ tool, said, note, target, switching }) => ({ tool, said, note, target, switching });
var workLine = (lead, doing, more) => (0, import_react19.createElement)(Shimmer, null, `${lead} · ${workPhrase(doing)}…${more > 0 ? ` +${more}` : ""}`);
var doingLine = (doing) => (0, import_react19.createElement)(Shimmer, null, `${workPhrase(doing)}…`);
@@ -9426,12 +9456,13 @@ function BotRow({ bot, roster, actions, useSessions, useSessionStatus, useSessio
const approval = useApproval(useWork, (entry) => entry.botId === id);
const alert = roster.questions?.[part] !== void 0 || approval;
const doing = useActivity((map) => map[id]);
- const groups = workKeys(useGroupWork(useWork, (rooms) => Object.entries(rooms).flatMap(([roomId, entries2]) => entries2.filter((entry) => entry.botId === id).map((entry) => ({ id: roomId, ...doingOf(entry) })))));
+ const groups = useGroupWork(useWork, (rooms) => Object.entries(rooms).flatMap(([roomId, entries2]) => entries2.filter((entry) => entry.botId === id).map((entry) => ({ id: roomId, ...doingOf(entry) }))));
const away = !running && groups.length > 0;
const state = botState(running || away, doing, alert);
const runningLine = running && doing ? doingLine(doing) : null;
const awayLine = away ? workLine(roster.roomsById[groups[0].id]?.name ?? t("a group chat"), groups[0], groups.length - 1) : null;
- const waits = workKeys(useWork ? useWork((work) => JSON.stringify(work.waiting?.[id] ?? null)) : "null");
+ const waitsRaw = useWork ? useWork((work) => JSON.stringify(work.waiting?.[id] ?? null)) : "null";
+ const waits = (0, import_react19.useMemo)(() => JSON.parse(waitsRaw), [waitsRaw]);
const waitsFor = state === "waiting" ? waitingFor(roster, waits) : "";
if (bot.hidden && !active && !main) return null;
const onContextMenu = (event) => {
@@ -9491,7 +9522,7 @@ function RoomRow({ room: room2, roster, actions, useSessions, useSessionStatus,
const unread = useSessionStatus((map) => map.get(sessionId)?.completionUnread === true) || marked && !active;
useMarkedUnread(id, active, marked, actions);
const approval = useApproval(useWork, (entry) => entry.roomId === id);
- const members = workKeys(useGroupWork(useWork, (rooms) => (rooms[id] ?? []).filter((entry) => entry.botId !== void 0).map((entry) => ({ id: entry.botId, ...doingOf(entry) }))));
+ const members = useGroupWork(useWork, (rooms) => (rooms[id] ?? []).filter((entry) => entry.botId !== void 0).map((entry) => ({ id: entry.botId, ...doingOf(entry) })));
const first = roster.byId[members[0]?.id];
const workingLine = first ? workLine(first.name, members[0], members.length - 1) : null;
if (room2.hidden && !active) return null;
@@ -9598,13 +9629,15 @@ function AgentRow({ agent, actions, useSessions, useSessionStatus, useUi, wide,
running: map.get(id)?.running === true,
unread: map.get(id)?.completionUnread === true
}))));
- const statuses = Object.fromEntries(JSON.parse(statusInfo).map((entry) => [entry.id, entry]));
- const sessions = JSON.parse(info).map((session) => ({
- ...session,
- running: statuses[session.id]?.running ?? session.running,
- unread: statuses[session.id]?.unread ?? false,
- title: session.title === "" ? t("New session") : session.title
- }));
+ const sessions = (0, import_react19.useMemo)(() => {
+ const statuses = Object.fromEntries(JSON.parse(statusInfo).map((entry) => [entry.id, entry]));
+ return JSON.parse(info).map((session) => ({
+ ...session,
+ running: statuses[session.id]?.running ?? session.running,
+ unread: statuses[session.id]?.unread ?? false,
+ title: session.title === "" ? t("New session") : session.title
+ }));
+ }, [info, statusInfo]);
const renaming = useUi((value) => value.renameAgent);
const active = sessions.some((session) => session.active);
const running = sessions.some((session) => session.running);
@@ -9666,7 +9699,6 @@ function AgentRow({ agent, actions, useSessions, useSessionStatus, useUi, wide,
)
);
}
-var GLIDE = springEasing(1e3, 63);
function useListGlide(listRef, layout, key) {
const tops = (0, import_react19.useRef)({ layout, map: /* @__PURE__ */ new Map() });
(0, import_react19.useLayoutEffect)(() => {
@@ -9680,7 +9712,7 @@ function useListGlide(listRef, layout, key) {
next.set(id, top);
const before = tops.current.map.get(id);
if (!still && before !== void 0 && Math.abs(before - top) > 0.5) {
- row.animate([{ transform: `translateY(${before - top}px)` }, { transform: "none" }], GLIDE);
+ row.animate([{ transform: `translateY(${before - top}px)` }, { transform: "none" }], SPRING_GLIDE);
}
}
tops.current = { layout, map: next };
@@ -9716,7 +9748,11 @@ function TeamSidebar(props) {
const listRef = (0, import_react19.useRef)(null);
const roster = useRoster((value) => value);
const markedUnread = useUi((value) => value.unread);
- const uiNow = useUi((value) => value);
+ const leftDrawer = useUi((value) => value.leftDrawer === true);
+ const details = useUi((value) => value.details ?? null);
+ const view = useUi((value) => value.view ?? "details");
+ const panelYield = useUi((value) => value.panelYield === true);
+ const bootFailed = useUi((value) => value.bootFailed === true);
props.useRegistry((value) => value);
const frameSnap = props.useFrame ? props.useFrame((value) => value) : { viewport: typeof window === "undefined" ? 0 : window.innerWidth, sidebarWidth: FALLBACK_SIDEBAR_WIDTH, collapsedWidth: 0 };
const pref = props.useSidebarPref ? props.useSidebarPref((value) => value) : "open";
@@ -9724,8 +9760,8 @@ function TeamSidebar(props) {
viewport: frameSnap.viewport,
sidebarWidth: frameSnap.sidebarWidth,
pref,
- drawer: uiNow.leftDrawer === true,
- panel: uiNow.details ? { view: uiNow.view, yielded: uiNow.panelYield === true } : null
+ drawer: leftDrawer,
+ panel: details ? { view, yielded: panelYield } : null
});
const [drag, setDrag] = (0, import_react19.useState)(null);
const mode = drag?.left ?? layout.left;
@@ -9913,7 +9949,7 @@ function TeamSidebar(props) {
}, [mode]);
const navigate = (open, id) => {
const result = open(id);
- if (uiNow.leftDrawer === true) actions.setLeftDrawer?.(false);
+ if (leftDrawer) actions.setLeftDrawer?.(false);
return result;
};
const rowActions = {
@@ -9958,7 +9994,7 @@ function TeamSidebar(props) {
{ className: "bt-rail-top" },
(0, import_react19.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),
(0, import_react19.createElement)("button", { type: "button", className: "bt-round bt-side-collapse", "aria-label": t("Collapse sidebar"), title: t("Collapse sidebar"), onClick: onToggle }, (0, import_react19.createElement)(SidebarIcon)),
- main ? (0, import_react19.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react19.createElement)("div", { className: "bt-hint" }, uiNow.bootFailed ? bootHint() : t("Setting up your Main Bot…")),
+ main ? (0, import_react19.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react19.createElement)("div", { className: "bt-hint" }, bootFailed ? bootHint() : t("Setting up your Main Bot…")),
(0, import_react19.createElement)("span", { className: "bt-rail-sep", "aria-hidden": true })
);
const foot = wideContent ? (0, import_react19.createElement)("div", { className: "bt-leftcol-foot" }, (0, import_react19.createElement)(AccountLauncher, { seat: false, actions })) : (0, import_react19.createElement)(
@@ -9975,7 +10011,7 @@ function TeamSidebar(props) {
(0, import_react19.createElement)(
"div",
{ ref: listRef, className: "bt-list", role: "region", "aria-label": t("Bot list") },
- wideContent ? main ? (0, import_react19.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react19.createElement)("div", { className: "bt-hint" }, uiNow.bootFailed ? bootHint() : t("Setting up your Main Bot…")) : null,
+ wideContent ? main ? (0, import_react19.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react19.createElement)("div", { className: "bt-hint" }, bootFailed ? bootHint() : t("Setting up your Main Bot…")) : null,
order.map((entry) => entry.kind === "bot" ? (0, import_react19.createElement)(BotRow, { key: entry.item.id, ...rowProps, bot: entry.item, marked: markedUnread[entry.item.id] === true }) : entry.kind === "room" ? (0, import_react19.createElement)(RoomRow, { key: entry.item.id, ...rowProps, room: entry.item, marked: markedUnread[entry.item.id] === true }) : (0, import_react19.createElement)(AgentRow, { key: entry.item.id, ...rowProps, agent: entry.item, marked: markedUnread[entry.item.id] === true }))
),
foot
@@ -9990,6 +10026,7 @@ function TeamSidebar(props) {
function UpdateButton({ useUpdate, actions }) {
const update = useUpdate((value) => value);
const [open, setOpen] = (0, import_react19.useState)(false);
+ const [shown, leaving] = useLinger(open, 120);
const [box, setBox] = (0, import_react19.useState)(null);
const [error, setError] = (0, import_react19.useState)("");
const [dshError, setDshError] = (0, import_react19.useState)("");
@@ -10053,9 +10090,9 @@ function UpdateButton({ useUpdate, actions }) {
"aria-expanded": open,
onClick: toggle
}, (0, import_react19.createElement)(CloudDownloadIcon, { done: phase === "installed" || phase === "updated" }), phase === "failed" || dshPhase === "failed" ? (0, import_react19.createElement)("span", { className: "bt-update-dot", "aria-hidden": true }) : null),
- open && box ? (0, import_react_dom3.createPortal)((0, import_react19.createElement)(
+ shown && box ? (0, import_react_dom3.createPortal)((0, import_react19.createElement)(
"div",
- { className: "bt-update-pop", role: "dialog", "aria-label": update?.available || phase !== "idle" ? t("DS Bot update") : t("DSH update"), style: box },
+ { className: "bt-update-pop", role: "dialog", "aria-label": update?.available || phase !== "idle" ? t("DS Bot update") : t("DSH update"), style: box, "data-leaving": leaving || void 0 },
update?.available || phase !== "idle" ? (0, import_react19.createElement)(
import_react19.Fragment,
null,
@@ -10175,6 +10212,7 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardi
}, [seat]);
const [box, setBox] = (0, import_react19.useState)(null);
const button = (0, import_react19.useRef)(null);
+ const menuRef = (0, import_react19.useRef)(null);
(0, import_react19.useEffect)(() => {
if (settingsOpen) setOpen(false);
}, [settingsOpen]);
@@ -10199,6 +10237,7 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardi
setOpen(false);
};
const onKey = (event) => {
+ if (stepMenuFocus(menuRef.current, event)) return;
if (event.key === "Escape") {
event.stopPropagation();
setOpen(false);
@@ -10288,7 +10327,7 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardi
),
open && box ? (0, import_react_dom3.createPortal)((0, import_react19.createElement)(
"div",
- { className: "bt-menu bt-menu-up bt-account-menu", role: "menu", "aria-label": t("Account"), style: box },
+ { ref: menuRef, className: "bt-menu bt-menu-up bt-account-menu", role: "menu", "aria-label": t("Account"), style: box },
confirm !== null ? (0, import_react19.createElement)(
"div",
{ className: "bt-confirm", role: "alertdialog", "aria-label": accountT("signOut") },
@@ -10410,13 +10449,14 @@ var SIDEBAR_CSS = `
.bt-update[data-phase=installing] .bt-cloud-arrow{animation:bt-cloud-drop 1.1s cubic-bezier(.45,0,.55,1) infinite}
@keyframes bt-cloud-drop{0%{transform:translateY(-3px);opacity:0}35%{opacity:1}70%{transform:translateY(1px);opacity:1}100%{transform:translateY(2px);opacity:0}}
.bt-update-dot{position:absolute;top:6px;right:6px;width:7px;height:7px;border-radius:50%;background:#E5484D;box-shadow:0 0 0 1.5px var(--bt-sidebar)}
-.bt-update-pop{position:fixed;z-index:60;width:280px;padding:14px 14px 12px;border-radius:14px;background:var(--bt-main);border:.5px solid var(--bt-line-2);box-shadow:0 10px 20px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);color:var(--bt-ink);box-sizing:border-box;transform-origin:top left;font-family:var(--bt-font);animation:bt-update-pop ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing}}
+.bt-update-pop{position:fixed;z-index:60;width:280px;padding:14px 14px 12px;border-radius:16px;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);box-shadow:var(--bt-glass-shadow);color:var(--bt-ink);box-sizing:border-box;transform-origin:top left;font-family:var(--bt-font);animation:bt-update-pop ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing}}
+.bt-update-pop[data-leaving]{animation:bt-pop-out .12s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}
@keyframes bt-update-pop{from{opacity:0;transform:scale(.96);filter:blur(4px)}}
.bt-update-title{font-size:14px;line-height:20px;font-weight:600}
-.bt-update-text{margin-top:2px;font-size:12.5px;line-height:18px;color:var(--bt-ink-2)}
+.bt-update-text{margin-top:2px;font-size:12px;line-height:18px;color:var(--bt-ink-2)}
.bt-update-error{margin-top:8px;font-size:12px;line-height:17px;color:var(--bt-danger);overflow-wrap:anywhere;max-height:90px;overflow:auto}
.bt-update-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:12px}
-.bt-update-notes{margin-right:auto;font-size:12.5px;color:var(--bt-ink-2);text-decoration:none}
+.bt-update-notes{margin-right:auto;font-size:12px;color:var(--bt-ink-2);text-decoration:none}
.bt-update-notes:hover{color:var(--bt-ink);text-decoration:underline}
.bt-update-go{height:30px;padding:0 14px;border:0;border-radius:999px;background:var(--bt-accent,#4D6BFE);color:var(--bt-accent-ink,#fff);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:opacity .12s ease,transform .12s ease}
.bt-update-go:hover:not(:disabled){opacity:.9}
@@ -10806,6 +10846,7 @@ function ComposerPlus({ sessionId, inputActions, useRoster, actions }) {
if (![button.current, menu.current].some((node) => node?.contains(event.target))) setOpen(null);
};
const onKey = (event) => {
+ if (stepMenuFocus(menu.current, event)) return;
if (event.key === "Escape") {
event.stopPropagation();
setOpen(null);
@@ -11253,9 +11294,11 @@ var SIDE_CSS = `
.bt-side-input:focus{border-color:var(--bt-accent)}
.bt-side-input:disabled{opacity:.6}
.bt-pmenu{position:relative;display:inline-flex;flex:none}
-.bt-pmenu-pop{position:absolute;top:calc(100% + 6px);right:0;z-index:6;min-width:172px;padding:6px;border-radius:12px;background:var(--bt-main);border:.5px solid var(--bt-line-2);box-shadow:0 10px 32px -8px rgba(0,0,0,.14),0 2px 8px rgba(0,0,0,.06);display:flex;flex-direction:column;gap:2px;animation:bt-bcard-in .18s cubic-bezier(.16,1,.3,1) both}
+.bt-pmenu-pop{position:absolute;top:calc(100% + 6px);right:0;z-index:6;min-width:172px;padding:6px;border-radius:12px;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);box-shadow:var(--bt-glass-shadow);display:flex;flex-direction:column;gap:2px;transform-origin:top right;animation:bt-pop-drop .18s cubic-bezier(.16,1,.3,1),bt-fade .14s ease-out}
+.bt-pmenu-pop[data-leaving]{animation:bt-pop-out .12s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}
.bt-pmenu-item{display:flex;align-items:center;gap:9px;width:100%;min-width:0;padding:7px 10px;border:0;border-radius:8px;background:none;color:var(--bt-ink);font:inherit;font-size:12px;line-height:17px;text-align:left;cursor:pointer}
.bt-pmenu-item:hover{background:var(--bt-hover)}
+.bt-pmenu-item:focus-visible{outline:2px solid var(--bt-accent);outline-offset:-2px}
.bt-pmenu-item svg{flex:none;width:15px;height:15px;color:var(--bt-ink-3)}
.bt-pmenu-sep{height:.5px;flex:none;margin:4px 8px;background:var(--bt-line-2)}
`;
@@ -11871,6 +11914,7 @@ function useAnchoredMenu() {
close();
};
const onKey = (event) => {
+ if (stepMenuFocus(menu.current, event)) return;
if (event.key === "Escape") {
event.stopPropagation();
close();
@@ -12684,47 +12728,47 @@ function CapabilityForm({ draft, setDraft, items, actions, onClose }) {
const available = items.filter((item) => item.name !== draft.name && ["mcp", "skill"].includes(item.kind));
return (0, import_react28.createElement)(
"form",
- { className: "bt-connector-form", onSubmit: submit },
+ { className: "bt-set-card bt-task-form", onSubmit: submit },
(0, import_react28.createElement)(Field, { label: "Name", value: draft.name, disabled: draft.originalName !== void 0, onChange: (value) => set("name", value), placeholder: "my-tool" }),
(0, import_react28.createElement)(
"label",
- { className: "bt-set-row bt-bs-row bt-bs-stack" },
+ { className: "bt-set-row bt-bs-row" },
(0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("Type"))),
(0, import_react28.createElement)(
"select",
- { className: "bt-input", value: draft.kind, disabled: draft.originalName !== void 0, onChange: (event) => set("kind", event.target.value) },
+ { className: "bt-select bt-task-bot", value: draft.kind, disabled: draft.originalName !== void 0, onChange: (event) => set("kind", event.target.value) },
["mcp", "skill", "pack"].map((kind) => (0, import_react28.createElement)("option", { key: kind, value: kind }, t(kind === "mcp" ? "MCP server" : kind === "skill" ? "Skill" : "Pack")))
)
),
(0, import_react28.createElement)(Field, { label: "Description", value: draft.description, onChange: (value) => set("description", value) }),
draft.kind === "mcp" ? (0, import_react28.createElement)(
"label",
- { className: "bt-set-row bt-bs-row bt-bs-stack" },
+ { className: "bt-set-row bt-bs-row" },
(0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("Connection"))),
(0, import_react28.createElement)(
"select",
- { className: "bt-input", value: draft.transport, onChange: (event) => set("transport", event.target.value) },
+ { className: "bt-select bt-task-bot", value: draft.transport, onChange: (event) => set("transport", event.target.value) },
(0, import_react28.createElement)("option", { value: "stdio" }, t("Local command")),
(0, import_react28.createElement)("option", { value: "streamable-http" }, t("HTTP server"))
)
) : null,
draft.kind === "mcp" && draft.transport === "stdio" ? (0, import_react28.createElement)(
- "div",
+ import_react28.Fragment,
null,
(0, import_react28.createElement)(Field, { label: "Command", value: draft.command, onChange: (value) => set("command", value) }),
(0, import_react28.createElement)(Field, { label: "Arguments (one per line)", value: draft.argsText, onChange: (value) => set("argsText", value), multiline: true }),
(0, import_react28.createElement)(Field, { label: "Environment (JSON)", value: draft.envText, onChange: (value) => set("envText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })
) : null,
draft.kind === "mcp" && draft.transport === "streamable-http" ? (0, import_react28.createElement)(
- "div",
+ import_react28.Fragment,
null,
(0, import_react28.createElement)(Field, { label: "URL", value: draft.url, onChange: (value) => set("url", value) }),
(0, import_react28.createElement)(Field, { label: "Headers (JSON)", value: draft.headersText, onChange: (value) => set("headersText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })
) : null,
draft.kind === "skill" ? (0, import_react28.createElement)(Field, { label: "Skill instructions", value: draft.content, onChange: (value) => set("content", value), multiline: true }) : null,
draft.kind === "pack" ? (0, import_react28.createElement)(
- "div",
- { className: "bt-set-card" },
+ import_react28.Fragment,
+ null,
available.length === 0 ? (0, import_react28.createElement)("div", { className: "bt-set-row" }, (0, import_react28.createElement)("span", { className: "bt-set-hint" }, t("Save an MCP server or skill first."))) : available.map((item) => (0, import_react28.createElement)(
"label",
{ key: item.name, className: "bt-set-row bt-bs-row" },
@@ -12732,12 +12776,12 @@ function CapabilityForm({ draft, setDraft, items, actions, onClose }) {
(0, import_react28.createElement)("input", { type: "checkbox", checked: draft.items.includes(item.name), onChange: (event) => set("items", event.target.checked ? [...draft.items, item.name] : draft.items.filter((name) => name !== item.name)) })
))
) : null,
- error ? (0, import_react28.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null,
+ error ? (0, import_react28.createElement)("div", { className: "bt-set-row" }, (0, import_react28.createElement)("span", { className: "bt-danger bt-set-hint", role: "alert" }, error)) : null,
(0, import_react28.createElement)(
"div",
- { className: "bt-connector-form-row" },
+ { className: "bt-set-row bt-task-foot" },
(0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onClose }, t("Cancel")),
- (0, import_react28.createElement)("button", { type: "submit", className: "bt-soft bt-soft-sm" }, draft.originalName ? t("Save changes") : t("Add capability"))
+ (0, import_react28.createElement)("button", { type: "submit", className: "bt-send bt-soft-sm" }, draft.originalName ? t("Save changes") : t("Add capability"))
)
);
}
@@ -12797,12 +12841,11 @@ function CapabilitiesPage({ roster, actions, run: run2 }) {
"section",
{ className: "bt-set-section" },
(0, import_react28.createElement)("h3", null, t("Shared capabilities")),
- (0, import_react28.createElement)(
+ draft ? (0, import_react28.createElement)(CapabilityForm, { draft, setDraft, items, actions, onClose: () => setDraft(null) }) : (0, import_react28.createElement)(
"div",
{ className: "bt-actions" },
(0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: startNew }, t("Add capability"))
),
- draft ? (0, import_react28.createElement)(CapabilityForm, { draft, setDraft, items, actions, onClose: () => setDraft(null) }) : null,
(0, import_react28.createElement)(
"div",
{ className: "bt-set-card bt-connectors-card" },
@@ -13272,6 +13315,7 @@ function MemoryDialog({ owner, actions, leaving = false }) {
setMenu(false);
};
const onKey = (event) => {
+ if (stepMenuFocus(menuRef.current, event)) return;
if (event.key === "Escape") {
event.stopPropagation();
setMenu(false);
@@ -13498,7 +13542,7 @@ function CharacterGrid({ look, hasPhoto = false, onShape, onColor }) {
}, (0, import_react31.createElement)("span", { style: { background: paintCss(color) } }))))
);
}
-function AvatarEditor({ bot, actions, run: run2, onClose }) {
+function AvatarEditor({ bot, actions, run: run2, onClose, leaving = false }) {
const look = lookOf(bot);
const [tab, setTab] = (0, import_react31.useState)(look.image ? "upload" : "bot");
const [over, setOver] = (0, import_react31.useState)(false);
@@ -13541,7 +13585,7 @@ function AvatarEditor({ bot, actions, run: run2, onClose }) {
const glide = useGlide(tab);
return (0, import_react31.createElement)(
"div",
- { ref, className: "bt-avedit", role: "dialog", "aria-label": t("Avatar editor") },
+ { ref, className: "bt-avedit", role: "dialog", "aria-label": t("Avatar editor"), "data-leaving": leaving || void 0 },
(0, import_react31.createElement)(
"div",
{ className: "bt-avedit-top" },
@@ -13618,6 +13662,7 @@ function MemoryCard({ bot, actions }) {
}
function BotSettingsForm({ bot, roster, actions, run: run2 }) {
const [editing, setEditing] = (0, import_react31.useState)(false);
+ const [editorShown, editorLeaving] = useLinger(editing, 120);
const [confirming, setConfirming] = (0, import_react31.useState)(false);
const closeEditor = (0, import_react31.useCallback)(() => setEditing(false), []);
(0, import_react31.useEffect)(() => {
@@ -13655,7 +13700,7 @@ function BotSettingsForm({ bot, roster, actions, run: run2 }) {
(0, import_react31.createElement)(BotMark, { bot, size: 64, live: true }),
(0, import_react31.createElement)("span", { className: "bt-avatar-pencil", "aria-hidden": true }, (0, import_react31.createElement)(PencilIcon))
),
- editing ? (0, import_react31.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor }) : null
+ editorShown ? (0, import_react31.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor, leaving: editorLeaving }) : null
),
(0, import_react31.createElement)(
"div",
@@ -15859,7 +15904,7 @@ var USAGE_CSS = `
.bt-us-pick-months{display:flex;flex-wrap:wrap;gap:8px 28px}
.bt-us-month{width:252px;animation:bt-us-fade .22s ease}
.bt-us-month-head{position:relative;display:flex;align-items:center;justify-content:center;height:28px;margin-bottom:4px;font-size:13px;line-height:18px;font-weight:600}
-.bt-us-month-nav{position:absolute;top:0;width:28px;height:28px;padding:0;border:0;border-radius:9px;background:none;color:var(--bt-ink-2);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background-color .12s ease}
+.bt-us-month-nav{position:absolute;top:0;width:28px;height:28px;padding:0;border:0;border-radius:8px;background:none;color:var(--bt-ink-2);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background-color .12s ease}
.bt-us-month-nav[data-side=left]{left:0}
.bt-us-month-nav[data-side=right]{right:0}
.bt-us-month-nav:hover:not(:disabled){background:var(--bt-hover);color:var(--bt-ink)}
@@ -16214,7 +16259,7 @@ function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
Row3,
{ label: t("Site") },
(0, import_react41.createElement)("input", {
- className: "bt-select bt-browser-site",
+ className: "bt-input bt-browser-site",
type: "text",
value: site,
placeholder: t("example.com — leave empty for all sites"),
@@ -16259,7 +16304,7 @@ function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
{ className: "bt-browser-form-foot" },
(0, import_react41.createElement)("button", {
type: "submit",
- className: "bt-soft",
+ className: "bt-soft bt-soft-sm",
disabled: busy || !selectedBot || kinds.length === 0
}, busy ? t("Saving…") : t("Add"))
)
@@ -16883,7 +16928,7 @@ function FormActions({ onCancel, onAdd, ready }) {
);
}
var PROVIDERS_CSS = `
-.bt-provider-id{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;color:var(--bt-ink-3)}
+.bt-provider-id{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;color:var(--bt-ink-3)}
.bt-provider .bt-set-hint[data-error]{color:var(--bt-danger)}
.bt-provider-state{display:inline-flex;align-items:center;gap:6px;font-size:12px;line-height:16px;color:var(--bt-ink-2);white-space:nowrap}
.bt-provider-state::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--bt-ink-3)}
@@ -16903,7 +16948,7 @@ var PROVIDERS_CSS = `
.bt-provider-pair{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.bt-provider-models-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.bt-provider-found{max-height:180px;overflow-y:auto;scrollbar-width:thin}
-.bt-provider-found code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px}
+.bt-provider-found code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}
.bt-provider-found .bt-secret-bot{padding:0 10px}
@media (prefers-reduced-motion:reduce){.bt-provider-add{animation:none}}
`;
@@ -16912,7 +16957,7 @@ var PROVIDERS_CSS = `
var import_react45 = require("react");
var capitalize2 = (word) => word[0].toUpperCase() + word.slice(1);
var SETTINGS_PAGES = [["general", "General"], ["models", "Models"], ["bots", "Bots"], ["groups", "Group chats"], ["connectors", "Connectors"], ["capabilities", "Capabilities"], ["browser", "Browser"], ["schedules", "Scheduled tasks"], ["usage", "Usage"], ["secrets", "Secrets"], ["feedback", "Feedback"], ["about", "About DS Bot"]];
-var PAGE_ICONS = { ...SETTINGS_ICONS, models: SlidersIcon, connectors: ConnectorIcon, capabilities: PlugIcon, browser: ConnectorIcon, schedules: ClockIcon, secrets: KeyIcon, feedback: FeedbackIcon, about: InfoIcon };
+var PAGE_ICONS = { ...SETTINGS_ICONS, models: SlidersIcon, connectors: ConnectorIcon, capabilities: PlugIcon, browser: GlobeIcon, schedules: ClockIcon, secrets: KeyIcon, feedback: FeedbackIcon, about: InfoIcon };
function SetSection({ title, className = "", children }) {
return (0, import_react45.createElement)("section", { className: `bt-set-section ${className}`.trim() }, (0, import_react45.createElement)("h3", null, title), (0, import_react45.createElement)("div", { className: "bt-set-card" }, children));
}
@@ -17296,14 +17341,21 @@ function SettingsDialog({ page, id, roster, actions, useUpdate, leaving = false
var import_react46 = require("react");
function ContextMenu({ menu, roster, actions, leaving = false }) {
useEscape(() => actions.closeMenu());
+ const ref = (0, import_react46.useRef)(null);
(0, import_react46.useEffect)(() => {
const onDown = (event) => {
if (!(event.target instanceof Element) || !event.target.closest(".bt-menu")) actions.closeMenu();
};
+ const onKey = (event) => {
+ stepMenuFocus(ref.current, event);
+ };
window.addEventListener("mousedown", onDown);
- return () => window.removeEventListener("mousedown", onDown);
+ window.addEventListener("keydown", onKey, true);
+ return () => {
+ window.removeEventListener("mousedown", onDown);
+ window.removeEventListener("keydown", onKey, true);
+ };
}, []);
- const ref = (0, import_react46.useRef)(null);
const [place, setPlace] = (0, import_react46.useState)({ left: menu.x, top: menu.y });
const tick = useViewport();
(0, import_react46.useLayoutEffect)(() => {
@@ -17364,6 +17416,13 @@ function ContextMenu({ menu, roster, actions, leaving = false }) {
}
function AgentMenu({ menu, roster, actions, leaving }) {
const ref = (0, import_react46.useRef)(null);
+ (0, import_react46.useEffect)(() => {
+ const onKey = (event) => {
+ stepMenuFocus(ref.current, event);
+ };
+ window.addEventListener("keydown", onKey, true);
+ return () => window.removeEventListener("keydown", onKey, true);
+ }, []);
const [place, setPlace] = (0, import_react46.useState)({ left: menu.x, top: menu.y });
const tick = useViewport();
(0, import_react46.useLayoutEffect)(() => {
@@ -17621,7 +17680,7 @@ body[data-ds-dark-theme] .bt-mw-ask{color:#f0b84a}
.bt-member-time{flex:none;margin-left:.3em;font-variant-numeric:tabular-nums}
.bt-member-state.bt-mw-ask{color:#b7791f}
body[data-ds-dark-theme] .bt-member-state.bt-mw-ask{color:#f0b84a}
-.bt-member-stop{flex:none;height:26px;padding:0 11px;border:0;border-radius:13px;background:var(--bt-main);box-shadow:inset 0 0 0 .5px var(--bt-line-2);color:var(--bt-ink-2);font:inherit;font-size:12px;cursor:pointer;transition:background-color .12s ease,color .12s ease,${spring(SPRING_TAP, "scale")}}
+.bt-member-stop{flex:none;height:26px;padding:0 11px;border:0;border-radius:999px;background:var(--bt-main);box-shadow:inset 0 0 0 .5px var(--bt-line-2);color:var(--bt-ink-2);font:inherit;font-size:12px;cursor:pointer;transition:background-color .12s ease,color .12s ease,${spring(SPRING_TAP, "scale")}}
.bt-member-stop:hover{background:var(--bt-active);color:var(--bt-ink)}
.bt-member-stop:active:not(:disabled){scale:.94}
.bt-member-stop:disabled{opacity:.5;cursor:default}
@@ -18030,8 +18089,6 @@ var MIN_WIDTH = 360;
var READ_FLASH_MS = 2400;
var EMPTY_PAGE = { url: "", title: "", favicon: null, loading: false, canGoBack: false, canGoForward: false, error: null, excerpt: "" };
var EMPTY_TABS2 = { ids: [], active: null };
-var SPRING_LEAD2 = springEasing(576, 39.4);
-var SPRING_TRAIL2 = springEasing(144, 19.7);
var icon = (paths) => function BrowserIcon() {
return (0, import_react49.createElement)(
"svg",
@@ -18070,6 +18127,7 @@ var reducedMotion2 = () => typeof matchMedia === "function" && matchMedia("(pref
var tabLabel = (page) => page.title || shortAddress(page.url) || t("New tab");
function PanelMenu({ items, className, "aria-label": label }) {
const [open, setOpen] = (0, import_react49.useState)(false);
+ const [shown, leaving] = useLinger(open, 120);
const wrap = (0, import_react49.useRef)(null);
(0, import_react49.useEffect)(() => {
if (!open) return void 0;
@@ -18077,6 +18135,7 @@ function PanelMenu({ items, className, "aria-label": label }) {
if (wrap.current && !wrap.current.contains(event.target)) setOpen(false);
};
const onKey = (event) => {
+ if (stepMenuFocus(wrap.current, event)) return;
if (event.key !== "Escape") return;
event.stopPropagation();
setOpen(false);
@@ -18101,9 +18160,9 @@ function PanelMenu({ items, className, "aria-label": label }) {
"aria-expanded": open,
onClick: () => setOpen((value) => !value)
}, (0, import_react49.createElement)(DotsIcon)),
- open ? (0, import_react49.createElement)(
+ shown ? (0, import_react49.createElement)(
"div",
- { className: "bt-pmenu-pop", role: "menu" },
+ { className: "bt-pmenu-pop", role: "menu", "data-leaving": leaving || void 0 },
items.map((item, index) => item.sep ? (0, import_react49.createElement)("span", { key: `sep-${index}`, className: "bt-pmenu-sep", role: "separator" }) : (0, import_react49.createElement)("button", {
key: item.key,
type: "button",
@@ -18170,8 +18229,8 @@ function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, r
if (from === null || from.left === to.left && from.right === to.right || reducedMotion2()) return void 0;
const ahead = to.left > from.left ? "right" : "left";
const behind = ahead === "right" ? "left" : "right";
- const lead = capsule.animate([{ [ahead]: `${from[ahead]}px` }, { [ahead]: `${to[ahead]}px` }], { duration: SPRING_LEAD2.duration, easing: SPRING_LEAD2.easing });
- const trail = capsule.animate([{ [behind]: `${from[behind]}px` }, { [behind]: `${to[behind]}px` }], { duration: SPRING_TRAIL2.duration, easing: SPRING_TRAIL2.easing });
+ const lead = capsule.animate([{ [ahead]: `${from[ahead]}px` }, { [ahead]: `${to[ahead]}px` }], { duration: SPRING_LEAD.duration, easing: SPRING_LEAD.easing });
+ const trail = capsule.animate([{ [behind]: `${from[behind]}px` }, { [behind]: `${to[behind]}px` }], { duration: SPRING_TRAIL.duration, easing: SPRING_TRAIL.easing });
return () => {
lead.cancel();
trail.cancel();
@@ -18922,7 +18981,7 @@ var BROWSER_CSS = `
.bt-ptabs-in>.bt-ptab-bot{position:sticky;left:0;z-index:2;background:var(--bt-main)}
.bt-ptabs-in>.bt-ptab-bot[aria-selected=true]{background:transparent}
.bt-ptabs-in::-webkit-scrollbar{display:none}
-.bt-ptab{position:relative;z-index:1;display:inline-flex;align-items:center;gap:6px;height:32px;max-width:180px;padding:0 8px;flex:none;border:0;border-radius:9px;background:none;color:var(--bt-ink-2);font:inherit;font-size:12.5px;cursor:pointer;white-space:nowrap;transition:color .12s ease}
+.bt-ptab{position:relative;z-index:1;display:inline-flex;align-items:center;gap:6px;height:32px;max-width:180px;padding:0 8px;flex:none;border:0;border-radius:8px;background:none;color:var(--bt-ink-2);font:inherit;font-size:12px;cursor:pointer;white-space:nowrap;transition:color .12s ease}
.bt-ptab:hover{color:var(--bt-ink)}
.bt-ptab[aria-selected=true]{color:var(--bt-ink)}
.bt-ptab-bot{padding:0 7px}
@@ -18936,10 +18995,10 @@ var BROWSER_CSS = `
.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{position:relative;z-index:1;flex:none;width:28px;height:32px;border:0;border-radius:8px;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)}
.bt-ptab-new svg{width:15px;height:15px}
-.bt-ptab-ind{position:absolute;top:4px;bottom:4px;border-radius:9px;background:var(--bt-hover);opacity:0;pointer-events:none;z-index:0;transition:opacity .15s ease}
+.bt-ptab-ind{position:absolute;top:4px;bottom:4px;border-radius:8px;background:var(--bt-hover);opacity:0;pointer-events:none;z-index:0;transition:opacity .15s ease}
.bt-ptab-close{flex:none;margin-left:2px}
.bt-panel-ghost{position:absolute;top:calc(44px + var(--bt-caption-band,0px));right:0;bottom:0;overflow:hidden;pointer-events:none;z-index:2}
.bt-panel-ghost>.bt-panel-view{position:absolute;inset:0}
@@ -18986,18 +19045,18 @@ var BROWSER_CSS = `
.bt-bcard-row{display:flex;align-items:center;gap:7px;padding:8px 10px;min-width:0}
.bt-bcard-fav{width:14px;height:14px;flex:none;border-radius:3px;color:var(--bt-ink-3)}
.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-title{flex:1;min-width:0;font-size:12px;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;pointer-events:none;transition:opacity .12s ease;backdrop-filter:blur(4px)}
+.bt-bcard-x{position:absolute;top:6px;right:6px;width:22px;height:22px;border:0;border-radius:6px;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{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:12px;cursor:pointer}
.bt-bcard-new:hover{color:var(--bt-ink);border-color:var(--bt-ink-3)}
.bt-bcard-new svg{width:14px;height:14px}
.bt-browser-empty-mark{display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center}
/* Cookie imports */
-.bt-import-menu{position:absolute;top:6px;right:6px;z-index:6;width:236px;padding:6px;border-radius:16px;background:var(--bt-main);border:.5px solid var(--bt-line-2);box-shadow:0 10px 32px -8px rgba(0,0,0,.14),0 2px 8px rgba(0,0,0,.06);animation:bt-bcard-in .18s cubic-bezier(.16,1,.3,1) both}
+.bt-import-menu{position:absolute;top:6px;right:6px;z-index:6;width:236px;padding:6px;border-radius:16px;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);box-shadow:var(--bt-glass-shadow);transform-origin:top right;animation:bt-pop-drop .18s cubic-bezier(.16,1,.3,1),bt-fade .14s ease-out}
.bt-import-menu-title{padding:6px 10px 8px;font-size:11px;font-weight:500;letter-spacing:.02em;color:var(--bt-ink-3)}
-.bt-import-item{display:flex;align-items:center;gap:9px;width:100%;min-width:0;padding:8px 10px;border:0;border-radius:8px;background:none;color:var(--bt-ink);font:inherit;font-size:12.5px;text-align:left;cursor:pointer}
+.bt-import-item{display:flex;align-items:center;gap:9px;width:100%;min-width:0;padding:8px 10px;border:0;border-radius:8px;background:none;color:var(--bt-ink);font:inherit;font-size:12px;text-align:left;cursor:pointer}
.bt-import-item:hover{background:var(--bt-hover)}
.bt-import-item:disabled{opacity:.5;cursor:default}
.bt-import-item-icon{flex:none;color:var(--bt-ink-3)}
@@ -19013,8 +19072,8 @@ var BROWSER_CSS = `
.bt-import-list{max-height:180px;overflow:auto;border:.5px solid var(--bt-line);border-radius:10px;padding:4px 10px}
.bt-import-line{display:flex;align-items:baseline;gap:8px;padding:4px 0;min-width:0}
.bt-import-line-name{flex:none;max-width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--bt-ink)}
-.bt-import-line-count{flex:1;min-width:0;text-align:right;font-size:11.5px;color:var(--bt-ink-3);white-space:nowrap}
-.bt-import-line-reason{flex:1;min-width:0;font-size:11.5px;line-height:16px;color:var(--bt-ink-3);overflow-wrap:anywhere}
+.bt-import-line-count{flex:1;min-width:0;text-align:right;font-size:11px;color:var(--bt-ink-3);white-space:nowrap}
+.bt-import-line-reason{flex:1;min-width:0;font-size:11px;line-height:16px;color:var(--bt-ink-3);overflow-wrap:anywhere}
.bt-import-note{font-size:12px;line-height:17px;color:var(--bt-ink-3)}
.bt-import-warns{font-size:12px;color:var(--bt-ink-3)}
.bt-import-warns summary{cursor:pointer;padding:2px 0}
diff --git a/ds-bot/src/client/bot-settings.js b/ds-bot/src/client/bot-settings.js
index 38fb73b0..b16dae2f 100644
--- a/ds-bot/src/client/bot-settings.js
+++ b/ds-bot/src/client/bot-settings.js
@@ -10,7 +10,7 @@ import { BotSchedules } from './schedules.js'
import { BotCapabilitiesCard } from './capability-settings.js'
import { AvatarLibraryPanel, avatarImage } from './avatar-library.js'
import { useMemoryCount } from './memory-panel.js'
-import { SPRING_SHAPE, SPRING_TAP, spring, useGlide } from './motion.js'
+import { SPRING_SHAPE, SPRING_TAP, spring, useGlide, useLinger } from './motion.js'
import { t } from './i18n.js'
const capitalize = word => word[0].toUpperCase() + word.slice(1)
@@ -99,7 +99,7 @@ export function CharacterGrid({ look, hasPhoto = false, onShape, onColor }) {
// The avatar editor: the Bot tab picks a character (every click saves), the
// Upload tab takes a photo, the Library tab picks one the user imported before, and
// Reset returns to the look the Bot id gives.
-function AvatarEditor({ bot, actions, run, onClose }) {
+function AvatarEditor({ bot, actions, run, onClose, leaving = false }) {
const look = lookOf(bot)
const [tab, setTab] = useState(look.image ? 'upload' : 'bot')
const [over, setOver] = useState(false)
@@ -129,7 +129,7 @@ function AvatarEditor({ bot, actions, run, onClose }) {
}, [tab, bot])
const hasPhoto = Boolean(look.image)
const glide = useGlide(tab)
- return h('div', { ref, className: 'bt-avedit', role: 'dialog', 'aria-label': t('Avatar editor') },
+ return h('div', { ref, className: 'bt-avedit', role: 'dialog', 'aria-label': t('Avatar editor'), 'data-leaving': leaving || undefined },
h('div', { className: 'bt-avedit-top' },
h('div', { ref: glide.box, role: 'tablist', 'aria-label': t('Avatar source'), className: 'bt-avedit-tabs' },
h('span', { ref: glide.thumb, className: 'bt-thumb', 'aria-hidden': true }),
@@ -177,6 +177,7 @@ function MemoryCard({ bot, actions }) {
// sidebar place, and copies.
export function BotSettingsForm({ bot, roster, actions, run }) {
const [editing, setEditing] = useState(false)
+ const [editorShown, editorLeaving] = useLinger(editing, 120)
const [confirming, setConfirming] = useState(false)
const closeEditor = useCallback(() => setEditing(false), [])
useEffect(() => {
@@ -201,7 +202,7 @@ export function BotSettingsForm({ bot, roster, actions, run }) {
h('button', { type: 'button', className: 'bt-avatar-trigger', 'aria-label': t('Edit Bot avatar'), 'aria-expanded': editing, onClick: () => setEditing(value => !value) },
h(BotMark, { bot, size: 64, live: true }),
h('span', { className: 'bt-avatar-pencil', 'aria-hidden': true }, h(PencilIcon))),
- editing ? h(AvatarEditor, { bot, actions, run, onClose: closeEditor }) : null),
+ editorShown ? h(AvatarEditor, { bot, actions, run, onClose: closeEditor, leaving: editorLeaving }) : null),
h('div', { className: 'bt-bs-who' },
h('span', { className: 'bt-bs-name' }, bot.name),
h('span', { className: 'bt-bs-sub' }, [bot.role, isMainBot ? t('Main Bot') : ''].filter(Boolean).join(' · ') || t('Bot')))),
diff --git a/ds-bot/src/client/browser-pane.js b/ds-bot/src/client/browser-pane.js
index ecfc8b2a..364f9dd0 100644
--- a/ds-bot/src/client/browser-pane.js
+++ b/ds-bot/src/client/browser-pane.js
@@ -10,7 +10,7 @@ import { BotMark } from './mark.js'
import { STORAGE } from './storage.js'
import { MIN_CHAT } from './frame-layout.js'
import { chatRoom } from './frame-watch.js'
-import { SPRING_SHAPE, springEasing } from './motion.js'
+import { SPRING_LEAD, SPRING_SHAPE, SPRING_TRAIL, stepMenuFocus, useLinger } from './motion.js'
import { DetailsDrawer } from './details-drawer.js'
import { SideChatView } from './side-chat.js'
import { panelHasStrip, sideChatsOf, stripMenuKeys } from './side-model.js'
@@ -31,10 +31,6 @@ const MIN_WIDTH = 360
const READ_FLASH_MS = 2400
const EMPTY_PAGE = { url: '', title: '', favicon: null, loading: false, canGoBack: false, canGoForward: false, error: null, excerpt: '' }
const EMPTY_TABS = { ids: [], active: null }
-// The indicator's leading edge runs the fast spring, the trailing one the slow
-// spring — the capsule stretches into the move, then settles.
-const SPRING_LEAD = springEasing(576, 39.4)
-const SPRING_TRAIL = springEasing(144, 19.7)
const icon = paths => function BrowserIcon() {
return h('svg', { width: 16, height: 16, viewBox: '0 0 20 20', fill: 'none', stroke: 'currentColor', strokeWidth: 1.5, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true },
@@ -85,11 +81,13 @@ const tabLabel = page => page.title || shortAddress(page.url) || t('New tab')
// callers hide the button when the list is empty.
export function PanelMenu({ items, className, 'aria-label': label }) {
const [open, setOpen] = useState(false)
+ const [shown, leaving] = useLinger(open, 120)
const wrap = useRef(null)
useEffect(() => {
if (!open) return undefined
const onDown = (event) => { if (wrap.current && !wrap.current.contains(event.target)) setOpen(false) }
const onKey = (event) => {
+ if (stepMenuFocus(wrap.current, event)) return
if (event.key !== 'Escape') return
event.stopPropagation()
setOpen(false)
@@ -104,7 +102,7 @@ export function PanelMenu({ items, className, 'aria-label': label }) {
type: 'button', className, 'aria-label': label, title: label,
'aria-haspopup': 'menu', 'aria-expanded': open, onClick: () => setOpen(value => !value),
}, h(DotsIcon)),
- open ? h('div', { className: 'bt-pmenu-pop', role: 'menu' },
+ shown ? h('div', { className: 'bt-pmenu-pop', role: 'menu', 'data-leaving': leaving || undefined },
items.map((item, index) => (item.sep
? h('span', { key: `sep-${index}`, className: 'bt-pmenu-sep', role: 'separator' })
: h('button', {
@@ -752,7 +750,7 @@ export const BROWSER_CSS = `
.bt-ptabs-in>.bt-ptab-bot{position:sticky;left:0;z-index:2;background:var(--bt-main)}
.bt-ptabs-in>.bt-ptab-bot[aria-selected=true]{background:transparent}
.bt-ptabs-in::-webkit-scrollbar{display:none}
-.bt-ptab{position:relative;z-index:1;display:inline-flex;align-items:center;gap:6px;height:32px;max-width:180px;padding:0 8px;flex:none;border:0;border-radius:9px;background:none;color:var(--bt-ink-2);font:inherit;font-size:12.5px;cursor:pointer;white-space:nowrap;transition:color .12s ease}
+.bt-ptab{position:relative;z-index:1;display:inline-flex;align-items:center;gap:6px;height:32px;max-width:180px;padding:0 8px;flex:none;border:0;border-radius:8px;background:none;color:var(--bt-ink-2);font:inherit;font-size:12px;cursor:pointer;white-space:nowrap;transition:color .12s ease}
.bt-ptab:hover{color:var(--bt-ink)}
.bt-ptab[aria-selected=true]{color:var(--bt-ink)}
.bt-ptab-bot{padding:0 7px}
@@ -766,10 +764,10 @@ export const BROWSER_CSS = `
.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{position:relative;z-index:1;flex:none;width:28px;height:32px;border:0;border-radius:8px;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)}
.bt-ptab-new svg{width:15px;height:15px}
-.bt-ptab-ind{position:absolute;top:4px;bottom:4px;border-radius:9px;background:var(--bt-hover);opacity:0;pointer-events:none;z-index:0;transition:opacity .15s ease}
+.bt-ptab-ind{position:absolute;top:4px;bottom:4px;border-radius:8px;background:var(--bt-hover);opacity:0;pointer-events:none;z-index:0;transition:opacity .15s ease}
.bt-ptab-close{flex:none;margin-left:2px}
.bt-panel-ghost{position:absolute;top:calc(44px + var(--bt-caption-band,0px));right:0;bottom:0;overflow:hidden;pointer-events:none;z-index:2}
.bt-panel-ghost>.bt-panel-view{position:absolute;inset:0}
@@ -816,18 +814,18 @@ export const BROWSER_CSS = `
.bt-bcard-row{display:flex;align-items:center;gap:7px;padding:8px 10px;min-width:0}
.bt-bcard-fav{width:14px;height:14px;flex:none;border-radius:3px;color:var(--bt-ink-3)}
.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-title{flex:1;min-width:0;font-size:12px;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;pointer-events:none;transition:opacity .12s ease;backdrop-filter:blur(4px)}
+.bt-bcard-x{position:absolute;top:6px;right:6px;width:22px;height:22px;border:0;border-radius:6px;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{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:12px;cursor:pointer}
.bt-bcard-new:hover{color:var(--bt-ink);border-color:var(--bt-ink-3)}
.bt-bcard-new svg{width:14px;height:14px}
.bt-browser-empty-mark{display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center}
/* Cookie imports */
-.bt-import-menu{position:absolute;top:6px;right:6px;z-index:6;width:236px;padding:6px;border-radius:16px;background:var(--bt-main);border:.5px solid var(--bt-line-2);box-shadow:0 10px 32px -8px rgba(0,0,0,.14),0 2px 8px rgba(0,0,0,.06);animation:bt-bcard-in .18s cubic-bezier(.16,1,.3,1) both}
+.bt-import-menu{position:absolute;top:6px;right:6px;z-index:6;width:236px;padding:6px;border-radius:16px;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);box-shadow:var(--bt-glass-shadow);transform-origin:top right;animation:bt-pop-drop .18s cubic-bezier(.16,1,.3,1),bt-fade .14s ease-out}
.bt-import-menu-title{padding:6px 10px 8px;font-size:11px;font-weight:500;letter-spacing:.02em;color:var(--bt-ink-3)}
-.bt-import-item{display:flex;align-items:center;gap:9px;width:100%;min-width:0;padding:8px 10px;border:0;border-radius:8px;background:none;color:var(--bt-ink);font:inherit;font-size:12.5px;text-align:left;cursor:pointer}
+.bt-import-item{display:flex;align-items:center;gap:9px;width:100%;min-width:0;padding:8px 10px;border:0;border-radius:8px;background:none;color:var(--bt-ink);font:inherit;font-size:12px;text-align:left;cursor:pointer}
.bt-import-item:hover{background:var(--bt-hover)}
.bt-import-item:disabled{opacity:.5;cursor:default}
.bt-import-item-icon{flex:none;color:var(--bt-ink-3)}
@@ -843,8 +841,8 @@ export const BROWSER_CSS = `
.bt-import-list{max-height:180px;overflow:auto;border:.5px solid var(--bt-line);border-radius:10px;padding:4px 10px}
.bt-import-line{display:flex;align-items:baseline;gap:8px;padding:4px 0;min-width:0}
.bt-import-line-name{flex:none;max-width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--bt-ink)}
-.bt-import-line-count{flex:1;min-width:0;text-align:right;font-size:11.5px;color:var(--bt-ink-3);white-space:nowrap}
-.bt-import-line-reason{flex:1;min-width:0;font-size:11.5px;line-height:16px;color:var(--bt-ink-3);overflow-wrap:anywhere}
+.bt-import-line-count{flex:1;min-width:0;text-align:right;font-size:11px;color:var(--bt-ink-3);white-space:nowrap}
+.bt-import-line-reason{flex:1;min-width:0;font-size:11px;line-height:16px;color:var(--bt-ink-3);overflow-wrap:anywhere}
.bt-import-note{font-size:12px;line-height:17px;color:var(--bt-ink-3)}
.bt-import-warns{font-size:12px;color:var(--bt-ink-3)}
.bt-import-warns summary{cursor:pointer;padding:2px 0}
diff --git a/ds-bot/src/client/browser-settings.js b/ds-bot/src/client/browser-settings.js
index 358c10ee..41d2a09e 100644
--- a/ds-bot/src/client/browser-settings.js
+++ b/ds-bot/src/client/browser-settings.js
@@ -96,7 +96,7 @@ export function BrowserPage({ roster, actions, run, Section, Row }) {
bots.map(bot => h('option', { key: bot.id, value: bot.id }, bot.name)))),
h(Row, { label: t('Site') },
h('input', {
- className: 'bt-select bt-browser-site',
+ className: 'bt-input bt-browser-site',
type: 'text',
value: site,
placeholder: t('example.com — leave empty for all sites'),
@@ -123,7 +123,7 @@ export function BrowserPage({ roster, actions, run, Section, Row }) {
h('div', { className: 'bt-browser-form-foot' },
h('button', {
type: 'submit',
- className: 'bt-soft',
+ className: 'bt-soft bt-soft-sm',
disabled: busy || !selectedBot || kinds.length === 0,
}, busy ? t('Saving…') : t('Add'))))))
}
diff --git a/ds-bot/src/client/capability-settings.js b/ds-bot/src/client/capability-settings.js
index d572cd91..49691ec2 100644
--- a/ds-bot/src/client/capability-settings.js
+++ b/ds-bot/src/client/capability-settings.js
@@ -1,4 +1,4 @@
-import { createElement as h, useEffect, useState } from 'react'
+import { createElement as h, Fragment, useEffect, useState } from 'react'
import { t } from './i18n.js'
const blank = () => ({ name: '', kind: 'mcp', description: '', transport: 'stdio', command: '', argsText: '', envText: '{}', url: '', headersText: '{}', content: '', items: [] })
@@ -59,35 +59,35 @@ function CapabilityForm({ draft, setDraft, items, actions, onClose }) {
}
}
const available = items.filter(item => item.name !== draft.name && ['mcp', 'skill'].includes(item.kind))
- return h('form', { className: 'bt-connector-form', onSubmit: submit },
+ return h('form', { className: 'bt-set-card bt-task-form', onSubmit: submit },
h(Field, { label: 'Name', value: draft.name, disabled: draft.originalName !== undefined, onChange: value => set('name', value), placeholder: 'my-tool' }),
- h('label', { className: 'bt-set-row bt-bs-row bt-bs-stack' },
+ h('label', { className: 'bt-set-row bt-bs-row' },
h('span', { className: 'bt-set-copy' }, h('span', { className: 'bt-bs-label' }, t('Type'))),
- h('select', { className: 'bt-input', value: draft.kind, disabled: draft.originalName !== undefined, onChange: event => set('kind', event.target.value) },
+ h('select', { className: 'bt-select bt-task-bot', value: draft.kind, disabled: draft.originalName !== undefined, onChange: event => set('kind', event.target.value) },
['mcp', 'skill', 'pack'].map(kind => h('option', { key: kind, value: kind }, t(kind === 'mcp' ? 'MCP server' : kind === 'skill' ? 'Skill' : 'Pack'))))),
h(Field, { label: 'Description', value: draft.description, onChange: value => set('description', value) }),
- draft.kind === 'mcp' ? h('label', { className: 'bt-set-row bt-bs-row bt-bs-stack' },
+ draft.kind === 'mcp' ? h('label', { className: 'bt-set-row bt-bs-row' },
h('span', { className: 'bt-set-copy' }, h('span', { className: 'bt-bs-label' }, t('Connection'))),
- h('select', { className: 'bt-input', value: draft.transport, onChange: event => set('transport', event.target.value) },
+ h('select', { className: 'bt-select bt-task-bot', value: draft.transport, onChange: event => set('transport', event.target.value) },
h('option', { value: 'stdio' }, t('Local command')),
h('option', { value: 'streamable-http' }, t('HTTP server')))) : null,
- draft.kind === 'mcp' && draft.transport === 'stdio' ? h('div', null,
+ draft.kind === 'mcp' && draft.transport === 'stdio' ? h(Fragment, null,
h(Field, { label: 'Command', value: draft.command, onChange: value => set('command', value) }),
h(Field, { label: 'Arguments (one per line)', value: draft.argsText, onChange: value => set('argsText', value), multiline: true }),
h(Field, { label: 'Environment (JSON)', value: draft.envText, onChange: value => set('envText', value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })) : null,
- draft.kind === 'mcp' && draft.transport === 'streamable-http' ? h('div', null,
+ draft.kind === 'mcp' && draft.transport === 'streamable-http' ? h(Fragment, null,
h(Field, { label: 'URL', value: draft.url, onChange: value => set('url', value) }),
h(Field, { label: 'Headers (JSON)', value: draft.headersText, onChange: value => set('headersText', value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })) : null,
draft.kind === 'skill' ? h(Field, { label: 'Skill instructions', value: draft.content, onChange: value => set('content', value), multiline: true }) : null,
- draft.kind === 'pack' ? h('div', { className: 'bt-set-card' },
+ draft.kind === 'pack' ? h(Fragment, null,
available.length === 0 ? h('div', { className: 'bt-set-row' }, h('span', { className: 'bt-set-hint' }, t('Save an MCP server or skill first.')))
: available.map(item => h('label', { key: item.name, className: 'bt-set-row bt-bs-row' },
h('span', { className: 'bt-set-copy' }, h('span', { className: 'bt-bs-label' }, item.name)),
h('input', { type: 'checkbox', checked: draft.items.includes(item.name), onChange: event => set('items', event.target.checked ? [...draft.items, item.name] : draft.items.filter(name => name !== item.name)) })))) : null,
- error ? h('div', { className: 'bt-connector-error', role: 'alert' }, error) : null,
- h('div', { className: 'bt-connector-form-row' },
+ error ? h('div', { className: 'bt-set-row' }, h('span', { className: 'bt-danger bt-set-hint', role: 'alert' }, error)) : null,
+ h('div', { className: 'bt-set-row bt-task-foot' },
h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: onClose }, t('Cancel')),
- h('button', { type: 'submit', className: 'bt-soft bt-soft-sm' }, draft.originalName ? t('Save changes') : t('Add capability'))))
+ h('button', { type: 'submit', className: 'bt-send bt-soft-sm' }, draft.originalName ? t('Save changes') : t('Add capability'))))
}
function CapabilityRow({ item, onEdit, onDelete, onApprove, confirming }) {
@@ -135,9 +135,10 @@ export function CapabilitiesPage({ roster, actions, run }) {
}
return h('section', { className: 'bt-set-section' },
h('h3', null, t('Shared capabilities')),
- h('div', { className: 'bt-actions' },
- h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: startNew }, t('Add capability'))),
- draft ? h(CapabilityForm, { draft, setDraft, items, actions, onClose: () => setDraft(null) }) : null,
+ draft
+ ? h(CapabilityForm, { draft, setDraft, items, actions, onClose: () => setDraft(null) })
+ : h('div', { className: 'bt-actions' },
+ h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: startNew }, t('Add capability'))),
h('div', { className: 'bt-set-card bt-connectors-card' },
items.length === 0 ? h('div', { className: 'bt-set-row' }, h('span', { className: 'bt-set-hint' }, t('No capabilities saved')))
: items.map(item => h(CapabilityRow, {
diff --git a/ds-bot/src/client/composer.js b/ds-bot/src/client/composer.js
index 1ea7632d..81550e74 100644
--- a/ds-bot/src/client/composer.js
+++ b/ds-bot/src/client/composer.js
@@ -2,7 +2,7 @@ import { createElement as h, Fragment, useEffect, useMemo, useRef, useState } fr
import { createPortal } from 'react-dom'
import { ChatsIcon, ClockIcon, MicIcon, PaperclipIcon, PeopleIcon, PlusIcon, WaveIcon } from './icons.js'
import { BotMark } from './mark.js'
-import { useLinger, useViewport, viewBottom } from './motion.js'
+import { stepMenuFocus, useLinger, useViewport, viewBottom } from './motion.js'
import { t } from './i18n.js'
// -------------------------------------------------------------------------
@@ -116,7 +116,10 @@ export function ComposerPlus({ sessionId, inputActions, useRoster, actions }) {
useEffect(() => {
if (!open) return undefined
const onDown = (event) => { if (![button.current, menu.current].some(node => node?.contains(event.target))) setOpen(null) }
- const onKey = (event) => { if (event.key === 'Escape') { event.stopPropagation(); setOpen(null) } }
+ const onKey = (event) => {
+ if (stepMenuFocus(menu.current, event)) return
+ if (event.key === 'Escape') { event.stopPropagation(); setOpen(null) }
+ }
window.addEventListener('mousedown', onDown, true)
window.addEventListener('keydown', onKey, true)
return () => { window.removeEventListener('mousedown', onDown, true); window.removeEventListener('keydown', onKey, true) }
diff --git a/ds-bot/src/client/context-menu.js b/ds-bot/src/client/context-menu.js
index dc5fd1b8..d74a4dc3 100644
--- a/ds-bot/src/client/context-menu.js
+++ b/ds-bot/src/client/context-menu.js
@@ -3,17 +3,19 @@ import { isMainOf } from './sources.js'
import { currentPart } from './text.js'
import { GearIcon, PinIcon, UnreadIcon, PencilIcon, StarLineIcon, CopyIcon, HideIcon, TrashIcon, DuplicateIcon } from './icons.js'
import { useEscape } from './overlay-hooks.js'
-import { useViewport, viewBottom } from './motion.js'
+import { stepMenuFocus, useViewport, viewBottom } from './motion.js'
import { t } from './i18n.js'
export function ContextMenu({ menu, roster, actions, leaving = false }) {
useEscape(() => actions.closeMenu())
+ const ref = useRef(null)
useEffect(() => {
const onDown = (event) => { if (!(event.target instanceof Element) || !event.target.closest('.bt-menu')) actions.closeMenu() }
+ const onKey = (event) => { stepMenuFocus(ref.current, event) }
window.addEventListener('mousedown', onDown)
- return () => window.removeEventListener('mousedown', onDown)
+ window.addEventListener('keydown', onKey, true)
+ return () => { window.removeEventListener('mousedown', onDown); window.removeEventListener('keydown', onKey, true) }
}, [])
- const ref = useRef(null)
const [place, setPlace] = useState({ left: menu.x, top: menu.y })
const tick = useViewport()
useLayoutEffect(() => {
@@ -61,6 +63,11 @@ export function ContextMenu({ menu, roster, actions, leaving = false }) {
// Menus for the DSH Agent row and its Sessions; none of the Bot entries apply.
function AgentMenu({ menu, roster, actions, leaving }) {
const ref = useRef(null)
+ useEffect(() => {
+ const onKey = (event) => { stepMenuFocus(ref.current, event) }
+ window.addEventListener('keydown', onKey, true)
+ return () => window.removeEventListener('keydown', onKey, true)
+ }, [])
const [place, setPlace] = useState({ left: menu.x, top: menu.y })
const tick = useViewport()
useLayoutEffect(() => {
diff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.js
index fa328fd3..c52874fc 100644
--- a/ds-bot/src/client/i18n.js
+++ b/ds-bot/src/client/i18n.js
@@ -71,6 +71,7 @@ const ZH = {
'Add capability': '添加能力',
'No capabilities saved': '还没有保存能力',
Type: '类型',
+ Description: '说明',
'MCP server': 'MCP 服务',
Skill: '技能',
Pack: '能力包',
diff --git a/ds-bot/src/client/mark.js b/ds-bot/src/client/mark.js
index 498d23bb..be620c91 100644
--- a/ds-bot/src/client/mark.js
+++ b/ds-bot/src/client/mark.js
@@ -1,5 +1,6 @@
import { createElement as h, useEffect, useRef, useState } from 'react'
import { fnv1a, lookOf, shapeId, shapeOf, MASK_ID, nextMarkSerial, characterMarkup } from './characters.js'
+import { reducedMotion } from './motion.js'
import { t } from './i18n.js'
export { colorOf, lookOf } from './characters.js'
@@ -19,7 +20,7 @@ export const toolState = name => (/^(message_bot|stop_bot|create_bot|update_bot|
// Eyes follow the pointer on large marks.
function useGaze(ref, enabled) {
useEffect(() => {
- if (!enabled) return undefined
+ if (!enabled || reducedMotion()) return undefined
let frame = 0
let point = null
const place = () => {
@@ -31,7 +32,11 @@ function useGaze(ref, enabled) {
node.style.setProperty('--bt-gx', clamp((point.x - box.left - box.width / 2) / 160).toFixed(2))
node.style.setProperty('--bt-gy', clamp((point.y - box.top - box.height / 2) / 160).toFixed(2))
}
- const onMove = (event) => { point = { x: event.clientX, y: event.clientY }; if (!frame) frame = requestAnimationFrame(place) }
+ const onMove = (event) => {
+ if (document.body?.dataset.btMotion === 'quiet') return
+ point = { x: event.clientX, y: event.clientY }
+ if (!frame) frame = requestAnimationFrame(place)
+ }
const onLeave = () => { point = null; ref.current?.style.setProperty('--bt-gx', '0'); ref.current?.style.setProperty('--bt-gy', '0') }
window.addEventListener('pointermove', onMove, { passive: true })
document.documentElement.addEventListener('pointerleave', onLeave)
diff --git a/ds-bot/src/client/member-status.js b/ds-bot/src/client/member-status.js
index 401f2ecb..87100c58 100644
--- a/ds-bot/src/client/member-status.js
+++ b/ds-bot/src/client/member-status.js
@@ -237,7 +237,7 @@ body[data-ds-dark-theme] .bt-mw-ask{color:#f0b84a}
.bt-member-time{flex:none;margin-left:.3em;font-variant-numeric:tabular-nums}
.bt-member-state.bt-mw-ask{color:#b7791f}
body[data-ds-dark-theme] .bt-member-state.bt-mw-ask{color:#f0b84a}
-.bt-member-stop{flex:none;height:26px;padding:0 11px;border:0;border-radius:13px;background:var(--bt-main);box-shadow:inset 0 0 0 .5px var(--bt-line-2);color:var(--bt-ink-2);font:inherit;font-size:12px;cursor:pointer;transition:background-color .12s ease,color .12s ease,${spring(SPRING_TAP, 'scale')}}
+.bt-member-stop{flex:none;height:26px;padding:0 11px;border:0;border-radius:999px;background:var(--bt-main);box-shadow:inset 0 0 0 .5px var(--bt-line-2);color:var(--bt-ink-2);font:inherit;font-size:12px;cursor:pointer;transition:background-color .12s ease,color .12s ease,${spring(SPRING_TAP, 'scale')}}
.bt-member-stop:hover{background:var(--bt-active);color:var(--bt-ink)}
.bt-member-stop:active:not(:disabled){scale:.94}
.bt-member-stop:disabled{opacity:.5;cursor:default}
diff --git a/ds-bot/src/client/memory-panel.js b/ds-bot/src/client/memory-panel.js
index d432c625..d497b84b 100644
--- a/ds-bot/src/client/memory-panel.js
+++ b/ds-bot/src/client/memory-panel.js
@@ -7,7 +7,7 @@ import { useEscape } from './overlay-hooks.js'
import { ArrowUpIcon, CheckIcon, ChevronLeftIcon, ChevronRightIcon, CloseIcon, DotsIcon, MemoryIcon, TrashIcon } from './icons.js'
import { dateLocale, hostText, t } from './i18n.js'
import { summaryBlocks } from './text.js'
-import { useLinger } from './motion.js'
+import { stepMenuFocus, useLinger } from './motion.js'
const POLL_MS = 1500
const MENU_EXIT_MS = 120
@@ -225,7 +225,10 @@ export function MemoryDialog({ owner, actions, leaving = false }) {
if (menuRef.current?.contains(event.target) || dotsRef.current?.contains(event.target)) return
setMenu(false)
}
- const onKey = (event) => { if (event.key === 'Escape') { event.stopPropagation(); setMenu(false); dotsRef.current?.focus() } }
+ const onKey = (event) => {
+ if (stepMenuFocus(menuRef.current, event)) return
+ if (event.key === 'Escape') { event.stopPropagation(); setMenu(false); dotsRef.current?.focus() }
+ }
window.addEventListener('mousedown', onDown)
window.addEventListener('keydown', onKey, true)
return () => {
diff --git a/ds-bot/src/client/model-menu.js b/ds-bot/src/client/model-menu.js
index 4ac48362..895902d4 100644
--- a/ds-bot/src/client/model-menu.js
+++ b/ds-bot/src/client/model-menu.js
@@ -4,7 +4,7 @@ import { currentPart } from './text.js'
import { CheckIcon, SlidersIcon } from './icons.js'
import { BotMark } from './mark.js'
import { KeyIcon, MaskedInput } from './secret-card.js'
-import { SPRING_POP, SPRING_SHAPE, spring, useLinger, useViewport, viewBottom } from './motion.js'
+import { SPRING_POP, SPRING_SHAPE, spring, stepMenuFocus, useLinger, useViewport, viewBottom } from './motion.js'
import { hostText, t } from './i18n.js'
const MENU_EXIT_MS = 120
@@ -114,7 +114,10 @@ export function useAnchoredMenu() {
if (menu.current?.contains(event.target) || button.current?.contains(event.target)) return
close()
}
- const onKey = (event) => { if (event.key === 'Escape') { event.stopPropagation(); close(); button.current?.focus() } }
+ const onKey = (event) => {
+ if (stepMenuFocus(menu.current, event)) return
+ if (event.key === 'Escape') { event.stopPropagation(); close(); button.current?.focus() }
+ }
const onScroll = (event) => { if (!menu.current?.contains(event.target)) close() }
window.addEventListener('mousedown', onDown)
window.addEventListener('keydown', onKey, true)
diff --git a/ds-bot/src/client/motion.js b/ds-bot/src/client/motion.js
index 66723a80..50d5538a 100644
--- a/ds-bot/src/client/motion.js
+++ b/ds-bot/src/client/motion.js
@@ -55,6 +55,8 @@ export const SPRING_POP = springEasing(500, 22)
// within about a quarter second.
export const SPRING_LEAD = springEasing(784, 48.2)
export const SPRING_TRAIL = springEasing(289, 29.2)
+// Critically damped layout glide (ω≈31.6, ζ=1) for sidebar row reordering.
+export const SPRING_GLIDE = springEasing(1000, 63)
// A highlight that follows the keyboard and pointer down a list keeps up on stiffer
// edges (ω=30 and ω=20).
export const QUICK_EDGES = { lead: springEasing(900, 51), trail: springEasing(400, 34) }
@@ -67,35 +69,41 @@ export const spring = (curve, ...properties) => properties.map(property => `${pr
// page delays the thumb instead of slowing it down.
function liveSprings(apply) {
const values = new Map()
+ const current = {}
let frame = 0
let last = 0
- const read = () => Object.fromEntries([...values].map(([key, value]) => [key, value.x]))
const step = (now) => {
const dt = Math.min(0.5, Math.max(0.001, (now - last) / 1000))
last = now
const steps = Math.ceil(dt * 240)
const h = dt / steps
let moving = false
- for (const value of values.values()) {
+ for (const [key, value] of values) {
for (let index = 0; index < steps; index += 1) {
value.v += (-value.k * (value.x - value.to) - value.c * value.v) * h
value.x += value.v * h
}
if (Math.abs(value.x - value.to) < 0.05 && Math.abs(value.v) < 1) { value.x = value.to; value.v = 0 } else moving = true
+ current[key] = value.x
}
- apply(read())
+ apply(current)
frame = moving ? requestAnimationFrame(step) : 0
}
return {
- target: () => (values.size ? Object.fromEntries([...values].map(([key, value]) => [key, value.to])) : null),
+ target: () => {
+ if (!values.size) return null
+ const out = {}
+ for (const [key, value] of values) out[key] = value.to
+ return out
+ },
set(targets, curves, jump) {
for (const [key, to] of Object.entries(targets)) {
const value = values.get(key)
const { stiffness: k, damping: c } = curves[key]
- if (!value || jump) values.set(key, { x: to, v: 0, to, k, c })
+ if (!value || jump) { values.set(key, { x: to, v: 0, to, k, c }); current[key] = to }
else Object.assign(value, { to, k, c })
}
- if (jump) { cancelAnimationFrame(frame); frame = 0; apply(read()); return }
+ if (jump) { cancelAnimationFrame(frame); frame = 0; apply(current); return }
if (!frame) { last = performance.now(); frame = requestAnimationFrame(step) }
},
stop: () => cancelAnimationFrame(frame),
@@ -243,3 +251,19 @@ export function useLinger(value, ms) {
}, [value])
return [value || kept, !value && Boolean(kept)]
}
+
+// Moves keyboard focus through enabled menu items on ArrowDown, ArrowUp, Home and End.
+export function stepMenuFocus(menu, event) {
+ if (!menu || !['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return false
+ const items = Array.from(menu.querySelectorAll('button[role^="menuitem"]:not(:disabled)'))
+ if (items.length === 0) return false
+ event.preventDefault()
+ event.stopPropagation()
+ const current = items.indexOf(document.activeElement)
+ const next = event.key === 'Home' ? 0
+ : event.key === 'End' ? items.length - 1
+ : event.key === 'ArrowDown' ? (current + 1) % items.length
+ : (current <= 0 ? items.length - 1 : current - 1)
+ items[next]?.focus()
+ return true
+}
diff --git a/ds-bot/src/client/providers-page.js b/ds-bot/src/client/providers-page.js
index a3f8bc8d..b27e46b3 100644
--- a/ds-bot/src/client/providers-page.js
+++ b/ds-bot/src/client/providers-page.js
@@ -169,7 +169,7 @@ function FormActions({ onCancel, onAdd, ready }) {
}
export const PROVIDERS_CSS = `
-.bt-provider-id{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;color:var(--bt-ink-3)}
+.bt-provider-id{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;color:var(--bt-ink-3)}
.bt-provider .bt-set-hint[data-error]{color:var(--bt-danger)}
.bt-provider-state{display:inline-flex;align-items:center;gap:6px;font-size:12px;line-height:16px;color:var(--bt-ink-2);white-space:nowrap}
.bt-provider-state::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--bt-ink-3)}
@@ -189,7 +189,7 @@ export const PROVIDERS_CSS = `
.bt-provider-pair{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.bt-provider-models-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.bt-provider-found{max-height:180px;overflow-y:auto;scrollbar-width:thin}
-.bt-provider-found code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px}
+.bt-provider-found code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}
.bt-provider-found .bt-secret-bot{padding:0 10px}
@media (prefers-reduced-motion:reduce){.bt-provider-add{animation:none}}
`
diff --git a/ds-bot/src/client/secret-card.js b/ds-bot/src/client/secret-card.js
index 51b9d477..667bc427 100644
--- a/ds-bot/src/client/secret-card.js
+++ b/ds-bot/src/client/secret-card.js
@@ -302,7 +302,7 @@ export const SECRET_CSS = `
.bt-secret-who{position:relative;flex:none;display:inline-flex}
.bt-secret-lock{position:absolute;right:-5px;bottom:-4px;width:16px;height:16px;border-radius:50%;background:var(--bt-main);color:var(--bt-ink-2);display:inline-flex;align-items:center;justify-content:center;box-shadow:0 0 0 1.5px var(--bt-bubble)}
.bt-secret-lock svg{width:11px;height:11px}
-.bt-secret-name{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:16px;padding:1px 6px;border-radius:5px;background:var(--bt-hover);color:var(--bt-ink)}
+.bt-secret-name{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:16px;padding:1px 6px;border-radius:6px;background:var(--bt-hover);color:var(--bt-ink)}
.bt-secret-body{display:flex;flex-direction:column;gap:8px}
.bt-secret-field{align-items:center;min-height:36px}
.bt-secret-input{flex:1;width:100%;min-width:0;margin:0;padding:0;border:0;outline:none;background:transparent;color:var(--bt-ink);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:14px;line-height:20px;letter-spacing:.04em}
@@ -323,7 +323,7 @@ export const SECRET_CSS = `
@keyframes bt-secret-in{from{opacity:0;transform:translateY(-2px)}}
.bt-secret-saved{display:flex;align-items:center;gap:6px;font-size:13px;line-height:18px;color:var(--bt-ink-2)}
.bt-secret-note{font-size:12px;line-height:17px;color:var(--bt-ink-3)}
-.bt-secret-note code,.bt-secret-about code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px}
+.bt-secret-note code,.bt-secret-about code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}
.bt-secret-warn{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:8px;font-size:12px;line-height:16px;color:#b25e09;background:color-mix(in srgb,#f59e0b 12%,transparent)}
.bt-secret-error{font-size:12px;line-height:16px;color:var(--bt-danger)}
.bt-secret .bt-q-btn:disabled{opacity:.5;cursor:default}
diff --git a/ds-bot/src/client/settings.js b/ds-bot/src/client/settings.js
index 4428659d..5e90f8f9 100644
--- a/ds-bot/src/client/settings.js
+++ b/ds-bot/src/client/settings.js
@@ -2,7 +2,7 @@ import { createElement as h, useCallback, useEffect, useRef, useState } from 're
import { ACCENT_INKS, INKS } from './inks.js'
import { isMainOf } from './sources.js'
import { MESSAGE_WIDTH, allThemes, flatWidthOf, layoutOf, thinkingShown, widthOf } from './themes.js'
-import { CloseIcon, ChevronLeftIcon, ChevronRightIcon, ClockIcon, ConnectorIcon, InfoIcon, PlugIcon, PlusIcon, SlidersIcon, SETTINGS_ICONS } from './icons.js'
+import { CloseIcon, ChevronLeftIcon, ChevronRightIcon, ClockIcon, ConnectorIcon, GlobeIcon, InfoIcon, PlugIcon, PlusIcon, SlidersIcon, SETTINGS_ICONS } from './icons.js'
import { AdminStar, BotAvatar, RoomAvatar } from './mark.js'
import { useEscape } from './overlay-hooks.js'
import { BotSettingsForm, Switch } from './bot-settings.js'
@@ -28,7 +28,7 @@ const capitalize = word => word[0].toUpperCase() + word.slice(1)
// their members, and one opens on its own settings form. Usage widens the dialog.
// Models is there only in a window without DSH's own settings, which carry the providers.
const SETTINGS_PAGES = [['general', 'General'], ['models', 'Models'], ['bots', 'Bots'], ['groups', 'Group chats'], ['connectors', 'Connectors'], ['capabilities', 'Capabilities'], ['browser', 'Browser'], ['schedules', 'Scheduled tasks'], ['usage', 'Usage'], ['secrets', 'Secrets'], ['feedback', 'Feedback'], ['about', 'About DS Bot']]
-const PAGE_ICONS = { ...SETTINGS_ICONS, models: SlidersIcon, connectors: ConnectorIcon, capabilities: PlugIcon, browser: ConnectorIcon, schedules: ClockIcon, secrets: KeyIcon, feedback: FeedbackIcon, about: InfoIcon }
+const PAGE_ICONS = { ...SETTINGS_ICONS, models: SlidersIcon, connectors: ConnectorIcon, capabilities: PlugIcon, browser: GlobeIcon, schedules: ClockIcon, secrets: KeyIcon, feedback: FeedbackIcon, about: InfoIcon }
function SetSection({ title, className = '', children }) {
return h('section', { className: `bt-set-section ${className}`.trim() }, h('h3', null, title), h('div', { className: 'bt-set-card' }, children))
diff --git a/ds-bot/src/client/side-chat.js b/ds-bot/src/client/side-chat.js
index bf762a75..309a0b0b 100644
--- a/ds-bot/src/client/side-chat.js
+++ b/ds-bot/src/client/side-chat.js
@@ -139,9 +139,11 @@ export const SIDE_CSS = `
.bt-side-input:focus{border-color:var(--bt-accent)}
.bt-side-input:disabled{opacity:.6}
.bt-pmenu{position:relative;display:inline-flex;flex:none}
-.bt-pmenu-pop{position:absolute;top:calc(100% + 6px);right:0;z-index:6;min-width:172px;padding:6px;border-radius:12px;background:var(--bt-main);border:.5px solid var(--bt-line-2);box-shadow:0 10px 32px -8px rgba(0,0,0,.14),0 2px 8px rgba(0,0,0,.06);display:flex;flex-direction:column;gap:2px;animation:bt-bcard-in .18s cubic-bezier(.16,1,.3,1) both}
+.bt-pmenu-pop{position:absolute;top:calc(100% + 6px);right:0;z-index:6;min-width:172px;padding:6px;border-radius:12px;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);box-shadow:var(--bt-glass-shadow);display:flex;flex-direction:column;gap:2px;transform-origin:top right;animation:bt-pop-drop .18s cubic-bezier(.16,1,.3,1),bt-fade .14s ease-out}
+.bt-pmenu-pop[data-leaving]{animation:bt-pop-out .12s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}
.bt-pmenu-item{display:flex;align-items:center;gap:9px;width:100%;min-width:0;padding:7px 10px;border:0;border-radius:8px;background:none;color:var(--bt-ink);font:inherit;font-size:12px;line-height:17px;text-align:left;cursor:pointer}
.bt-pmenu-item:hover{background:var(--bt-hover)}
+.bt-pmenu-item:focus-visible{outline:2px solid var(--bt-accent);outline-offset:-2px}
.bt-pmenu-item svg{flex:none;width:15px;height:15px;color:var(--bt-ink-3)}
.bt-pmenu-sep{height:.5px;flex:none;margin:4px 8px;background:var(--bt-line-2)}
`
diff --git a/ds-bot/src/client/sidebar.js b/ds-bot/src/client/sidebar.js
index e2d58d3b..49f04d8f 100644
--- a/ds-bot/src/client/sidebar.js
+++ b/ds-bot/src/client/sidebar.js
@@ -8,7 +8,7 @@ import { MAIN_LOOK } from './characters.js'
import { botState, BotMark, BotAvatar, RoomAvatar } from './mark.js'
import { reducedMotion } from './activity-row.js'
import { Shimmer, workPhrase } from './cells.js'
-import { springEasing, SPRING_SHAPE, useLinger, useViewport, viewBottom } from './motion.js'
+import { SPRING_GLIDE, SPRING_SHAPE, stepMenuFocus, useLinger, useViewport, viewBottom } from './motion.js'
import { hostText, t } from './i18n.js'
import { clientErrors } from './diagnostics.js'
import { showsDshRow } from './dsh-offer.js'
@@ -43,8 +43,10 @@ const useApproval = (useWork, match) => (useWork ? useWork(work => (work.approva
// Work running in group Sessions, as "botId|tool" keys so a row redraws only when it
// changes: the groups one Bot works in, or the members at work in one group.
// Picked as text, so a row redraws only when what it shows changes.
-const useGroupWork = (useWork, pick) => (useWork ? useWork(work => JSON.stringify(pick(work.rooms ?? {}))) : '[]')
-const workKeys = text => JSON.parse(text)
+const useGroupWork = (useWork, pick) => {
+ const raw = useWork ? useWork(work => JSON.stringify(pick(work.rooms ?? {}))) : '[]'
+ return useMemo(() => JSON.parse(raw), [raw])
+}
const doingOf = ({ tool, said, note, target, switching }) => ({ tool, said, note, target, switching })
const workLine = (lead, doing, more) => h(Shimmer, null, `${lead} · ${workPhrase(doing)}…${more > 0 ? ` +${more}` : ''}`)
// The row already names the Bot; its own-chat preview is just what it is doing.
@@ -69,13 +71,14 @@ function BotRow({ bot, roster, actions, useSessions, useSessionStatus, useSessio
const alert = roster.questions?.[part] !== undefined || approval
const doing = useActivity(map => map[id])
// Work in a group runs in a Session of its own, so the Bot's chat stays idle meanwhile.
- const groups = workKeys(useGroupWork(useWork, rooms => Object.entries(rooms).flatMap(([roomId, entries]) => entries.filter(entry => entry.botId === id).map(entry => ({ id: roomId, ...doingOf(entry) })))))
+ const groups = useGroupWork(useWork, rooms => Object.entries(rooms).flatMap(([roomId, entries]) => entries.filter(entry => entry.botId === id).map(entry => ({ id: roomId, ...doingOf(entry) }))))
const away = !running && groups.length > 0
const state = botState(running || away, doing, alert)
// A Bot running in its own chat previews what it is doing, like a group's row.
const runningLine = running && doing ? doingLine(doing) : null
const awayLine = away ? workLine(roster.roomsById[groups[0].id]?.name ?? t('a group chat'), groups[0], groups.length - 1) : null
- const waits = workKeys(useWork ? useWork(work => JSON.stringify(work.waiting?.[id] ?? null)) : 'null')
+ const waitsRaw = useWork ? useWork(work => JSON.stringify(work.waiting?.[id] ?? null)) : 'null'
+ const waits = useMemo(() => JSON.parse(waitsRaw), [waitsRaw])
const waitsFor = state === 'waiting' ? waitingFor(roster, waits) : ''
if (bot.hidden && !active && !main) return null
const onContextMenu = (event) => {
@@ -119,7 +122,7 @@ function RoomRow({ room, roster, actions, useSessions, useSessionStatus, useSess
const unread = useSessionStatus(map => map.get(sessionId)?.completionUnread === true) || (marked && !active)
useMarkedUnread(id, active, marked, actions)
const approval = useApproval(useWork, entry => entry.roomId === id)
- const members = workKeys(useGroupWork(useWork, rooms => (rooms[id] ?? []).filter(entry => entry.botId !== undefined).map(entry => ({ id: entry.botId, ...doingOf(entry) }))))
+ const members = useGroupWork(useWork, rooms => (rooms[id] ?? []).filter(entry => entry.botId !== undefined).map(entry => ({ id: entry.botId, ...doingOf(entry) })))
const first = roster.byId[members[0]?.id]
const workingLine = first ? workLine(first.name, members[0], members.length - 1) : null
if (room.hidden && !active) return null
@@ -204,13 +207,15 @@ function AgentRow({ agent, actions, useSessions, useSessionStatus, useUi, wide,
const statusInfo = useSessionStatus(map => JSON.stringify(agent.sessions.map(id => ({
id, running: map.get(id)?.running === true, unread: map.get(id)?.completionUnread === true,
}))))
- const statuses = Object.fromEntries(JSON.parse(statusInfo).map(entry => [entry.id, entry]))
- const sessions = JSON.parse(info).map(session => ({
- ...session,
- running: statuses[session.id]?.running ?? session.running,
- unread: statuses[session.id]?.unread ?? false,
- title: session.title === '' ? t('New session') : session.title,
- }))
+ const sessions = useMemo(() => {
+ const statuses = Object.fromEntries(JSON.parse(statusInfo).map(entry => [entry.id, entry]))
+ return JSON.parse(info).map(session => ({
+ ...session,
+ running: statuses[session.id]?.running ?? session.running,
+ unread: statuses[session.id]?.unread ?? false,
+ title: session.title === '' ? t('New session') : session.title,
+ }))
+ }, [info, statusInfo])
const renaming = useUi(value => value.renameAgent)
const active = sessions.some(session => session.active)
const running = sessions.some(session => session.running)
@@ -241,9 +246,6 @@ function AgentRow({ agent, actions, useSessions, useSessionStatus, useUi, wide,
})))))
}
-// List rows glide to new places on a spring.
-const GLIDE = springEasing(1000, 63)
-
function useListGlide(listRef, layout, key) {
const tops = useRef({ layout, map: new Map() })
useLayoutEffect(() => {
@@ -258,7 +260,7 @@ function useListGlide(listRef, layout, key) {
next.set(id, top)
const before = tops.current.map.get(id)
if (!still && before !== undefined && Math.abs(before - top) > 0.5) {
- row.animate([{ transform: `translateY(${before - top}px)` }, { transform: 'none' }], GLIDE)
+ row.animate([{ transform: `translateY(${before - top}px)` }, { transform: 'none' }], SPRING_GLIDE)
}
}
tops.current = { layout, map: next }
@@ -305,14 +307,18 @@ export function TeamSidebar(props) {
const listRef = useRef(null)
const roster = useRoster(value => value)
const markedUnread = useUi(value => value.unread)
- const uiNow = useUi(value => value)
+ const leftDrawer = useUi(value => value.leftDrawer === true)
+ const details = useUi(value => value.details ?? null)
+ const view = useUi(value => value.view ?? 'details')
+ const panelYield = useUi(value => value.panelYield === true)
+ const bootFailed = useUi(value => value.bootFailed === true)
props.useRegistry(value => value)
const frameSnap = props.useFrame ? props.useFrame(value => value) : { viewport: typeof window === 'undefined' ? 0 : window.innerWidth, sidebarWidth: FALLBACK_SIDEBAR_WIDTH, collapsedWidth: 0 }
const pref = props.useSidebarPref ? props.useSidebarPref(value => value) : 'open'
const layout = frameLayout({
viewport: frameSnap.viewport, sidebarWidth: frameSnap.sidebarWidth,
- pref, drawer: uiNow.leftDrawer === true,
- panel: uiNow.details ? { view: uiNow.view, yielded: uiNow.panelYield === true } : null,
+ pref, drawer: leftDrawer,
+ panel: details ? { view, yielded: panelYield } : null,
})
// A drag of the column's edge shows where it would land, live.
const [drag, setDrag] = useState(null)
@@ -517,7 +523,7 @@ export function TeamSidebar(props) {
const navigate = (open, id) => {
const result = open(id)
- if (uiNow.leftDrawer === true) actions.setLeftDrawer?.(false)
+ if (leftDrawer) actions.setLeftDrawer?.(false)
return result
}
const rowActions = {
@@ -565,7 +571,7 @@ export function TeamSidebar(props) {
: h('div', { className: 'bt-rail-top' },
h(UpdateButton, { useUpdate: props.useUpdate, actions }),
h('button', { type: 'button', className: 'bt-round bt-side-collapse', 'aria-label': t('Collapse sidebar'), title: t('Collapse sidebar'), onClick: onToggle }, h(SidebarIcon)),
- main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, uiNow.bootFailed ? bootHint() : t('Setting up your Main Bot…')),
+ main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, bootFailed ? bootHint() : t('Setting up your Main Bot…')),
h('span', { className: 'bt-rail-sep', 'aria-hidden': true }))
// The foot stands in for the shell's hidden footer: the account avatar, and on
// the rail the new-chat button above it.
@@ -578,7 +584,7 @@ export function TeamSidebar(props) {
top,
wideContent && roster.readOnly ? h('div', { className: 'bt-hint bt-read-only', role: 'status' }, hostText(roster.readOnly)) : null,
h('div', { ref: listRef, className: 'bt-list', role: 'region', 'aria-label': t('Bot list') },
- wideContent ? (main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, uiNow.bootFailed ? bootHint() : t('Setting up your Main Bot…'))) : null,
+ wideContent ? (main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, bootFailed ? bootHint() : t('Setting up your Main Bot…'))) : null,
order.map(entry => (entry.kind === 'bot'
? h(BotRow, { key: entry.item.id, ...rowProps, bot: entry.item, marked: markedUnread[entry.item.id] === true })
: entry.kind === 'room'
@@ -597,6 +603,7 @@ export function TeamSidebar(props) {
function UpdateButton({ useUpdate, actions }) {
const update = useUpdate(value => value)
const [open, setOpen] = useState(false)
+ const [shown, leaving] = useLinger(open, 120)
const [box, setBox] = useState(null)
const [error, setError] = useState('')
const [dshError, setDshError] = useState('')
@@ -654,7 +661,7 @@ function UpdateButton({ useUpdate, actions }) {
ref: button, type: 'button', className: 'bt-round bt-update', 'data-phase': cloudPhase, 'aria-label': label, title: label,
'aria-haspopup': 'dialog', 'aria-expanded': open, onClick: toggle,
}, h(CloudDownloadIcon, { done: phase === 'installed' || phase === 'updated' }), phase === 'failed' || dshPhase === 'failed' ? h('span', { className: 'bt-update-dot', 'aria-hidden': true }) : null),
- open && box ? createPortal(h('div', { className: 'bt-update-pop', role: 'dialog', 'aria-label': update?.available || phase !== 'idle' ? t('DS Bot update') : t('DSH update'), style: box },
+ shown && box ? createPortal(h('div', { className: 'bt-update-pop', role: 'dialog', 'aria-label': update?.available || phase !== 'idle' ? t('DS Bot update') : t('DSH update'), style: box, 'data-leaving': leaving || undefined },
update?.available || phase !== 'idle' ? h(Fragment, null,
h('div', { className: 'bt-update-title' }, phase === 'installed' || phase === 'updated' ? t('Update installed') : t('DS Bot {version}', { version: update.latest })),
h('div', { className: 'bt-update-text' }, phase === 'installed'
@@ -770,6 +777,7 @@ export function AccountLauncher({ seat = true, settingsOpen, openSettings, openO
}, [seat])
const [box, setBox] = useState(null)
const button = useRef(null)
+ const menuRef = useRef(null)
useEffect(() => { if (settingsOpen) setOpen(false) }, [settingsOpen])
// The settings dialog links back to the shell's own settings (models, providers).
useEffect(() => {
@@ -788,7 +796,10 @@ export function AccountLauncher({ seat = true, settingsOpen, openSettings, openO
if (event.target instanceof Element && (event.target.closest('.bt-account-menu') || button.current?.contains(event.target))) return
setOpen(false)
}
- const onKey = (event) => { if (event.key === 'Escape') { event.stopPropagation(); setOpen(false); button.current?.focus() } }
+ const onKey = (event) => {
+ if (stepMenuFocus(menuRef.current, event)) return
+ if (event.key === 'Escape') { event.stopPropagation(); setOpen(false); button.current?.focus() }
+ }
window.addEventListener('mousedown', onDown)
window.addEventListener('keydown', onKey, true)
return () => { window.removeEventListener('mousedown', onDown); window.removeEventListener('keydown', onKey, true) }
@@ -856,7 +867,7 @@ export function AccountLauncher({ seat = true, settingsOpen, openSettings, openO
return h(Fragment, null,
h('button', { ref: button, type: 'button', className: 'bt-account', 'aria-label': t('Account'), 'aria-haspopup': 'menu', 'aria-expanded': open, onClick: toggle },
h('span', { className: 'bt-you', 'aria-hidden': true }, h(GearIcon))),
- open && box ? createPortal(h('div', { className: 'bt-menu bt-menu-up bt-account-menu', role: 'menu', 'aria-label': t('Account'), style: box },
+ open && box ? createPortal(h('div', { ref: menuRef, className: 'bt-menu bt-menu-up bt-account-menu', role: 'menu', 'aria-label': t('Account'), style: box },
confirm !== null ? h('div', { className: 'bt-confirm', role: 'alertdialog', 'aria-label': accountT('signOut') },
h('p', { className: 'bt-confirm-text' }, accountT(confirm === 'running' ? 'signOutRunningDescription' : confirm === 'unknown' ? 'signOutUnknownDescription' : 'signOutDescription')),
signOutError !== '' ? h('p', { className: 'bt-confirm-error', role: 'alert' }, signOutError) : null,
@@ -977,13 +988,14 @@ export const SIDEBAR_CSS = `
.bt-update[data-phase=installing] .bt-cloud-arrow{animation:bt-cloud-drop 1.1s cubic-bezier(.45,0,.55,1) infinite}
@keyframes bt-cloud-drop{0%{transform:translateY(-3px);opacity:0}35%{opacity:1}70%{transform:translateY(1px);opacity:1}100%{transform:translateY(2px);opacity:0}}
.bt-update-dot{position:absolute;top:6px;right:6px;width:7px;height:7px;border-radius:50%;background:#E5484D;box-shadow:0 0 0 1.5px var(--bt-sidebar)}
-.bt-update-pop{position:fixed;z-index:60;width:280px;padding:14px 14px 12px;border-radius:14px;background:var(--bt-main);border:.5px solid var(--bt-line-2);box-shadow:0 10px 20px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);color:var(--bt-ink);box-sizing:border-box;transform-origin:top left;font-family:var(--bt-font);animation:bt-update-pop ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing}}
+.bt-update-pop{position:fixed;z-index:60;width:280px;padding:14px 14px 12px;border-radius:16px;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);box-shadow:var(--bt-glass-shadow);color:var(--bt-ink);box-sizing:border-box;transform-origin:top left;font-family:var(--bt-font);animation:bt-update-pop ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing}}
+.bt-update-pop[data-leaving]{animation:bt-pop-out .12s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}
@keyframes bt-update-pop{from{opacity:0;transform:scale(.96);filter:blur(4px)}}
.bt-update-title{font-size:14px;line-height:20px;font-weight:600}
-.bt-update-text{margin-top:2px;font-size:12.5px;line-height:18px;color:var(--bt-ink-2)}
+.bt-update-text{margin-top:2px;font-size:12px;line-height:18px;color:var(--bt-ink-2)}
.bt-update-error{margin-top:8px;font-size:12px;line-height:17px;color:var(--bt-danger);overflow-wrap:anywhere;max-height:90px;overflow:auto}
.bt-update-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:12px}
-.bt-update-notes{margin-right:auto;font-size:12.5px;color:var(--bt-ink-2);text-decoration:none}
+.bt-update-notes{margin-right:auto;font-size:12px;color:var(--bt-ink-2);text-decoration:none}
.bt-update-notes:hover{color:var(--bt-ink);text-decoration:underline}
.bt-update-go{height:30px;padding:0 14px;border:0;border-radius:999px;background:var(--bt-accent,#4D6BFE);color:var(--bt-accent-ink,#fff);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:opacity .12s ease,transform .12s ease}
.bt-update-go:hover:not(:disabled){opacity:.9}
diff --git a/ds-bot/src/client/styles.js b/ds-bot/src/client/styles.js
index a3bbe26d..d1438852 100644
--- a/ds-bot/src/client/styles.js
+++ b/ds-bot/src/client/styles.js
@@ -332,7 +332,7 @@ button.bt-q-opt:active{background:var(--bt-active)}
.bt-admin-star{flex:none;display:inline-flex;align-items:center;justify-content:center;width:12px;height:12px;border-radius:50%;corner-shape:round;background:color-mix(in srgb,var(--bt-star) 82%,var(--bt-sidebar));vertical-align:-1px}
.bt-to-star{display:inline-flex;margin-right:-2px;animation:bt-check-pop ${SPRING_POP.duration}ms ${SPRING_POP.easing}}
.bt-to .bt-to-create{flex:none;height:28px;padding:0 12px;font-size:13px;animation:bt-q-submit-in ${SPRING_TAP.duration}ms ${SPRING_TAP.easing},bt-veil-in .16s ease-out}
-.bt-drop{position:absolute;top:48px;left:32px;width:min(550px,calc(100% - 64px));display:flex;flex-direction:column;padding:6px;max-height:min(420px,60vh);overflow-y:auto;background:var(--bt-card);border:1px solid var(--bt-line-2);border-radius:12px;box-shadow:0 6px 20px -4px rgba(0,0,0,.12);box-sizing:border-box;z-index:1;transform-origin:24px 0;animation:bt-pop-drop ${SPRING_TAP.duration}ms ${SPRING_TAP.easing},bt-veil-in .14s ease-out}
+.bt-drop{position:absolute;top:48px;left:32px;width:min(550px,calc(100% - 64px));display:flex;flex-direction:column;padding:6px;max-height:min(420px,60vh);overflow-y:auto;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);border-radius:12px;box-shadow:var(--bt-glass-shadow);box-sizing:border-box;z-index:1;transform-origin:24px 0;animation:bt-pop-drop ${SPRING_TAP.duration}ms ${SPRING_TAP.easing},bt-veil-in .14s ease-out}
.bt-option{display:flex;align-items:center;gap:10px;border:0;background:none;border-radius:8px;padding:7px 8px;min-height:36px;box-sizing:border-box;font-size:13px;line-height:18px;color:var(--bt-ink);cursor:pointer;text-align:left;width:100%}
.bt-option[aria-selected=true]{background:var(--bt-active)}
.bt-drop-list>.bt-option:not([aria-selected=true]):hover{background:var(--bt-hover)}
@@ -433,10 +433,10 @@ html[data-windows-titlebar]:not([data-fullscreen]) :is(.bt-pane,.bt-panel)::befo
.bt-drawer-name-input{font-size:17px;line-height:24px;text-align:center;border:.5px solid var(--bt-line-2);border-radius:6px;padding:0 6px;background:var(--bt-main);color:var(--bt-ink);outline:none;font-weight:500}
.bt-drawer-role{font-size:12px;line-height:16px;color:var(--bt-ink-3);margin-top:6px;text-align:center}
.bt-tabs{position:relative;display:flex;justify-content:center;gap:2px;margin:16px 16px 0}
-.bt-tab{position:relative;z-index:1;border:0;background:none;border-radius:9999px;padding:4px 8px;font-size:13px;line-height:20px;color:var(--bt-ink-2);cursor:pointer;white-space:nowrap}
+.bt-tab{position:relative;z-index:1;border:0;background:none;border-radius:999px;padding:4px 8px;font-size:13px;line-height:20px;color:var(--bt-ink-2);cursor:pointer;white-space:nowrap}
.bt-tab:hover{color:var(--bt-ink)}
.bt-tab[aria-selected=true]{background:var(--bt-hover);color:var(--bt-ink)}
-.bt-tabs>.bt-thumb{top:0;bottom:0;border-radius:9999px;background:var(--bt-hover)}
+.bt-tabs>.bt-thumb{top:0;bottom:0;border-radius:999px;background:var(--bt-hover)}
.bt-tabs[data-glide] .bt-tab[aria-selected=true]{background:transparent}
.bt-drawer-body{flex:1;overflow-y:auto;padding:20px 16px 16px;font-size:13px;line-height:18px;display:flex;flex-direction:column;gap:16px}
.bt-empty{text-align:center;color:var(--bt-ink-3);font-size:13px;line-height:18px;padding:8px 12px}
@@ -466,6 +466,7 @@ html[data-windows-titlebar]:not([data-fullscreen]) :is(.bt-pane,.bt-panel)::befo
.bt-avatar-trigger{position:relative;width:64px;height:64px;border:0;border-radius:50%;background:none;cursor:pointer;padding:0}
.bt-avatar-pencil{position:absolute;right:-2px;bottom:-2px;width:22px;height:22px;border-radius:50%;background:var(--bt-main);border:1px solid var(--bt-line-2);color:var(--bt-ink-2);display:flex;align-items:center;justify-content:center;box-shadow:0 1px 4px rgba(0,0,0,.12)}
.bt-avedit{position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);width:288px;box-sizing:border-box;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);border:.5px solid var(--bt-glass-rim);border-radius:16px;box-shadow:var(--bt-glass-shadow),0 16px 40px rgba(0,0,0,.16);padding:12px;z-index:70;display:flex;flex-direction:column;gap:12px;color:var(--bt-ink);transform-origin:top center;animation:bt-pop-drop ${SPRING_TAP.duration}ms ${SPRING_TAP.easing},bt-veil-in .16s ease-out}
+.bt-avedit[data-leaving]{animation:bt-pop-out .12s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}
.bt-bs .bt-avedit{transform-origin:32px 0}
.bt-avedit-top{display:flex;align-items:center;justify-content:space-between}
.bt-avedit-tabs{position:relative;display:flex;gap:2px;background:var(--bt-hover);border-radius:999px;padding:2px}
@@ -544,7 +545,9 @@ body[data-ds-dark-theme] .bt-scrim{background:rgba(0,0,0,.5)}
.bt-settings-close{position:absolute;top:12px;right:12px;width:32px;height:32px;border-radius:50%;border:0;background:var(--bt-hover);color:var(--bt-ink-2);display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
.bt-settings-close:hover{background:var(--bt-active);color:var(--bt-ink)}
.bt-settings-form{display:flex;flex-direction:column;gap:16px}
-.bt-set-section h3{font-size:13px;line-height:18px;font-weight:600;margin:0 0 8px;padding:0 4px}
+.bt-set-section{display:flex;flex-direction:column;gap:10px}
+.bt-set-section>h3{font-size:13px;line-height:18px;font-weight:600;margin:0 0 -2px;padding:0 4px}
+.bt-browser-settings{display:flex;flex-direction:column;gap:20px}
.bt-set-card{border:1px solid var(--bt-line);border-radius:12px;background:var(--bt-card);display:flex;flex-direction:column}
.bt-set-card>*+*{border-top:.5px solid var(--bt-line)}
.bt-set-row{display:flex;align-items:center;gap:12px;padding:10px 12px;border:0;background:none;color:var(--bt-ink);font:inherit;font-size:13px;line-height:18px;text-align:left;width:100%;box-sizing:border-box;border-radius:0}
@@ -710,7 +713,7 @@ button:hover .bt-you{background:color-mix(in srgb,var(--bt-ink) 9%,var(--bt-side
.bt-menu-hint{flex:none;color:var(--bt-ink-3);font-size:12px;font-variant-numeric:tabular-nums}
.bt-palette-layer{position:fixed;inset:var(--dsh-frame-chrome-top,0px) 0 0;z-index:70;pointer-events:auto;font-family:var(--bt-font)}
.bt-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.46);animation:bt-fade .22s ease-out}
-.bt-palette{position:absolute;top:50%;left:50%;width:min(560px,92vw);transform:translate(-50%,-50%);display:flex;flex-direction:column;border-radius:12px;background:var(--bt-main);border:1px solid var(--bt-line-2);box-shadow:0 24px 48px -12px rgba(0,0,0,.25);overflow:hidden;color:var(--bt-ink);animation:bt-palette-in ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing},bt-veil-in .2s ease-out}
+.bt-palette{position:absolute;top:50%;left:50%;width:min(560px,92vw);transform:translate(-50%,-50%);display:flex;flex-direction:column;border-radius:16px;background:var(--bt-glass-bg);-webkit-backdrop-filter:blur(28px) saturate(180%);backdrop-filter:blur(28px) saturate(180%);border:.5px solid var(--bt-glass-rim);box-shadow:var(--bt-glass-shadow);overflow:hidden;color:var(--bt-ink);animation:bt-palette-in ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing},bt-veil-in .2s ease-out}
.bt-palette-layer[data-leaving]{pointer-events:none}
.bt-palette-layer[data-leaving] .bt-backdrop{opacity:0;transition:opacity .16s ease-in}
.bt-palette-layer[data-leaving] .bt-palette{animation:bt-dialog-sink .16s cubic-bezier(.4,0,1,1) forwards}
@@ -764,7 +767,10 @@ button:hover .bt-you{background:color-mix(in srgb,var(--bt-ink) 9%,var(--bt-side
.bt-pick[aria-pressed=true]{border-color:var(--bt-line-2);background:var(--bt-hover)}
.bt-pick>span:last-child:not(.bt-mark){max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bt-pick:hover .bt-mark[data-state=idle] .bt-eye{animation:bt-blink .5s linear 1}
-.bt-select{width:100%;height:34px;box-sizing:border-box;border-radius:8px;border:1px solid var(--bt-line);background:var(--bt-card);color:var(--bt-ink);padding:0 8px;font:inherit;font-size:13px}
+.bt-select{width:100%;height:34px;box-sizing:border-box;border-radius:8px;border:1px solid var(--bt-line);background:var(--bt-card);color:var(--bt-ink);padding:0 8px;font:inherit;font-size:13px;outline:none}
+:is(.bt-input,.bt-select,.bt-textarea):focus-visible{border-color:var(--bt-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--bt-accent) 22%,transparent)}
+:is(.bt-round,.bt-icon-btn,.bt-soft,.bt-send,.bt-mini,.bt-pill,.bt-plus,.bt-mic,.bt-voice,.bt-account,.bt-title-toggle,.bt-settings-close,.bt-avatar-trigger,.bt-shape,.bt-color,.bt-swatch,.bt-pick,.bt-more,.bt-mem-row,.bt-mem-send):focus-visible{outline:2px solid var(--bt-accent);outline-offset:2px}
+:is(.bt-row,.bt-tile,.bt-tab,.bt-avedit-tab,.bt-settings-item,.bt-menu button,.bt-option,.bt-palette-row,button.bt-set-row):focus-visible{outline:2px solid var(--bt-accent);outline-offset:-2px}
.bt-note{font-size:12px;line-height:16px;color:var(--bt-ink-2);margin-top:6px}
.bt-swatch-sep{width:1px;height:22px;background:var(--bt-line-2);margin:0 2px}
.bt-swatch-custom{position:relative;overflow:hidden;background:conic-gradient(#ff3e51,#ffaf38,#00c972,#1cc3b0,#2a92fe,#a97efe,#ff5eb1,#ff3e51);box-sizing:border-box}
diff --git a/ds-bot/src/client/team-actions.js b/ds-bot/src/client/team-actions.js
index 31ab7852..e7f2d130 100644
--- a/ds-bot/src/client/team-actions.js
+++ b/ds-bot/src/client/team-actions.js
@@ -82,7 +82,7 @@ export function teamActions({ call, after, partFor, roster, ui, live, cards, hel
clearQuote: token => ui.set(state => (state.quote?.token === token ? { ...state, quote: null } : state)),
setFlags: (id, flags) => after(call('set-flags', { id, ...flags })),
deleteRoom: id => after(call('delete-room', { id })),
- openMenu: (menu) => { ui.set(state => ({ ...state, menu })) },
+ openMenu: (menu) => { ui.set(state => ({ ...state, menu, palette: null })) },
closeMenu: () => { ui.set(state => (state.menu ? { ...state, menu: null } : state)) },
closeOverlay: () => { ui.set(state => ({ ...state, newChat: null, exchange: null, details: state.newChat || state.exchange ? state.details : null })) },
createBot: payload => after(call('create-bot', payload)),
diff --git a/ds-bot/src/client/usage-page.js b/ds-bot/src/client/usage-page.js
index 0d705b24..52c6a6b3 100644
--- a/ds-bot/src/client/usage-page.js
+++ b/ds-bot/src/client/usage-page.js
@@ -605,7 +605,7 @@ export const USAGE_CSS = `
.bt-us-pick-months{display:flex;flex-wrap:wrap;gap:8px 28px}
.bt-us-month{width:252px;animation:bt-us-fade .22s ease}
.bt-us-month-head{position:relative;display:flex;align-items:center;justify-content:center;height:28px;margin-bottom:4px;font-size:13px;line-height:18px;font-weight:600}
-.bt-us-month-nav{position:absolute;top:0;width:28px;height:28px;padding:0;border:0;border-radius:9px;background:none;color:var(--bt-ink-2);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background-color .12s ease}
+.bt-us-month-nav{position:absolute;top:0;width:28px;height:28px;padding:0;border:0;border-radius:8px;background:none;color:var(--bt-ink-2);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background-color .12s ease}
.bt-us-month-nav[data-side=left]{left:0}
.bt-us-month-nav[data-side=right]{right:0}
.bt-us-month-nav:hover:not(:disabled){background:var(--bt-hover);color:var(--bt-ink)}
diff --git a/ds-bot/test/sidebar-switch.test.js b/ds-bot/test/sidebar-switch.test.js
index 4b9693dc..387a2fcb 100644
--- a/ds-bot/test/sidebar-switch.test.js
+++ b/ds-bot/test/sidebar-switch.test.js
@@ -536,3 +536,24 @@ test('after a snap the spring stops and the drag follows the cursor', async () =
assert.equal(column.style.width, '330px')
})
})
+
+test('TeamSidebar subscribes to specific ui slices rather than the whole ui object', () => {
+ const selectors = []
+ const base = { unread: {}, leftDrawer: false, details: null, view: 'details', panelYield: false, bootFailed: false }
+ TeamSidebar({
+ wide: true,
+ useRoster: pick => pick({ bots: [], rooms: [], agents: [], byId: {}, ready: true }),
+ useUi: (pick) => { selectors.push(pick); return pick(base) },
+ useRegistry: pick => pick({}),
+ useSessions: pick => pick({ ids: [], byId: {} }),
+ useUpdate: () => ({}),
+ actions: { toggleSidebar() {} },
+ })
+ assert.ok(selectors.length > 0)
+ for (const pick of selectors) {
+ const before = pick(base)
+ const after = pick({ ...base, palette: { query: 'test', token: 1 }, settings: { page: 'general' }, menu: { kind: 'bot', id: 'b1' }, toast: { text: 'err' } })
+ assert.equal(Object.is(before, after), true)
+ }
+})
+
diff --git a/ds-bot/test/style-debt.json b/ds-bot/test/style-debt.json
index 4985bf19..d94626be 100644
--- a/ds-bot/test/style-debt.json
+++ b/ds-bot/test/style-debt.json
@@ -73,38 +73,17 @@
"browser-pane.js": {
"2px": 1,
"3px": 2,
- "5px": 1,
- "7px": 1,
- "9px": 3
- },
- "member-status.js": {
- "13px": 1
- },
- "secret-card.js": {
"5px": 1
},
- "sidebar.js": {
- "14px": 1
- },
"styles.js": {
- "1px": 1,
- "9999px": 2
+ "1px": 1
},
"usage-page.js": {
"14px": 5,
"30%": 1,
"3px": 1,
- "5px": 1,
- "9px": 1
+ "5px": 1
}
},
- "springs": {
- "browser-pane.js": {
- "springEasing(144,19.7)": 1,
- "springEasing(576,39.4)": 1
- },
- "sidebar.js": {
- "springEasing(1000,63)": 1
- }
- }
+ "springs": {}
}