A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Fix browser handoff follow-ups
Fei241191f99f0a7ba2
diff --git a/docs/plans/2026-10-21-browser-plugins.md b/docs/plans/2026-10-21-browser-plugins.mdindex 0d83c00c..8ee81f01 100644--- a/docs/plans/2026-10-21-browser-plugins.md+++ b/docs/plans/2026-10-21-browser-plugins.md@@ -21,7 +21,7 @@ Bot 是长期身份。登录应该跟着 Bot 走,而不是跟着某一段对- 只有发帖、上传、下载、删除需要用户授权。Bot 在设置的「浏览器」页获得匹配网站和操作类型的预授权时直接执行;否则走 DSH 审批卡片,审批只允许本次操作。预授权可设过期时间。- 删除无论有没有预授权,都先返回核对快照;Bot 必须在检查目标后用 `browser_click` 的 `confirm: true` 再点同一个元素,且页面 URL 和标签都必须匹配,才进入正常授权流程。- 付款、购买、转账等操作永远不由 Bot 执行;付款详情也不由 Bot 输入。Bot 调用 `browser_handoff`(或脚本里的 `handoff`),由用户完成。登录或验证码也可交给用户;交接后点击、输入、打开页面都会停住,直到 `browser_resume`。不另设域名名单,也不拦截内网地址。-- Bot 在自己的聊天里交接时,聊天里出现一张卡片:写明原因、要用户做的事和当前页面的站点,按钮依次是「跳过」「接管」「我完成了」。「我完成了」和「跳过」把结果告诉 Bot 并交还浏览器,Bot 接着做或换一条路;「接管」打开浏览器面板,卡片留着,直到用户点另外两个按钮之一。聊天里的卡片消失后,转录里留下标题和结果。+- Bot 在自己的聊天里交接时,聊天里出现一张卡片:写明原因、要用户做的事和当前页面的站点,按钮依次是「跳过」「接管」「我完成了」。「我完成了」和「跳过」把结果告诉 Bot 并交还浏览器,Bot 接着做或换一条路;「接管」打开浏览器面板,卡片留着,直到用户点另外两个按钮之一。用户用卡片或面板回答后,回复消息在转录里留下标题和结果;Bot 自己调用 `browser_resume` 或应用重启后,旧卡片不显示,也不补这一行。- 上传只允许使用 Bot 的工作目录、团队目录或 `browser-downloads/<botId>/` 中的文件,链接目标在校验前解析。- 已授权的发帖、上传、下载、删除若结果未知,会按来源记录,要求先用快照核实;页面仍未观察前,不允许重复同来源的操作。下载文件保存到 Bot 的工作目录;没有工作目录时保存到团队目录。- 三个插件:@@ -41,7 +41,7 @@ Bot 是长期身份。登录应该跟着 Bot 走,而不是跟着某一段对## 已知限制- DSH Desktop 的浏览器面板仍由用户操作;桌面应用中的面板页由 Bot 和用户共同使用,接管状态由用户控制。-- 群聊里 Bot 发起的交接不出聊天卡,只在浏览器面板顶部的接管条里处理;在面板里点交还不会通知 Bot。+- 群聊或子 Agent 里 Bot 发起的交接不出聊天卡,只在浏览器面板顶部的接管条里处理;工具结果会提醒 Bot 在当前对话说明要用户做什么,在面板里点交还不会通知 Bot。- 单独把 `browser-plugins/*` 装进一个没有 DS Bot 的 DSH profile 时,profile 按 Session id 分开,换段会像官方 browser-use 一样丢掉登录。跟 Bot 走的那份目录只有 DS Bot 挂载时才有。- `task` 在插件内部再调一次模型,步骤在工具结果里,不在 Bot 自己的逐步工具调用里。- 这次实测用的是自建多步页面,加上 WebVoyager 里两条 arXiv 任务,不是整套 600 多条。@@ -52,4 +52,4 @@ Bot 是长期身份。登录应该跟着 Bot 走,而不是跟着某一段对- 2026-10-22:`browser_task` 使用调用 Bot 在 DSH 中配置的模型;基准测试模型由 `BENCH_BASE_URL`、`BENCH_MODEL` 和 `BENCH_API_KEY` 配置。- 2026-10-23:维护者定下权限规则:默认放行;发帖、上传、下载、删除按预授权或审批;删除强制多核对一轮;付款一律交给用户;预授权可设时限,在设置的浏览器页管理。- 2026-10-24:桌面应用中的 Bot 操作浏览器面板里的页面;用户可接管、停止 Bot 或交还控制权。Bot 交接可由 Bot 恢复;用户接管只能由用户交还。-- 2026-10-27:Bot 在自己的聊天里交接时,聊天里出卡片,按钮为跳过、接管、我完成了;点「我完成了」或「跳过」会通知 Bot,面板里的交还在这种交接下同样通知 Bot。+- 2026-10-27:Bot 在自己的聊天里交接时,聊天里出卡片,按钮为跳过、接管、我完成了;点「我完成了」或「跳过」会通知 Bot,面板里的交还在这种交接下同样通知 Bot,但只说明控制权已交还,不断言步骤已完成。群聊和子 Agent 不出卡,工具结果提示 Bot 在当前对话说明要用户做什么。diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 8fe0ee7f..92d08444 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -309,6 +309,7 @@ var ZH = {"Verification needed": "需要验证","Help needed in the browser": "需要你在浏览器里帮忙",Skipped: "已跳过",+ Returned: "已交还","I'm done": "我完成了","{name} is running": "{name} 正在运行","It must close for a moment so its cookies can be copied. It will reopen with your tabs.": "需要先把它关掉一下才能复制 cookie,之后会自动重新打开并恢复你的标签页。",@@ -4194,6 +4195,7 @@ function HandoffDock({ sessionId, useRoster, useCards, useHeldCards, useBrowserH}function SettledHandoff({ handoff }) {const skipped = handoff.outcome === "skipped";+ const returned = handoff.outcome === "returned";const title = titleOf(handoff.reason);return (0, import_react6.createElement)("div",@@ -4205,7 +4207,7 @@ function SettledHandoff({ handoff }) {"div",{ className: "bt-q-head" },(0, import_react6.createElement)("div", { className: "bt-q-text" }, (0, import_react6.createElement)("p", { className: "bt-q-title" }, title)),- skipped ? (0, import_react6.createElement)("span", { className: "bt-q-badge" }, t("Skipped")) : (0, import_react6.createElement)("span", { className: "bt-q-check", title: t("Done") }, (0, import_react6.createElement)(CheckIcon))+ skipped || returned ? (0, import_react6.createElement)("span", { className: "bt-q-badge" }, t(skipped ? "Skipped" : "Returned")) : (0, import_react6.createElement)("span", { className: "bt-q-check", title: t("Done") }, (0, import_react6.createElement)(CheckIcon)))));@@ -6228,7 +6230,7 @@ function AnsweredView({ node }) {function AnsweredReply({ node }) {const data = node?.data ?? {};if (Array.isArray(data.views) && data.views.length > 0) return (0, import_react9.createElement)(AnsweredView, { node });- if (data.handoff !== null && typeof data.handoff === "object") return (0, import_react9.createElement)(SettledHandoff, { handoff: data.handoff });+ if (typeof data.handoff?.reason === "string") return (0, import_react9.createElement)(SettledHandoff, { handoff: data.handoff });if (!Array.isArray(data.questions) || data.questions.length === 0) {let parsed = null;try {diff --git a/ds-bot/src/client/handoff-card.js b/ds-bot/src/client/handoff-card.jsindex f3783ae7..56d0391f 100644--- a/ds-bot/src/client/handoff-card.js+++ b/ds-bot/src/client/handoff-card.js@@ -108,13 +108,14 @@ export function HandoffDock({ sessionId, useRoster, useCards, useHeldCards, useB// The answered card the transcript keeps: the title and how it ended, read-only.export function SettledHandoff({ handoff }) {const skipped = handoff.outcome === 'skipped'+ const returned = handoff.outcome === 'returned'const title = titleOf(handoff.reason)return h('div', { className: 'bt-q-inline' },h('div', { className: skipped ? 'bt-q bt-q-settled bt-q-dismissed' : 'bt-q bt-q-settled', role: 'group', 'aria-label': title },h('div', { className: 'bt-q-head' },h('div', { className: 'bt-q-text' }, h('p', { className: 'bt-q-title' }, title)),- skipped- ? h('span', { className: 'bt-q-badge' }, t('Skipped'))+ skipped || returned+ ? h('span', { className: 'bt-q-badge' }, t(skipped ? 'Skipped' : 'Returned')): h('span', { className: 'bt-q-check', title: t('Done') }, h(CheckIcon)))))}diff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.jsindex 1aec585e..f6beb85c 100644--- a/ds-bot/src/client/i18n.js+++ b/ds-bot/src/client/i18n.js@@ -277,6 +277,7 @@ const ZH = {'Verification needed': '需要验证','Help needed in the browser': '需要你在浏览器里帮忙',Skipped: '已跳过',+ Returned: '已交还',"I'm done": '我完成了','{name} is running': '{name} 正在运行','It must close for a moment so its cookies can be copied. It will reopen with your tabs.': '需要先把它关掉一下才能复制 cookie,之后会自动重新打开并恢复你的标签页。',diff --git a/ds-bot/src/client/widget-cell.js b/ds-bot/src/client/widget-cell.jsindex 8d91b17c..27a6d18b 100644--- a/ds-bot/src/client/widget-cell.js+++ b/ds-bot/src/client/widget-cell.js@@ -486,7 +486,7 @@ export function AnsweredView({ node }) {export function AnsweredReply({ node }) {const data = node?.data ?? {}if (Array.isArray(data.views) && data.views.length > 0) return h(AnsweredView, { node })- if (data.handoff !== null && typeof data.handoff === 'object') return h(SettledHandoff, { handoff: data.handoff })+ if (typeof data.handoff?.reason === 'string') return h(SettledHandoff, { handoff: data.handoff })if (!Array.isArray(data.questions) || data.questions.length === 0) {let parsed = nulltry { parsed = typeof data.text === 'string' ? JSON.parse(data.text) : null } catch { parsed = null }diff --git a/ds-bot/src/host/browser/session.js b/ds-bot/src/host/browser/session.jsindex a701f3fd..e623809e 100644--- a/ds-bot/src/host/browser/session.js+++ b/ds-bot/src/host/browser/session.js@@ -117,7 +117,7 @@ export async function openBotBrowser({ botId, profileRoot, downloadDir, headlessreturn createSession({ context, browser, page, botId, userDataDir, cookieFile, downloadDir: getDownloadDir, actionTimeout, getHold, onHold, uploadRoots })}-function createSession({ context, browser, page, botId, userDataDir, cookieFile, downloadDir, actionTimeout, getHold, onHold, uploadRoots }) {+export function createSession({ context, browser, page, botId, userDataDir, cookieFile, downloadDir, actionTimeout, getHold, onHold, uploadRoots }) {const pages = new Set()const unknownByOrigin = new Map()const unknownPageOrigins = new WeakMap()@@ -706,7 +706,11 @@ function createSession({ context, browser, page, botId, userDataDir, cookieFile,const kind = REASONS.has(reason) ? reason : 'other'hold = { reason: kind, note: String(note ?? '').slice(0, 300) }onHold?.({ by: 'bot', reason: kind, note: hold.note, ...origin })- return `Waiting for the user (${kind}). ${hold.note || 'Ask them to take over.'} Call browser_resume when they have finished.`+ const recorded = getHold?.()+ const guidance = origin?.callId !== undefined && recorded && recorded.callId === undefined+ ? 'There is no handoff card in this conversation. Tell the user here what you need them to do. After they reply, check with browser_snapshot or call browser_resume.'+ : 'Call browser_resume when they have finished.'+ return `Waiting for the user (${kind}). ${hold.note || 'Ask them to take over.'} ${guidance}`},resume() {if (getHold?.()?.by === 'user') throw new Error('The user has taken over this browser. Only the user can give it back.')diff --git a/ds-bot/src/host/browser/task.js b/ds-bot/src/host/browser/task.jsindex a6a555a8..4540c1ed 100644--- a/ds-bot/src/host/browser/task.js+++ b/ds-bot/src/host/browser/task.js@@ -3,17 +3,17 @@import { runToolLoop } from './loop.js'import { systemPrompt as refsPrompt, toolDefs as refTools } from './refs.js'-const driverTools = (session) => refTools.map(tool => ({+const driverTools = (session, origin) => refTools.map(tool => ({name: tool.name,description: tool.description,parameters: tool.parameters,- execute: (args) => tool.execute(args, { session, botId: session.botId, profileDir: session.userDataDir }),+ execute: (args) => tool.execute(args, { session, botId: session.botId, profileDir: session.userDataDir, origin }),}))-export async function runTask({ session, goal, complete, maxSteps = 8 }) {+export async function runTask({ session, goal, complete, origin, maxSteps = 8 }) {if (typeof complete !== 'function') throw new Error('browser_task needs a Bot session model')const result = await runToolLoop({- tools: driverTools(session),+ tools: driverTools(session, origin),complete,goal,system: refsPrompt,@@ -47,6 +47,7 @@ export const toolDefs = [session: ctx.session,goal: String(args.goal ?? ''),complete: ctx.complete,+ origin: ctx.origin,})return { text: result.text }},diff --git a/ds-bot/src/host/channel.js b/ds-bot/src/host/channel.jsindex b14ed875..4723051a 100644--- a/ds-bot/src/host/channel.js+++ b/ds-bot/src/host/channel.js@@ -476,14 +476,14 @@ export function install(rt) {: { by: 'user', reason: 'takeover', note: 'The user is controlling this browser.' })return ok(true)}- // Gives the browser back. The user's answer to a handoff card ('done' or 'skip')- // tells the Bot how it went; any other hold is cleared without a word.+ // A card's 'done' or 'skip' says how the handoff went. The panel's Give back+ // sends no outcome, so its reply only says that control returned to the Bot.case 'browser-give-back': {if (rt.browserChannel === undefined) return fail('Bot browsers are off on this host', 'bot/browser-off')await rt.load()const botId = String(body.botId ?? '')if (!rt.botOf(botId)) return fail('Unknown Bot', 'bot/not-found')- if (body.outcome !== undefined && body.outcome !== 'done' && body.outcome !== 'skip') return fail('Nothing to send', 'bot/invalid')+ if (body.outcome !== undefined && !['done', 'skip', 'returned'].includes(body.outcome)) return fail('Nothing to send', 'bot/invalid')const hold = rt.browserChannel.holdOf(botId)if (hold === null) return fail('This browser is not held', 'bot/forbidden')if (body.callId !== undefined && body.callId !== hold.callId) return fail('This handoff is no longer open', 'bot/stale')diff --git a/ds-bot/src/host/parts.js b/ds-bot/src/host/parts.jsindex 8a446e9f..6000bcd9 100644--- a/ds-bot/src/host/parts.js+++ b/ds-bot/src/host/parts.js@@ -101,15 +101,17 @@ export function viewReply(record, action, values) {}}-// The user's answer to a browser_handoff card: they finished the step, or skipped it.-// The message carries the reason with the answer, so it still makes sense after a-// checkpoint drops the card.+// The user's answer to a browser_handoff card: they finished the step, skipped it,+// or only gave the browser back from its panel. The message carries the reason with+// the answer, so it still makes sense after a checkpoint drops the card.export function handoffReply(hold, outcome) {- const skipped = outcome === 'skip'+ const settled = outcome === 'done' ? 'done' : outcome === 'skip' ? 'skipped' : 'returned'const callId = hold.callId- const message = skipped+ const message = settled === 'skipped'? 'The user skipped this step and gave the browser back. Do not retry it. Do what you can without it, or tell the user you cannot.'- : 'The user finished this step and gave the browser back. Carry on from where you stopped. Take a browser_snapshot first to see the page.'+ : settled === 'done'+ ? 'The user finished this step and gave the browser back. Carry on from where you stopped. Take a browser_snapshot first to see the page.'+ : 'The user gave the browser back. Do not assume this step is finished. Take a browser_snapshot to see the page, then carry on or ask the user what remains.'return {text: JSON.stringify({kind: 'answer_to_pending_handoff',@@ -117,7 +119,7 @@ export function handoffReply(hold, outcome) {callId,reason: hold.reason,...(hold.note ? { note: hold.note } : {}),- outcome: skipped ? 'skipped' : 'done',+ outcome: settled,message,}),source: { kind: REPLY_KIND, callId, outcome: 'answered' },@@ -131,7 +133,7 @@ export function readReply(text) {try { value = JSON.parse(text) } catch { return undefined }if (value?.kind === 'answer_to_pending_handoff') {if (typeof value.callId !== 'string' || typeof value.reason !== 'string') return undefined- return { handoff: { callId: value.callId, reason: value.reason, note: typeof value.note === 'string' ? value.note : '', outcome: value.outcome === 'skipped' ? 'skipped' : 'done' } }+ return { handoff: { callId: value.callId, reason: value.reason, note: typeof value.note === 'string' ? value.note : '', outcome: value.outcome === 'skipped' || value.outcome === 'returned' ? value.outcome : 'done' } }}if (value?.kind === 'answer_to_pending_view' || (Array.isArray(value?.views) && value.views.length > 0 && value?.kind !== 'answer_to_pending_question')) {const views = (Array.isArray(value.views) ? value.views : []).filter(item => typeof item?.id === 'string' && typeof item.title === 'string' && isRecord(item.view))diff --git a/ds-bot/test/browser-handoff.test.js b/ds-bot/test/browser-handoff.test.jsindex 39fdce8a..c180e6ef 100644--- a/ds-bot/test/browser-handoff.test.js+++ b/ds-bot/test/browser-handoff.test.js@@ -6,8 +6,10 @@ import { test } from 'node:test'import { createRuntime } from '../index.js'import { handoffHold } from '../src/host/browser-plugins.js'import { mountBrowserPlugin } from '../src/host/browser/mount.js'+import { createSession } from '../src/host/browser/session.js'import { toolDefs as refsTools } from '../src/host/browser/refs.js'import { toolDefs as scriptTools } from '../src/host/browser/script.js'+import { toolDefs as taskTools } from '../src/host/browser/task.js'import { REPLY_KIND } from '../src/host/constants.js'import { handoffReply, historyEntry, install as installParts, readReply, replyText } from '../src/host/parts.js'import { fakeContext } from './fake-ctx.js'@@ -97,6 +99,48 @@ test('a browser handoff names the call and the Session that raised it', async ()])})+test('browser_task forwards its outer call origin to a nested handoff', async () => {+ const tools = new Map()+ const holds = []+ let completions = 0+ mountBrowserPlugin({+ effect() {},+ tools: { register(tool) { tools.set(tool.name, tool) } },+ }, {+ toolDefs: taskTools,+ defineTool: value => value,+ keyOf: async () => 'b2',+ profileRoot: '/profiles',+ headless: true,+ onHold: (botId, hold) => holds.push([botId, hold]),+ completeFor: () => async () => {+ completions += 1+ if (completions === 1) {+ return { choices: [{ message: { tool_calls: [{+ id: 'inner-call',+ function: { name: 'browser_handoff', arguments: JSON.stringify({ reason: 'login', note: 'Sign in' }) },+ }] } }] }+ }+ return { choices: [{ message: { content: 'Waiting for sign-in.' } }] }+ },+ openSession: async ({ onHold }) => ({+ botId: 'b2',+ userDataDir: '/profiles/b2',+ handoff(reason, note, origin) {+ onHold({ by: 'bot', reason, note, ...origin })+ return 'waiting'+ },+ async close() {},+ }),+ })++ const result = await tools.get('browser_task').execute({ goal: 'Sign in' }, { agent: { id: 'b2' }, callId: 'outer-call' })+ assert.match(result.text, /Waiting for sign-in/)+ assert.deepEqual(holds, [+ ['b2', { by: 'bot', reason: 'login', note: 'Sign in', callId: 'outer-call', sessionId: 'b2' }],+ ])+})+test('only a handoff raised in the Bot\'s own chat keeps its call and drops the Session', async (t) => {const { rt, stop } = start()t.after(stop)@@ -112,6 +156,34 @@ test('only a handoff raised in the Bot\'s own chat keeps its call and drops theassert.deepEqual(handoffHold(rt, 'b2', { by: 'bot', reason: 'other', note: '' }), { by: 'bot', reason: 'other', note: '' })})+test('a handoff outside the Bot\'s own chat says to ask there instead of waiting for a card', async (t) => {+ const { rt, stop } = start()+ t.after(stop)+ await rt.load()+ const makeSession = () => createSession({+ context: { pages: () => [], on() {} },+ page: null,+ botId: 'b2',+ userDataDir: '/profiles/b2',+ cookieFile: '/profiles/b2/cookies.json',+ downloadDir: '/downloads',+ actionTimeout: 1000,+ getHold: () => rt.browserChannel.holdOf('b2'),+ onHold: hold => rt.browserChannel.setHold('b2', hold && handoffHold(rt, 'b2', hold)),+ })++ const own = makeSession().handoff('login', 'Sign in', { callId: 'call-1', sessionId: 'b2' })+ assert.match(own, /Call browser_resume when they have finished/)+ assert.doesNotMatch(own, /no handoff card/)++ rt.browserChannel.setHold('b2', null)+ const group = makeSession().handoff('login', 'Sign in', { callId: 'call-2', sessionId: 'room-session' })+ assert.match(group, /no handoff card in this conversation/)+ assert.match(group, /Tell the user here what you need them to do/)+ assert.match(group, /browser_snapshot or call browser_resume/)+ assert.deepEqual(rt.browserChannel.holdOf('b2'), { by: 'bot', reason: 'login', note: 'Sign in' })+})+test('the channel keeps a handoff\'s call on its hold', async (t) => {const { rt, stop } = start()t.after(stop)@@ -187,7 +259,11 @@ test('browser-give-back answers an open handoff once, and a plain hold without art.browserChannel.setHold('b2', BOT_HOLD)assert.equal((await call('browser-give-back', { botId: 'b2', callId: 'call-1' })).value, true)- assert.equal(JSON.parse(sent[0].message.content[0].text).outcome, 'done')+ const returned = JSON.parse(sent[0].message.content[0].text)+ assert.equal(returned.outcome, 'returned')+ assert.match(returned.message, /gave the browser back/)+ assert.match(returned.message, /Do not assume this step is finished/)+ assert.match(returned.message, /browser_snapshot/)// A second answer finds nothing held.const again = await call('browser-give-back', { botId: 'b2', callId: 'call-1', outcome: 'done' })@@ -245,8 +321,13 @@ test('a handoff answer carries its reason, so it reads on its own', () => {assert.deepEqual(readReply(plain.text).handoff, { callId: 'call-3', reason: 'captcha', note: '', outcome: 'skipped' })assert.equal(replyText(plain.text), '[Browser handoff] captcha\nAnswer: skipped')- // Anything but a skip is done, and a reply without its call or reason is no handoff.- assert.equal(JSON.parse(handoffReply(BOT_HOLD, undefined).text).outcome, 'done')+ // The panel sends no outcome: that only returns control, without claiming completion.+ const returned = handoffReply(BOT_HOLD, undefined)+ assert.equal(JSON.parse(returned.text).outcome, 'returned')+ assert.match(JSON.parse(returned.text).message, /Do not assume this step is finished/)+ assert.equal(JSON.parse(handoffReply(BOT_HOLD, 'returned').text).outcome, 'returned')+ assert.deepEqual(readReply(returned.text).handoff, { callId: 'call-1', reason: 'login', note: 'Sign in to the shop.', outcome: 'returned' })+ assert.equal(replyText(returned.text), '[Browser handoff] login — Sign in to the shop.\nAnswer: returned')assert.equal(readReply(JSON.stringify({ kind: 'answer_to_pending_handoff', reason: 'login' })), undefined)assert.equal(readReply(JSON.stringify({ kind: 'answer_to_pending_handoff', callId: 'call-1' })), undefined)diff --git a/ds-bot/test/card-hold.test.js b/ds-bot/test/card-hold.test.jsindex f358c00b..dde4d80f 100644--- a/ds-bot/test/card-hold.test.js+++ b/ds-bot/test/card-hold.test.js@@ -14,7 +14,8 @@ const { outputFiles } = await build({"export { useDockHold } from './src/client/card-hold.js'","export { PendingQuestion } from './src/client/questions.js'","export { SecretCard } from './src/client/secret-card.js'",- "export { PendingView } from './src/client/widget-cell.js'",+ "export { PendingView, AnsweredReply } from './src/client/widget-cell.js'",+ "export { AnsweredCell } from './src/client/questions.js'","export { HandoffCall, HandoffDock, PendingHandoff, SettledHandoff } from './src/client/handoff-card.js'",].join('\n'),resolveDir: fileURLToPath(new URL('..', import.meta.url)),@@ -60,7 +61,7 @@ runInNewContext(outputFiles[0].text, {HTMLInputElement: class {}, HTMLTextAreaElement: class {}, HTMLSelectElement: class {}, HTMLElement: class {},URL,})-const { useDockHold, PendingQuestion, SecretCard, PendingView, HandoffCall, HandoffDock, PendingHandoff, SettledHandoff } = module.exports+const { useDockHold, PendingQuestion, SecretCard, PendingView, AnsweredReply, AnsweredCell, HandoffCall, HandoffDock, PendingHandoff, SettledHandoff } = module.exportsconst mount = (Component, props) => {const instance = {slots: [], effects: [], props,@@ -486,4 +487,27 @@ test('an answered handoff keeps its title and how it ended, and nothing to pressassert.equal(byClass(skipped, 'bt-q-check'), undefined)assert.match(skipped.props.children[0].props.className, /bt-q-dismissed/)assert.doesNotMatch(done.props.children[0].props.className, /bt-q-dismissed/)+ const returned = SettledHandoff({ handoff: { reason: 'login', note: '', outcome: 'returned' } })+ assert.equal(byClass(returned, 'bt-q-badge').props.children[0], 'Returned')+ assert.equal(byClass(returned, 'bt-q-check'), undefined)+ assert.doesNotMatch(returned.props.children[0].props.className, /bt-q-dismissed/)+})++test('answered handoff replies route to their settled row in history and live transcripts', () => {+ const fromHistory = AnsweredReply({ node: { data: { handoff: { reason: 'login', note: 'Sign in', outcome: 'returned' } } } })+ assert.equal(fromHistory.type, SettledHandoff)+ assert.deepEqual(plain(fromHistory.props.handoff), { reason: 'login', note: 'Sign in', outcome: 'returned' })++ const fromText = AnsweredReply({ node: { data: { text: JSON.stringify({+ kind: 'answer_to_pending_handoff', callId: 'call-1', reason: 'payment', note: 'Pay', outcome: 'done',+ }) } } })+ assert.equal(fromText.type, SettledHandoff)+ assert.deepEqual(plain(fromText.props.handoff), { reason: 'payment', note: 'Pay', outcome: 'done' })++ for (const node of [+ { data: { handoff: { reason: 7, outcome: 'done' } } },+ { data: { text: JSON.stringify({ kind: 'answer_to_pending_handoff', callId: 'call-1', reason: 7, outcome: 'done' }) } },+ ]) {+ assert.equal(AnsweredReply({ node }).type, AnsweredCell)+ }})