Skip to content

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

Name the app and action in computer step rows and drop the repeated page title

Fei24117ac4153e85c6
diff --git a/ds-bot/client.js b/ds-bot/client.js
index a5c44a41..707004e7 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -5225,7 +5225,7 @@ function ComputerPage({ roster, actions, run: run2, Section, Row: Row3, Switch:
return [
(0, import_react10.createElement)(
Section,
- { key: "switch", title: t("Computer use") },
+ { key: "switch" },
(0, import_react10.createElement)(
Row3,
{ label: t("Let Bots use the computer") },
@@ -5372,9 +5372,20 @@ var actionName = (method) => {
const words = String(method ?? "").replace(/^cua_driver_native__/, "").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/_/g, " ").trim();
return words === "" ? "Computer" : words[0].toUpperCase() + words.slice(1);
};
+var callArgs = (call2) => {
+ const args = call2?.arguments;
+ if (args !== null && typeof args === "object") return args;
+ try {
+ return JSON.parse(args ?? "{}");
+ } catch {
+ return {};
+ }
+};
function ComputerCallRow({ sessionId, call: call2, roster, actions, hooks }) {
- const method = call2?.arguments?.method ?? String(call2?.name ?? "").replace(/^cua_driver_native__/, "");
- const app = hooks?.useComputer?.((map) => (map.bots?.[roster.byId[sessionId]?.id]?.steps ?? []).find((step) => step.callId === call2?.callId)?.app);
+ const args = callArgs(call2);
+ const method = args.method ?? String(call2?.name ?? "").replace(/^cua_driver_native__/, "");
+ const stepApp = hooks?.useComputer?.((map) => (map.bots?.[roster.byId[sessionId]?.id]?.steps ?? []).find((step) => step.callId === call2?.callId)?.app);
+ const app = stepApp ?? (method === "getApp" && typeof args.params?.selector === "string" && args.params.selector !== "" ? args.params.selector : void 0);
const shot = (call2?.content ?? []).find((block) => (block?.type === "image" || block?.type === "file") && block.attachment !== void 0)?.attachment;
const [url, setUrl] = (0, import_react10.useState)(null);
const [open, setOpen] = (0, import_react10.useState)(false);
@@ -5396,7 +5407,7 @@ function ComputerCallRow({ sessionId, call: call2, roster, actions, hooks }) {
return (0, import_react10.createElement)(
"div",
{ className: "bt-cstep" },
- (0, import_react10.createElement)("span", { className: "bt-cstep-label" }, `${app ?? t("the computer")} · ${actionName(method)}`),
+ (0, import_react10.createElement)("span", { className: "bt-cstep-label" }, app !== void 0 ? `${app} · ${actionName(method)}` : actionName(method)),
url !== null ? (0, import_react10.createElement)(
"button",
{ type: "button", className: open ? "bt-cstep-shot bt-cstep-shot-open" : "bt-cstep-shot", onClick: () => setOpen((value) => !value) },
diff --git a/ds-bot/src/client/computer.js b/ds-bot/src/client/computer.js
index da2aeec0..2c54046e 100644
--- a/ds-bot/src/client/computer.js
+++ b/ds-bot/src/client/computer.js
@@ -55,7 +55,7 @@ export function ComputerPage({ roster, actions, run, Section, Row, Switch }) {
granted ? null : h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => run(Promise.resolve(actions.computerPermission(key)).then(refresh)) }, t('Grant')))
}
return [
- h(Section, { key: 'switch', title: t('Computer use') },
+ h(Section, { key: 'switch' },
h(Row, { label: t('Let Bots use the computer') },
Switch === undefined ? null : h(Switch, { label: t('Let Bots use the computer'), on: computer.enabled === true, onChange: on => run(actions.computerSetEnabled(on)) }))),
computer.enabled ? h(Section, { key: 'provider', title: t('Provider') },
@@ -158,9 +158,17 @@ const actionName = (method) => {
const words = String(method ?? '').replace(/^cua_driver_native__/, '').replace(/([a-z])([A-Z])/g, '$1 $2').replace(/_/g, ' ').trim()
return words === '' ? 'Computer' : words[0].toUpperCase() + words.slice(1)
}
+const callArgs = (call) => {
+ const args = call?.arguments
+ if (args !== null && typeof args === 'object') return args
+ try { return JSON.parse(args ?? '{}') } catch { return {} }
+}
export function ComputerCallRow({ sessionId, call, roster, actions, hooks }) {
- const method = call?.arguments?.method ?? String(call?.name ?? '').replace(/^cua_driver_native__/, '')
- const app = hooks?.useComputer?.(map => (map.bots?.[roster.byId[sessionId]?.id]?.steps ?? []).find(step => step.callId === call?.callId)?.app)
+ const args = callArgs(call)
+ const method = args.method ?? String(call?.name ?? '').replace(/^cua_driver_native__/, '')
+ const stepApp = hooks?.useComputer?.(map => (map.bots?.[roster.byId[sessionId]?.id]?.steps ?? []).find(step => step.callId === call?.callId)?.app)
+ // getApp names its target in the selector; a step record names the app later calls act on.
+ const app = stepApp ?? (method === 'getApp' && typeof args.params?.selector === 'string' && args.params.selector !== '' ? args.params.selector : undefined)
const shot = (call?.content ?? []).find(block => (block?.type === 'image' || block?.type === 'file') && block.attachment !== undefined)?.attachment
const [url, setUrl] = useState(null)
const [open, setOpen] = useState(false)
@@ -172,7 +180,7 @@ export function ComputerCallRow({ sessionId, call, roster, actions, hooks }) {
return () => { current = false }
}, [shot?.attachmentId])
return h('div', { className: 'bt-cstep' },
- h('span', { className: 'bt-cstep-label' }, `${app ?? t('the computer')} · ${actionName(method)}`),
+ h('span', { className: 'bt-cstep-label' }, app !== undefined ? `${app} · ${actionName(method)}` : actionName(method)),
url !== null ? h('button', { type: 'button', className: open ? 'bt-cstep-shot bt-cstep-shot-open' : 'bt-cstep-shot', onClick: () => setOpen(value => !value) },
h('img', { src: url, alt: actionName(method) })) : null)
}
diff --git a/ds-bot/test/computer-ui.test.js b/ds-bot/test/computer-ui.test.js
index a6c6a712..b496acec 100644
--- a/ds-bot/test/computer-ui.test.js
+++ b/ds-bot/test/computer-ui.test.js
@@ -7,7 +7,7 @@ import { build } from 'esbuild'
const { outputFiles } = await build({
stdin: {
contents: [
- "export { ComputerPage, BotComputerCard, ComputerView, PendingAppAccess, ComputerIndicator } from './src/client/computer.js'",
+ "export { ComputerPage, BotComputerCard, ComputerView, PendingAppAccess, ComputerIndicator, ComputerCallRow } from './src/client/computer.js'",
].join('\n'),
resolveDir: fileURLToPath(new URL('..', import.meta.url)),
},
@@ -82,7 +82,8 @@ test('the settings page draws the switch, the provider line and one level picker
Section: ({ children }) => h2(children), Row: ({ children }) => h2(children), Switch,
})
function h2(children) { return { type: 'row', props: { children } } }
- assert.ok(texts(tree).some(text => text.includes('Computer')))
+ // The page title names the page; the first section carries no title of its own.
+ assert.ok(texts(tree).some(text => text.includes('Let Bots use the computer')))
})
test('the control card shows the level picker and the Always apps with Revoke', () => {
@@ -118,3 +119,29 @@ test('the indicator lists entries with a localized Stop and Stop all', () => {
assert.deepEqual(found.filter(name => name === 'Stop').length, 2)
assert.ok(found.includes('Stop all'))
})
+
+
+// A computer step row reads "app · action": the app from the step record or the
+// getApp selector, the action from the method; with no app just the action.
+test('a computer call row names the app and the action', () => {
+ const live = { bots: { w1: { steps: [{ callId: 'c1', app: 'Notes' }] } } }
+ const props = (call, botsLive = live) => ({
+ sessionId: 's-w1',
+ call,
+ roster: { byId: { 's-w1': { id: 'w1', name: 'Chief' } } },
+ actions: {},
+ hooks: { useComputer: map => map(botsLive) },
+ })
+ // arguments may arrive as a JSON string; the app comes from the step record
+ const row = render('ComputerCallRow', props({ name: 'cua', callId: 'c1', arguments: JSON.stringify({ method: 'click', params: { appHandle: 'h1' } }), content: [] }))
+ assert.deepEqual(texts(row), ['Notes · Click'])
+ // getApp names its target by the selector, before any step record exists
+ const getApp = render('ComputerCallRow', props({ name: 'cua', callId: 'c2', arguments: { method: 'getApp', params: { selector: 'TextEdit' } }, content: [] }, { bots: {} }))
+ assert.deepEqual(texts(getApp), ['TextEdit · Get App'])
+ // no app yet: just the action
+ const caps = render('ComputerCallRow', props({ name: 'cua', callId: 'c3', arguments: { method: 'getCapabilities', params: {} }, content: [] }, { bots: {} }))
+ assert.deepEqual(texts(caps), ['Capabilities'])
+ // cua-driver: the tool suffix is the action
+ const driver = render('ComputerCallRow', props({ name: 'cua_driver_native__screenshot', callId: 'c1', arguments: {}, content: [] }))
+ assert.deepEqual(texts(driver), ['Notes · Screenshot'])
+})