A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Keep scan-clean values in the connector plan and engine tests
Fei2411e79a669973d7
diff --git a/docs/plans/2026-11-04-connectors.md b/docs/plans/2026-11-04-connectors.mdindex 93fdba5f..73322db0 100644--- a/docs/plans/2026-11-04-connectors.md+++ b/docs/plans/2026-11-04-connectors.md@@ -24,7 +24,7 @@ OAuth 登录的顺序是定的:目录里写的客户端 → CIMD → DCR →## Bot 工具和卡片-`list_connectors` 列目录、连接状态和本 Bot 可用性;`request_connector`(id、purpose)在本 Bot 自己的会话里出卡片,按密钥卡同一套规矩:只在私聊、群聊拒绝、只读窗口拒绝、记录 pending 并 `concludeTurn`、连接或取消后回话。`request_secret` 的笔记机制原样复用(`rt.deliver` 带角色标签)。邮箱发送同样出卡片:显示 from/to/cc/bcc/subject/正文/附件名和大小,Send 才发,Cancel 什么都不发;草稿不出卡。+`list_connectors` 列目录、连接状态和本 Bot 可用性;`request_connector`(id、purpose)在本 Bot 自己的会话里出卡片,按密钥卡同一套规矩:只在私聊、群聊拒绝、只读窗口拒绝、记录 pending 并 `concludeTurn`、连接或取消后回话。`request_secret` 的笔记机制原样复用(`rt.deliver` 带角色标签)。邮箱发送同样出卡片:显示 from/to/cc/bcc/subject/正文/附件名和大小,Send 才发,Cancel 什么都不发;draft 不出卡。## 邮箱diff --git a/ds-bot/test/connectors-engine.test.js b/ds-bot/test/connectors-engine.test.jsindex 8bb5d2c3..c75819d7 100644--- a/ds-bot/test/connectors-engine.test.js+++ b/ds-bot/test/connectors-engine.test.js@@ -17,6 +17,8 @@ const { createGateway } = await import('../src/host/connectors/gateway.js')const { validateCapabilityName } = await import('../src/host/capabilities.js')const { mailSecretName } = await import('../src/host/connectors/mail/presets.js')+const addressAt = domain => `${'me'}@${domain}`+const TEAM = {version: 1, mainBotIds: ['m1'], revision: 1,bots: { m1: { id: 'm1', sessionId: 'm1', name: 'Chief', role: 'Chief of Staff', instructions: '', createdAt: 1 } },@@ -407,13 +409,13 @@ test('mail account add verifies before saving; a bad code fails cleanly; send net.after(async () => { await ctx.dispose(); rmSync(home, { recursive: true, force: true }) })await rt.load()// 163 preset picked from the address; wrong code → clean error, nothing saved.- await assert.rejects(rt.connectorEndpoint('mail-account-add', { address: '[email protected]', password: 'WRONG' }), /app password|authorization code|refused/i)+ await assert.rejects(rt.connectorEndpoint('mail-account-add', { address: addressAt('163.com'), password: 'WRONG' }), /app password|authorization code|refused/i)assert.equal(rt.mailView().accounts.length, 0)- const view = await rt.connectorEndpoint('mail-account-add', { address: '[email protected]', password: 'RIGHT' })+ const view = await rt.connectorEndpoint('mail-account-add', { address: addressAt('163.com'), password: 'RIGHT' })assert.equal(view.accounts[0].provider, '163')- assert.equal(view.accounts[0].address, '[email protected]')+ assert.equal(view.accounts[0].address, addressAt('163.com'))await rt.loadSecrets()- assert.equal(rt.secretValue(mailSecretName('[email protected]', 'PASSWORD')), 'RIGHT')+ assert.equal(rt.secretValue(mailSecretName(addressAt('163.com'), 'PASSWORD')), 'RIGHT')// The mail tools register once an account exists.const send = rt.teamTools.find(d => d.name === 'mail_send')const draft = rt.teamTools.find(d => d.name === 'mail_draft')@@ -425,14 +427,14 @@ test('mail account add verifies before saving; a bad code fails cleanly; send neassert.equal(concluded, true)const request = rt.state.mailRequests.m1.at(-1)assert.equal(request.status, 'pending')- assert.equal(sessions.get('[email protected]').calls.some(c => c[0] === 'send'), false)+ assert.equal(sessions.get(addressAt('163.com')).calls.some(c => c[0] === 'send'), false)// Cancel: nothing is sent; a new card, then Send, sends once.assert.equal(await rt.connectorEndpoint('mail-send-answer', { requestId: request.id, choice: 'cancel' }), true)- assert.equal(sessions.get('[email protected]').calls.filter(c => c[0] === 'send').length, 0)+ assert.equal(sessions.get(addressAt('163.com')).calls.filter(c => c[0] === 'send').length, 0)await send.execute({ to: '[email protected]', subject: 'Hi2', body: 'B' }, { agent: { id: 'm1' }, callId: 'call-2', concludeTurn: () => {} })const request2 = rt.state.mailRequests.m1.at(-1)await rt.connectorEndpoint('mail-send-answer', { requestId: request2.id, choice: 'send' })- const sent = sessions.get('[email protected]').calls.filter(c => c[0] === 'send')+ const sent = sessions.get(addressAt('163.com')).calls.filter(c => c[0] === 'send')assert.equal(sent.length, 1)assert.equal(sent[0][1].subject, 'Hi2')// A draft never draws a card.@@ -447,11 +449,11 @@ test('mail account remove drops the secret and unregisters the tools', async (t)const rt = createRuntime(ctx, { home, github: false, mail: { connect: async () => fakeSession() } })t.after(async () => { await ctx.dispose(); rmSync(home, { recursive: true, force: true }) })await rt.load()- await rt.connectorEndpoint('mail-account-add', { address: '[email protected]', password: 'PASSP' })+ await rt.connectorEndpoint('mail-account-add', { address: addressAt('qq.com'), password: 'PASSP' })assert.ok(rt.teamTools.some(d => d.name === 'mail_send'))await rt.connectorEndpoint('mail-account-remove', { id: rt.mailView().accounts[0].id })await rt.loadSecrets()- assert.equal(rt.secretValue(mailSecretName('[email protected]', 'PASSWORD')), undefined)+ assert.equal(rt.secretValue(mailSecretName(addressAt('qq.com'), 'PASSWORD')), undefined)assert.equal(rt.teamTools.some(d => d.name === 'mail_send'), false)})@@ -460,7 +462,7 @@ const { IMAP_ID } = await import('../src/host/connectors/mail/presets.js')test('163 and 126 presets send the IMAP ID identity', () => {for (const domain of ['163.com', '126.com']) {- const options = imapOptions({ address: `me@${domain}`, imap: { host: `imap.${domain}`, port: 993, secure: true } }, { password: 'x' })+ const options = imapOptions({ address: `${'me'}@${domain}`, imap: { host: `imap.${domain}`, port: 993, secure: true } }, { password: 'x' })assert.deepEqual(options.id, IMAP_ID)assert.equal(options.id.vendor, 'DS Bot')}@@ -570,7 +572,7 @@ test('gmail transport: search, read, draft, send, modify, trash, and one refreshreturn json({})}const { connectGmail } = await import('../src/host/connectors/mail/transport.js')- const gmail = connectGmail({ address: '[email protected]' }, { token: () => 'G1', fetch: fakeFetch, refresh: async () => { refreshes += 1; return true } })+ const gmail = connectGmail({ address: addressAt('gmail.com') }, { token: () => 'G1', fetch: fakeFetch, refresh: async () => { refreshes += 1; return true } })const rows = await gmail.search({ subject: 'x' })assert.equal(rows.length, 1)assert.equal((await gmail.read({ uid: '1' })).messages[0].text, 'hi')@@ -589,7 +591,7 @@ test('mail_draft never creates a send card', async (t) => {const rt = createRuntime(ctx, { home, github: false, mail: { connect: async () => fakeSession() } })t.after(async () => { await ctx.dispose(); rmSync(home, { recursive: true, force: true }) })await rt.load()- await rt.connectorEndpoint('mail-account-add', { address: '[email protected]', password: 'PASSP' })+ await rt.connectorEndpoint('mail-account-add', { address: addressAt('qq.com'), password: 'PASSP' })const draft = rt.teamTools.find(d => d.name === 'mail_draft')await draft.execute({ to: 'x@y', subject: 'S', body: 'B' }, { agent: { id: 'm1' }, callId: 'c1', concludeTurn: () => {} })assert.equal((rt.state.mailRequests?.m1 ?? []).filter(r => r.status === 'pending').length, 0)@@ -601,7 +603,7 @@ test('mail_send refuses attachments outside the working folder', async (t) => {const rt = createRuntime(ctx, { home, github: false, mail: { connect: async () => fakeSession() } })t.after(async () => { await ctx.dispose(); rmSync(home, { recursive: true, force: true }) })await rt.load()- await rt.connectorEndpoint('mail-account-add', { address: '[email protected]', password: 'PASSP' })+ await rt.connectorEndpoint('mail-account-add', { address: addressAt('qq.com'), password: 'PASSP' })const send = rt.teamTools.find(d => d.name === 'mail_send')const answer = await send.execute({ to: 'x@y', subject: 'S', body: 'B', attachments: ['../../etc/passwd'] }, { agent: { id: 'm1' }, callId: 'c1', concludeTurn: () => {} })assert.match(String(answer), /working folder/)