A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Offer signing out of the shell account in the account menu
Fei241141e44cb193ee
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 662dd1c1..2926eb84 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -3495,6 +3495,7 @@ var PlugIcon = lineIcon(["M7 3v4M13 3v4", "M5 7h10v2.5a5 5 0 0 1-10 0z", "M10 14var CalendarIcon = lineIcon(["M5.5 5h9A1.5 1.5 0 0 1 16 6.5v8a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 4 14.5v-8A1.5 1.5 0 0 1 5.5 5z", "M4 8.75h12", "M7.25 3.5v3M12.75 3.5v3"]);var ConnectorIcon = lineIcon(["M7 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z", "M18 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z", "M7 10h6"]);var SwitchIcon = lineIcon(["M4 7h9.5M10.5 3.5L14 7l-3.5 3.5", "M16 13H6.5M9.5 9.5L6 13l3.5 3.5"]);+var SignOutIcon = lineIcon(["M8.5 17H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5", "M10 10h6.5", "M13.5 7l3 3-3 3"]);var PaperclipIcon = lineIcon(["M15.5 9.5l-5.6 5.6a3.4 3.4 0 0 1-4.8-4.8l6.1-6.1a2.25 2.25 0 0 1 3.2 3.2l-6 6a1.1 1.1 0 0 1-1.6-1.6l5.5-5.5"]);var ClockIcon = lineIcon(["M10 3.5a6.5 6.5 0 1 1 0 13 6.5 6.5 0 0 1 0-13z", "M10 6.5V10l2.5 1.5"]);var GearIcon = lineIcon(["M10 7.4a2.6 2.6 0 1 1 0 5.2 2.6 2.6 0 0 1 0-5.2z", "M7.85 4.4l.29-1.87a7.7 7.7 0 0 1 3.72 0l.29 1.87a6 6 0 0 1 1.63.94l1.76-.69a7.7 7.7 0 0 1 1.86 3.23l-1.47 1.18a6 6 0 0 1 0 1.88l1.47 1.18a7.7 7.7 0 0 1-1.86 3.23l-1.76-.69a6 6 0 0 1-1.63.94l-.29 1.87a7.7 7.7 0 0 1-3.72 0l-.29-1.87a6 6 0 0 1-1.63-.94l-1.76.69a7.7 7.7 0 0 1-1.86-3.23l1.47-1.18a6 6 0 0 1 0-1.88L2.6 7.88a7.7 7.7 0 0 1 1.86-3.23l1.76.69a6 6 0 0 1 1.63-.94z"]);@@ -6568,6 +6569,9 @@ function pressSettingsShortcut() {metaKey: held.has("meta")}));}+var NO_SUBSCRIBE = () => () => {+};+var NO_SNAPSHOT = () => null;function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboarding, actions }) {const [open, setOpen] = (0, import_react11.useState)(false);(0, import_react11.useLayoutEffect)(() => {@@ -6614,11 +6618,53 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardiwindow.removeEventListener("keydown", onKey, true);};}, [open]);+ const signIn = actions.signInEntry?.() ?? null;+ const ops = (0, import_react11.useMemo)(() => signIn?.inject?.() ?? {}, [signIn]);+ const accountSource = ops.hooks?.account;+ const account = (0, import_react11.useSyncExternalStore)(accountSource?.subscribe ?? NO_SUBSCRIBE, accountSource ? () => accountSource.getSnapshot() : NO_SNAPSHOT);+ const signedIn = signIn !== null && typeof ops.signOut === "function" && account?.view?.status === "credential-stored";+ const accountT = actions.accountT?.() ?? ((key) => key);+ const [confirm, setConfirm] = (0, import_react11.useState)(null);+ const [busy, setBusy] = (0, import_react11.useState)(false);+ const [signOutError, setSignOutError] = (0, import_react11.useState)("");+ const askSignOut = async () => {+ setSignOutError("");+ let state = "none";+ try {+ if (await ops.hasRunningAccountTasks?.()) state = "running";+ } catch {+ state = "unknown";+ }+ setConfirm(state);+ };+ const cancelSignOut = () => {+ setConfirm(null);+ setSignOutError("");+ };+ const runSignOut = async () => {+ setBusy(true);+ setSignOutError("");+ try {+ await ops.signOut();+ setConfirm(null);+ setOpen(false);+ } catch (error) {+ setSignOutError(String(error?.message ?? error));+ } finally {+ setBusy(false);+ }+ };const toggle = () => {const rect = button.current?.getBoundingClientRect();if (rect) setBox({ left: rect.left, bottom: window.innerHeight - rect.top + 5 });setOpen((value) => !value);};+ (0, import_react11.useEffect)(() => {+ if (open) return;+ setConfirm(null);+ setSignOutError("");+ setBusy(false);+ }, [open]);const groups = [[[t("Usage"), GaugeIcon, () => actions.openSettings("usage")],@@ -6630,6 +6676,7 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardi[t("Switch to classic Agent mode"), SwitchIcon, () => actions.setSurface("agent")]]];+ if (signedIn) groups.push([[accountT("signOut"), SignOutIcon, askSignOut, void 0, true]]);return (0, import_react11.createElement)(import_react11.Fragment,null,@@ -6641,16 +6688,29 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardiopen && box ? (0, import_react_dom3.createPortal)((0, import_react11.createElement)("div",{ className: "bt-menu bt-menu-up bt-account-menu", role: "menu", "aria-label": t("Account"), style: box },- groups.map((group, index) => (0, import_react11.createElement)(+ confirm !== null ? (0, import_react11.createElement)(+ "div",+ { className: "bt-confirm", role: "alertdialog", "aria-label": accountT("signOut") },+ (0, import_react11.createElement)("p", { className: "bt-confirm-text" }, accountT(confirm === "running" ? "signOutRunningDescription" : confirm === "unknown" ? "signOutUnknownDescription" : "signOutDescription")),+ signOutError !== "" ? (0, import_react11.createElement)("p", { className: "bt-confirm-error", role: "alert" }, signOutError) : null,+ (0, import_react11.createElement)(+ "div",+ { className: "bt-confirm-row" },+ (0, import_react11.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: cancelSignOut }, t("Cancel")),+ (0, import_react11.createElement)("button", { type: "button", className: "bt-confirm-go", disabled: busy, onClick: () => {+ void runSignOut();+ } }, accountT("signOut"))+ )+ ) : groups.map((group, index) => (0, import_react11.createElement)(import_react11.Fragment,{ key: index },index > 0 ? (0, import_react11.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,- group.map(([label, Icon, run, hint]) => (0, import_react11.createElement)("button", {+ group.map(([label, Icon, run, hint, stay]) => (0, import_react11.createElement)("button", {key: label,type: "button",role: "menuitem",onClick: () => {- setOpen(false);+ if (stay !== true) setOpen(false);void Promise.resolve(run()).catch((error) => actions.reportError(error, "menu"));}}, (0, import_react11.createElement)(Icon), (0, import_react11.createElement)("span", { className: "bt-menu-label" }, label), hint ? (0, import_react11.createElement)("span", { className: "bt-menu-hint" }, hint) : null))@@ -6714,6 +6774,14 @@ function BrandName() {return (0, import_react11.createElement)("span", { style: { fontWeight: 600, fontSize: 14 } }, "DS Bot");}var SIDEBAR_CSS = `+.bt-confirm{width:260px;max-width:72vw;padding:10px 12px 12px;display:flex;flex-direction:column;gap:10px}+.bt-confirm-text{margin:0;font-size:13px;line-height:19px;color:var(--bt-ink-2)}+.bt-confirm-error{margin:0;font-size:12px;line-height:17px;color:var(--bt-danger);overflow-wrap:anywhere}+.bt-confirm-row{display:flex;justify-content:flex-end;gap:8px}+.bt-menu .bt-confirm button{width:auto;min-height:0}+.bt-confirm-go{height:28px;padding:0 14px;border:0;border-radius:999px;background:var(--bt-accent);color:var(--bt-accent-ink);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:opacity .12s ease}+.bt-confirm-go:hover:not(:disabled){opacity:.9}+.bt-confirm-go:disabled{opacity:.6;cursor:default}.bt-side-top .bt-brand{cursor:default;padding-left:6px}.bt-side-top .bt-brand:hover{background:none}.bt-brand .bt-mark{flex:none}diff --git a/ds-bot/src/client/icons.js b/ds-bot/src/client/icons.jsindex 97b2dee9..71fb14fe 100644--- a/ds-bot/src/client/icons.js+++ b/ds-bot/src/client/icons.js@@ -65,6 +65,7 @@ export const PlugIcon = lineIcon(['M7 3v4M13 3v4', 'M5 7h10v2.5a5 5 0 0 1-10 0z'export const CalendarIcon = lineIcon(['M5.5 5h9A1.5 1.5 0 0 1 16 6.5v8a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 4 14.5v-8A1.5 1.5 0 0 1 5.5 5z', 'M4 8.75h12', 'M7.25 3.5v3M12.75 3.5v3'])export const ConnectorIcon = lineIcon(['M7 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z', 'M18 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z', 'M7 10h6'])export const SwitchIcon = lineIcon(['M4 7h9.5M10.5 3.5L14 7l-3.5 3.5', 'M16 13H6.5M9.5 9.5L6 13l3.5 3.5'])+export const SignOutIcon = lineIcon(['M8.5 17H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5', 'M10 10h6.5', 'M13.5 7l3 3-3 3'])export const PaperclipIcon = lineIcon(['M15.5 9.5l-5.6 5.6a3.4 3.4 0 0 1-4.8-4.8l6.1-6.1a2.25 2.25 0 0 1 3.2 3.2l-6 6a1.1 1.1 0 0 1-1.6-1.6l5.5-5.5'])export const ClockIcon = lineIcon(['M10 3.5a6.5 6.5 0 1 1 0 13 6.5 6.5 0 0 1 0-13z', 'M10 6.5V10l2.5 1.5'])// Six broad, shallow teeth around a wide hub: it reads as a gear even at 15px.diff --git a/ds-bot/src/client/sidebar.js b/ds-bot/src/client/sidebar.jsindex 5b0e1933..ec2c3730 100644--- a/ds-bot/src/client/sidebar.js+++ b/ds-bot/src/client/sidebar.js@@ -1,9 +1,9 @@-import { createElement as h, Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'+import { createElement as h, Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'import { createPortal } from 'react-dom'import { FishLogo } from './dsh-primitives.js'import { isMainOf } from './sources.js'import { currentPart, previewOf, relativeShort } from './text.js'-import { PlusIcon, SearchIcon, SidebarIcon, GaugeIcon, PlugIcon, ClockIcon, GearIcon, PinMarkIcon, ConnectorIcon, SwitchIcon, CloudDownloadIcon } from './icons.js'+import { PlusIcon, SearchIcon, SidebarIcon, GaugeIcon, PlugIcon, ClockIcon, GearIcon, PinMarkIcon, ConnectorIcon, SwitchIcon, CloudDownloadIcon, SignOutIcon } from './icons.js'import { MAIN_LOOK } from './characters.js'import { botState, BotMark, BotAvatar, RoomAvatar } from './mark.js'import { reducedMotion } from './activity-row.js'@@ -475,6 +475,9 @@ function pressSettingsShortcut() {}))}+const NO_SUBSCRIBE = () => () => {}+const NO_SNAPSHOT = () => null+// The footer avatar opens an account menu above itself, with Bot settings as one// entry. Shell panels hidden from the Bot sidebar (plugins, automation) live here too.// `seat` is the shell's settings.launcher seat: at priority -10 the whale wins it@@ -512,11 +515,52 @@ export function AccountLauncher({ seat = true, settingsOpen, openSettings, openOwindow.addEventListener('keydown', onKey, true)return () => { window.removeEventListener('mousedown', onDown); window.removeEventListener('keydown', onKey, true) }}, [open])+ // The shell's account plugin lends its sign-out operation; the item shows only+ // when the plugin's entry is there and its account snapshot says signed in. The+ // entry can arrive after this mounts, so its operations follow the entry.+ const signIn = actions.signInEntry?.() ?? null+ const ops = useMemo(() => signIn?.inject?.() ?? {}, [signIn])+ const accountSource = ops.hooks?.account+ const account = useSyncExternalStore(accountSource?.subscribe ?? NO_SUBSCRIBE, accountSource ? () => accountSource.getSnapshot() : NO_SNAPSHOT)+ const signedIn = signIn !== null && typeof ops.signOut === 'function' && account?.view?.status === 'credential-stored'+ const accountT = actions.accountT?.() ?? (key => key)+ const [confirm, setConfirm] = useState(null)+ const [busy, setBusy] = useState(false)+ const [signOutError, setSignOutError] = useState('')+ const askSignOut = async () => {+ setSignOutError('')+ let state = 'none'+ try {+ if (await ops.hasRunningAccountTasks?.()) state = 'running'+ } catch { state = 'unknown' }+ setConfirm(state)+ }+ const cancelSignOut = () => { setConfirm(null); setSignOutError('') }+ const runSignOut = async () => {+ setBusy(true)+ setSignOutError('')+ try {+ await ops.signOut()+ setConfirm(null)+ setOpen(false)+ } catch (error) {+ setSignOutError(String(error?.message ?? error))+ } finally {+ setBusy(false)+ }+ }const toggle = () => {const rect = button.current?.getBoundingClientRect()if (rect) setBox({ left: rect.left, bottom: window.innerHeight - rect.top + 5 })setOpen(value => !value)}+ // Closing the menu drops a half-finished sign-out confirm with it.+ useEffect(() => {+ if (open) return+ setConfirm(null)+ setSignOutError('')+ setBusy(false)+ }, [open])const groups = [[[t('Usage'), GaugeIcon, () => actions.openSettings('usage')],@@ -528,16 +572,23 @@ export function AccountLauncher({ seat = true, settingsOpen, openSettings, openO[t('Switch to classic Agent mode'), SwitchIcon, () => actions.setSurface('agent')],],]+ if (signedIn) groups.push([[accountT('signOut'), SignOutIcon, askSignOut, undefined, true]])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(BotMark, { look: MAIN_LOOK, size: 24 }))),open && box ? createPortal(h('div', { className: 'bt-menu bt-menu-up bt-account-menu', role: 'menu', 'aria-label': t('Account'), style: box },- groups.map((group, index) => h(Fragment, { key: index },- index > 0 ? h('div', { className: 'bt-menu-sep', role: 'separator' }) : null,- group.map(([label, Icon, run, hint]) => h('button', {- key: label, type: 'button', role: 'menuitem',- onClick: () => { setOpen(false); void Promise.resolve(run()).catch(error => actions.reportError(error, 'menu')) },- }, h(Icon), h('span', { className: 'bt-menu-label' }, label), hint ? h('span', { className: 'bt-menu-hint' }, hint) : null))))), document.body) : null)+ 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,+ h('div', { className: 'bt-confirm-row' },+ h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: cancelSignOut }, t('Cancel')),+ h('button', { type: 'button', className: 'bt-confirm-go', disabled: busy, onClick: () => { void runSignOut() } }, accountT('signOut'))))+ : groups.map((group, index) => h(Fragment, { key: index },+ index > 0 ? h('div', { className: 'bt-menu-sep', role: 'separator' }) : null,+ group.map(([label, Icon, run, hint, stay]) => h('button', {+ key: label, type: 'button', role: 'menuitem',+ onClick: () => { if (stay !== true) setOpen(false); void Promise.resolve(run()).catch(error => actions.reportError(error, 'menu')) },+ }, h(Icon), h('span', { className: 'bt-menu-label' }, label), hint ? h('span', { className: 'bt-menu-hint' }, hint) : null))))), document.body) : null)}// Opens the Main Bot whenever the main view holds no Bot conversation, the way@@ -609,6 +660,14 @@ export function BrandName() {// and Connect plugins; FooterAccount only shows when the seat went to no one. The// shell's footer classes are CSS-module names, so they match on their stems.export const SIDEBAR_CSS = `+.bt-confirm{width:260px;max-width:72vw;padding:10px 12px 12px;display:flex;flex-direction:column;gap:10px}+.bt-confirm-text{margin:0;font-size:13px;line-height:19px;color:var(--bt-ink-2)}+.bt-confirm-error{margin:0;font-size:12px;line-height:17px;color:var(--bt-danger);overflow-wrap:anywhere}+.bt-confirm-row{display:flex;justify-content:flex-end;gap:8px}+.bt-menu .bt-confirm button{width:auto;min-height:0}+.bt-confirm-go{height:28px;padding:0 14px;border:0;border-radius:999px;background:var(--bt-accent);color:var(--bt-accent-ink);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:opacity .12s ease}+.bt-confirm-go:hover:not(:disabled){opacity:.9}+.bt-confirm-go:disabled{opacity:.6;cursor:default}.bt-side-top .bt-brand{cursor:default;padding-left:6px}.bt-side-top .bt-brand:hover{background:none}.bt-brand .bt-mark{flex:none}diff --git a/ds-bot/test/account-sign-out.test.js b/ds-bot/test/account-sign-out.test.jsnew file mode 100644index 00000000..4c3403e5--- /dev/null+++ b/ds-bot/test/account-sign-out.test.js@@ -0,0 +1,159 @@+import { test } from 'node:test'+import assert from 'node:assert/strict'+import { fileURLToPath } from 'node:url'+import { runInNewContext } from 'node:vm'+import { build } from 'esbuild'++// The account menu bundled once and rendered with a stateful stand-in React:+// useState/useRef slots persist across renders, so clicking a menu item and+// re-rendering drives the same state the real React would keep.+const { outputFiles } = await build({+ stdin: {+ contents: "export { AccountLauncher } from './src/client/sidebar.js'",+ resolveDir: fileURLToPath(new URL('..', import.meta.url)),+ },+ bundle: true, format: 'cjs', platform: 'browser', write: false, logLevel: 'silent',+ external: ['react', 'react-dom', '@deepseek-ai/dsh-client-ui-primitives'],+})+const slots = []+let cursor = 0+const react = {+ createElement: (type, props, ...children) => ({ type, props: { ...props, children } }), Fragment: Symbol('Fragment'),+ useState(initial) {+ const i = cursor+++ if (slots[i] === undefined) slots[i] = { v: typeof initial === 'function' ? initial() : initial }+ const slot = slots[i]+ return [slot.v, v => { slot.v = typeof v === 'function' ? v(slot.v) : v }]+ },+ useRef(initial) { const i = cursor++; if (slots[i] === undefined) slots[i] = { current: initial }; return slots[i] },+ useMemo: make => make(), useEffect() {}, useLayoutEffect() {}, useSyncExternalStore: (subscribe, get) => get(), useId: () => 'id',+}+const module = { exports: {} }+runInNewContext(outputFiles[0].text, {+ module, exports: module.exports,+ window: { innerHeight: 800, addEventListener() {}, removeEventListener() {} },+ document: { body: {} },+ require: name => (name === 'react' ? react : name === 'react-dom' ? { createPortal: node => node } : {}),+})+const { AccountLauncher } = module.exports++const tick = () => new Promise(resolve => setTimeout(resolve, 0))+const walk = (node, match, out = []) => {+ if (Array.isArray(node)) { node.forEach(child => walk(child, match, out)); return out }+ if (!node || typeof node !== 'object') return out+ if (match(node)) out.push(node)+ walk(node.props?.children, match, out)+ return out+}+const textOf = (node) => {+ if (node === null || node === undefined || typeof node === 'boolean') return ''+ if (typeof node === 'string' || typeof node === 'number') return String(node)+ if (Array.isArray(node)) return node.map(textOf).join('')+ return textOf(node.props?.children)+}++// `status` is what the account plugin's snapshot reports; `running` is what its+// hasRunningAccountTasks answers (or throws); `fail` makes signOut reject.+function launcher({ status = 'credential-stored', running = false, runningError = false, fail = '', withEntry = true } = {}) {+ const calls = []+ slots.length = 0+ const ops = {+ signOut: async () => { calls.push('signOut'); if (fail !== '') throw new Error(fail) },+ hasRunningAccountTasks: async () => { calls.push('hasRunningAccountTasks'); if (runningError) throw new Error('no account api'); return running },+ hooks: { account: { subscribe: () => () => {}, getSnapshot: () => ({ view: { status } }) } },+ }+ const props = {+ seat: false,+ actions: {+ signInEntry: () => ((typeof withEntry === 'function' ? withEntry() : withEntry) ? { inject: () => ops } : null),+ accountT: () => key => `acc:${key}`,+ reportError: () => {},+ },+ }+ const render = () => { cursor = 0; return AccountLauncher(props) }+ const open = () => {+ const tree = render()+ const [button] = walk(tree, node => node.props?.className === 'bt-account')+ button.props.ref.current = { getBoundingClientRect: () => ({ left: 0, top: 0, right: 0, bottom: 0 }), contains: () => false, focus() {} }+ button.props.onClick()+ return render()+ }+ const items = tree => walk(tree, node => node.props?.role === 'menuitem')+ const item = (tree, label) => items(tree).find(node => textOf(node) === label)+ return { render, open, items, item, calls }+}++test('the sign-out item only shows when the account snapshot is signed in', () => {+ const out = launcher({ status: 'signed-out' })+ const menu = out.open()+ assert.equal(out.item(menu, 'acc:signOut'), undefined)+ const inside = launcher()+ assert.ok(out.item(inside.open(), 'acc:signOut') !== undefined)+})++test('without the shell account entry there is no sign-out item', () => {+ const side = launcher({ withEntry: false })+ assert.equal(side.item(side.open(), 'acc:signOut'), undefined)+})++test('a shell account entry that arrives after mount still lends its sign-out', () => {+ let arrived = false+ const side = launcher({ withEntry: () => arrived })+ side.render()+ arrived = true+ // The first open is after the entry arrived; it must inject now, not reuse the+ // empty operations from mount.+ assert.ok(side.item(side.open(), 'acc:signOut') !== undefined)+})++test('signing out asks about running tasks, confirms, then signs out', async () => {+ const side = launcher()+ let tree = side.open()+ side.item(tree, 'acc:signOut').props.onClick()+ await tick()+ tree = side.render()+ const [confirm] = walk(tree, node => node.props?.className === 'bt-confirm')+ assert.match(textOf(confirm), /acc:signOutDescription/)+ const [go] = walk(tree, node => node.props?.className === 'bt-confirm-go')+ go.props.onClick()+ await tick()+ await tick()+ assert.deepEqual(side.calls, ['hasRunningAccountTasks', 'signOut'])+ // The confirm and the menu are gone after a successful sign-out.+ assert.equal(walk(side.render(), node => node.props?.className === 'bt-menu').length, 0)+})++test('running account tasks and an unavailable check pick their own descriptions', async () => {+ for (const [options, label] of [[{ running: true }, 'acc:signOutRunningDescription'], [{ runningError: true }, 'acc:signOutUnknownDescription']]) {+ const side = launcher(options)+ side.item(side.open(), 'acc:signOut').props.onClick()+ await tick()+ const [confirm] = walk(side.render(), node => node.props?.className === 'bt-confirm')+ assert.match(textOf(confirm), new RegExp(label))+ }+})++test('a failed sign-out shows its error and keeps the confirm open', async () => {+ const side = launcher({ fail: 'network down' })+ side.item(side.open(), 'acc:signOut').props.onClick()+ await tick()+ const [go] = walk(side.render(), node => node.props?.className === 'bt-confirm-go')+ go.props.onClick()+ await tick()+ await tick()+ const tree = side.render()+ const [error] = walk(tree, node => node.props?.className === 'bt-confirm-error')+ assert.match(textOf(error), /network down/)+ assert.equal(walk(tree, node => node.props?.className === 'bt-confirm').length, 1)+})++test('cancel closes the confirm without signing out', async () => {+ const side = launcher()+ side.item(side.open(), 'acc:signOut').props.onClick()+ await tick()+ const [cancel] = walk(side.render(), node => textOf(node) === 'Cancel')+ cancel.props.onClick()+ const tree = side.render()+ assert.equal(walk(tree, node => node.props?.className === 'bt-confirm').length, 0)+ assert.deepEqual(side.calls, ['hasRunningAccountTasks'])+})