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 • 673 B
import{n as e}from"./device-shell.js";import{i as t}from"./app-parsers.js";const n=[[`dumpsys`,`window`,`windows`],[`dumpsys`,`window`]],r=[[`dumpsys`,`activity`,`activities`],[`dumpsys`,`activity`]];async function i(e,t){return await a(e,n,t)||await a(e,r,t)||{}}async function a(t,n,r){for(let i of n){r?.throwIfAborted();let n=await t(e(`adb`,`shell`,i),{allowFailure:!0});r?.throwIfAborted();let a=o(n.stdout??``);if(a)return a}return null}function o(e){return t(e,e=>s(e))}function s(e){let t=e.match(/\b([A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)+)\/([A-Za-z0-9_.$]+)/);return t?.[1]&&t[2]?{package:t[1],activity:t[2]}:null}export{i as readAndroidAppStateWithExecutor};