UNPKG

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 • 2.12 kB
import{a as e,i as t,n,r,t as i}from"./perf-runtime-operation-builder.js";import a from"node:path";function o(o){let{resolveHost:l,device:u,owner:d}=o;return Object.freeze({...i({platform:`Android`,expectedProfileKind:`simpleperf`,start:async e=>await l().start(u,d,e),reattach:async e=>await l().reattach(u,e),cleanup:async e=>await l().cleanup(u,e),writeProfileReport:async e=>await l().writeProfileReport(u,e)}),perfFrames:async({appId:e})=>({metric:e?await t(l().sampleFrames(u,e)):n(`Android`,`package`),sampling:{method:`adb-shell-dumpsys-gfxinfo-framestats`,description:`Rendered-frame health from the current adb shell dumpsys gfxinfo <package> framestats window. Dropped frames use Android gfxinfo janky-frame/frame-deadline data when available; this is not video recording FPS.`,unit:`percent`,primaryField:`droppedFramePercent`,window:`since previous Android gfxinfo reset or app process start`,resetsAfterRead:!0,relatedActionsLimit:12}}),perfMemorySample:async({appId:e})=>({metric:e?await t(l().sampleMemory(u,e)):n(`Android`,`package`),sampling:{method:`adb-shell-dumpsys-meminfo`,description:`Memory snapshot from adb shell dumpsys meminfo <package>. Values are reported in kilobytes.`,unit:`kB`,topConsumerLimit:5}}),perfMemorySnapshot:async({appId:t,kind:n,outPath:i,artifactsDir:o})=>{let d=n??`android-hprof`,f=s();if(d!==`android-hprof`)return e(`Android`,d,f,`Use perf memory snapshot --kind android-hprof for Android Java heap artifacts.`);if(!t)throw r();let p=i??a.join(o,`memory-android-hprof-${c()}.hprof`);return{artifact:await l().captureMemorySnapshot(u,t,p),support:f,sampling:{method:`adb-shell-am-dumpheap`,description:`Java heap dump captured with adb shell am dumpheap, pulled to a local artifact path.`,defaultKind:`android-hprof`,artifactOnly:!0}}}})}function s(){return{platform:`android`,defaultKind:`android-hprof`,androidHprof:!0,memgraph:!1,heapprofd:!1,heapprofdDecision:`Deferred until Android Perfetto/heapprofd plumbing is available in the perf trace slice.`}}function c(){return new Date().toISOString().replaceAll(/[:.]/g,`-`)}export{o as createAndroidPerfOperations};