Skip to content

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

Unquote a Bot ref before findBot matches the name

Fei2411bc37bc9a3380
diff --git a/ds-bot/src/host/store.js b/ds-bot/src/host/store.js
index a20a0b3e..99fe0abe 100644
--- a/ds-bot/src/host/store.js
+++ b/ds-bot/src/host/store.js
@@ -410,7 +410,7 @@ export function install(rt) {
if (ref === undefined) return undefined
const byId = own(state.bots, ref)
if (byId) return byId
- const wanted = normalize(ref).replace(/^@/, '')
+ const wanted = normalize(unquote(ref)).replace(/^@/, '')
return Object.values(state.bots).find(bot => normalize(bot.name) === wanted)
}
// Every group chat whose id or name matches; callers refuse an ambiguous name.
diff --git a/ds-bot/test/store.test.js b/ds-bot/test/store.test.js
index 03cd46f6..a3079a59 100644
--- a/ds-bot/test/store.test.js
+++ b/ds-bot/test/store.test.js
@@ -285,3 +285,25 @@ test('dispose waits for a pending save and prevents later writes', async (t) =>
restore()
}
})
+
+// #715: a model that quotes the Bot's name must find it, like findRooms does.
+test('findBot unquotes a Bot ref before matching the name', async (t) => {
+ const { rt } = runtime(t, {
+ version: 1,
+ mainBotIds: [],
+ bots: {
+ a1: { id: 'a1', name: 'Ada' },
+ s2: { id: 's2', name: 'Sun Tzu' },
+ },
+ rooms: {},
+ })
+ await rt.load()
+ for (const ref of ['Ada', 'ada', ' @Ada ', '"Ada"', "'Ada'", '“Ada”', '「Ada」']) {
+ assert.equal(rt.findBot(ref)?.id, 'a1', ref)
+ }
+ assert.equal(rt.findBot('“Sun Tzu”')?.id, 's2')
+ // An id still resolves itself; an unknown name still misses.
+ assert.equal(rt.findBot('a1')?.id, 'a1')
+ assert.equal(rt.findBot('"Nobody"'), undefined)
+ assert.equal(rt.findBot(undefined), undefined)
+})