A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Redact stored secrets out of IM status errors and pin qrcode-generator
Fei241154beb07b4a0a
diff --git a/ds-bot/package-lock.json b/ds-bot/package-lock.jsonindex efc3e1c5..70abf34c 100644--- a/ds-bot/package-lock.json+++ b/ds-bot/package-lock.json@@ -14,7 +14,7 @@"devDependencies": {"@xmldom/xmldom": "0.9.12","esbuild": "0.28.2",- "qrcode-generator": "^2.0.4"+ "qrcode-generator": "2.0.4"},"peerDependencies": {"@deepseek-ai/cordis": "*",diff --git a/ds-bot/package.json b/ds-bot/package.jsonindex ca75288f..f0f93acc 100644--- a/ds-bot/package.json+++ b/ds-bot/package.json@@ -66,7 +66,7 @@"devDependencies": {"@xmldom/xmldom": "0.9.12","esbuild": "0.28.2",- "qrcode-generator": "^2.0.4"+ "qrcode-generator": "2.0.4"},"dependencies": {"deep-view": "0.1.0"diff --git a/ds-bot/src/host/im/index.js b/ds-bot/src/host/im/index.jsindex 51abd7ce..8649371c 100644--- a/ds-bot/src/host/im/index.js+++ b/ds-bot/src/host/im/index.js@@ -150,7 +150,11 @@ export function install(rt) {/** @type {Map<string, {handle:any, queues:Map<string, {jobs:any[], retry?:any}>, statuses:Map}>} */const runners = new Map()const statuses = new Map()- const setStatus = (id, next) => statuses.set(id, { at: Date.now(), ...next })+ const setStatus = (id, next) => {+ // Adapter errors can echo platform responses that quote the token; keep them out of the UI and logs.+ if (typeof next.error === 'string' && next.error !== '') return statuses.set(id, { ...next, error: rt.redactSecrets(next.error), at: Date.now() })+ return statuses.set(id, { ...next, at: Date.now() })+ }const targetsOf = (conn) => {const out = []for (const [chatKey, chat] of Object.entries(conn.chats ?? {})) {diff --git a/ds-bot/test/im.test.js b/ds-bot/test/im.test.jsindex 8f1fb7d1..58b5b4b9 100644--- a/ds-bot/test/im.test.js+++ b/ds-bot/test/im.test.js@@ -520,3 +520,22 @@ test('a weixin QR login creates the connection paired with the scanning owner',assert.equal(s.rt.secretValue(conn.secrets.token), 'wx-tok')assert.equal(conn.settings.baseUrl, 'http://ilink/')})++test('a platform status error is redacted of the stored secret', async (t) => {+ const s = await start({ adapter: (() => {+ const adapter = fakeAdapter()+ const connect = adapter.connect+ adapter.connect = (fields, env, handlers) => {+ const handle = connect(fields, env, handlers)+ handlers.onStatus({ state: 'error', error: 'platform echoed the token tok-1234 back' })+ return handle+ }+ return adapter+ })() })+ t.after(s.stop)+ const conn = await add(s)+ await s.flush()+ const status = s.rt.imStatusView()[conn.id]+ assert.equal(status.state, 'error')+ assert.ok(!status.error.includes('tok-1234'), 'the token is redacted')+})