Skip to content

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

Merge branch 'fix/315-touch-actions' into fix/315-viewport-units

Fei2411ad92b73d65b6
diff --cc ds-bot/client.js
index 4f36c935,66b92657..f102d3a0
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@@ -6694,13 -6709,53 +6747,55 @@@ function AccountLauncher({ seat = true
window.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 tick = useViewport();
+ (0, import_react11.useLayoutEffect)(() => {
+ if (!open) return;
const rect = button.current?.getBoundingClientRect();
- if (rect) setBox({ left: rect.left, bottom: window.innerHeight - rect.top + 5 });
- setOpen((value) => !value);
- };
+ if (rect) setBox({ left: rect.left, bottom: viewBottom() - rect.top + 5 });
+ }, [open, tick]);
+ const toggle = () => setOpen((value) => !value);
+ (0, import_react11.useEffect)(() => {
+ if (open) return;
+ setConfirm(null);
+ setSignOutError("");
+ setBusy(false);
+ }, [open]);
const groups = [
[
[t("Usage"), GaugeIcon, () => actions.openSettings("usage")],
diff --cc ds-bot/src/client/sidebar.js
index a45ee990,344418d7..55afc4ac
--- a/ds-bot/src/client/sidebar.js
+++ b/ds-bot/src/client/sidebar.js
@@@ -514,13 -520,52 +522,54 @@@ export function AccountLauncher({ seat
window.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 tick = useViewport()
+ useLayoutEffect(() => {
+ if (!open) return
const rect = button.current?.getBoundingClientRect()
- if (rect) setBox({ left: rect.left, bottom: window.innerHeight - rect.top + 5 })
- setOpen(value => !value)
- }
+ if (rect) setBox({ left: rect.left, bottom: viewBottom() - rect.top + 5 })
+ }, [open, tick])
+ const toggle = () => 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')],