A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Serve recorded screenshots from the content parts the provider returns
feiz6eea1fab6e8e
diff --git a/ds-bot/src/host/computer/index.js b/ds-bot/src/host/computer/index.jsindex 77c7630e..4ee39ad1 100644--- a/ds-bot/src/host/computer/index.js+++ b/ds-bot/src/host/computer/index.js@@ -786,10 +786,16 @@ export function install(rt) {recordGeo(sessionId, payload)// A refused or failed call pointed nowhere.if (payload !== null) emitCursor(exec, call, payload)- const shot = payload !== null && typeof payload === 'object' ? payload.attachment : undefined+ // The screenshot's image rides in the content parts, not the value: the+ // real envelope is { value: {...}, content: [text, {type:'image',attachment}] }.+ const shot = payload !== null && typeof payload === 'object'+ ? (payload.attachment ?? payload.content?.find?.(part => part?.attachment)?.attachment)+ : undefinedif (shot !== undefined) {controlOf(botId).lastShot = shot- if (typeof shot.mimeType === 'string') shotMimes.set(shot.attachmentId ?? shot.id, shot.mimeType)+ // The real provider names the field mediaType; mimeType is the older name.+ const mime = shot.mimeType ?? shot.mediaType+ if (typeof mime === 'string') shotMimes.set(shot.attachmentId ?? shot.id, mime)}noteStep(botId, { time: started, callId: exec.callId, app: app?.name, action: call.method ?? exec.name, kind: call.kind, ok: true })return resultdiff --git a/ds-bot/test/computer.test.js b/ds-bot/test/computer.test.jsindex 71b0e2f9..15441f7e 100644--- a/ds-bot/test/computer.test.js+++ b/ds-bot/test/computer.test.js@@ -1038,3 +1038,22 @@ test('cursor-wait returns fresh events, wakes on publish, and times out empty',rt.closeComputerWaiters()assert.deepEqual((await held).events, [])})++test('computer-shot serves a real screenshot attachment by its mediaType', async (t) => {+ const { ctx, home, rt } = setup({ services: { attachments: { readFileStream: async function* () { yield Buffer.from('PNGDATA') } } } })+ t.after(async () => { await ctx.dispose(); rmSync(home, { recursive: true, force: true, maxRetries: 5 }) })+ await rt.load()+ await rt.computerEndpoint('set-enabled', { enabled: true })+ await rt.computerEndpoint('set-level', { botId: 'w1', level: 'view' })+ rt.botOf('w1').computer = { apps: { 'com.apple.Notes': { name: 'Notes', id: 'com.apple.Notes', grantedAt: 0 } } }+ const track = ctx.listeners.get('tools/execute').find(fn => fn.name === 'computerTrack')+ // the real provider's attachment carries mediaType, not mimeType+ await track(+ { name: 'cua', arguments: { method: 'screenshot', params: { appHandle: 'h1', windowId: 7 } }, agent: { id: 'w1' }, callId: 's1' },+ async () => ({ isError: false, value: { windowId: 7, attachment: { attachmentId: 'sha256:abc', mediaType: 'image/webp', width: 100, height: 100, bytes: 7 } } }),+ )+ const shot = await rt.computerEndpoint('shot', { attachmentId: 'sha256:abc' })+ assert.equal(shot?.dataUrl, `data:image/webp;base64,${Buffer.from('PNGDATA').toString('base64')}`)+ // an id this module never recorded is not readable+ assert.equal(await rt.computerEndpoint('shot', { attachmentId: 'sha256:other' }), null)+})