Skip to content

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

Explain an unreachable mail server and keep the guide links together

Fei241148f7941d9d72
diff --git a/ds-bot/client.js b/ds-bot/client.js
index 17273043..da228141 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -1264,6 +1264,7 @@ var ZH = {
"Authorization code": "授权码",
"Password or app password": "密码或授权码",
"Official help": "官方帮助",
+ "Could not reach the mail server. Check the server address.": "连不上邮件服务器,请检查服务器地址。",
"Sign in at mail.qq.com, click your avatar at the top right, and open Settings → Account and Security → Security Settings.": "在 mail.qq.com 登录,点右上角头像,进入 设置 → 账号与安全 → 安全设置。",
"Turn on the POP3/IMAP/SMTP service, then click Generate authorization code and verify yourself.": "开启 POP3/IMAP/SMTP 服务,再点「生成授权码」,按提示验证身份。",
"Paste the 16-letter code below. Changing your QQ password cancels it.": "把 16 位授权码粘贴到下面。改了 QQ 密码后授权码会失效。",
@@ -1361,6 +1362,7 @@ var ZH = {
"Failed": "失败"
};
var HOST_ERRORS = [
+ [/^Could not reach the mail server at (.+)\. Check the server address\.$/, "连不上邮件服务器 $1,请检查服务器地址。"],
[/^Model (.+) is not available\. Available: (.*)$/, "模型 $1 不可用。可用的:$2"],
[/^The API key for (.+) is set outside DS Bot and cannot be changed here$/, "$1 的 API key 是在 DS Bot 之外设置的,这里改不了"],
[/^(.+) takes no API key here$/, "$1 不能在这里填 API key"],
@@ -3311,6 +3313,8 @@ button.bt-set-row:hover{background:var(--bt-hover)}
.bt-connector-error{padding-left:48px;font-size:12px;line-height:16px;color:var(--bt-danger)}
.bt-mail-guide{margin:0;padding-left:20px;font-size:12px;line-height:16px;color:color-mix(in srgb,var(--bt-ink-2) 50%,var(--bt-ink-3));display:flex;flex-direction:column;gap:4px}
.bt-mail-form .bt-connector-error{padding-left:0}
+.bt-mail-links{gap:16px}
+.bt-mail-links .bt-connector-link{flex:none}
.bt-im-mark{width:20px;height:20px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;color:var(--bt-im-mark-ink)}
.bt-im-line{display:flex;align-items:center;gap:8px}
.bt-im-label{flex:1;font-size:12px;color:var(--bt-ink-2)}
@@ -10992,7 +10996,7 @@ function MailForm({ mail, actions, mailRun, busy, error, fields, setField, onClo
(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" },
+ { key: "links", className: "bt-connector-form-row bt-mail-links" },
(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"))
)
diff --git a/ds-bot/src/client/connectors.js b/ds-bot/src/client/connectors.js
index a1eabb55..2bb493c5 100644
--- a/ds-bot/src/client/connectors.js
+++ b/ds-bot/src/client/connectors.js
@@ -232,7 +232,7 @@ function MailForm({ mail, actions, mailRun, busy, error, fields, setField, onClo
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('div', { key: 'links', className: 'bt-connector-form-row bt-mail-links' },
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,
diff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.js
index 196b4ae1..5493fa00 100644
--- a/ds-bot/src/client/i18n.js
+++ b/ds-bot/src/client/i18n.js
@@ -1217,6 +1217,7 @@ const ZH = {
'Authorization code': '授权码',
'Password or app password': '密码或授权码',
'Official help': '官方帮助',
+ 'Could not reach the mail server. Check the server address.': '连不上邮件服务器,请检查服务器地址。',
'Sign in at mail.qq.com, click your avatar at the top right, and open Settings → Account and Security → Security Settings.': '在 mail.qq.com 登录,点右上角头像,进入 设置 → 账号与安全 → 安全设置。',
'Turn on the POP3/IMAP/SMTP service, then click Generate authorization code and verify yourself.': '开启 POP3/IMAP/SMTP 服务,再点「生成授权码」,按提示验证身份。',
'Paste the 16-letter code below. Changing your QQ password cancels it.': '把 16 位授权码粘贴到下面。改了 QQ 密码后授权码会失效。',
@@ -1318,6 +1319,7 @@ const ZH = {
// Host errors stay English, since Bots read them too; they are translated where the
// interface shows them. Static ones go through ZH, these carry names or numbers.
const HOST_ERRORS = [
+ [/^Could not reach the mail server at (.+)\. Check the server address\.$/, '连不上邮件服务器 $1,请检查服务器地址。'],
[/^Model (.+) is not available\. Available: (.*)$/, '模型 $1 不可用。可用的:$2'],
[/^The API key for (.+) is set outside DS Bot and cannot be changed here$/, '$1 的 API key 是在 DS Bot 之外设置的,这里改不了'],
[/^(.+) takes no API key here$/, '$1 不能在这里填 API key'],
diff --git a/ds-bot/src/client/styles.js b/ds-bot/src/client/styles.js
index 0d31b0cc..6d691c9d 100644
--- a/ds-bot/src/client/styles.js
+++ b/ds-bot/src/client/styles.js
@@ -607,6 +607,8 @@ button.bt-set-row:hover{background:var(--bt-hover)}
.bt-connector-error{padding-left:48px;font-size:12px;line-height:16px;color:var(--bt-danger)}
.bt-mail-guide{margin:0;padding-left:20px;font-size:12px;line-height:16px;color:color-mix(in srgb,var(--bt-ink-2) 50%,var(--bt-ink-3));display:flex;flex-direction:column;gap:4px}
.bt-mail-form .bt-connector-error{padding-left:0}
+.bt-mail-links{gap:16px}
+.bt-mail-links .bt-connector-link{flex:none}
.bt-im-mark{width:20px;height:20px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;color:var(--bt-im-mark-ink)}
.bt-im-line{display:flex;align-items:center;gap:8px}
.bt-im-label{flex:1;font-size:12px;color:var(--bt-ink-2)}
diff --git a/ds-bot/src/host/connectors/mail/index.js b/ds-bot/src/host/connectors/mail/index.js
index 07e9bd04..530d667b 100644
--- a/ds-bot/src/host/connectors/mail/index.js
+++ b/ds-bot/src/host/connectors/mail/index.js
@@ -589,5 +589,7 @@ function mailError(error) {
const text = String(error?.responseText ?? error?.message ?? error)
if (/Unsafe Login/i.test(text)) return 'The mail service refused the login (Unsafe Login). Enable IMAP/SMTP in the mailbox settings and use its authorization code, not the account password.'
if (error?.authenticationFailed === true || /Login fail|authentication|invalid credentials|535|534/i.test(text)) return 'The password was refused. Use the mailbox app password or authorization code, not the account password.'
+ const unreachable = /\b(?:ECONNREFUSED|ETIMEDOUT|EHOSTUNREACH|ECONNRESET|ENOTFOUND|EAI_AGAIN)\b\s*(\S+)?/.exec(text)
+ if (unreachable) return unreachable[1] ? `Could not reach the mail server at ${unreachable[1]}. Check the server address.` : 'Could not reach the mail server. Check the server address.'
return text.slice(0, 300)
}
diff --git a/ds-bot/test/connectors-engine.test.js b/ds-bot/test/connectors-engine.test.js
index e12e7b05..dd98be6b 100644
--- a/ds-bot/test/connectors-engine.test.js
+++ b/ds-bot/test/connectors-engine.test.js
@@ -677,6 +677,7 @@ test('mail add explains refused and unsafe logins in plain words', async (t) =>
if (mode === 'flag') { const error = new Error('NO'); error.authenticationFailed = true; throw error }
if (mode === 'qq') throw new Error('Login fail. Account is abnormal, service is not open, password is incorrect, login frequency limited, or system is busy.')
if (mode === 'unsafe') throw new Error('Unsafe Login')
+ if (mode === 'refused') throw new Error('connect ECONNREFUSED 127.0.0.1:993')
return fakeSession()
}
const home = teamHome()
@@ -691,6 +692,8 @@ test('mail add explains refused and unsafe logins in plain words', async (t) =>
await assert.rejects(rt.connectorEndpoint('mail-account-add', { address: addressAt('qq.com'), password: 'CODE' }), /The password was refused/)
mode = 'unsafe'
await assert.rejects(rt.connectorEndpoint('mail-account-add', { address: addressAt('qq.com'), password: 'CODE' }), /Unsafe Login/)
+ mode = 'refused'
+ await assert.rejects(rt.connectorEndpoint('mail-account-add', { address: addressAt('qq.com'), password: 'CODE' }), /^Error: Could not reach the mail server at 127\.0\.0\.1:993\. Check the server address\.$/)
assert.equal(rt.mailView().accounts.length, 0)
})