agent-device 0.13.0 → 0.13.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 +4 -0
- package/dist/src/1974.js +2 -2
- package/dist/src/2301.js +1 -0
- package/dist/src/3918.js +29 -28
- package/dist/src/4993.js +1 -0
- package/dist/src/5721.js +1 -0
- package/dist/src/7166.js +1 -0
- package/dist/src/7651.js +1 -1
- package/dist/src/8564.js +1 -1
- package/dist/src/8656.js +1 -0
- package/dist/src/9076.js +1 -1
- package/dist/src/9152.js +1 -1
- package/dist/src/9542.js +2 -2
- package/dist/src/backend.js +1 -1
- package/dist/src/bin.js +49 -41
- package/dist/src/contracts.d.ts +12 -1
- package/dist/src/contracts.js +1 -1
- package/dist/src/daemon.js +18 -15
- package/dist/src/index.d.ts +36 -8
- package/dist/src/metro-companion.js +1 -1
- package/dist/src/metro.d.ts +29 -8
- package/dist/src/metro.js +1 -1
- package/dist/src/observability.d.ts +91 -0
- package/dist/src/observability.js +1 -0
- package/package.json +5 -1
- package/skills/agent-device/SKILL.md +2 -0
- package/skills/agent-device/references/bootstrap-install.md +26 -6
- package/skills/agent-device/references/exploration.md +11 -0
- package/skills/agent-device/references/remote-tenancy.md +45 -26
- package/skills/react-devtools/SKILL.md +2 -0
- package/dist/src/320.js +0 -1
- package/dist/src/3883.js +0 -1
- package/dist/src/8164.js +0 -1
- package/dist/src/9323.js +0 -5
package/dist/src/9323.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{URL as t}from"node:url";import{whichCmd as e,runCmd as n}from"./9818.js";import{asAppError as a,AppError as r}from"./9152.js";import{ensureAndroidSdkPathConfigured as i}from"./8164.js";import"./4829.js";function o(t,e){return["-s",t.id,...e]}async function s(){if(await i(),!await e("adb"))throw new r("TOOL_MISSING","adb not found in PATH")}function l(t,e){let n=`${t}
|
|
2
|
-
${e}`.toLowerCase();return n.includes("no shell command implementation")||n.includes("unknown command")}let u=/\.(?:apk|aab)$/i,d=/^[A-Za-z_][\w]*(\.[A-Za-z_][\w]*)+$/;function c(t){var e,n;let a=t.trim();return 0===a.length?"other":u.test(a)?a.includes("/")||a.includes("\\")||a.startsWith(".")||a.startsWith("~")||(e=a,!d.test(e))?"binary":"package":(n=a,d.test(n))?"package":"other"}function p(t){return`Android runtime hints require an installed package name, not "${t}". Install or reinstall the app first, then relaunch by package.`}let m=["AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET","IOS_SIMULATOR_DEVICE_SET"],f=["AGENT_DEVICE_ANDROID_DEVICE_ALLOWLIST","ANDROID_DEVICE_ALLOWLIST"];function h(t){return t?.trim()||void 0}function w(t,e){for(let n of t){let t=h(e[n]);if(t)return t}}function _(t,e=process.env){return h(t)??w(m,e)}function A(t){return new Set(t.split(/[\s,]+/).map(t=>t.trim()).filter(Boolean))}function g(t,e=process.env){let n=h(t)??w(f,e);if(n)return A(n)}function b(t,e={}){let n=_(e.simulatorSetPath);return n?["simctl","--set",n,...t]:["simctl",...t]}function S(t,e){return"ios"!==t.platform||"simulator"!==t.kind?["simctl",...e]:b(e,{simulatorSetPath:t.simulatorSetPath})}let I="shared_prefs/ReactNativeDevPrefs.xml",v="debug_http_host",C="dev_server_https",$="RCT_jsLocation",E="RCT_packager_scheme",R="React Native runtime hints require adb run-as access to the app sandbox. Verify the app is debuggable and the selected package/device are correct.",k='<?xml version="1.0" encoding="utf-8" standalone="yes" ?>\n<map>\n</map>\n';function y(t){return void 0!==D(t)}function D(e){if(!e)return;let n=K(e.metroHost),a=q(e.metroPort),i="http",o=K(e.bundleUrl);if(o){var s;let e;try{e=new t(o)}catch(t){throw new r("INVALID_ARGS",`Invalid runtime bundle URL: ${o}`,{},t)}("http:"===e.protocol||"https:"===e.protocol)&&(n??=K(e.hostname),a??=q(e.port.length>0?Number(e.port):"https:"===(s=e.protocol)?443:"http:"===s?80:void 0),i="https:"===e.protocol?"https":"http")}if(n&&a)return{host:n,port:a,scheme:i}}async function N(t){let{device:e,appId:n,runtime:a}=t;if(!n)return;let r=D(a);if(r){if("android"===e.platform)return void await L(e,n,r);"ios"===e.platform&&"simulator"===e.kind&&await P(e,n,r)}}async function x(t){let{device:e,appId:n}=t;if(n){if("android"===e.platform)return void await T(e,n);"ios"===e.platform&&"simulator"===e.kind&&await F(e,n)}}async function L(t,e,n){var a,r,i,o,s,l;let u,d;G(e);let c=(a=await O(t,e),r=v,i=`${n.host}:${n.port}`,u=` <string name="${W(r)}">${W(i)}</string>`,V(U(a,r),u));o=c,s=C,l="https"===n.scheme,d=` <boolean name="${W(s)}" value="${l?"true":"false"}" />`,c=V(U(o,s),d),await M(t,e,c)}async function T(t,e){G(e);let n=await O(t,e),a=U(n,v),r=U(a,C);r!==n&&await M(t,e,r)}async function O(t,e){let a=await n("adb",o(t,["shell","run-as",e,"cat",I]),{allowFailure:!0});return 0!==a.exitCode?k:H(a.stdout)}async function M(t,e,i){let s=o(t,["shell","run-as",e,"id"]),l=await n("adb",s,{allowFailure:!0});if(0!==l.exitCode){let t=z(l.stdout,l.stderr);throw new r("COMMAND_FAILED",t?`Failed to access Android app sandbox for ${e}`:`Failed to probe Android app sandbox for ${e}`,{package:e,cmd:"adb",args:s,stdout:l.stdout,stderr:l.stderr,exitCode:l.exitCode,hint:t?R:"adb shell run-as probe failed. Check adb connectivity and that the device is reachable. Inspect stderr/details for more information."})}try{await n("adb",o(t,["shell","run-as",e,"mkdir","-p","shared_prefs"])),await n("adb",o(t,["shell","run-as",e,"tee",I]),{stdin:i.trimEnd()})}catch(i){let t=a(i);if("TOOL_MISSING"===t.code)throw t;let n=z("string"==typeof t.details?.stdout?t.details.stdout:"","string"==typeof t.details?.stderr?t.details.stderr:"");throw new r("COMMAND_FAILED",n?`Failed to access Android app sandbox for ${e}`:`Failed to write Android runtime hints for ${e}`,{...t.details??{},package:e,cmd:"adb",phase:"write-runtime-hints",hint:n?R:"adb run-as succeeded, but writing ReactNativeDevPrefs.xml failed. Inspect stderr/details for the failing shell command."},t)}}async function P(t,e,a){await n("xcrun",S(t,["spawn",t.id,"defaults","write",e,$,"-string",`${a.host}:${a.port}`])),await n("xcrun",S(t,["spawn",t.id,"defaults","write",e,E,"-string",a.scheme]))}async function F(t,e){await n("xcrun",S(t,["spawn",t.id,"defaults","delete",e,$]),{allowFailure:!0}),await n("xcrun",S(t,["spawn",t.id,"defaults","delete",e,E]),{allowFailure:!0})}function H(t){let e=t.trim();return e.includes("<map")&&e.includes("</map>")?`${e}
|
|
3
|
-
`:k}function V(t,e){return H(t).replace("</map>",`${e}
|
|
4
|
-
</map>`)}function U(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return H(t).replace(RegExp(`^\\s*<string name="${n}">[\\s\\S]*?<\\/string>\\n?`,"m"),"").replace(RegExp(`^\\s*<boolean name="${n}" value="(?:true|false)"\\s*\\/?>\\n?`,"m"),"")}function K(t){let e=t?.trim();return e&&e.length>0?e:void 0}function G(t){if("binary"!==c(t))return;let e=p(t);throw new r("INVALID_ARGS",e,{package:t,hint:e})}function q(t){if(Number.isInteger(t)&&!(t<=0)&&!(t>65535))return t}function W(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function z(t,e){let n=`${t}
|
|
5
|
-
${e}`.toLowerCase();return["run-as: package not debuggable","run-as: permission denied","run-as: package is unknown","run-as: unknown package","is unknown","is not an application","could not set capabilities"].some(t=>n.includes(t))}export{o as adbArgs,N as applyRuntimeHintsToApp,b as buildSimctlArgs,S as buildSimctlArgsForDevice,c as classifyAndroidAppTarget,x as clearRuntimeHintsFromApp,s as ensureAdb,p as formatAndroidInstalledPackageRequiredMessage,y as hasRuntimeTransportHints,l as isClipboardShellUnsupported,A as parseSerialAllowlist,g as resolveAndroidSerialAllowlist,_ as resolveIosSimulatorDeviceSetPath,D as resolveRuntimeTransportHints,K as trimRuntimeValue};
|