A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Draw the mail and connector request cards on the shared card
Fei24112ffb0618667e
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex cb41b7c3..26f7b840 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -1298,6 +1298,8 @@ var ZH = {"Sign in with Google": "使用 Google 登录","Add account": "添加账户","Add an account": "添加账户",+ "No mail accounts yet": "还没有邮箱账户",+ "Verifying…": "正在验证…","Open the Google sign-in page": "打开 Google 登录页","Add an address": "添加地址","Add a command": "添加命令",@@ -1316,16 +1318,15 @@ var ZH = {"Commerce": "商务","No connectors connected": "未连接任何连接器","{bot} needs {name}": "{bot} 需要 {name}",- "{bot} asked for a connector — connected": "{bot} 请求了连接器 — 已连接",- "{bot} asked for a connector": "{bot} 请求了连接器","{bot} wants to send an email": "{bot} 想发送一封邮件","To": "收件人","Cc": "抄送","Bcc": "密送","Attachments: {names}": "附件:{names}","Sent “{subject}”": "已发送“{subject}”",- "Could not send “{subject}”": "“{subject}”发送失败",- "“{subject}” was not sent": "“{subject}”未发送"+ "{bot} wanted to send “{subject}”": "{bot} 想发送“{subject}”",+ "Failed": "失败",+ "Sending…": "正在发送…"};var HOST_ERRORS = [[/^Model (.+) is not available\. Available: (.*)$/, "模型 $1 不可用。可用的:$2"],@@ -4233,6 +4234,7 @@ var SwitchIcon = lineIcon(["M4 7h9.5M10.5 3.5L14 7l-3.5 3.5", "M16 13H6.5M9.5 9.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 SignInIcon = lineIcon(["M11.5 3H14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2.5", "M3.5 10H10", "M7 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 MailIcon = lineIcon(["M4 5.5h12a1.5 1.5 0 0 1 1.5 1.5v6a1.5 1.5 0 0 1-1.5 1.5H4A1.5 1.5 0 0 1 2.5 13V7a1.5 1.5 0 0 1 1.5-1.5z", "M3.2 7l6.8 4.5L16.8 7"]);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"]);var PinIcon = lineIcon(["M12.5 3l4.5 4.5-3 1.5-2.5 2.5.5 3.5-1.5 1.5L7 13 3.5 16.5", "M7 13l-3.5-3.5L5 8l3.5.5L11 6l1.5-3"]);@@ -7705,10 +7707,11 @@ var scopeLabel = (scope, roster) => {return names.length === 0 ? t("No Bot") : names.join(t(" and "));};var when = (time) => Number.isFinite(time) ? new Date(time).toLocaleString(dateLocale(), { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "";-function MaskedInput({ value, onChange, onEnter, label, autoFocus = false }) {+function MaskedInput({ value, onChange, onEnter, label, autoFocus = false, disabled = false }) {return (0, import_react16.createElement)("input", {className: "bt-secret-input",type: MASK_BY_CSS ? "text" : "password",+ disabled,"data-masked": MASK_BY_CSS ? "" : void 0,value,autoFocus,@@ -10766,104 +10769,156 @@ var MAIL_GUIDES = {]}};-function MailSection({ mail, actions, run: run2 }) {- const [form, setForm] = (0, import_react25.useState)(false);- const [address, setAddress] = (0, import_react25.useState)("");- const [password, setPassword] = (0, import_react25.useState)("");- const [provider, setProvider] = (0, import_react25.useState)("");- const [imapHost, setImapHost] = (0, import_react25.useState)("");- const [smtpHost, setSmtpHost] = (0, import_react25.useState)("");- const [error, setError] = (0, import_react25.useState)(null);- const accounts = mail?.accounts ?? [];- const domain = address.split("@")[1]?.toLowerCase() ?? "";- const guessed = ["qq.com", "foxmail.com"].includes(domain) ? "qq" : ["163.com", "126.com", "gmail.com", "googlemail.com"].includes(domain) ? domain.replace(/\..*/, "").replace("googlemail", "gmail") : ["icloud.com", "me.com", "mac.com"].includes(domain) ? "icloud" : "";- const chosen = provider || guessed || "other";- const guide = MAIL_GUIDES[chosen];- const mailRun = (task, onDone) => Promise.resolve(task).then(() => {- setError(null);- onDone?.();- }, (failure) => setError(failure?.message ?? String(failure)));- const add = () => void mailRun(actions.mailAccountAdd({ address: address.trim(), password, provider: chosen, imapHost, smtpHost }), () => {- setForm(false);- setAddress("");- setPassword("");- });- const close = () => {- setError(null);- setForm(false);+function MailAccount({ account, actions, run: run2 }) {+ const [busy, setBusy] = (0, import_react25.useState)(false);+ const busyRef = (0, import_react25.useRef)(false);+ const remove = () => {+ if (busyRef.current || busy) return;+ busyRef.current = true;+ setBusy(true);+ void Promise.resolve(run2(actions.mailAccountRemove(account.id))).finally(() => {+ busyRef.current = false;+ setBusy(false);+ });};return (0, import_react25.createElement)("div",- { className: "bt-mail" },- (0, import_react25.createElement)("div", { className: "bt-section-title" }, t("Mailbox")),- accounts.map((account) => (0, import_react25.createElement)(+ { className: "bt-connector", "data-state": account.error ? "error" : "ready" },+ (0, import_react25.createElement)("div",- { key: account.id, className: "bt-connector" },+ { className: "bt-connector-head" },+ (0, import_react25.createElement)("span", { className: "bt-connector-mark" }, (0, import_react25.createElement)(ConnectorMark, { connector: { id: `mail-${account.provider}`, name: account.address } })),(0, import_react25.createElement)(- "div",- { className: "bt-connector-head" },- (0, import_react25.createElement)("span", { className: "bt-connector-mark" }, (0, import_react25.createElement)(ConnectorMark, { connector: { id: `mail-${account.provider}`, name: account.address } })),- (0, import_react25.createElement)(- "span",- { className: "bt-connector-text" },- (0, import_react25.createElement)("span", { className: "bt-connector-name" }, account.address),- (0, import_react25.createElement)("span", { className: "bt-connector-status" }, account.error ?? t("Connected"))- ),- (0, import_react25.createElement)(- "span",- { className: "bt-connector-actions" },- (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => void run2(actions.mailAccountRemove(account.id)) }, t("Remove"))- )- )- )),- mail?.pending?.map((p) => (0, import_react25.createElement)(- "div",- { key: p.address ?? "google", className: "bt-connector" },+ "span",+ { className: "bt-connector-text" },+ (0, import_react25.createElement)("span", { className: "bt-connector-name" }, account.address),+ (0, import_react25.createElement)("span", { className: "bt-connector-status" }, account.error ? hostText(account.error) : t("Connected"))+ ),(0, import_react25.createElement)(- "div",- { className: "bt-connector-form-row" },- (0, import_react25.createElement)("a", { className: "bt-connector-link", href: p.url, target: "_blank", rel: "noopener noreferrer" }, t("Open the Google sign-in page"))+ "span",+ { className: "bt-connector-actions" },+ (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: remove }, t("Remove")))- )) ?? null,- form ? (0, import_react25.createElement)(+ )+ );+}+function MailPending({ pending }) {+ return (0, import_react25.createElement)(+ "div",+ { className: "bt-connector", "data-state": "connecting" },+ (0, import_react25.createElement)("div",- { className: "bt-connector-form bt-mail-form" },+ { className: "bt-connector-head" },+ (0, import_react25.createElement)("span", { className: "bt-connector-mark" }, (0, import_react25.createElement)(ConnectorMark, { connector: { id: "mail-gmail", name: "Google" } })),(0, import_react25.createElement)(- "div",- { className: "bt-mail-providers", role: "radiogroup", "aria-label": t("Provider") },- [["qq", "QQ"], ["163", "163"], ["126", "126"], ["gmail", "Gmail"], ["icloud", "iCloud"], ["other", t("Other")]].map(([id, label]) => (0, import_react25.createElement)("button", { key: id, type: "button", role: "radio", "aria-checked": chosen === id, className: "bt-secret-seg", onClick: () => setProvider(id) }, label))+ "span",+ { className: "bt-connector-text" },+ (0, import_react25.createElement)("span", { className: "bt-connector-name" }, pending.address ?? "Google"),+ (0, import_react25.createElement)("span", { className: "bt-connector-status" }, t("Waiting for sign-in…"))),- guide ? [- (0, import_react25.createElement)("ol", { key: "guide", className: "bt-mail-guide" }, guide.steps.map((step) => (0, import_react25.createElement)("li", { key: step }, t(step, { host: guide.host })))),- (0, import_react25.createElement)(- "div",- { key: "links", className: "bt-connector-form-row" },- (0, import_react25.createElement)("a", { className: "bt-connector-link", href: guide.open, target: "_blank", rel: "noopener noreferrer" }, t("Open {host}", { host: guide.host })),- (0, import_react25.createElement)("a", { className: "bt-connector-link", href: guide.help, target: "_blank", rel: "noopener noreferrer" }, t("Official help"))- )- ] : null,- (0, import_react25.createElement)("input", { className: "bt-input", "aria-label": t("Email address"), placeholder: t("Email address"), value: address, autoComplete: "off", onChange: (e) => setAddress(e.target.value) }),- (0, import_react25.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react25.createElement)(MaskedInput, { value: password, onChange: setPassword, label: t(guide?.label ?? "Password or app password") })),- chosen === "other" ? [- (0, import_react25.createElement)("input", { key: "ih", className: "bt-input", "aria-label": t("IMAP host"), placeholder: t("IMAP host"), value: imapHost, onChange: (e) => setImapHost(e.target.value) }),- (0, import_react25.createElement)("input", { key: "sh", className: "bt-input", "aria-label": t("SMTP host"), placeholder: t("SMTP host"), value: smtpHost, onChange: (e) => setSmtpHost(e.target.value) })- ] : null,- error ? (0, import_react25.createElement)("div", { className: "bt-connector-error", role: "alert" }, hostText(error)) : null,+ (0, import_react25.createElement)(+ "span",+ { className: "bt-connector-actions" },+ (0, import_react25.createElement)("a", { className: "bt-soft bt-soft-sm bt-mail-open", href: pending.url, target: "_blank", rel: "noopener noreferrer" }, t("Open the sign-in page"))+ )+ )+ );+}+function MailForm({ mail, actions, mailRun, busy, error, fields, setField, onClose }) {+ const { address, password, provider, imapHost, smtpHost } = fields;+ const setAddress = (value) => setField("address", value);+ const setPassword = (value) => setField("password", value);+ const setProvider = (value) => setField("provider", value);+ const setImapHost = (value) => setField("imapHost", value);+ const setSmtpHost = (value) => setField("smtpHost", value);+ const domain = address.split("@")[1]?.toLowerCase() ?? "";+ const guessed = ["qq.com", "foxmail.com"].includes(domain) ? "qq" : ["163.com", "126.com", "gmail.com", "googlemail.com"].includes(domain) ? domain.replace(/\..*/, "").replace("googlemail", "gmail") : ["icloud.com", "me.com", "mac.com"].includes(domain) ? "icloud" : "";+ const chosen = provider || guessed || "other";+ const guide = MAIL_GUIDES[chosen];+ const add = () => void mailRun(() => actions.mailAccountAdd({ address: address.trim(), password, provider: chosen, imapHost: imapHost.trim(), smtpHost: smtpHost.trim() }), onClose);+ return (0, import_react25.createElement)(+ "div",+ { className: "bt-set-row bt-set-paste bt-mail-form" },+ (0, import_react25.createElement)(+ "div",+ { className: "bt-mail-providers", role: "radiogroup", "aria-label": t("Provider") },+ [["qq", "QQ"], ["163", "163"], ["126", "126"], ["gmail", "Gmail"], ["icloud", "iCloud"], ["other", t("Other")]].map(([id, label]) => (0, import_react25.createElement)("button", { key: id, type: "button", role: "radio", "aria-checked": chosen === id, className: "bt-secret-seg", disabled: busy, onClick: () => setProvider(id) }, label))+ ),+ guide ? [+ (0, import_react25.createElement)("ol", { key: "guide", className: "bt-mail-guide" }, guide.steps.map((step) => (0, import_react25.createElement)("li", { key: step }, t(step, { host: guide.host })))),(0, import_react25.createElement)("div",- { className: "bt-connector-form-row" },- mail?.google ? (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => void mailRun(actions.mailAccountAdd({ address: address.trim(), google: true })) }, t("Sign in with Google")) : (0, import_react25.createElement)("span", { className: "bt-connector-link" }),- (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: close }, t("Cancel")),- (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !address.includes("@") || password === "", onClick: add }, t("Add account"))+ { key: "links", className: "bt-connector-form-row" },+ (0, import_react25.createElement)("a", { className: "bt-connector-link", href: guide.open, target: "_blank", rel: "noopener noreferrer" }, t("Open {host}", { host: guide.host })),+ (0, import_react25.createElement)("a", { className: "bt-connector-link", href: guide.help, target: "_blank", rel: "noopener noreferrer" }, t("Official help")))- ) : (0, import_react25.createElement)(+ ] : null,+ (0, import_react25.createElement)("input", { className: "bt-input", "aria-label": t("Email address"), placeholder: t("Email address"), value: address, autoComplete: "off", disabled: busy, onChange: (e) => setAddress(e.target.value) }),+ (0, import_react25.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react25.createElement)(MaskedInput, { value: password, onChange: setPassword, label: t(guide?.label ?? "Password or app password"), disabled: busy })),+ chosen === "other" ? [+ (0, import_react25.createElement)("input", { key: "ih", className: "bt-input", "aria-label": t("IMAP host"), placeholder: t("IMAP host"), value: imapHost, disabled: busy, onChange: (e) => setImapHost(e.target.value) }),+ (0, import_react25.createElement)("input", { key: "sh", className: "bt-input", "aria-label": t("SMTP host"), placeholder: t("SMTP host"), value: smtpHost, disabled: busy, onChange: (e) => setSmtpHost(e.target.value) })+ ] : null,+ error ? (0, import_react25.createElement)("div", { className: "bt-connector-error", role: "alert" }, hostText(error)) : null,+ (0, import_react25.createElement)("div",- { className: "bt-connector-form-row" },- (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setForm(true) }, t("Add an account")),- mail?.google ? (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => void run2(actions.mailAccountAdd({ google: true })) }, t("Sign in with Google")) : null+ { className: "bt-secret-row-actions" },+ mail?.google ? (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void mailRun(() => actions.mailAccountAdd({ address: address.trim(), google: true }), onClose) }, t("Sign in with Google")) : (0, import_react25.createElement)("span", { className: "bt-connector-link" }),+ (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: onClose }, t("Cancel")),+ (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy || !address.includes("@") || password === "", onClick: add }, busy ? t("Verifying…") : t("Add account"))));}+var EMPTY_MAIL = { address: "", password: "", provider: "", imapHost: "", smtpHost: "" };+function MailSection({ mail, actions, run: run2 }) {+ const [form, setForm] = (0, import_react25.useState)(false);+ const [busy, setBusy] = (0, import_react25.useState)(false);+ const [error, setError] = (0, import_react25.useState)(null);+ const [fields, setFields] = (0, import_react25.useState)(EMPTY_MAIL);+ const busyRef = (0, import_react25.useRef)(false);+ const accounts = mail?.accounts ?? [];+ const setField = (key, value) => setFields((current) => ({ ...current, [key]: value }));+ const close = () => {+ setError(null);+ setForm(false);+ setFields(EMPTY_MAIL);+ };+ const mailRun = (task, onDone) => {+ if (busyRef.current || busy) return false;+ busyRef.current = true;+ setBusy(true);+ setError(null);+ void Promise.resolve().then(task).then(() => {+ onDone?.();+ }, (failure) => {+ setError(failure?.message ?? String(failure));+ }).finally(() => {+ busyRef.current = false;+ setBusy(false);+ });+ return true;+ };+ return [+ (0, import_react25.createElement)("div", { key: "title", className: "bt-section-title" }, t("Mailbox")),+ (0, import_react25.createElement)(+ "div",+ { key: "card", className: "bt-set-card bt-connectors-card" },+ accounts.length === 0 && !form ? (0, import_react25.createElement)("div", { className: "bt-set-row" }, (0, import_react25.createElement)("span", { className: "bt-set-hint" }, t("No mail accounts yet"))) : null,+ accounts.map((account) => (0, import_react25.createElement)(MailAccount, { key: account.id, account, actions, run: run2 })),+ (mail?.pending ?? []).map((p) => (0, import_react25.createElement)(MailPending, { key: p.address ?? "google", pending: p })),+ form ? (0, import_react25.createElement)(MailForm, { mail, actions, mailRun, busy, error, fields, setField, onClose: close }) : null+ ),+ form ? null : (0, import_react25.createElement)(+ "div",+ { key: "add", className: "bt-actions" },+ (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => {+ setError(null);+ setForm(true);+ } }, t("Add an account")),+ mail?.google ? (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.mailAccountAdd({ google: true })) }, t("Sign in with Google")) : null+ )+ ];+}function AddMenu({ actions, run: run2 }) {const [kind, setKind] = (0, import_react25.useState)(null);const [name, setName] = (0, import_react25.useState)("");@@ -10946,9 +11001,9 @@ function ConnectorsPage({ roster, actions }) {"div",{ className: "bt-set-card bt-connectors-card" },connected.length === 0 ? (0, import_react25.createElement)("div", { className: "bt-set-row" }, (0, import_react25.createElement)("span", { className: "bt-set-hint" }, t("No connectors connected"))) : null,- connected.map((connector) => (0, import_react25.createElement)(ConnectorRow, { key: connector.id, connector, actions })),- (0, import_react25.createElement)(MailSection, { mail: data.mail, actions, run: run2 })+ connected.map((connector) => (0, import_react25.createElement)(ConnectorRow, { key: connector.id, connector, actions }))),+ (0, import_react25.createElement)(MailSection, { mail: data.mail, actions, run: run2 }),(0, import_react25.createElement)("div", { className: "bt-section-title" }, t("Catalog")),(0, import_react25.createElement)("div",@@ -10988,30 +11043,48 @@ function BotConnectors({ bot, roster, actions, run: run2 }) {}));}-function ConnectorCard({ sessionId, bot, request, actions, inline = false }) {- const hold = useDockHold(sessionId, "connector", request.id, actions, inline);- const connector = { id: request.connectorId, name: request.name ?? request.connectorId, state: "off", auth: request.auth ?? { kind: "oauth" } };+function RequestHead({ bot, badge, title, detail, onClose }) {return (0, import_react25.createElement)("div",- { className: "bt-q bt-secret bt-connector-card", role: "group", onFocusCapture: hold, onPointerDownCapture: hold },+ { className: "bt-q-head bt-secret-head" },+ (0, import_react25.createElement)("span", { className: "bt-secret-who" }, (0, import_react25.createElement)(BotMark, { bot, size: 28 }), badge ? (0, import_react25.createElement)("span", { className: "bt-secret-lock" }, badge) : null),(0, import_react25.createElement)("div",- { className: "bt-q-head bt-secret-head" },- (0, import_react25.createElement)("span", { className: "bt-secret-who" }, (0, import_react25.createElement)(BotMark, { bot, size: 28 })),- (0, import_react25.createElement)(- "div",- { className: "bt-q-text" },- (0, import_react25.createElement)("p", { className: "bt-q-title" }, t("{bot} needs {name}", { bot: bot.name, name: connector.name })),- request.purpose ? (0, import_react25.createElement)("div", { className: "bt-q-detail" }, request.purpose) : null- )+ { className: "bt-q-text" },+ (0, import_react25.createElement)("p", { className: "bt-q-title" }, title),+ detail ? (0, import_react25.createElement)("div", { className: "bt-q-detail" }, detail) : null),+ onClose ? (0, import_react25.createElement)("button", { type: "button", className: "bt-q-x", "aria-label": t("Cancel the request"), title: t("Cancel"), onClick: onClose }, (0, import_react25.createElement)(CloseIcon)) : null+ );+}+function SettledCard({ bot, title, done, badge }) {+ return (0, import_react25.createElement)(+ "div",+ { className: `bt-q bt-q-settled bt-secret bt-secret-done${done ? "" : " bt-q-dismissed"}`, role: "group", "aria-label": title },+ (0, import_react25.createElement)(+ "div",+ { className: "bt-q-head" },+ (0, import_react25.createElement)("span", { className: "bt-secret-who" }, (0, import_react25.createElement)(BotMark, { bot, size: 22 })),+ (0, import_react25.createElement)("div", { className: "bt-q-text" }, (0, import_react25.createElement)("p", { className: "bt-q-title" }, title)),+ done ? (0, import_react25.createElement)("span", { className: "bt-q-check bt-secret-check", title: t("Done") }, (0, import_react25.createElement)(CheckIcon)) : (0, import_react25.createElement)("span", { className: "bt-q-badge" }, badge)+ )+ );+}+function ConnectorCard({ sessionId, bot, request, actions, inline = false }) {+ const hold = useDockHold(sessionId, "connector", request.id, actions, inline);+ const name = request.name ?? request.connectorId;+ const dismiss = () => {+ hold();+ void actions.connectorRequestCancel(request.id);+ };+ return (0, import_react25.createElement)(+ "div",+ { className: "bt-q bt-secret", role: "group", onFocusCapture: hold, onPointerDownCapture: hold },+ (0, import_react25.createElement)(RequestHead, { bot, badge: (0, import_react25.createElement)(PlugIcon), title: t("{bot} needs {name}", { bot: bot.name, name }), detail: request.purpose, onClose: dismiss }),(0, import_react25.createElement)("div",{ className: "bt-q-foot" },- (0, import_react25.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => {- hold();- void actions.connectorRequestCancel(request.id);- } }, t("Dismiss")),+ (0, import_react25.createElement)("button", { type: "button", className: "bt-q-btn", onClick: dismiss }, t("Dismiss")),(0, import_react25.createElement)("button", { type: "button", className: "bt-q-submit", onClick: () => {hold();actions.openConnectors();@@ -11019,6 +11092,14 @@ function ConnectorCard({ sessionId, bot, request, actions, inline = false }) {));}+function SettledConnector({ bot, request }) {+ return (0, import_react25.createElement)(SettledCard, {+ bot,+ title: t("{bot} asked for {name}", { bot: bot.name, name: request.name ?? request.connectorId }),+ done: request.status === "connected",+ badge: t("Canceled")+ });+}var humanSize = (bytes) => bytes >= 1024 * 1024 ? `${(bytes / (1024 * 1024)).toFixed(1)} MB` : bytes >= 1024 ? `${Math.round(bytes / 1024)} KB` : `${bytes} B`;var NONE2 = {};function ConnectorToolCell({ sessionId, callId, done, content, roster, actions, heldCards = NONE2 }) {@@ -11027,7 +11108,7 @@ function ConnectorToolCell({ sessionId, callId, done, content, roster, actions,const request = (roster.connectorRequests?.[bot.id] ?? []).find((entry) => entry.callId === callId && (entry.sessionId ?? sessionId) === sessionId);if (request?.status === "pending" && heldCards[heldCardKey("connector", request.id)] > 0) return (0, import_react25.createElement)(CellEmpty);if (request) {- return request.status === "pending" ? (0, import_react25.createElement)("div", { className: "bt-q-inline" }, (0, import_react25.createElement)(ConnectorCard, { sessionId, bot, request, actions, inline: true })) : (0, import_react25.createElement)("div", { className: "bt-event" }, (0, import_react25.createElement)("span", { className: "bt-secret-event" }, request.status === "connected" ? t("{bot} asked for a connector — connected", { bot: bot.name }) : t("{bot} asked for a connector", { bot: bot.name })));+ return request.status === "pending" ? (0, import_react25.createElement)("div", { className: "bt-q-inline" }, (0, import_react25.createElement)(ConnectorCard, { sessionId, bot, request, actions, inline: true })) : (0, import_react25.createElement)("div", { className: "bt-q-inline" }, (0, import_react25.createElement)(SettledConnector, { bot, request }));}if (done && /already connected/.test(contentText(content))) return (0, import_react25.createElement)(CellEmpty);return (0, import_react25.createElement)(CellEmpty);@@ -11043,57 +11124,75 @@ function ConnectorDock({ sessionId, useRoster, useCards, useHeldCards, actions }if (waiting.length === 0) return null;return (0, import_react25.createElement)("div", { className: "bt-q-dock bt-secret-dock" }, waiting.map((request) => (0, import_react25.createElement)(ConnectorCard, { key: request.id, sessionId, bot, request, actions })));}-function MailSendCard({ sessionId, bot, request, actions, inline = false }) {+function MailSendCard({ sessionId, bot, request, roster, actions, inline = false }) {const [busy, setBusy] = (0, import_react25.useState)(false);+ const busyRef = (0, import_react25.useRef)(false);const hold = useDockHold(sessionId, "mail", request.id, actions, inline);const answer = (choice) => {- if (busy) return;+ if (busyRef.current || busy) return;+ busyRef.current = true;hold();setBusy(true);- void Promise.resolve(actions.mailSendAnswer(request.id, choice)).finally(() => setBusy(false));+ void Promise.resolve(actions.mailSendAnswer(request.id, choice)).catch(() => {+ }).finally(() => {+ busyRef.current = false;+ setBusy(false);+ });};+ const account = (roster?.connectors?.mail?.accounts ?? []).find((entry) => entry.id === request.account);+ const from = account?.address ?? request.account;+ const route = [+ request.to ? `${t("To")} ${request.to}` : "",+ request.cc ? `${t("Cc")} ${request.cc}` : "",+ request.bcc ? `${t("Bcc")} ${request.bcc}` : ""+ ].filter((line) => line !== "").join(" · ");return (0, import_react25.createElement)("div",- { className: "bt-q bt-secret bt-mail-card", role: "group", onFocusCapture: hold, onPointerDownCapture: hold },+ { className: "bt-q bt-secret", role: "group", onFocusCapture: hold, onPointerDownCapture: hold },+ (0, import_react25.createElement)(RequestHead, {+ bot,+ badge: (0, import_react25.createElement)(MailIcon),+ title: t("{bot} wants to send an email", { bot: bot.name }),+ detail: request.subject,+ onClose: busy ? void 0 : () => answer("cancel")+ }),+ // The message preview rides on the file box the other cards use for quoted+ // content; the body stays scrollable when it runs long.(0, import_react25.createElement)("div",- { className: "bt-q-head bt-secret-head" },- (0, import_react25.createElement)("span", { className: "bt-secret-who" }, (0, import_react25.createElement)(BotMark, { bot, size: 28 })),+ { className: "bt-learning-file" },(0, import_react25.createElement)("div",- { className: "bt-q-text" },- (0, import_react25.createElement)("p", { className: "bt-q-title" }, t("{bot} wants to send an email", { bot: bot.name })),- (0, import_react25.createElement)("div", { className: "bt-q-detail" }, request.subject)- )- ),- (0, import_react25.createElement)(- "div",- { className: "bt-mail-preview" },- (0, import_react25.createElement)("div", { className: "bt-q-detail" }, t("To"), " ", request.to),- request.cc ? (0, import_react25.createElement)("div", { className: "bt-q-detail" }, t("Cc"), " ", request.cc) : null,- request.bcc ? (0, import_react25.createElement)("div", { className: "bt-q-detail" }, t("Bcc"), " ", request.bcc) : null,- (0, import_react25.createElement)("div", { className: "bt-mail-body bt-q-detail" }, request.body),- request.attachmentDetails?.length ? (0, import_react25.createElement)("div", { className: "bt-q-detail" }, t("Attachments: {names}", { names: request.attachmentDetails.map((a) => a.size !== void 0 ? `${a.name} (${humanSize(a.size)})` : a.name).join(", ") })) : null+ { className: "bt-learning-filehead" },+ from ? (0, import_react25.createElement)("span", { className: "bt-learning-name" }, from) : null,+ (0, import_react25.createElement)("span", { className: "bt-learning-path" }, route)+ ),+ (0, import_react25.createElement)("div", { className: "bt-mail-body" }, request.body)),+ request.attachmentDetails?.length ? (0, import_react25.createElement)("div", { className: "bt-q-detail" }, t("Attachments: {names}", { names: request.attachmentDetails.map((a) => a.size !== void 0 ? `${a.name} (${humanSize(a.size)})` : a.name).join(", ") })) : null,(0, import_react25.createElement)("div",{ className: "bt-q-foot" },(0, import_react25.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => answer("cancel") }, t("Cancel")),- (0, import_react25.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("send") }, t("Send"))+ (0, import_react25.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("send") }, busy ? t("Sending…") : t("Send"))));}+function SettledMail({ bot, request }) {+ return (0, import_react25.createElement)(SettledCard, {+ bot,+ title: request.status === "sent" ? t("Sent “{subject}”", { subject: request.subject }) : t("{bot} wanted to send “{subject}”", { bot: bot.name, subject: request.subject }),+ done: request.status === "sent",+ badge: request.status === "failed" ? t("Failed") : t("Canceled")+ });+}function MailToolCell({ sessionId, callId, roster, actions, heldCards = NONE2 }) {const bot = roster.byId[sessionId];if (!bot) return (0, import_react25.createElement)(CellEmpty);const request = (roster.mailRequests?.[bot.id] ?? []).find((entry) => entry.callId === callId && (entry.sessionId ?? sessionId) === sessionId);if (request?.status === "pending" && heldCards[heldCardKey("mail", request.id)] > 0) return (0, import_react25.createElement)(CellEmpty);if (request) {- return request.status === "pending" ? (0, import_react25.createElement)("div", { className: "bt-q-inline" }, (0, import_react25.createElement)(MailSendCard, { sessionId, bot, request, actions, inline: true })) : (0, import_react25.createElement)("div", { className: "bt-event" }, (0, import_react25.createElement)(- "span",- { className: "bt-secret-event" },- request.status === "sent" ? t("Sent “{subject}”", { subject: request.subject }) : request.status === "failed" ? t("Could not send “{subject}”", { subject: request.subject }) : t("“{subject}” was not sent", { subject: request.subject })- ));+ return request.status === "pending" ? (0, import_react25.createElement)("div", { className: "bt-q-inline" }, (0, import_react25.createElement)(MailSendCard, { sessionId, bot, request, roster, actions, inline: true })) : (0, import_react25.createElement)("div", { className: "bt-q-inline" }, (0, import_react25.createElement)(SettledMail, { bot, request }));}return (0, import_react25.createElement)(CellEmpty);}@@ -11106,7 +11205,7 @@ function MailDock({ sessionId, useRoster, useCards, useHeldCards, actions }) {const drawn = (entry) => entry.callId && entry.sessionId === sessionId && shown[entry.callId] > 0 && !(held[heldCardKey("mail", entry.id)] > 0);const waiting = (roster.mailRequests?.[bot.id] ?? []).filter((entry) => entry.status === "pending" && !drawn(entry));if (waiting.length === 0) return null;- return (0, import_react25.createElement)("div", { className: "bt-q-dock bt-secret-dock" }, waiting.map((request) => (0, import_react25.createElement)(MailSendCard, { key: request.id, sessionId, bot, request, actions })));+ return (0, import_react25.createElement)("div", { className: "bt-q-dock bt-secret-dock" }, waiting.map((request) => (0, import_react25.createElement)(MailSendCard, { key: request.id, sessionId, bot, request, roster, actions })));}var CONNECTOR_CSS = `.bt-connector-mono{display:inline-flex;width:20px;height:20px;border-radius:6px;align-items:center;justify-content:center;background:var(--bt-accent);color:var(--bt-card);font-size:12px;font-weight:600;filter:hue-rotate(calc(var(--bt-hue,0)*1deg))}@@ -11120,14 +11219,12 @@ var CONNECTOR_CSS = `.bt-connector-device{display:flex;align-items:center;gap:10px}.bt-connector-code{font-family:ui-monospace,Menlo,monospace;font-size:16px;letter-spacing:.12em;padding:4px 10px;border-radius:8px;background:var(--bt-hover)}.bt-connector-import{display:flex;align-items:center;gap:8px;font-size:13px;padding:4px 0;cursor:pointer}-.bt-mail{display:flex;flex-direction:column;gap:10px;padding:12px}-.bt-mail-form{padding-left:0}.bt-mail-providers{display:flex;gap:4px;flex-wrap:wrap}.bt-mail-providers .bt-secret-seg{height:26px;padding:0 10px;border:.5px solid var(--bt-line)}.bt-mail-providers .bt-secret-seg[aria-checked=true]{background:var(--bt-active)}.bt-connector-bot .bt-set-copy{min-width:0}-.bt-mail-preview{display:flex;flex-direction:column;gap:4px;font-size:13px;line-height:18px;color:var(--bt-ink);margin:6px 0}-.bt-mail-body{white-space:pre-wrap;max-height:160px;overflow-y:auto;padding:8px 10px;border-radius:8px;background:var(--bt-hover);font-size:13px}+.bt-mail-open{text-decoration:none}+.bt-mail-body{max-height:180px;overflow-y:auto;padding:8px 12px;font-size:13px;line-height:19px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--bt-ink)}`;// src/client/turn-reasoning.jsdiff --git a/ds-bot/src/client/connectors.js b/ds-bot/src/client/connectors.jsindex 01d58281..f03335d9 100644--- a/ds-bot/src/client/connectors.js+++ b/ds-bot/src/client/connectors.js@@ -5,6 +5,7 @@ import { createElement as h, useRef, useState } from 'react'import { useMorph } from './motion.js'import { MaskedInput } from './secret-card.js'import { SwitchRow } from './bot-settings.js'+import { CheckIcon, CloseIcon, MailIcon, PlugIcon } from './icons.js'import { BotMark } from './mark.js'import { contentText, currentPart } from './text.js'import { useDockHold } from './card-hold.js'@@ -177,59 +178,106 @@ const MAIL_GUIDES = {},}-export function MailSection({ mail, actions, run }) {- const [form, setForm] = useState(false)- const [address, setAddress] = useState('')- const [password, setPassword] = useState('')- const [provider, setProvider] = useState('')- const [imapHost, setImapHost] = useState('')- const [smtpHost, setSmtpHost] = useState('')- const [error, setError] = useState(null)- const accounts = mail?.accounts ?? []+function MailAccount({ account, actions, run }) {+ const [busy, setBusy] = useState(false)+ const busyRef = useRef(false)+ const remove = () => {+ if (busyRef.current || busy) return+ busyRef.current = true+ setBusy(true)+ void Promise.resolve(run(actions.mailAccountRemove(account.id))).finally(() => { busyRef.current = false; setBusy(false) })+ }+ return h('div', { className: 'bt-connector', 'data-state': account.error ? 'error' : 'ready' },+ h('div', { className: 'bt-connector-head' },+ h('span', { className: 'bt-connector-mark' }, h(ConnectorMark, { connector: { id: `mail-${account.provider}`, name: account.address } })),+ h('span', { className: 'bt-connector-text' },+ h('span', { className: 'bt-connector-name' }, account.address),+ h('span', { className: 'bt-connector-status' }, account.error ? hostText(account.error) : t('Connected'))),+ h('span', { className: 'bt-connector-actions' },+ h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: busy, onClick: remove }, t('Remove')))))+}++// The Google sign-in the host started: it waits as a row that looks like the+// connector rows, with the sign-in page one click away.+function MailPending({ pending }) {+ return h('div', { className: 'bt-connector', 'data-state': 'connecting' },+ h('div', { className: 'bt-connector-head' },+ h('span', { className: 'bt-connector-mark' }, h(ConnectorMark, { connector: { id: 'mail-gmail', name: 'Google' } })),+ h('span', { className: 'bt-connector-text' },+ h('span', { className: 'bt-connector-name' }, pending.address ?? 'Google'),+ h('span', { className: 'bt-connector-status' }, t('Waiting for sign-in…'))),+ h('span', { className: 'bt-connector-actions' },+ h('a', { className: 'bt-soft bt-soft-sm bt-mail-open', href: pending.url, target: '_blank', rel: 'noopener noreferrer' }, t('Open the sign-in page')))))+}++// The add form lives in the card like the other pages' add rows. While the host+// verifies the sign-in every field and button is disabled, so a second click+// cannot start a second add. A good add closes the form, which drops the typed+// address, code, provider and hosts with it.+function MailForm({ mail, actions, mailRun, busy, error, fields, setField, onClose }) {+ const { address, password, provider, imapHost, smtpHost } = fields+ const setAddress = value => setField('address', value)+ const setPassword = value => setField('password', value)+ const setProvider = value => setField('provider', value)+ const setImapHost = value => setField('imapHost', value)+ const setSmtpHost = value => setField('smtpHost', value)const domain = address.split('@')[1]?.toLowerCase() ?? ''const guessed = ['qq.com', 'foxmail.com'].includes(domain) ? 'qq' : ['163.com', '126.com', 'gmail.com', 'googlemail.com'].includes(domain) ? domain.replace(/\..*/, '').replace('googlemail', 'gmail') : ['icloud.com', 'me.com', 'mac.com'].includes(domain) ? 'icloud' : ''const chosen = provider || guessed || 'other'const guide = MAIL_GUIDES[chosen]- const mailRun = (task, onDone) => Promise.resolve(task).then(() => { setError(null); onDone?.() }, failure => setError(failure?.message ?? String(failure)))- const add = () => void mailRun(actions.mailAccountAdd({ address: address.trim(), password, provider: chosen, imapHost, smtpHost }), () => { setForm(false); setAddress(''); setPassword('') })- const close = () => { setError(null); setForm(false) }- return h('div', { className: 'bt-mail' },- h('div', { className: 'bt-section-title' }, t('Mailbox')),- accounts.map(account => h('div', { key: account.id, className: 'bt-connector' },- h('div', { className: 'bt-connector-head' },- h('span', { className: 'bt-connector-mark' }, h(ConnectorMark, { connector: { id: `mail-${account.provider}`, name: account.address } })),- h('span', { className: 'bt-connector-text' },- h('span', { className: 'bt-connector-name' }, account.address),- h('span', { className: 'bt-connector-status' }, account.error ?? t('Connected'))),- h('span', { className: 'bt-connector-actions' },- h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => void run(actions.mailAccountRemove(account.id)) }, t('Remove')))))),- mail?.pending?.map(p => h('div', { key: p.address ?? 'google', className: 'bt-connector' },- h('div', { className: 'bt-connector-form-row' },- h('a', { className: 'bt-connector-link', href: p.url, target: '_blank', rel: 'noopener noreferrer' }, t('Open the Google sign-in page'))))) ?? null,- form ? h('div', { className: 'bt-connector-form bt-mail-form' },- h('div', { className: 'bt-mail-providers', role: 'radiogroup', 'aria-label': t('Provider') },- [['qq', 'QQ'], ['163', '163'], ['126', '126'], ['gmail', 'Gmail'], ['icloud', 'iCloud'], ['other', t('Other')]].map(([id, label]) =>- h('button', { key: id, type: 'button', role: 'radio', 'aria-checked': chosen === id, className: 'bt-secret-seg', onClick: () => setProvider(id) }, label))),- guide ? [- h('ol', { key: 'guide', className: 'bt-mail-guide' }, guide.steps.map(step => h('li', { key: step }, t(step, { host: guide.host })))),- h('div', { key: 'links', className: 'bt-connector-form-row' },- h('a', { className: 'bt-connector-link', href: guide.open, target: '_blank', rel: 'noopener noreferrer' }, t('Open {host}', { host: guide.host })),- h('a', { className: 'bt-connector-link', href: guide.help, target: '_blank', rel: 'noopener noreferrer' }, t('Official help'))),- ] : null,- h('input', { className: 'bt-input', 'aria-label': t('Email address'), placeholder: t('Email address'), value: address, autoComplete: 'off', onChange: e => setAddress(e.target.value) }),- h('label', { className: 'bt-q-field bt-secret-field' }, h(MaskedInput, { value: password, onChange: setPassword, label: t(guide?.label ?? 'Password or app password') })),- chosen === 'other' ? [- h('input', { key: 'ih', className: 'bt-input', 'aria-label': t('IMAP host'), placeholder: t('IMAP host'), value: imapHost, onChange: e => setImapHost(e.target.value) }),- h('input', { key: 'sh', className: 'bt-input', 'aria-label': t('SMTP host'), placeholder: t('SMTP host'), value: smtpHost, onChange: e => setSmtpHost(e.target.value) }),- ] : null,- error ? h('div', { className: 'bt-connector-error', role: 'alert' }, hostText(error)) : null,- h('div', { className: 'bt-connector-form-row' },- mail?.google ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => void mailRun(actions.mailAccountAdd({ address: address.trim(), google: true })) }, t('Sign in with Google')) : h('span', { className: 'bt-connector-link' }),- h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: close }, t('Cancel')),- h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: !address.includes('@') || password === '', onClick: add }, t('Add account'))))- : h('div', { className: 'bt-connector-form-row' },- h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => setForm(true) }, t('Add an account')),- mail?.google ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => void run(actions.mailAccountAdd({ google: true })) }, t('Sign in with Google')) : null))+ const add = () => void mailRun(() => actions.mailAccountAdd({ address: address.trim(), password, provider: chosen, imapHost: imapHost.trim(), smtpHost: smtpHost.trim() }), onClose)+ return h('div', { className: 'bt-set-row bt-set-paste bt-mail-form' },+ h('div', { className: 'bt-mail-providers', role: 'radiogroup', 'aria-label': t('Provider') },+ [['qq', 'QQ'], ['163', '163'], ['126', '126'], ['gmail', 'Gmail'], ['icloud', 'iCloud'], ['other', t('Other')]].map(([id, label]) =>+ h('button', { key: id, type: 'button', role: 'radio', 'aria-checked': chosen === id, className: 'bt-secret-seg', disabled: busy, onClick: () => setProvider(id) }, label))),+ guide ? [+ h('ol', { key: 'guide', className: 'bt-mail-guide' }, guide.steps.map(step => h('li', { key: step }, t(step, { host: guide.host })))),+ h('div', { key: 'links', className: 'bt-connector-form-row' },+ h('a', { className: 'bt-connector-link', href: guide.open, target: '_blank', rel: 'noopener noreferrer' }, t('Open {host}', { host: guide.host })),+ h('a', { className: 'bt-connector-link', href: guide.help, target: '_blank', rel: 'noopener noreferrer' }, t('Official help'))),+ ] : null,+ h('input', { className: 'bt-input', 'aria-label': t('Email address'), placeholder: t('Email address'), value: address, autoComplete: 'off', disabled: busy, onChange: e => setAddress(e.target.value) }),+ h('label', { className: 'bt-q-field bt-secret-field' }, h(MaskedInput, { value: password, onChange: setPassword, label: t(guide?.label ?? 'Password or app password'), disabled: busy })),+ chosen === 'other' ? [+ h('input', { key: 'ih', className: 'bt-input', 'aria-label': t('IMAP host'), placeholder: t('IMAP host'), value: imapHost, disabled: busy, onChange: e => setImapHost(e.target.value) }),+ h('input', { key: 'sh', className: 'bt-input', 'aria-label': t('SMTP host'), placeholder: t('SMTP host'), value: smtpHost, disabled: busy, onChange: e => setSmtpHost(e.target.value) }),+ ] : null,+ error ? h('div', { className: 'bt-connector-error', role: 'alert' }, hostText(error)) : null,+ h('div', { className: 'bt-secret-row-actions' },+ mail?.google ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: busy, onClick: () => void mailRun(() => actions.mailAccountAdd({ address: address.trim(), google: true }), onClose) }, t('Sign in with Google')) : h('span', { className: 'bt-connector-link' }),+ h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: busy, onClick: onClose }, t('Cancel')),+ h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: busy || !address.includes('@') || password === '', onClick: add }, busy ? t('Verifying…') : t('Add account'))))+}++const EMPTY_MAIL = { address: '', password: '', provider: '', imapHost: '', smtpHost: '' }+export function MailSection({ mail, actions, run }) {+ const [form, setForm] = useState(false)+ const [busy, setBusy] = useState(false)+ const [error, setError] = useState(null)+ const [fields, setFields] = useState(EMPTY_MAIL)+ const busyRef = useRef(false)+ const accounts = mail?.accounts ?? []+ const setField = (key, value) => setFields(current => ({ ...current, [key]: value }))+ const close = () => { setError(null); setForm(false); setFields(EMPTY_MAIL) }+ const mailRun = (task, onDone) => {+ if (busyRef.current || busy) return false+ busyRef.current = true+ setBusy(true)+ setError(null)+ void Promise.resolve().then(task).then(() => { onDone?.() }, (failure) => { setError(failure?.message ?? String(failure)) }).finally(() => { busyRef.current = false; setBusy(false) })+ return true+ }+ return [+ h('div', { key: 'title', className: 'bt-section-title' }, t('Mailbox')),+ h('div', { key: 'card', className: 'bt-set-card bt-connectors-card' },+ accounts.length === 0 && !form ? h('div', { className: 'bt-set-row' }, h('span', { className: 'bt-set-hint' }, t('No mail accounts yet'))) : null,+ accounts.map(account => h(MailAccount, { key: account.id, account, actions, run })),+ (mail?.pending ?? []).map(p => h(MailPending, { key: p.address ?? 'google', pending: p })),+ form ? h(MailForm, { mail, actions, mailRun, busy, error, fields, setField, onClose: close }) : null),+ form ? null : h('div', { key: 'add', className: 'bt-actions' },+ h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => { setError(null); setForm(true) } }, t('Add an account')),+ mail?.google ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: busy, onClick: () => void run(actions.mailAccountAdd({ google: true })) }, t('Sign in with Google')) : null),+ ]}function AddMenu({ actions, run }) {@@ -281,8 +329,8 @@ export function ConnectorsPage({ roster, actions }) {h('div', { className: 'bt-section-title' }, t('Connected')),h('div', { className: 'bt-set-card bt-connectors-card' },connected.length === 0 ? h('div', { className: 'bt-set-row' }, h('span', { className: 'bt-set-hint' }, t('No connectors connected'))) : null,- connected.map(connector => h(ConnectorRow, { key: connector.id, connector, actions })),- h(MailSection, { mail: data.mail, actions, run })),+ connected.map(connector => h(ConnectorRow, { key: connector.id, connector, actions }))),+ h(MailSection, { mail: data.mail, actions, run }),h('div', { className: 'bt-section-title' }, t('Catalog')),h('div', { className: 'bt-set-card bt-connectors-card' },h('div', { className: 'bt-connector-search' },@@ -314,20 +362,48 @@ export function BotConnectors({ bot, roster, actions, run }) {// --- cards ---------------------------------------------------------------+// The request cards all draw on the secret card: mark with a kind badge, title+// and detail, the same close key, and .bt-q-btn/.bt-q-submit in the foot.+// Answered requests settle into the same read-only card the secret card leaves.+function RequestHead({ bot, badge, title, detail, onClose }) {+ return h('div', { className: 'bt-q-head bt-secret-head' },+ h('span', { className: 'bt-secret-who' }, h(BotMark, { bot, size: 28 }), badge ? h('span', { className: 'bt-secret-lock' }, badge) : null),+ h('div', { className: 'bt-q-text' },+ h('p', { className: 'bt-q-title' }, title),+ detail ? h('div', { className: 'bt-q-detail' }, detail) : null),+ onClose ? h('button', { type: 'button', className: 'bt-q-x', 'aria-label': t('Cancel the request'), title: t('Cancel'), onClick: onClose }, h(CloseIcon)) : null)+}++// The read-only card an answered request leaves in the transcript, on the same+// settled frame the secret and question cards use.+function SettledCard({ bot, title, done, badge }) {+ return h('div', { className: `bt-q bt-q-settled bt-secret bt-secret-done${done ? '' : ' bt-q-dismissed'}`, role: 'group', 'aria-label': title },+ h('div', { className: 'bt-q-head' },+ h('span', { className: 'bt-secret-who' }, h(BotMark, { bot, size: 22 })),+ h('div', { className: 'bt-q-text' }, h('p', { className: 'bt-q-title' }, title)),+ done ? h('span', { className: 'bt-q-check bt-secret-check', title: t('Done') }, h(CheckIcon)) : h('span', { className: 'bt-q-badge' }, badge)))+}+function ConnectorCard({ sessionId, bot, request, actions, inline = false }) {const hold = useDockHold(sessionId, 'connector', request.id, actions, inline)- const connector = { id: request.connectorId, name: request.name ?? request.connectorId, state: 'off', auth: request.auth ?? { kind: 'oauth' } }- return h('div', { className: 'bt-q bt-secret bt-connector-card', role: 'group', onFocusCapture: hold, onPointerDownCapture: hold },- h('div', { className: 'bt-q-head bt-secret-head' },- h('span', { className: 'bt-secret-who' }, h(BotMark, { bot, size: 28 })),- h('div', { className: 'bt-q-text' },- h('p', { className: 'bt-q-title' }, t('{bot} needs {name}', { bot: bot.name, name: connector.name })),- request.purpose ? h('div', { className: 'bt-q-detail' }, request.purpose) : null)),+ const name = request.name ?? request.connectorId+ const dismiss = () => { hold(); void actions.connectorRequestCancel(request.id) }+ return h('div', { className: 'bt-q bt-secret', role: 'group', onFocusCapture: hold, onPointerDownCapture: hold },+ h(RequestHead, { bot, badge: h(PlugIcon), title: t('{bot} needs {name}', { bot: bot.name, name }), detail: request.purpose, onClose: dismiss }),h('div', { className: 'bt-q-foot' },- h('button', { type: 'button', className: 'bt-q-btn', onClick: () => { hold(); void actions.connectorRequestCancel(request.id) } }, t('Dismiss')),+ h('button', { type: 'button', className: 'bt-q-btn', onClick: dismiss }, t('Dismiss')),h('button', { type: 'button', className: 'bt-q-submit', onClick: () => { hold(); actions.openConnectors() } }, t('Connect'))))}+function SettledConnector({ bot, request }) {+ return h(SettledCard, {+ bot,+ title: t('{bot} asked for {name}', { bot: bot.name, name: request.name ?? request.connectorId }),+ done: request.status === 'connected',+ badge: t('Canceled'),+ })+}+const humanSize = bytes => bytes >= 1024 * 1024 ? `${(bytes / (1024 * 1024)).toFixed(1)} MB` : bytes >= 1024 ? `${Math.round(bytes / 1024)} KB` : `${bytes} B`const NONE = {}@@ -339,7 +415,7 @@ export function ConnectorToolCell({ sessionId, callId, done, content, roster, acif (request) {return request.status === 'pending'? h('div', { className: 'bt-q-inline' }, h(ConnectorCard, { sessionId, bot, request, actions, inline: true }))- : h('div', { className: 'bt-event' }, h('span', { className: 'bt-secret-event' }, request.status === 'connected' ? t('{bot} asked for a connector — connected', { bot: bot.name }) : t('{bot} asked for a connector', { bot: bot.name })))+ : h('div', { className: 'bt-q-inline' }, h(SettledConnector, { bot, request }))}if (done && /already connected/.test(contentText(content))) return h(CellEmpty)return h(CellEmpty)@@ -357,25 +433,49 @@ export function ConnectorDock({ sessionId, useRoster, useCards, useHeldCards, acreturn h('div', { className: 'bt-q-dock bt-secret-dock' }, waiting.map(request => h(ConnectorCard, { key: request.id, sessionId, bot, request, actions })))}-export function MailSendCard({ sessionId, bot, request, actions, inline = false }) {+export function MailSendCard({ sessionId, bot, request, roster, actions, inline = false }) {const [busy, setBusy] = useState(false)+ const busyRef = useRef(false)const hold = useDockHold(sessionId, 'mail', request.id, actions, inline)- const answer = (choice) => { if (busy) return; hold(); setBusy(true); void Promise.resolve(actions.mailSendAnswer(request.id, choice)).finally(() => setBusy(false)) }- return h('div', { className: 'bt-q bt-secret bt-mail-card', role: 'group', onFocusCapture: hold, onPointerDownCapture: hold },- h('div', { className: 'bt-q-head bt-secret-head' },- h('span', { className: 'bt-secret-who' }, h(BotMark, { bot, size: 28 })),- h('div', { className: 'bt-q-text' },- h('p', { className: 'bt-q-title' }, t('{bot} wants to send an email', { bot: bot.name })),- h('div', { className: 'bt-q-detail' }, request.subject))),- h('div', { className: 'bt-mail-preview' },- h('div', { className: 'bt-q-detail' }, t('To'), ' ', request.to),- request.cc ? h('div', { className: 'bt-q-detail' }, t('Cc'), ' ', request.cc) : null,- request.bcc ? h('div', { className: 'bt-q-detail' }, t('Bcc'), ' ', request.bcc) : null,- h('div', { className: 'bt-mail-body bt-q-detail' }, request.body),- request.attachmentDetails?.length ? h('div', { className: 'bt-q-detail' }, t('Attachments: {names}', { names: request.attachmentDetails.map(a => a.size !== undefined ? `${a.name} (${humanSize(a.size)})` : a.name).join(', ') })) : null),+ const answer = (choice) => {+ if (busyRef.current || busy) return+ busyRef.current = true+ hold()+ setBusy(true)+ void Promise.resolve(actions.mailSendAnswer(request.id, choice)).catch(() => {}).finally(() => { busyRef.current = false; setBusy(false) })+ }+ const account = (roster?.connectors?.mail?.accounts ?? []).find(entry => entry.id === request.account)+ const from = account?.address ?? request.account+ const route = [+ request.to ? `${t('To')} ${request.to}` : '',+ request.cc ? `${t('Cc')} ${request.cc}` : '',+ request.bcc ? `${t('Bcc')} ${request.bcc}` : '',+ ].filter(line => line !== '').join(' · ')+ return h('div', { className: 'bt-q bt-secret', role: 'group', onFocusCapture: hold, onPointerDownCapture: hold },+ h(RequestHead, {+ bot, badge: h(MailIcon), title: t('{bot} wants to send an email', { bot: bot.name }), detail: request.subject,+ onClose: busy ? undefined : () => answer('cancel'),+ }),+ // The message preview rides on the file box the other cards use for quoted+ // content; the body stays scrollable when it runs long.+ h('div', { className: 'bt-learning-file' },+ h('div', { className: 'bt-learning-filehead' },+ from ? h('span', { className: 'bt-learning-name' }, from) : null,+ h('span', { className: 'bt-learning-path' }, route)),+ h('div', { className: 'bt-mail-body' }, request.body)),+ request.attachmentDetails?.length ? h('div', { className: 'bt-q-detail' }, t('Attachments: {names}', { names: request.attachmentDetails.map(a => a.size !== undefined ? `${a.name} (${humanSize(a.size)})` : a.name).join(', ') })) : null,h('div', { className: 'bt-q-foot' },h('button', { type: 'button', className: 'bt-q-btn', disabled: busy, onClick: () => answer('cancel') }, t('Cancel')),- h('button', { type: 'button', className: 'bt-q-submit', disabled: busy, onClick: () => answer('send') }, t('Send'))))+ h('button', { type: 'button', className: 'bt-q-submit', disabled: busy, onClick: () => answer('send') }, busy ? t('Sending…') : t('Send'))))+}++function SettledMail({ bot, request }) {+ return h(SettledCard, {+ bot,+ title: request.status === 'sent' ? t('Sent “{subject}”', { subject: request.subject }) : t('{bot} wanted to send “{subject}”', { bot: bot.name, subject: request.subject }),+ done: request.status === 'sent',+ badge: request.status === 'failed' ? t('Failed') : t('Canceled'),+ })}export function MailToolCell({ sessionId, callId, roster, actions, heldCards = NONE }) {@@ -385,9 +485,8 @@ export function MailToolCell({ sessionId, callId, roster, actions, heldCards = Nif (request?.status === 'pending' && heldCards[heldCardKey('mail', request.id)] > 0) return h(CellEmpty)if (request) {return request.status === 'pending'- ? h('div', { className: 'bt-q-inline' }, h(MailSendCard, { sessionId, bot, request, actions, inline: true }))- : h('div', { className: 'bt-event' }, h('span', { className: 'bt-secret-event' },- request.status === 'sent' ? t('Sent “{subject}”', { subject: request.subject }) : request.status === 'failed' ? t('Could not send “{subject}”', { subject: request.subject }) : t('“{subject}” was not sent', { subject: request.subject })))+ ? h('div', { className: 'bt-q-inline' }, h(MailSendCard, { sessionId, bot, request, roster, actions, inline: true }))+ : h('div', { className: 'bt-q-inline' }, h(SettledMail, { bot, request }))}return h(CellEmpty)}@@ -401,7 +500,7 @@ export function MailDock({ sessionId, useRoster, useCards, useHeldCards, actionsconst drawn = entry => entry.callId && entry.sessionId === sessionId && shown[entry.callId] > 0 && !(held[heldCardKey('mail', entry.id)] > 0)const waiting = (roster.mailRequests?.[bot.id] ?? []).filter(entry => entry.status === 'pending' && !drawn(entry))if (waiting.length === 0) return null- return h('div', { className: 'bt-q-dock bt-secret-dock' }, waiting.map(request => h(MailSendCard, { key: request.id, sessionId, bot, request, actions })))+ return h('div', { className: 'bt-q-dock bt-secret-dock' }, waiting.map(request => h(MailSendCard, { key: request.id, sessionId, bot, request, roster, actions })))}export const CONNECTOR_CSS = `@@ -416,12 +515,10 @@ export const CONNECTOR_CSS = `.bt-connector-device{display:flex;align-items:center;gap:10px}.bt-connector-code{font-family:ui-monospace,Menlo,monospace;font-size:16px;letter-spacing:.12em;padding:4px 10px;border-radius:8px;background:var(--bt-hover)}.bt-connector-import{display:flex;align-items:center;gap:8px;font-size:13px;padding:4px 0;cursor:pointer}-.bt-mail{display:flex;flex-direction:column;gap:10px;padding:12px}-.bt-mail-form{padding-left:0}.bt-mail-providers{display:flex;gap:4px;flex-wrap:wrap}.bt-mail-providers .bt-secret-seg{height:26px;padding:0 10px;border:.5px solid var(--bt-line)}.bt-mail-providers .bt-secret-seg[aria-checked=true]{background:var(--bt-active)}.bt-connector-bot .bt-set-copy{min-width:0}-.bt-mail-preview{display:flex;flex-direction:column;gap:4px;font-size:13px;line-height:18px;color:var(--bt-ink);margin:6px 0}-.bt-mail-body{white-space:pre-wrap;max-height:160px;overflow-y:auto;padding:8px 10px;border-radius:8px;background:var(--bt-hover);font-size:13px}+.bt-mail-open{text-decoration:none}+.bt-mail-body{max-height:180px;overflow-y:auto;padding:8px 12px;font-size:13px;line-height:19px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--bt-ink)}`diff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.jsindex ae89ef30..45efd94b 100644--- a/ds-bot/src/client/i18n.js+++ b/ds-bot/src/client/i18n.js@@ -1251,6 +1251,8 @@ const ZH = {'Sign in with Google': '使用 Google 登录','Add account': '添加账户','Add an account': '添加账户',+ 'No mail accounts yet': '还没有邮箱账户',+ 'Verifying…': '正在验证…','Open the Google sign-in page': '打开 Google 登录页','Add an address': '添加地址','Add a command': '添加命令',@@ -1269,16 +1271,15 @@ const ZH = {'Commerce': '商务','No connectors connected': '未连接任何连接器','{bot} needs {name}': '{bot} 需要 {name}',- '{bot} asked for a connector — connected': '{bot} 请求了连接器 — 已连接',- '{bot} asked for a connector': '{bot} 请求了连接器','{bot} wants to send an email': '{bot} 想发送一封邮件','To': '收件人','Cc': '抄送','Bcc': '密送','Attachments: {names}': '附件:{names}','Sent “{subject}”': '已发送“{subject}”',- 'Could not send “{subject}”': '“{subject}”发送失败',- '“{subject}” was not sent': '“{subject}”未发送',+ '{bot} wanted to send “{subject}”': '{bot} 想发送“{subject}”',+ 'Failed': '失败',+ 'Sending…': '正在发送…',}diff --git a/ds-bot/src/client/icons.js b/ds-bot/src/client/icons.jsindex d111d9ec..cc34094b 100644--- a/ds-bot/src/client/icons.js+++ b/ds-bot/src/client/icons.js@@ -70,6 +70,7 @@ export const SwitchIcon = lineIcon(['M4 7h9.5M10.5 3.5L14 7l-3.5 3.5', 'M16 13H6export 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 SignInIcon = lineIcon(['M11.5 3H14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2.5', 'M3.5 10H10', 'M7 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 MailIcon = lineIcon(['M4 5.5h12a1.5 1.5 0 0 1 1.5 1.5v6a1.5 1.5 0 0 1-1.5 1.5H4A1.5 1.5 0 0 1 2.5 13V7a1.5 1.5 0 0 1 1.5-1.5z', 'M3.2 7l6.8 4.5L16.8 7'])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.export const 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'])diff --git a/ds-bot/src/client/secret-card.js b/ds-bot/src/client/secret-card.jsindex 96d6968e..6cb71448 100644--- a/ds-bot/src/client/secret-card.js+++ b/ds-bot/src/client/secret-card.js@@ -36,10 +36,11 @@ const scopeLabel = (scope, roster) => {}const when = time => (Number.isFinite(time) ? new Date(time).toLocaleString(dateLocale(), { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }) : '')-export function MaskedInput({ value, onChange, onEnter, label, autoFocus = false }) {+export function MaskedInput({ value, onChange, onEnter, label, autoFocus = false, disabled = false }) {return h('input', {className: 'bt-secret-input',type: MASK_BY_CSS ? 'text' : 'password',+ disabled,'data-masked': MASK_BY_CSS ? '' : undefined,value,autoFocus,diff --git a/ds-bot/test/connectors-page.test.js b/ds-bot/test/connectors-page.test.jsindex 9080d9fa..1b1fcb52 100644--- a/ds-bot/test/connectors-page.test.js+++ b/ds-bot/test/connectors-page.test.js@@ -15,7 +15,7 @@ const { JSDOM } = createRequire(join(process.env.DSH_HARNESS ?? join(PLUGIN, '..// stable because the tree expands the same way every pass.const { outputFiles } = await build({stdin: {- contents: "export { MailSection } from './src/client/connectors.js'",+ contents: "export { MailSection, MailToolCell } from './src/client/connectors.js'",resolveDir: PLUGIN,},bundle: true, format: 'cjs', platform: 'browser', write: false, logLevel: 'silent',@@ -55,8 +55,9 @@ runInNewContext(outputFiles[0].text, {window: { matchMedia: () => ({ matches: false }) },require: name => (name === 'react' ? react : name === 'react-dom' ? { createPortal: node => node } : {}),})-const { MailSection } = module.exports+const { MailSection, MailToolCell } = module.exportsconst render = () => { idx = 0; concrete = expand(MailSection(props)) }+const renderCell = (cellProps) => { slots.length = 0; idx = 0; concrete = expand(MailToolCell(cellProps)) }const flatten = (node, out = []) => {if (node === null || node === undefined || node === false || node === true) return out@@ -96,6 +97,7 @@ test('the mail form shows the QQ guide with its links and closes after a good ad}const run = (task, onDone) => Promise.resolve(task).then(() => onDone?.(), () => {})props = { mail: { accounts: [] }, actions, run }+ slots.length = 0render()click('Add an account')click('QQ')@@ -116,6 +118,65 @@ test('the mail form shows the QQ guide with its links and closes after a good adassert.equal(collect(n => String(n.props?.className ?? '').includes('bt-mail-form')).length, 0, 'form closed after a resolved add')})+test('a busy mail add blocks a second click and a good add clears the fields', async () => {+ const adds = []+ let release = null+ const actions = {+ mailAccountAdd: (body) => { adds.push(body); return new Promise(resolve => { release = resolve }) },+ mailAccountRemove: () => Promise.resolve(true),+ }+ const run = (task, onDone) => Promise.resolve(task).then(() => onDone?.(), () => {})+ props = { mail: { accounts: [] }, actions, run }+ slots.length = 0+ render()+ click('Add an account')+ fill('Email address', '[email protected]')+ fill('Authorization code', 'CODE')+ click('Add account')+ await flush()+ assert.equal(adds.length, 1)+ const adding = collect(n => n.type === 'button' && flatten(n).join('') === 'Verifying…')[0]+ assert.ok(adding, 'busy button reads Verifying…')+ assert.equal(adding.props.disabled, true)+ adding.props.onClick?.()+ await flush()+ assert.equal(adds.length, 1, 'a second click while busy adds nothing')+ const address = collect(n => n.type === 'input' && n.props?.['aria-label'] === 'Email address')[0]+ assert.equal(address.props.disabled, true, 'the fields are disabled while busy')+ release({ accounts: [] })+ await flush()+ assert.equal(collect(n => String(n.props?.className ?? '').includes('bt-mail-form')).length, 0, 'form closed after a resolved add')+ click('Add an account')+ assert.equal(collect(n => n.type === 'input' && n.props?.['aria-label'] === 'Email address')[0].props.value, '', 'address cleared')+ assert.equal(collect(n => n.type === 'input' && String(n.props?.className ?? '') === 'bt-secret-input')[0].props.value, '', 'code cleared')+ const other = collect(n => n.type === 'button' && flatten(n).join('') === 'Other')[0]+ assert.equal(other.props['aria-checked'], true, 'provider chip back to the default')+ assert.equal(collect(n => n.type === 'input' && n.props?.['aria-label'] === 'IMAP host')[0].props.value, '', 'IMAP host cleared')+ assert.equal(collect(n => n.type === 'input' && n.props?.['aria-label'] === 'SMTP host')[0].props.value, '', 'SMTP host cleared')+})++test('the mail send card renders on the shared card structure', async () => {+ const bot = { id: 'b1', name: 'Chief' }+ const roster = {+ byId: { s1: bot },+ connectors: { mail: { accounts: [{ id: '[email protected]', address: '[email protected]' }] } },+ mailRequests: {+ b1: [{ id: 'r1', callId: 'c1', sessionId: 's1', status: 'pending', account: '[email protected]', to: '[email protected]', subject: 'Weekly', body: 'Hi all', attachmentDetails: [{ name: 'report.pdf', size: 2048 }] }],+ },+ }+ renderCell({ sessionId: 's1', callId: 'c1', roster, actions: {} })+ const card = collect(n => String(n.props?.className ?? '').split(' ').includes('bt-q'))[0]+ assert.ok(card, 'card root')+ assert.deepEqual(card.props.className.split(' ').sort(), ['bt-q', 'bt-secret'], 'card is the shared request card')+ assert.equal(collect(n => String(n.props?.className ?? '').includes('bt-mail-card')).length, 0, 'no bespoke card class')+ assert.equal(collect(n => String(n.props?.className ?? '').includes('bt-mail-preview')).length, 0, 'no bespoke preview class')+ assert.ok(collect(n => n.props?.className === 'bt-q-head bt-secret-head')[0], 'shared head')+ assert.ok(collect(n => String(n.props?.className ?? '').includes('bt-learning-file'))[0], 'shared quoted box')+ assert.ok(collect(n => n.props?.className === 'bt-mail-body')[0], 'body preview')+ assert.ok(collect(n => n.type === 'button' && String(n.props?.className ?? '') === 'bt-q-submit' && flatten(n).join('') === 'Send')[0], 'primary Send button')+ assert.ok(collect(n => n.type === 'button' && String(n.props?.className ?? '') === 'bt-q-btn' && flatten(n).join('') === 'Cancel')[0], 'secondary Cancel button')+})+test('a failed mail add shows the host message inside the form', async () => {const actions = {mailAccountAdd: () => Promise.reject(new Error('The password was refused. Use the mailbox app password or authorization code, not the account password.')),@@ -123,6 +184,7 @@ test('a failed mail add shows the host message inside the form', async () => {}const run = (task, onDone) => Promise.resolve(task).then(() => onDone?.(), () => {})props = { mail: { accounts: [] }, actions, run }+ slots.length = 0render()click('Add an account')fill('Email address', '[email protected]')