agent-device
Version:
Open source device layer for AI coding agents: a CLI, MCP server, and typed Node.js API to control mobile, web, TV, and desktop apps on devices and simulators, locally or in the cloud.
1 lines • 563 B
JavaScript
import{v as e}from"./sdk-contracts.js";import{g as t}from"./host-file.js";import{n,r}from"./hdc.js";import{randomUUID as i}from"node:crypto";async function a(a,o){let s=`/data/local/tmp/agent-device-screen-${i()}.jpeg`;try{await r(a,[`snapshot_display`,`-f`,s],{timeoutMs:15e3}),await n(a,[`file`,`recv`,s,o],{timeoutMs:15e3});let i=await t(o);if(i.length<3||i[0]!==255||i[1]!==216||i[2]!==255)throw new e(`COMMAND_FAILED`,`HarmonyOS screenshot is not a JPEG file`)}finally{await r(a,[`rm`,`-f`,s],{allowFailure:!0}).catch(()=>{})}}export{a as screenshotHarmony};