agent-device 0.21.1 → 0.21.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/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.1.apk → agent-device-android-ime-helper-0.21.2.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.2.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.1.manifest.json → agent-device-android-ime-helper-0.21.2.manifest.json} +4 -4
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.2.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.2.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.1.manifest.json → agent-device-android-snapshot-helper-0.21.2.manifest.json} +6 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerScrollViewportPolicy.swift +413 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +34 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +56 -31
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +1 -13
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +4 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +9 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +1 -0
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/RecordingExportSupport.swift +0 -4
- package/dist/src/absence-observation-errors.js +1 -0
- package/dist/src/adapter.js +1 -1
- package/dist/src/agent-browser-lifecycle.js +1 -1
- package/dist/src/agent-browser-process-record.js +1 -1
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/ai-sdk.d.ts +1 -1
- package/dist/src/ai-sdk.js +1 -1
- package/dist/src/alert-runtime.js +1 -1
- package/dist/src/android-input-ownership.js +1 -1
- package/dist/src/app-helpers.js +1 -1
- package/dist/src/app-inventory-contract.js +1 -1
- package/dist/src/app-inventory.js +1 -1
- package/dist/src/app-log-runtime2.js +2 -2
- package/dist/src/auth-session.js +1 -1
- package/dist/src/back-mode.js +1 -0
- package/dist/src/browser-launch.js +1 -0
- package/dist/src/catalog.js +1 -1
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +12 -12
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +3 -3
- package/dist/src/client-metro-companion.js +1 -1
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +2 -1
- package/dist/src/code-signature-cache.js +1 -1
- package/dist/src/code-signature.js +1 -1
- package/dist/src/command-metadata.js +1 -1
- package/dist/src/command-schema.js +3 -3
- package/dist/src/command-tools.js +2 -2
- package/dist/src/config.js +1 -1
- package/dist/src/connection-runtime.js +1 -1
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/daemon-client-lifecycle.js +1 -1
- package/dist/src/daemon-process.js +1 -1
- package/dist/src/daemon-shutdown-report.js +1 -1
- package/dist/src/device-boot.js +1 -0
- package/dist/src/device-claim-inspection.js +1 -1
- package/dist/src/device-claim-rule.js +1 -1
- package/dist/src/device-input-state.d.ts +1 -1
- package/dist/src/device-session.js +1 -1
- package/dist/src/durable-resource.js +1 -1
- package/dist/src/engine-eval-script.js +1 -0
- package/dist/src/file.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/format.js +1 -0
- package/dist/src/generic-settle.js +1 -1
- package/dist/src/gesture-plan.js +1 -1
- package/dist/src/gesture-runtime.js +1 -1
- package/dist/src/helper.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/input-actions.js +1 -1
- package/dist/src/interaction-positionals.js +1 -1
- package/dist/src/interaction-ref-policy.js +1 -1
- package/dist/src/interaction.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor.js +5 -5
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +2 -2
- package/dist/src/internal/png-worker.d.ts +3 -0
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/ios-snapshot-acquisition.js +1 -1
- package/dist/src/ios-snapshot-planning.js +1 -1
- package/dist/src/ios-snapshot-runtime.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun.d.ts +1 -1
- package/dist/src/local-interactor-operation-set.js +1 -1
- package/dist/src/mechanics.js +16 -16
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/mp4-atoms.js +1 -0
- package/dist/src/owner-identity.js +3 -3
- package/dist/src/parameterized-recorded-fill.js +1 -1
- package/dist/src/perf-facade.js +1 -1
- package/dist/src/perf-runtime-plan.js +1 -1
- package/dist/src/platform-request-scope.js +1 -1
- package/dist/src/platform-runtime-app-log-process.js +1 -1
- package/dist/src/platform-runtime-managed-owner.js +1 -1
- package/dist/src/platform-runtime-operation-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-android-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-runner-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-process-host.js +1 -1
- package/dist/src/platform-runtime.js +1 -1
- package/dist/src/platform-runtime2.js +1 -1
- package/dist/src/png-crop-bytes.js +1 -0
- package/dist/src/png-worker-contract.js +1 -1
- package/dist/src/png.js +1 -0
- package/dist/src/process.js +1 -1
- package/dist/src/provider-webdriver.js +1 -1
- package/dist/src/quality-warnings.js +1 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/registry.js +36 -37
- package/dist/src/replay.js +1 -1
- package/dist/src/request-admission.js +1 -1
- package/dist/src/request-cancellation.js +1 -1
- package/dist/src/request-runtime-binding.js +1 -1
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-disposal.js +1 -1
- package/dist/src/runner-presentation.js +1 -1
- package/dist/src/runtime.js +3 -3
- package/dist/src/runtime10.js +1 -0
- package/dist/src/runtime2.js +4 -4
- package/dist/src/runtime4.js +3 -3
- package/dist/src/runtime6.js +1 -1
- package/dist/src/runtime7.js +1 -1
- package/dist/src/runtime8.js +1 -1
- package/dist/src/runtime9.js +1 -1
- package/dist/src/screen-recording-live-handle.js +1 -1
- package/dist/src/screen-recording-resource-recovery.js +1 -1
- package/dist/src/screenshot-runtime.js +1 -1
- package/dist/src/screenshot3.js +2 -2
- package/dist/src/script.js +1 -1
- package/dist/src/scroll-gesture.js +1 -1
- package/dist/src/sdk-batch.js +1 -1
- package/dist/src/sdk-contracts.d.ts +26 -26
- package/dist/src/sdk-finders.d.ts +1 -1
- package/dist/src/sdk-finders.js +1 -1
- package/dist/src/sdk-remote-config.d.ts +1 -1
- package/dist/src/sdk-selectors.d.ts +12 -4
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selection.js +0 -0
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/semantic-index.js +1 -1
- package/dist/src/server.js +1 -1
- package/dist/src/session-snapshot.js +1 -1
- package/dist/src/session-store.js +2 -2
- package/dist/src/session-target-evidence.js +1 -1
- package/dist/src/session2.js +5 -5
- package/dist/src/simulator-boot.js +3 -0
- package/dist/src/snapshot-runtime-binding.js +1 -1
- package/dist/src/snapshot-runtime.js +1 -1
- package/dist/src/snapshot-state.js +1 -1
- package/dist/src/snapshot4.js +1 -1
- package/dist/src/src.js +1 -1
- package/dist/src/src7.js +1 -1
- package/dist/src/src8.js +2 -2
- package/dist/src/telemetry.js +1 -1
- package/dist/src/touch-reference-frame.js +1 -1
- package/dist/src/tree.js +1 -1
- package/dist/src/type-text-runtime.js +1 -1
- package/dist/src/vars.js +2 -0
- package/dist/src/version.js +1 -1
- package/dist/src/video.js +2 -2
- package/dist/src/viewport.js +1 -0
- package/dist/src/webdriver-ios-snapshot.js +1 -1
- package/package.json +2 -1
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.1.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.1.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.1.apk.sha256 +0 -1
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-trim.swift +0 -93
- package/dist/src/snapshot-quality-verdict.js +0 -1
package/dist/src/video.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e}from"./sdk-contracts.js";import{
|
|
1
|
+
import{C as e}from"./sdk-contracts.js";import{nr as t}from"./sdk-batch.js";import{x as n}from"./owner-identity.js";import{c as r}from"./exec.js";import{t as i}from"./timeouts.js";import{t as a}from"./file.js";import"./command.js";import"./retry.js";import"./process.js";import o from"node:path";import s from"node:fs";import{createHash as c}from"node:crypto";import l from"node:os";function u(e=process.env){let t=p(),n=o.join(t,`home`),r=o.join(t,`module-cache`);return s.mkdirSync(n,{recursive:!0}),s.mkdirSync(r,{recursive:!0}),{...e,HOME:n,CLANG_MODULE_CACHE_PATH:r}}async function d(e){let t=[e.sourcePath,...e.extraSourcePaths??[]],n=t.map(e=>({sourcePath:e,stat:s.statSync(e),source:s.readFileSync(e)})),r=_(e.cacheName??o.basename(e.sourcePath,o.extname(e.sourcePath))),i=v([`2`,process.platform,process.arch,...n.flatMap(({sourcePath:e,stat:t,source:n})=>[o.resolve(e),t.size,n])]),a=o.join(p(),`bin`,`${r}-${i}`);return await m({sourcePaths:t,executablePath:a,timeoutMs:e.timeoutMs}),a}async function f(e){let t=_(e.cacheName),n=v([`2`,process.platform,process.arch,e.source]),r=o.join(p(),`sources`,`${t}-${n}.swift`),i=o.join(p(),`bin`,`${t}-${n}`);return await m({sourcePaths:[r],executablePath:i,sourceText:e.source,timeoutMs:e.timeoutMs}),i}function p(){let e=process.env.AGENT_DEVICE_SWIFT_CACHE_DIR?.trim();return e?o.resolve(e):o.join(l.tmpdir(),`agent-device-swift-cache`)}async function m(e){if(g(e.executablePath))return;let t=o.dirname(e.executablePath);s.mkdirSync(t,{recursive:!0});let n=await h(`${e.executablePath}.lock`,e.executablePath,e.timeoutMs??12e4);if(!n)return;let i=s.mkdtempSync(o.join(t,`.${o.basename(e.executablePath)}.${process.pid}.`)),a=o.join(i,o.basename(e.executablePath));try{if(g(e.executablePath))return;let[t]=e.sourcePaths;e.sourceText!==void 0&&t&&!s.existsSync(t)&&(s.mkdirSync(o.dirname(t),{recursive:!0}),s.writeFileSync(t,e.sourceText)),await r(`xcrun`,[`swiftc`,...e.sourcePaths,`-o`,a],{timeoutMs:e.timeoutMs??12e4,env:u()}),s.renameSync(a,e.executablePath)}finally{s.rmSync(i,{recursive:!0,force:!0}),await n()}}async function h(t,r,i){if(g(r))return null;try{return await a({lockDirPath:t,owner:{pid:process.pid,startTime:n(process.pid),acquiredAtMs:Date.now()},timeoutMs:i,pollMs:25,ownerGraceMs:i,description:`Swift cache lock: ${t} (${i}ms)`})}catch(n){throw n instanceof e&&n.message.startsWith(`Timed out waiting for Swift cache lock:`)?new e(`COMMAND_FAILED`,n.message,{...n.details,lockDir:t,timeoutMs:i,hint:`Another agent-device process may still be compiling this Swift helper. Retry shortly; if no agent-device process is active, remove "${t}" and retry.`}):n}}function g(e){try{return s.accessSync(e,s.constants.X_OK),s.statSync(e).isFile()}catch{return!1}}function _(e){return t(e.replaceAll(/[^A-Za-z0-9._-]/g,`-`))||`swift-helper`}function v(e){let t=c(`sha256`);for(let n of e)t.update(Buffer.isBuffer(n)?n:String(n)),t.update(`\0`);return t.digest(`hex`).slice(0,16)}const y={block:161,blockGroup:160,cluster:524531317,codecId:134,documentType:17026,ebml:440786851,segment:408125543,simpleBlock:163,trackEntry:174,trackNumber:215,tracks:374648427,trackType:131};function b(e){let t=x(e);if(!t)return!1;let{bytes:n,fileSize:r}=t,i=M(n,0,n.length,r);if(!i||i.id!==y.ebml||!i.complete||i.unknownSize||!S(n,i))return!1;let a=M(n,i.nextOffset,n.length,r);return!a||a.id!==y.segment||!I(a,r)?!1:C(n,a,r)}function x(e){try{let t=s.openSync(e,`r`);try{let e=s.fstatSync(t).size;if(e<=0)return;let n=Buffer.alloc(Math.min(e,1048576));return s.readSync(t,n,0,n.length,0)===n.length?{bytes:n,fileSize:e}:void 0}finally{s.closeSync(t)}}catch{return}}function S(e,t){let n=j(e,t)?.find(e=>e.id===y.documentType);return n!==void 0&&e.toString(`ascii`,n.dataStart,n.dataEnd)===`webm`}function C(e,t,n){let r=new Set,i=new Set;for(let a=t.dataStart;a<t.dataEnd;){let o=M(e,a,t.dataEnd,n);if(!o||!I(o,n))return!1;if(o.id===y.tracks&&w(e,o,r),o.id===y.cluster&&E(e,o,n,i),L(r,i))return!0;if(!o.complete||o.unknownSize)return!1;a=o.nextOffset}return!1}function w(e,t,n){let r=j(e,t);if(r){for(let t of r)if(t.id===y.trackEntry){let r=T(e,t);r!==void 0&&n.add(r)}}}function T(e,t){let n=j(e,t),r=A(e,n,y.trackNumber),i=A(e,n,y.trackType),a=n?.find(e=>e.id===y.codecId),o=a?e.toString(`ascii`,a.dataStart,a.dataEnd):void 0;return i===1&&o?.startsWith(`V_`)?r:void 0}function E(e,t,n,r){for(let i=t.dataStart;i<t.dataEnd;){let a=M(e,i,t.dataEnd,n);if(!a||!I(a,n)||(a.id===y.simpleBlock&&O(e,a,r),a.id===y.blockGroup&&D(e,a,r),!a.complete||a.unknownSize))return;i=a.nextOffset}}function D(e,t,n){let r=j(e,t)?.find(e=>e.id===y.block);r&&O(e,r,n)}function O(e,t,n){if(!t.complete||t.unknownSize)return;let r=P(e,t.dataStart);!r||r.unknown||t.dataEnd-t.dataStart<r.length+4||n.add(r.value)}function k(e,t){let n=t.dataEnd-t.dataStart;if(n<1||n>6)return;let r=0;for(let n=t.dataStart;n<t.dataEnd;n+=1)r=r*256+e[n];return Number.isSafeInteger(r)?r:void 0}function A(e,t,n){let r=t?.find(e=>e.id===n);return r?k(e,r):void 0}function j(e,t){if(!t.complete||t.unknownSize)return;let n=[];for(let r=t.dataStart;r<t.dataEnd;){let i=M(e,r,t.dataEnd,e.length);if(!i||!i.complete||i.unknownSize)return;n.push(i),r=i.nextOffset}return n}function M(e,t,n,r){let i=N(e,t);if(!i)return;let a=P(e,t+i.length);if(!a)return;let o=t+i.length+a.length;if(o>n)return;let s=a.unknown?r:o+a.value;if(!(!Number.isSafeInteger(s)||s<o))return{id:i.value,dataStart:o,dataEnd:Math.min(s,n),nextOffset:s,complete:s<=n,unknownSize:a.unknown}}function N(e,t){let n=F(e,t,4);if(!n)return;let r=0;for(let i=0;i<n;i+=1)r=r*256+e[t+i];return{length:n,value:r}}function P(e,t){let n=F(e,t,8);if(!n)return;let r=e[t],i=128>>n-1;if((r&i-1)==i-1&&e.subarray(t+1,t+n).every(e=>e===255))return{length:n,value:0,unknown:!0};let a=r&i-1;for(let r=1;r<n;r+=1)a=a*256+e[t+r];return Number.isSafeInteger(a)?{length:n,value:a,unknown:!1}:void 0}function F(e,t,n){let r=e[t];if(r===void 0||r===0)return;let i=128,a=1;for(;(r&i)===0;)i>>=1,a+=1;return a<=n&&t+a<=e.length?a:void 0}function I(e,t){return e.unknownSize||e.nextOffset<=t}function L(e,t){for(let n of e)if(t.has(n))return!0;return!1}let R;async function z(e,t={}){let n=t.pollMs??150,r=t.attempts??12,a,o=0;for(let t=0;t<r;t+=1){let t=0;try{t=s.statSync(e).size}catch{t=0}if(t>0&&t===a){if(o+=1,o>=2)return}else o=0;a=t,await i(n)}}async function B(e){let t=await G(e);if(!t)return!1;if(t===`webm`)return!0;try{let t=await V(),n=await r(t,[e],{allowFailure:!0,timeoutMs:1e4,env:u()});return n.exitCode===0||W(n.stderr,n.stdout)}catch(e){if(H(e))return!0;throw e}}async function V(){R??=f({source:`import Foundation
|
|
2
2
|
import AVFoundation
|
|
3
3
|
|
|
4
4
|
let url = URL(fileURLWithPath: CommandLine.arguments[1])
|
|
@@ -20,4 +20,4 @@ Task {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
semaphore.wait()
|
|
23
|
-
exit(exitCode)`,cacheName:`video-validator`,timeoutMs:3e4});try{return await R}catch(e){throw R=void 0,e}}function H(t){return t instanceof e?t.code===`TOOL_MISSING`||W(String(t.details?.stderr??``),String(t.details?.stdout??``)):!1}async function U(e,t={}){let n=t.pollMs??150,r=t.attempts??12;for(let t=0;t<r;t+=1){if(await B(e))return;await i(n)}}function W(e,t){let n=`${e}\n${t}`;return/\b(no such module ['"]AVFoundation['"]|unable to find utility ["']swiftc?["']|xcrun: error: unable to find utility ["']swiftc?["'])\b/i.test(n)}function G(e){try{let t=s.statSync(e);if(!t.isFile()||t.size<=0)return}catch{return}
|
|
23
|
+
exit(exitCode)`,cacheName:`video-validator`,timeoutMs:3e4});try{return await R}catch(e){throw R=void 0,e}}function H(t){return t instanceof e?t.code===`TOOL_MISSING`||W(String(t.details?.stderr??``),String(t.details?.stdout??``)):!1}async function U(e,t={}){let n=t.pollMs??150,r=t.attempts??12;for(let t=0;t<r;t+=1){if(await B(e))return;await i(n)}}function W(e,t){let n=`${e}\n${t}`;return/\b(no such module ['"]AVFoundation['"]|unable to find utility ["']swiftc?["']|xcrun: error: unable to find utility ["']swiftc?["'])\b/i.test(n)}async function G(e){try{let t=s.statSync(e);if(!t.isFile()||t.size<=0)return}catch{return}return e.toLowerCase().endsWith(`.webm`)?b(e)?`webm`:void 0:await K(e)?`mp4`:void 0}async function K(e){let{findMp4Atom:t}=await import(`./mp4-atoms.js`).then(e=>e.n);return t(e,[`ftyp`])!==void 0&&t(e,[`moov`])!==void 0}export{d as a,u as i,U as n,z as r,B as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e}from"./sdk-contracts.js";function t(t,n){let r=t===void 0?NaN:Number(t);if(!Number.isInteger(r)||r<1)throw new e(`INVALID_ARGS`,`viewport ${n} must be a positive integer`);return r}function n(n){if(n.length!==2)throw new e(`INVALID_ARGS`,`viewport requires exactly two arguments: <width> <height>`);return{width:t(n[0],`width`),height:t(n[1],`height`)}}export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./webdriver-source.js";import{r as t,t as n}from"./ios-snapshot-acquisition.js";
|
|
1
|
+
import{t as e}from"./webdriver-source.js";import{r as t,t as n}from"./ios-snapshot-acquisition.js";function r(r,i){let a=e(r),o=t(a.roots)??{kind:`missing`,reason:`not-provided`};return n({producer:`appium-source`,nodes:a.nodes,viewport:o,lineage:i?{targetId:i}:{}})}export{r as acquireWebDriverIosSnapshot};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-device",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
4
4
|
"description": "Mobile app automation and verification for AI coding agents. CLI, MCP server, and typed Node.js API for iOS, Android, HarmonyOS, TV, web, macOS, and Linux.",
|
|
5
5
|
"mcpName": "io.github.callstack/agent-device",
|
|
6
6
|
"license": "MIT",
|
|
@@ -124,6 +124,7 @@
|
|
|
124
124
|
"bench:ios-snapshot": "node --experimental-strip-types scripts/ios-snapshot-benchmark/run.ts",
|
|
125
125
|
"bench:ios-snapshot:deep-button": "node --experimental-strip-types scripts/ios-snapshot-benchmark/deep-button.ts",
|
|
126
126
|
"bench:ios-snapshot:evidence": "node --experimental-strip-types scripts/ios-snapshot-benchmark/evidence.ts",
|
|
127
|
+
"bench:png-crop": "node --experimental-strip-types scripts/png-crop-benchmark/run.ts",
|
|
127
128
|
"bench:ios-ax-bridge:targeted": "node --experimental-strip-types scripts/ios-ax-bridge-spike/targeted-run.ts",
|
|
128
129
|
"mutation:run": "node --experimental-strip-types scripts/mutation/run.ts",
|
|
129
130
|
"mutation:check": "node --experimental-strip-types scripts/mutation/run.ts --no-run",
|
package/server.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"url": "https://github.com/callstack/agent-device",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.21.
|
|
10
|
+
"version": "0.21.2",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "agent-device",
|
|
15
|
-
"version": "0.21.
|
|
15
|
+
"version": "0.21.2",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
65454a4663596adfc7fccd9a30e42f02b5ecde17eb1514fa115ef3036171b995 agent-device-android-ime-helper-0.21.1.apk
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6ee75909ac499eca439d3663717d8fc1928ada3fec71bf2ae85fb567967a3793 agent-device-android-snapshot-helper-0.21.1.apk
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import AVFoundation
|
|
2
|
-
import Foundation
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@main
|
|
7
|
-
enum RecordingTrim {
|
|
8
|
-
static func main() {
|
|
9
|
-
do {
|
|
10
|
-
try run()
|
|
11
|
-
} catch {
|
|
12
|
-
fputs("recording-trim: \(error)\n", stderr)
|
|
13
|
-
exit(1)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
func run() throws {
|
|
19
|
-
let arguments = Array(CommandLine.arguments.dropFirst())
|
|
20
|
-
let parsedArgs = try parseArguments(arguments)
|
|
21
|
-
let inputURL = URL(fileURLWithPath: parsedArgs.inputPath)
|
|
22
|
-
let outputURL = URL(fileURLWithPath: parsedArgs.outputPath)
|
|
23
|
-
|
|
24
|
-
try removeStaleOutput(outputURL)
|
|
25
|
-
|
|
26
|
-
let asset = AVURLAsset(url: inputURL)
|
|
27
|
-
let videoTrack = try sourceVideoTrack(of: asset)
|
|
28
|
-
let trimStart = CMTime(seconds: parsedArgs.trimStartMs / 1000.0, preferredTimescale: 600)
|
|
29
|
-
guard CMTimeCompare(trimStart, asset.duration) < 0 else {
|
|
30
|
-
throw RecordingScriptError.invalidTrimRange
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let trimmedDuration = CMTimeSubtract(asset.duration, trimStart)
|
|
34
|
-
guard CMTimeCompare(trimmedDuration, .zero) > 0 else {
|
|
35
|
-
throw RecordingScriptError.invalidTrimRange
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
let composition = try makeRecordingComposition(
|
|
39
|
-
asset: asset,
|
|
40
|
-
videoTrack: videoTrack,
|
|
41
|
-
timeRange: CMTimeRange(start: trimStart, duration: trimmedDuration)
|
|
42
|
-
)
|
|
43
|
-
composition.tracks(withMediaType: .video).first?.preferredTransform = videoTrack.preferredTransform
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
let presetName = AVAssetExportSession.exportPresets(compatibleWith: composition)
|
|
48
|
-
.contains(AVAssetExportPresetPassthrough)
|
|
49
|
-
? AVAssetExportPresetPassthrough
|
|
50
|
-
: AVAssetExportPresetHighestQuality
|
|
51
|
-
let exporter = try makeRecordingExporter(composition, presetName: presetName, outputURL: outputURL)
|
|
52
|
-
try runRecordingExport(
|
|
53
|
-
exporter,
|
|
54
|
-
timeoutMessage: "Trim export timed out.",
|
|
55
|
-
failureMessage: "Trim export failed."
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
func parseArguments(_ arguments: [String]) throws -> (inputPath: String, outputPath: String, trimStartMs: Double) {
|
|
60
|
-
var inputPath: String?
|
|
61
|
-
var outputPath: String?
|
|
62
|
-
var trimStartMs: Double?
|
|
63
|
-
var index = 0
|
|
64
|
-
|
|
65
|
-
while index < arguments.count {
|
|
66
|
-
let argument = arguments[index]
|
|
67
|
-
let nextIndex = index + 1
|
|
68
|
-
switch argument {
|
|
69
|
-
case "--input":
|
|
70
|
-
inputPath = try recordingOptionValue(arguments, nextIndex, "--input")
|
|
71
|
-
index += 2
|
|
72
|
-
case "--output":
|
|
73
|
-
outputPath = try recordingOptionValue(arguments, nextIndex, "--output")
|
|
74
|
-
index += 2
|
|
75
|
-
case "--trim-start-ms":
|
|
76
|
-
let rawValue = try recordingOptionValue(arguments, nextIndex, "--trim-start-ms")
|
|
77
|
-
guard let parsed = Double(rawValue), parsed >= 0 else {
|
|
78
|
-
throw RecordingScriptError.invalidArgs("--trim-start-ms must be a non-negative number")
|
|
79
|
-
}
|
|
80
|
-
trimStartMs = parsed
|
|
81
|
-
index += 2
|
|
82
|
-
default:
|
|
83
|
-
throw RecordingScriptError.invalidArgs("Unknown argument: \(argument)")
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
guard let inputPath, let outputPath, let trimStartMs else {
|
|
88
|
-
throw RecordingScriptError.invalidArgs(
|
|
89
|
-
"Usage: recording-trim.swift --input <video> --output <video> --trim-start-ms <ms>"
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
return (inputPath, outputPath, trimStartMs)
|
|
93
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,R as t}from"./sdk-contracts.js";import{i as n}from"./capture.js";import{n as r}from"./snapshot-quality-backend-capabilities.js";import{r as i}from"./diagnostics.js";import"./diagnostics2.js";import{a,i as o,n as s,r as c,t as l}from"./png-worker-contract.js";import u from"node:path";import d,{promises as f}from"node:fs";import{fileURLToPath as p}from"node:url";import{Worker as m}from"node:worker_threads";function h(e,t){try{let n=p(e),r=u.extname(n)||`.js`;return[u.join(u.dirname(n),`${t}${r}`),u.join(u.dirname(n),`internal`,`${t}${r}`)].find(e=>d.existsSync(e))??null}catch{return null}}var g=class extends Error{};let _=null,v=!1,y=!1,b=0;const x=new Map;function S(e){v=!0,!y&&(y=!0,i({level:`warn`,phase:`png_worker_unavailable`,data:{reason:e}}),process.emitWarning(`PNG worker unavailable, falling back to in-process PNG processing: ${e}`))}function C(n){let r=x.get(n.id);r&&(x.delete(n.id),E(),n.ok?r.resolve(n.result):r.reject(new e(t(n.error.code),n.error.message,n.error.details)))}function w(e,t){_===e&&(S(t.message),_=null,e.terminate().catch(()=>{}),T(new g(`PNG worker failed: ${t.message}`)))}function T(e){let t=[...x.values()];x.clear();for(let n of t)n.reject(e)}function E(){_&&(x.size>0?_.ref():_.unref())}function D(){if(v)return null;if(_)return _;let e=h(import.meta.url,`png-worker`);if(!e)return S(`worker entry module not found next to the current module`),null;try{let t=new m(e,{execArgv:e.endsWith(`.ts`)?[`--experimental-strip-types`]:[]});return t.on(`message`,C),t.on(`error`,e=>{w(t,e)}),t.on(`exit`,e=>{w(t,Error(`PNG worker exited with code ${e}`))}),t.unref(),_=t,t}catch(e){return S(`failed to spawn worker: ${e instanceof Error?e.message:String(e)}`),null}}function O(e){let t=D();if(!t)return Promise.reject(new g(`PNG worker is unavailable`));b+=1;let n=b;return new Promise((r,i)=>{x.set(n,{resolve:r,reject:i}),E();try{t.postMessage({...e,id:n})}catch(e){x.delete(n),E(),i(new g(`failed to post job to PNG worker: ${e instanceof Error?e.message:String(e)}`))}})}async function k(e,t){try{return await O(e)}catch(e){if(e instanceof g)return t();throw e}}function A(){D()}async function j(){let e=_;_=null,T(new g(`PNG worker terminated`)),e&&await e.terminate()}async function M(e,t){let n=await k({kind:`decode`,png:e,label:t},()=>{let n=o(e,t);return{kind:`decode`,width:n.width,height:n.height,data:n.data}}),r=new a.PNG({width:n.width,height:n.height});return r.data=l(n.data),r}async function N(e){let t=await k({kind:`encode`,width:e.width,height:e.height,data:e.data},()=>({kind:`encode`,png:a.PNG.sync.write(e)}));return l(t.png)}async function P(e,t,n){let{kind:r,...i}=await k({kind:`rgb-difference`,firstPng:e,secondPng:t,label:n},()=>({kind:`rgb-difference`,...s(o(e,n),o(t,n))}));return i}async function F(e){let{kind:t,...n}=await k({kind:`diff-pixels`,...e},()=>({kind:`diff-pixels`,...c(e)}));return{...n,diffData:l(n.diffData)}}async function I(t,r){let{min:i,max:a}=n;if(!Number.isFinite(r)||r<i||r>a)throw new e(`INVALID_ARGS`,`Screenshot scale must be between ${i} and ${a}`);if(r===1)return;let o=await M(await f.readFile(t),`screenshot`),s=Math.max(1,Math.round(o.width*r)),c=Math.max(1,Math.round(o.height*r));await f.writeFile(t,await N(R(o,s,c)))}async function L(t,n,r){if(!Number.isInteger(n)||n<1||!Number.isInteger(r)||r<1)throw new e(`INVALID_ARGS`,`Screenshot resize dimensions must be positive integers`);let i=await M(await f.readFile(t),`screenshot`);(i.width!==n||i.height!==r)&&await f.writeFile(t,await N(R(i,n,r)))}function R(e,t,n){let r=new a.PNG({width:t,height:n});for(let i=0;i<n;i+=1){let a=i*e.height/n,o=(i+1)*e.height/n;for(let n=0;n<t;n+=1){let s=n*e.width/t,c=(n+1)*e.width/t,l=0,u=0,d=0,f=0,p=0;for(let t=Math.floor(a);t<Math.ceil(o);t+=1){let n=Math.min(t+1,o)-Math.max(t,a);for(let r=Math.floor(s);r<Math.ceil(c);r+=1){let i=n*(Math.min(r+1,c)-Math.max(r,s)),a=(t*e.width+r)*4;l+=(e.data[a]??0)*i,u+=(e.data[a+1]??0)*i,d+=(e.data[a+2]??0)*i,f+=(e.data[a+3]??0)*i,p+=i}}let m=(i*r.width+n)*4;r.data[m]=Math.round(l/p),r.data[m+1]=Math.round(u/p),r.data[m+2]=Math.round(d/p),r.data[m+3]=Math.round(f/p)}}return r}const z=new Set([`healthy`,`recovered`,`sparse`]),B=new Set(Object.keys(r)),V=new Set([`ax-rejected`,`sparse-tree`,`budget`,`no-nodes`,`capture-failed`,`presentation-failed`,`deferred`,`requested-backend`]);function H(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.state!=`string`||!z.has(t.state)||typeof t.backend!=`string`||!B.has(t.backend))return;let n=U(t.timing);return{state:t.state,backend:t.backend,reason:typeof t.reason==`string`?t.reason:void 0,reasonCode:typeof t.reasonCode==`string`&&V.has(t.reasonCode)?t.reasonCode:void 0,customActions:W(t.customActions),effectiveDepth:typeof t.effectiveDepth==`number`?t.effectiveDepth:void 0,collapsedLeafIndexes:Array.isArray(t.collapsedLeafIndexes)?t.collapsedLeafIndexes.filter(e=>typeof e==`number`):void 0,...n?{timing:n}:{}}}function U(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.acquisitionMs==`number`&&typeof t.presentationMs==`number`)return{acquisitionMs:t.acquisitionMs,presentationMs:t.presentationMs}}function W(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.read==`number`&&typeof t.candidates==`number`)return{read:t.read,candidates:t.candidates,truncated:typeof t.truncated==`number`?t.truncated:0,blocked:t.blocked===!0}}function G(e){return e?.state===`sparse`}function K(e){return e?.backend===`private-ax`?`private-ax`:void 0}export{I as a,M as c,j as d,L as i,N as l,K as n,P as o,H as r,F as s,G as t,A as u};
|