Skip to content

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

Exercise show_view on the bench and in the smoke test

Fei2411704465877d52
diff --git a/ds-bot/dev/mock-llm.mjs b/ds-bot/dev/mock-llm.mjs
index b16db6f4..b69d5566 100644
--- a/ds-bot/dev/mock-llm.mjs
+++ b/ds-bot/dev/mock-llm.mjs
@@ -27,6 +27,8 @@
// 报错 (fake rejected key, 401; also as the text of 转告, so the receiving Bot fails)
// 卡片 K (K×1000 characters, then a question card) · 笔记模式 截断一次|缺节一次|总截断|总缺节|失败|正常
// 记住[@话题] 事实 · 团队记住 事实 (remember) · 忘掉 事实 (forget) · 回忆 [词] (recall)
+// 视图选项 (options card, waits) · 视图表单 (form card, waits) · 视图展示 (display-only
+// stack) · 大视图 (display-only, just under the byte limit)
// 查能力 [词] (names the mcp__ tools and catalog skills that contain 词; also in a group)
// A message with a file (a long Bot message as a file, a file the user sent): the Bot
// reads the saved path, then says how many lines it read and how the file ends.
@@ -467,6 +469,31 @@ function decide(body) {
if (/^\s*阻塞提问/.test(userText) && tools.has('ask_user_question')) {
return [tool('ask_user_question', { questions: [{ id: 'start', header: 'Choose', question: '先从哪块开始?', options: [{ label: '先定目标 (Recommended)', description: '先把要做成什么说清楚' }, { label: '整理日常事务' }] }] })]
}
+ // View cards: 视图选项 and 视图表单 wait for an answer; 视图展示 and 大视图 are
+ // display-only — the latter sits just under the view byte limit.
+ if (/^\s*视图选项/.test(userText) && tools.has('show_view')) {
+ return [tool('show_view', { title: 'Pick a lane', view: { type: 'options', id: 'lane', options: [{ label: 'Ship now' }, { label: 'One more pass' }] } })]
+ }
+ if (/^\s*视图表单/.test(userText) && tools.has('show_view')) {
+ return [tool('show_view', { title: 'A few details', view: { type: 'form', id: 'ask', submitLabel: 'Send', fields: [{ id: 'name', label: 'Name', placeholder: 'Ada' }, { id: 'note', label: 'Note' }] } })]
+ }
+ if (/^\s*视图展示/.test(userText) && tools.has('show_view')) {
+ return [tool('show_view', {
+ title: 'Status board', await_reply: false,
+ view: {
+ type: 'stack',
+ children: [
+ { type: 'text', text: '**Release readiness** — all checks are in.' },
+ { type: 'metric', label: 'Open issues', value: 3, tone: 'warn' },
+ { type: 'table', columns: [{ key: 'item', label: 'Item' }, { key: 'state', label: 'State' }], rows: [['Tests', 'green'], ['Docs', 'draft'], ['Changelog', 'done']] },
+ { type: 'progress', label: 'Reviewed', percent: 72 },
+ ],
+ },
+ })]
+ }
+ if (/^\s*大视图/.test(userText) && tools.has('show_view')) {
+ return [tool('show_view', { title: 'A long note', view: { type: 'text', text: 'x'.repeat(7800) }, await_reply: false })]
+ }
// Streams slowly, then checks the team: exercises the activity row stepping aside
// for a streaming reply and coming back for the tool.
if (/^\s*慢慢说/.test(userText) && tools.has('list_bots')) {
diff --git a/ds-bot/dev/smoke.mjs b/ds-bot/dev/smoke.mjs
index 7d25eb7e..dc4e8dd5 100644
--- a/ds-bot/dev/smoke.mjs
+++ b/ds-bot/dev/smoke.mjs
@@ -198,6 +198,34 @@ await step('a Bot is not offered dsh\'s blocking question tool', () => send(botN
?? expect(saidText(calls, /^收到:阻塞提问/), 'expected Writer to answer in its reply')
})
+// show_view: an options card waits in state.views; answering it sends the reply to
+// the Bot as its next message and clears the card.
+await step('Writer shows an options view', () => send(botNamed('Writer').id, '视图选项'), () => {
+ const view = state().views?.[botNamed('Writer').sessionId]
+ return expect(view?.title === 'Pick a lane' && typeof view.id === 'string', `no pending view (${JSON.stringify(view)})`)
+ ?? expect(view.callId !== undefined, 'the view does not carry its call')
+})
+await step('the view answer reaches Writer and clears the card', () => api('view-reply', {
+ sessionId: botNamed('Writer').sessionId,
+ viewId: state().views[botNamed('Writer').sessionId].id,
+ action: 'lane',
+ values: { selected: ['Ship now'] },
+}), (_value, calls) => {
+ return expect(state().views?.[botNamed('Writer').sessionId] === undefined, 'the view is still open')
+ ?? expect(calls.some(call => call.last?.startsWith('{"kind":"answer_to_pending_view"')), 'the answer did not arrive as the Bot\'s next message')
+})
+
+// A display-only view just under the byte limit lives on the recorded call; re-reading
+// the part brings it back with its arguments.
+await step('Writer shows a view just under the byte limit', () => send(botNamed('Writer').id, '大视图'), (_value, calls) => {
+ return expect(calls.some(call => (call.out ?? []).some(block => block.type === 'tool_use' && block.name === 'show_view')), 'Writer did not call show_view')
+})
+await step('the big view survives a re-read of the part', () => api('earlier', { sessionId: botNamed('Writer').sessionId }), (page) => {
+ const found = (page?.items ?? []).find(item => JSON.stringify(item).includes('show_view'))
+ return expect(found !== undefined, `no show_view call in the part (${JSON.stringify(page?.items?.length)})`)
+ ?? expect(JSON.stringify(found).length > 7500, `the call came back without its view (${JSON.stringify(found).length} chars)`)
+})
+
await step('user creates Coder, who keeps the default model', () => api('create-bot', { name: 'Coder', role: 'Engineer', instructions: 'Write code.' }), (bot) => {
const coder = botNamed('Coder')
return expect(coder && coder.id === bot.id && coder.role === 'Engineer', 'Coder not saved as asked')