agent-device-proxy 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -155,13 +155,7 @@ Use `agent-device-proxy`, `agent-device-proxy/*`, and `AGENT_DEVICE_PROXY_*` env
155
155
  import { createAgentDeviceProxyClient } from "agent-device-proxy"
156
156
  ```
157
157
 
158
- ## Proxy-backed `agent-device` contract
159
-
160
- The package also exposes a proxy-backed `agent-device` contract for Linux sandboxes:
161
-
162
- - install the package in the sandbox
163
- - run `npx agent-device ...`
164
- - the command is forwarded to the remote macOS `agent-device-proxy` host
158
+ ## Auxiliary helpers
165
159
 
166
160
  For Node consumers, use:
167
161
 
@@ -169,14 +163,13 @@ For Node consumers, use:
169
163
  import {
170
164
  createAgentDeviceProxyClient,
171
165
  ensureMetroRuntime,
172
- runAgentDeviceCommand,
173
166
  } from "agent-device-proxy"
174
167
  ```
175
168
 
176
- `runAgentDeviceCommand()` translates `agent-device install` / `reinstall` into
177
- artifact upload + remote install, and forwards the other commands through
178
- `agentDeviceExec()`. If `AGENT_DEVICE_PROXY_METRO_PROJECT_ROOT` is set, the `agent-device`
179
- bin will automatically attach Metro hints for iOS commands that require them.
169
+ Use `installApp()` for artifact handoff and `agentDeviceExec()` for explicit
170
+ proxy-side execution from Node. This package does not install an `agent-device`
171
+ bin shim; use the real `agent-device` package for CLI execution and native
172
+ remote-daemon support.
180
173
 
181
174
  ## Embedded server
182
175
 
package/dist/src/index.js CHANGED
@@ -1 +1 @@
1
- export{createAgentDeviceProxyClient}from"./224.js";export{createagentDeviceProxyServer,startAgentDeviceProxyServer}from"./36.js";export{ensureMetroRuntime}from"./403.js";export{runAgentDeviceCommand}from"./111.js";
1
+ export{createAgentDeviceProxyClient}from"./224.js";export{createagentDeviceProxyServer,startAgentDeviceProxyServer}from"./36.js";export{ensureMetroRuntime}from"./403.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-device-proxy",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -22,8 +22,7 @@
22
22
  }
23
23
  },
24
24
  "bin": {
25
- "agent-device-proxy": "./dist/src/bin.js",
26
- "agent-device": "./dist/src/agent-device.js"
25
+ "agent-device-proxy": "./dist/src/bin.js"
27
26
  },
28
27
  "scripts": {
29
28
  "build": "rslib build",
package/dist/src/111.js DELETED
@@ -1 +0,0 @@
1
- import{ensureMetroRuntime as t}from"./403.js";let e=new Set(["open","reopen","reload","push","trigger-app-event"]);async function r(r){if(!Array.isArray(r.argv)||0===r.argv.length)throw Error("argv must contain at least one agent-device command");let n=r.argv[0];if("install"===n||"reinstall"===n)return await i(r,"reinstall"===n);let l=null;try{var u;return function(t,r){if(!r)return!1;let i=function(t,e){let r=t.indexOf(e);if(-1===r)return;let i=t[r+1];if(!(!i||i.startsWith("--")))return i}(t,"--platform");return("ios"===i||"apple"===i)&&e.has(t[0]||"")}(r.argv,r.metro)&&(l=await t(r.metro)),u=await r.client.agentDeviceExec({argv:r.argv,...r.cwd?{cwd:r.cwd}:{},...l?{ios_runtime:l.ios_runtime}:{}}),o(u)?{exitCode:a(u.exit_code)??0,stdout:s(u.stdout)??JSON.stringify(u),stderr:s(u.stderr)??"",output:u}:{exitCode:0,stdout:JSON.stringify(u),stderr:"",output:u}}finally{await l?.stop()}}async function i(t,e){let r=function(t){let e=t.slice(1),r=[],i=new Map;for(let t=0;t<e.length;t+=1){let n=e[t];if(!n.startsWith("--")){r.push(n);continue}let a=n.slice(2),s=e[t+1];if(s&&!s.startsWith("--")){i.set(a,s),t+=1;continue}i.set(a,!0)}if(r.length<2)throw Error("agent-device install requires <app> and <path-to-binary>");let[a,s]=r,o={app:a,filePath:s,platform:function(t,e){let r=t.get(e);if("string"!=typeof r||!r.trim())throw Error(`agent-device install requires --${e}`);return r}(i,"platform")},l=n(i,"device"),u=n(i,"session"),f=n(i,"udid"),c=n(i,"serial");return l&&(o.device=l),u&&(o.session=u),f&&(o.udid=f),c&&(o.serial=c),!0===i.get("json")&&(o.json=!0),o}(t.argv),i=await t.client.installApp({...r,...e?{reinstall:!0}:{}}),l=o(i)&&o(i.install)?i.install:{},u=a(l.exit_code)??0;return{exitCode:u,stdout:s(l.stdout)??JSON.stringify(i),stderr:s(l.stderr)??"",output:i}}function n(t,e){let r=t.get(e);return"string"==typeof r&&r.trim()?r:void 0}function a(t){if("number"==typeof t&&Number.isInteger(t))return t}function s(t){return"string"==typeof t?t:void 0}function o(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}export{r as runAgentDeviceCommand};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{createAgentDeviceProxyClient as _}from"./224.js";import{runAgentDeviceCommand as E}from"./111.js";function e(_){let E=process.env[_];return E&&E.trim()?E.trim():void 0}function r(_){let E=e(_);if(!E)return;let r=Number.parseInt(E,10);return Number.isInteger(r)?r:void 0}function t(_){let E=e(_);if(!E)return;let r=E.toLowerCase();return!!["1","true","yes","on"].includes(r)||!["0","false","no","off"].includes(r)&&void 0}(async function(){var T;let s,O=_({baseUrl:function(_){let E=e(_);if(!E)throw Error(`${_} is required`);return E}("AGENT_DEVICE_PROXY_BASE_URL"),...e("AGENT_DEVICE_PROXY_BEARER_TOKEN")?{bearerToken:e("AGENT_DEVICE_PROXY_BEARER_TOKEN")}:{},...r("AGENT_DEVICE_PROXY_TIMEOUT_MS")?{timeoutMs:r("AGENT_DEVICE_PROXY_TIMEOUT_MS")}:{}}),o=await E({argv:process.argv.slice(2),client:O,cwd:process.cwd(),metro:(T=process.cwd(),(s=e("AGENT_DEVICE_PROXY_METRO_PROJECT_ROOT"))?{projectRoot:s||T,...r("AGENT_DEVICE_PROXY_METRO_PORT")?{port:r("AGENT_DEVICE_PROXY_METRO_PORT")}:{},...e("AGENT_DEVICE_PROXY_METRO_LISTEN_HOST")?{listenHost:e("AGENT_DEVICE_PROXY_METRO_LISTEN_HOST")}:{},...e("AGENT_DEVICE_PROXY_METRO_STATUS_HOST")?{statusHost:e("AGENT_DEVICE_PROXY_METRO_STATUS_HOST")}:{},...e("AGENT_DEVICE_PROXY_METRO_PUBLIC_HOST")?{publicHost:e("AGENT_DEVICE_PROXY_METRO_PUBLIC_HOST")}:{},...r("AGENT_DEVICE_PROXY_METRO_STARTUP_TIMEOUT_MS")?{startupTimeoutMs:r("AGENT_DEVICE_PROXY_METRO_STARTUP_TIMEOUT_MS")}:{},...r("AGENT_DEVICE_PROXY_METRO_PROBE_TIMEOUT_MS")?{probeTimeoutMs:r("AGENT_DEVICE_PROXY_METRO_PROBE_TIMEOUT_MS")}:{},...void 0!==t("AGENT_DEVICE_PROXY_METRO_REUSE_EXISTING")?{reuseExisting:t("AGENT_DEVICE_PROXY_METRO_REUSE_EXISTING")}:{}}:null)});o.stdout&&(process.stdout.write(o.stdout),o.stdout.endsWith("\n")||process.stdout.write("\n")),o.stderr&&(process.stderr.write(o.stderr),o.stderr.endsWith("\n")||process.stderr.write("\n")),process.exitCode=o.exitCode})().catch(_=>{process.stderr.write(`${_ instanceof Error?_.message:String(_)}
3
- `),process.exitCode=1});