agent-device 0.20.8 → 0.20.9

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.
Files changed (199) hide show
  1. package/README.md +94 -31
  2. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.8.apk → agent-device-android-ime-helper-0.20.9.apk} +0 -0
  3. package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.9.apk.sha256 +1 -0
  4. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.8.manifest.json → agent-device-android-ime-helper-0.20.9.manifest.json} +4 -4
  5. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.8.apk → agent-device-android-snapshot-helper-0.20.9.apk} +0 -0
  6. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.9.apk.sha256 +1 -0
  7. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.8.manifest.json → agent-device-android-snapshot-helper-0.20.9.manifest.json} +6 -6
  8. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +3 -0
  9. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +13 -7
  10. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +4 -112
  11. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +9 -1
  12. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +90 -0
  13. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +46 -10
  14. package/dist/src/agent-browser-tool.js +1 -1
  15. package/dist/src/agent-device-client.js +2 -2
  16. package/dist/src/android-adb.d.ts +5 -5
  17. package/dist/src/android-adb.js +1 -1
  18. package/dist/src/android.js +1 -1
  19. package/dist/src/app-helpers.js +1 -1
  20. package/dist/src/app-lifecycle.js +6 -7
  21. package/dist/src/app-lifecycle2.js +2 -2
  22. package/dist/src/app-log-reconnect.js +1 -1
  23. package/dist/src/app-log-runtime.js +3 -3
  24. package/dist/src/app-resolution.js +2 -2
  25. package/dist/src/app-state.js +2 -0
  26. package/dist/src/appearance.js +1 -0
  27. package/dist/src/apps.js +5 -5
  28. package/dist/src/artifacts.d.ts +1 -1
  29. package/dist/src/audio-probe.js +1 -1
  30. package/dist/src/auth-session.js +1 -1
  31. package/dist/src/backend-snapshot-options.js +1 -0
  32. package/dist/src/boot-diagnostics.js +2 -2
  33. package/dist/src/bounds.js +1 -0
  34. package/dist/src/byte-limit-stream.js +1 -0
  35. package/dist/src/cancel.js +1 -0
  36. package/dist/src/cli-config.js +1 -1
  37. package/dist/src/cli-help.js +25 -20
  38. package/dist/src/cli.js +6 -6
  39. package/dist/src/client-metro.js +1 -1
  40. package/dist/src/command-catalog.js +1 -0
  41. package/dist/src/command-metadata.js +1 -1
  42. package/dist/src/command-schema.js +1 -1
  43. package/dist/src/command-surface.js +1 -1
  44. package/dist/src/config.js +1 -0
  45. package/dist/src/connection-runtime.js +1 -1
  46. package/dist/src/connection.js +3 -3
  47. package/dist/src/contracts.js +1 -1
  48. package/dist/src/debug-symbols.js +3 -3
  49. package/dist/src/device-claim-inspection.js +1 -1
  50. package/dist/src/device-input-state.js +1 -1
  51. package/dist/src/device-ready.js +1 -1
  52. package/dist/src/device2.js +2 -2
  53. package/dist/src/dispatch.js +1 -1
  54. package/dist/src/entities.js +1 -1
  55. package/dist/src/find.js +1 -1
  56. package/dist/src/finders.js +1 -1
  57. package/dist/src/generic-settle.js +1 -1
  58. package/dist/src/generic.js +1 -1
  59. package/dist/src/harmonyos.js +1 -1
  60. package/dist/src/hdc.js +1 -1
  61. package/dist/src/helper-package-install.js +1 -0
  62. package/dist/src/helper.js +2 -2
  63. package/dist/src/host-process.js +1 -1
  64. package/dist/src/ime-lifecycle.js +2 -9
  65. package/dist/src/ime-recovery-marker.js +1 -0
  66. package/dist/src/index.d.ts +24 -15
  67. package/dist/src/index.js +1 -1
  68. package/dist/src/input-actions.js +4 -4
  69. package/dist/src/input-actions2.js +1 -1
  70. package/dist/src/input-actions3.js +1 -1
  71. package/dist/src/install-artifact.js +1 -1
  72. package/dist/src/install-artifact2.js +1 -1
  73. package/dist/src/install-source2.js +1 -1
  74. package/dist/src/interaction-common.js +1 -0
  75. package/dist/src/interaction-runtime.js +1 -1
  76. package/dist/src/interaction-snapshot.js +1 -1
  77. package/dist/src/interaction.js +1 -1
  78. package/dist/src/interaction2.js +1 -0
  79. package/dist/src/interactor.js +2 -2
  80. package/dist/src/interactor2.js +1 -1
  81. package/dist/src/interactors.js +1 -0
  82. package/dist/src/internal/bin.js +1 -1
  83. package/dist/src/internal/daemon.js +4 -7
  84. package/dist/src/internal/png-worker.js +1 -1
  85. package/dist/src/inventory.js +1 -1
  86. package/dist/src/keyed-lock.js +1 -0
  87. package/dist/src/lease-context.js +1 -1
  88. package/dist/src/lease.js +1 -1
  89. package/dist/src/limrun-runtime-dependencies.js +1 -1
  90. package/dist/src/limrun.d.ts +3 -1
  91. package/dist/src/limrun.js +1 -1
  92. package/dist/src/linux.js +1 -1
  93. package/dist/src/location-coordinates.js +1 -0
  94. package/dist/src/logcat.js +1 -1
  95. package/dist/src/manifest.js +1 -1
  96. package/dist/src/observability.js +1 -0
  97. package/dist/src/owner-identity.js +1 -1
  98. package/dist/src/perf.js +4 -0
  99. package/dist/src/physical-device-control.js +1 -1
  100. package/dist/src/platform-runtime-app-log-process.js +1 -1
  101. package/dist/src/platform-runtime-host.js +1 -1
  102. package/dist/src/platform-runtime-network-web-transport.js +1 -1
  103. package/dist/src/platform-runtime-open-target.js +1 -0
  104. package/dist/src/platform-runtime-operation-host.js +4 -4
  105. package/dist/src/platform-runtime-runtime-hints.js +2 -0
  106. package/dist/src/platform-runtime-screen-recording-apple-runner-host.js +1 -1
  107. package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
  108. package/dist/src/platform-runtime-screen-recording-apple-transport.js +1 -1
  109. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  110. package/dist/src/platform-runtime-screen-recording-web-host.js +1 -1
  111. package/dist/src/platform-runtime.js +1 -1
  112. package/dist/src/platform-runtime2.js +1 -0
  113. package/dist/src/plist.js +1 -1
  114. package/dist/src/png-resize.js +1 -0
  115. package/dist/src/png-worker-contract.js +1 -1
  116. package/dist/src/prepare-kind.js +13 -13
  117. package/dist/src/process-lock.js +1 -1
  118. package/dist/src/project-runtime.js +1 -0
  119. package/dist/src/provider-webdriver.js +1 -1
  120. package/dist/src/provider.js +1 -0
  121. package/dist/src/proxy.js +1 -1
  122. package/dist/src/react-native.js +1 -1
  123. package/dist/src/record-runtime.js +1 -1
  124. package/dist/src/record-trace.js +1 -1
  125. package/dist/src/recording-export-quality.js +1 -0
  126. package/dist/src/registry.js +29 -26
  127. package/dist/src/remote-config2.js +1 -1
  128. package/dist/src/replay.js +1 -1
  129. package/dist/src/reporting.js +3 -3
  130. package/dist/src/rolldown-runtime.js +1 -0
  131. package/dist/src/runner-client.js +1 -0
  132. package/dist/src/runner-disposal.js +1 -1
  133. package/dist/src/runner-lease.js +1 -1
  134. package/dist/src/runner-sequence.js +1 -1
  135. package/dist/src/runtime-transport.js +1 -1
  136. package/dist/src/runtime.js +3 -3
  137. package/dist/src/runtime2.js +4 -3
  138. package/dist/src/runtime3.js +1 -3
  139. package/dist/src/runtime4.js +3 -1
  140. package/dist/src/runtime5.js +1 -1
  141. package/dist/src/runtime6.js +1 -1
  142. package/dist/src/runtime7.js +1 -1
  143. package/dist/src/runtime8.js +1 -0
  144. package/dist/src/runtime9.js +1 -0
  145. package/dist/src/scoped-provider.js +1 -0
  146. package/dist/src/screenshot-density.js +1 -0
  147. package/dist/src/screenshot-geometry.js +1 -0
  148. package/dist/src/screenshot-result.js +4 -4
  149. package/dist/src/screenshot.js +1 -1
  150. package/dist/src/sdk-android-adb.d.ts +20 -2
  151. package/dist/src/sdk-android-adb.js +3 -3
  152. package/dist/src/sdk-batch-runner.js +3 -3
  153. package/dist/src/sdk-contracts.d.ts +3 -3
  154. package/dist/src/sdk-contracts.js +2 -2
  155. package/dist/src/sdk-device.js +1 -1
  156. package/dist/src/sdk-finders.js +1 -1
  157. package/dist/src/sdk-io.js +1 -1
  158. package/dist/src/sdk-remote-config.js +1 -1
  159. package/dist/src/sdk-selectors.d.ts +19 -19
  160. package/dist/src/sdk-selectors.js +1 -1
  161. package/dist/src/sdk.js +1 -0
  162. package/dist/src/selector-runtime.js +1 -1
  163. package/dist/src/selectors.d.ts +1 -1
  164. package/dist/src/selectors.js +1 -1
  165. package/dist/src/server.js +2 -2
  166. package/dist/src/session-target-evidence.js +1 -1
  167. package/dist/src/session.js +1 -30
  168. package/dist/src/session2.js +28 -0
  169. package/dist/src/setting-state.js +1 -1
  170. package/dist/src/shared.js +1 -1
  171. package/dist/src/simctl.js +1 -0
  172. package/dist/src/simulator-state.js +1 -0
  173. package/dist/src/simulator.js +1 -1
  174. package/dist/src/snapshot-runtime.js +1 -1
  175. package/dist/src/snapshot-session.js +1 -1
  176. package/dist/src/snapshot.js +8 -1
  177. package/dist/src/snapshot2.js +1 -1
  178. package/dist/src/snapshot3.js +1 -0
  179. package/dist/src/src.js +1 -1
  180. package/dist/src/src2.js +1 -2
  181. package/dist/src/src3.js +2 -1
  182. package/dist/src/string-enum.js +1 -0
  183. package/dist/src/tool-provider.js +3 -3
  184. package/dist/src/tool-provider2.js +1 -1
  185. package/dist/src/update-check.js +1 -1
  186. package/dist/src/verdict.js +1 -0
  187. package/dist/src/verified-file.js +1 -0
  188. package/dist/src/version.js +1 -1
  189. package/dist/src/video.js +1 -1
  190. package/dist/src/web.js +1 -1
  191. package/package.json +8 -4
  192. package/server.json +3 -3
  193. package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.8.apk.sha256 +0 -1
  194. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.8.apk.sha256 +0 -1
  195. package/dist/src/interaction-touch-reference-frame.js +0 -1
  196. package/dist/src/notifications.js +0 -1
  197. package/dist/src/platform-runtime-toolchain-host.js +0 -1
  198. package/dist/src/text-surface.js +0 -1
  199. package/dist/src/tool-provider3.js +0 -1
@@ -1 +1 @@
1
- import{S as e,_ as t}from"./sdk-contracts.js";import{Mt as n}from"./version.js";import{M as r,N as i,j as a}from"./sdk-batch-runner.js";import{C as o,E as s}from"./sdk-device.js";import{en as c,nn as l,rn as u}from"./prepare-kind.js";import{i as d}from"./output-path.js";import{g as f}from"./dispatch.js";import{Mt as p,Pt as m,d as h,f as g,l as _,u as v}from"./internal/daemon.js";import{t as y}from"./device-ready.js";import{t as b}from"./handler-utils.js";import{t as x}from"./recording-telemetry.js";import S from"node:path";function C(e){let r=n(`record`,e.flags);if(r)throw new t(`INVALID_ARGS`,r);let i=e.flags?.fps;if(i!==void 0&&(!Number.isInteger(i)||i<1||i>120))throw new t(`INVALID_ARGS`,`fps must be an integer between 1 and 120`);let a=u(e.flags?.quality);if(e.flags?.quality!==void 0&&a===void 0)throw new t(`INVALID_ARGS`,`quality must be one of: ${l.join(`, `)} (legacy numeric values 5-10 are accepted)`);return{scope:w(e.flags?.recordingScope),...i===void 0?{}:{fps:i},...a===void 0?{}:{exportQuality:a},showTouches:e.flags?.hideTouches!==!0,hideTouchesRequested:e.flags?.hideTouches===!0}}function w(e){if(e===void 0)return`app`;if(e===`app`||e===`device`||e===`system`)return e;throw new t(`INVALID_ARGS`,`record scope must be app, device, or system`)}function T(e){return{ok:!1,error:{code:`INVALID_ARGS`,message:p(e)?`record start with app scope and an explicit session requires an active app session; run open <app> first, or use --scope device to record the full screen`:`record start defaults to app scope and requires an active app session; run open <app> first, or use --scope device to record the full screen`}}}function E(e,t,n){return{ok:!0,data:{recording:`started`,outPath:e.clientOutPath??n,sessionStateDir:t,recordingBackend:e.backend,recordingScope:e.scope,recordOnlySession:e.recordOnlySession,activeSessionApp:e.activeSessionApp,showTouches:e.showTouches}}}function D(e){return{action:`start`,...e.clientOutPath?{requestedFileName:S.basename(e.clientOutPath)}:{},showTouches:e.showTouches}}function O(e){return{ok:!1,error:{code:`UNSUPPORTED_OPERATION`,message:`record is not supported on this device`,hint:e.hint??`Select an Apple, Android, physical HarmonyOS, or web target that supports screen recording.`,details:{reason:e.reason}}}}function k(e){let t=[A(e)];if(e.chunks&&e.chunks.length>1&&t.push(...e.chunks.slice(1).map(e=>({field:`chunkPath`,artifactType:`screen-recording-chunk`,path:e.path,localPath:e.clientOutPath,fileName:S.basename(e.clientOutPath??e.path)}))),e.telemetryPath){let n=e.clientOutPath?x(e.clientOutPath):void 0;t.push({field:`telemetryPath`,artifactType:`screen-recording-telemetry`,path:e.telemetryPath,localPath:n,fileName:S.basename(e.telemetryPath)})}return{ok:!0,data:{recording:`stopped`,outPath:e.outPath,telemetryPath:e.telemetryPath,artifacts:t,recordingBackend:e.backend,recordingScope:e.scope,recordOnlySession:e.recordOnlySession,activeSessionApp:e.activeSessionApp,durationMs:Math.max(0,e.completedAt-e.startedAt),showTouches:e.showTouches,warning:e.warning,overlayWarning:e.overlayWarning,chunks:e.chunks?.map(e=>({index:e.index,path:e.clientOutPath??e.path}))}}}function A(e){return{field:`outPath`,artifactType:`screen-recording`,path:e.outPath,localPath:e.clientOutPath,fileName:S.basename(e.clientOutPath??e.outPath)}}async function j(t){try{return await M(t)}catch(t){return{ok:!1,error:e(t)}}}async function M(e){let{req:t,sessionName:n,sessionStore:r}=e,i=r.get(n),{plan:a,scope:o}=N(t,i);if(a.kind===`start`&&!c(o)&&!i)return T(t);let s=await P(e,i);return a.kind===`start`?await F(e,s,C(t),a.use):await z(e,s,a.kind)}function N(e,t){let n=w(e.flags?.recordingScope);return{scope:n,plan:a({action:e.positionals?.[0],scope:n,hasLiveHandle:t?.screenRecording!==void 0})}}async function P(e,t){let n=t?.device??await f(e.req.flags??{});return await e.retainDeviceExecutionLock(n.id),t||(await y(n),H(e,n))}async function F(e,t,n,i){if(t.screenRecording)return{ok:!1,error:{code:`INVALID_ARGS`,message:`recording already in progress`}};let a=(await e.bindDevice(t.device,r)).facts.screenRecordingStart;if(!a.available)return O(a);let o=await e.bindDevice(t.device,i),{fence:s,outputPaths:c}=I(e,t),l=await o.operations.screenRecordingStart(L(e,t,n,s,c.outputPath));await _({admissionLedger:e.admissionLedger,session:t,sessionName:e.sessionName,sessionStore:e.sessionStore,device:t.device,owner:o.owner,fence:s,...l,throwIfCanceled:e.throwIfCanceled});let u=e.sessionStore.get(e.sessionName)?.screenRecording;if(!u)throw TypeError(`Screen recording adoption did not publish a live handle`);let d=u.handle.inspect();return b(e.sessionStore,t,e.req,e.req.command,D(d)),E(d,e.sessionStore.ensureSessionDir(e.sessionName),c.requestedPath)}function I(e,t){let n=g.store.resolvePath(e.sessionStore.resolveSessionDir(e.sessionName));return{fence:g.createNextFence({admissionLedger:e.admissionLedger,resourcePath:n,device:t.device}),outputPaths:d({requestedPath:e.req.positionals?.[1],platform:t.device.platform,cwd:e.req.meta?.cwd})}}function L(e,t,n,r,i){return{sessionId:e.sessionName,outputPath:i,clientOutputPath:e.req.meta?.clientArtifactPaths?.outPath,scope:n.scope,showTouches:n.showTouches,hideTouchesRequested:n.hideTouchesRequested,recordOnlySession:t.recordOnlySession===!0,activeSessionApp:R(t),exportQuality:n.exportQuality,fps:n.fps,fence:r}}function R(e){if(e.appBundleId)return{bundleId:e.appBundleId,...e.appName?{name:e.appName}:{}}}async function z(e,t,n){let r;try{r=n===`stop-live`?await v({session:t,sessionName:e.sessionName,sessionStore:e.sessionStore}):await V(e,t)}catch(n){throw B(e,t),n}let i=k(r);return b(e.sessionStore,t,e.req,e.req.command,{action:`stop`,outPath:r.outPath,...r.clientOutPath?{requestedFileName:S.basename(r.clientOutPath)}:{},showTouches:r.showTouches}),t.recordOnlySession&&e.sessionStore.delete(e.sessionName),i}function B(e,t){if(!t.recordOnlySession)return;let n=g.store.resolvePath(e.sessionStore.resolveSessionDir(e.sessionName)),r=g.store.read(n);r.status===`decoded`&&r.envelope.lifecycle===`completed`&&e.sessionStore.delete(e.sessionName)}async function V(e,n){let r=g.store.resolvePath(e.sessionStore.resolveSessionDir(e.sessionName)),a=g.store.read(r);if(a.status!==`decoded`||a.envelope.lifecycle!==`open`)throw new t(`INVALID_ARGS`,`no active recording`);if(a.envelope.sessionId!==e.sessionName)throw new t(`COMMAND_FAILED`,`Screen recording recovery record does not belong to the requested session`,{reason:`runtime-contract-invalid`});if(!s(a.envelope.device,o(n.device)))throw new t(`COMMAND_FAILED`,`Screen recording recovery device does not match the selected device`,{reason:`runtime-contract-invalid`});return await h({resourcePath:r,scope:e.requestScope,acquireControl:async(t,r)=>{let a=await e.bindExactDevice(n.device,t.owner,t.fence,i,r);return{reattach:async e=>await a.operations.screenRecordingReattach({envelope:e}),cleanup:async e=>await a.operations.screenRecordingCleanup({envelope:e}),[Symbol.asyncDispose]:async()=>{}}}})}function H(e,t){return{name:e.sessionName,sessionScope:m(e.req),device:t,createdAt:Date.now(),recordOnlySession:!0,actions:[]}}export{j as t};
1
+ import{C as e,_ as t}from"./sdk-contracts.js";import{w as n}from"./location-coordinates.js";import{$ as r,Q as i,Z as a}from"./sdk-batch-runner.js";import{C as o,E as s}from"./sdk-device.js";import{Ot as c}from"./prepare-kind.js";import{n as l,r as u}from"./recording-export-quality.js";import{i as d}from"./output-path.js";import{p as f}from"./dispatch.js";import{C as p,S as m,b as h,ft as g,mt as _,t as v,x as y}from"./internal/daemon.js";import{t as b}from"./device-ready.js";import{t as x}from"./handler-utils.js";import{t as S}from"./recording-telemetry.js";import C from"node:path";function w(e){let r=n(`record`,e.flags);if(r)throw new t(`INVALID_ARGS`,r);let i=e.flags?.fps;if(i!==void 0&&(!Number.isInteger(i)||i<1||i>120))throw new t(`INVALID_ARGS`,`fps must be an integer between 1 and 120`);let a=u(e.flags?.quality);if(e.flags?.quality!==void 0&&a===void 0)throw new t(`INVALID_ARGS`,`quality must be one of: ${l.join(`, `)} (legacy numeric values 5-10 are accepted)`);return{scope:T(e.flags?.recordingScope),...i===void 0?{}:{fps:i},...a===void 0?{}:{exportQuality:a},showTouches:e.flags?.hideTouches!==!0,hideTouchesRequested:e.flags?.hideTouches===!0}}function T(e){if(e===void 0)return`app`;if(e===`app`||e===`device`||e===`system`)return e;throw new t(`INVALID_ARGS`,`record scope must be app, device, or system`)}function E(e){return{ok:!1,error:{code:`INVALID_ARGS`,message:g(e)?`record start with app scope and an explicit session requires an active app session; run open <app> first, or use --scope device to record the full screen`:`record start defaults to app scope and requires an active app session; run open <app> first, or use --scope device to record the full screen`}}}function D(e,t,n){return{ok:!0,data:{recording:`started`,outPath:e.clientOutPath??n,sessionStateDir:t,recordingBackend:e.backend,recordingScope:e.scope,recordOnlySession:e.recordOnlySession,activeSessionApp:e.activeSessionApp,showTouches:e.showTouches}}}function O(e){return{action:`start`,...e.clientOutPath?{requestedFileName:C.basename(e.clientOutPath)}:{},showTouches:e.showTouches}}function k(e){return{ok:!1,error:{code:`UNSUPPORTED_OPERATION`,message:`record is not supported on this device`,hint:e.hint??`Select an Apple, Android, physical HarmonyOS, or web target that supports screen recording.`,details:{reason:e.reason}}}}function A(e){let t=[j(e)];if(e.chunks&&e.chunks.length>1&&t.push(...e.chunks.slice(1).map(e=>({field:`chunkPath`,artifactType:`screen-recording-chunk`,path:e.path,localPath:e.clientOutPath,fileName:C.basename(e.clientOutPath??e.path)}))),e.telemetryPath){let n=e.clientOutPath?S(e.clientOutPath):void 0;t.push({field:`telemetryPath`,artifactType:`screen-recording-telemetry`,path:e.telemetryPath,localPath:n,fileName:C.basename(e.telemetryPath)})}return{ok:!0,data:{recording:`stopped`,outPath:e.outPath,telemetryPath:e.telemetryPath,artifacts:t,recordingBackend:e.backend,recordingScope:e.scope,recordOnlySession:e.recordOnlySession,activeSessionApp:e.activeSessionApp,durationMs:Math.max(0,e.completedAt-e.startedAt),showTouches:e.showTouches,warning:e.warning,overlayWarning:e.overlayWarning,chunks:e.chunks?.map(e=>({index:e.index,path:e.clientOutPath??e.path}))}}}function j(e){return{field:`outPath`,artifactType:`screen-recording`,path:e.outPath,localPath:e.clientOutPath,fileName:C.basename(e.clientOutPath??e.outPath)}}async function M(t){try{return await N(t)}catch(t){return{ok:!1,error:e(t)}}}async function N(e){let{req:t,sessionName:n,sessionStore:r}=e,i=r.get(n),{plan:a,scope:o}=P(t,i);if(a.kind===`start`&&!c(o)&&!i)return E(t);let s=await F(e,i);return a.kind===`start`?await I(e,s,w(t),a.use):await B(e,s,a.kind)}function P(e,t){let n=T(e.flags?.recordingScope);return{scope:n,plan:a({action:e.positionals?.[0],scope:n,hasLiveHandle:t?.screenRecording!==void 0})}}async function F(e,t){let n=t?.device??await f(e.req.flags??{});return await e.retainDeviceExecutionLock(n.id),t||(await b(n),U(e,n))}async function I(e,t,n,r){if(t.screenRecording)return{ok:!1,error:{code:`INVALID_ARGS`,message:`recording already in progress`}};let a=(await e.bindDevice(t.device,i)).facts.screenRecordingStart;if(!a.available)return k(a);let o=await e.bindDevice(t.device,r),{fence:s,outputPaths:c}=L(e,t),l=await o.operations.screenRecordingStart(R(e,t,n,s,c.outputPath));await h({admissionLedger:e.admissionLedger,session:t,sessionName:e.sessionName,sessionStore:e.sessionStore,device:t.device,owner:o.owner,fence:s,...l,throwIfCanceled:e.throwIfCanceled});let u=e.sessionStore.get(e.sessionName)?.screenRecording;if(!u)throw TypeError(`Screen recording adoption did not publish a live handle`);let d=u.handle.inspect();return x(e.sessionStore,t,e.req,e.req.command,O(d)),D(d,e.sessionStore.ensureSessionDir(e.sessionName),c.requestedPath)}function L(e,t){let n=p.store.resolvePath(e.sessionStore.resolveSessionDir(e.sessionName));return{fence:p.createNextFence({admissionLedger:e.admissionLedger,resourcePath:n,device:t.device}),outputPaths:d({requestedPath:e.req.positionals?.[1],platform:t.device.platform,cwd:e.req.meta?.cwd})}}function R(e,t,n,r,i){return{sessionId:e.sessionName,outputPath:i,clientOutputPath:e.req.meta?.clientArtifactPaths?.outPath,scope:n.scope,showTouches:n.showTouches,hideTouchesRequested:n.hideTouchesRequested,recordOnlySession:t.recordOnlySession===!0,activeSessionApp:z(t),exportQuality:n.exportQuality,fps:n.fps,fence:r}}function z(e){if(e.appBundleId)return{bundleId:e.appBundleId,...e.appName?{name:e.appName}:{}}}async function B(e,t,n){let r;try{r=n===`stop-live`?await y({session:t,sessionName:e.sessionName,sessionStore:e.sessionStore}):await H(e,t)}catch(n){throw V(e,t),n}let i=A(r);return x(e.sessionStore,t,e.req,e.req.command,{action:`stop`,outPath:r.outPath,...r.clientOutPath?{requestedFileName:C.basename(r.clientOutPath)}:{},showTouches:r.showTouches}),t.recordOnlySession&&e.sessionStore.delete(e.sessionName),i}function V(e,t){if(!t.recordOnlySession)return;let n=p.store.resolvePath(e.sessionStore.resolveSessionDir(e.sessionName)),r=p.store.read(n);r.status===`decoded`&&r.envelope.lifecycle===`completed`&&e.sessionStore.delete(e.sessionName)}async function H(e,n){let i=p.store.resolvePath(e.sessionStore.resolveSessionDir(e.sessionName)),a=p.store.read(i);if(a.status!==`decoded`||a.envelope.lifecycle!==`open`)throw new t(`INVALID_ARGS`,`no active recording`);if(a.envelope.sessionId!==e.sessionName)throw new t(`COMMAND_FAILED`,`Screen recording recovery record does not belong to the requested session`,{reason:`runtime-contract-invalid`});if(!s(a.envelope.device,o(n.device)))throw new t(`COMMAND_FAILED`,`Screen recording recovery device does not match the selected device`,{reason:`runtime-contract-invalid`});return await m({resourcePath:i,scope:e.requestScope,acquireControl:async(t,i)=>v({runtime:await e.bindExactDevice(n.device,t.owner,t.fence,r,i),dispose:async()=>{}})})}function U(e,t){return{name:e.sessionName,sessionScope:_(e.req),device:t,createdAt:Date.now(),recordOnlySession:!0,actions:[]}}export{M as t};
@@ -1 +1 @@
1
- import{x as e}from"./screenshot-result.js";import{o as t}from"./dispatch.js";import{t as n}from"./handler-utils.js";import{t as r}from"./record-runtime.js";import i from"node:path";import a from"node:fs";function o(e){let n=(e.req.positionals?.[0]??``).toLowerCase();if(n!==`start`&&n!==`stop`)return t(`INVALID_ARGS`,`trace requires start|stop`);let r=e.sessionStore.get(e.sessionName);return r?n===`start`?s(e.req,e.sessionStore,r):c(e.req,e.sessionStore,r):t(`SESSION_NOT_FOUND`,`No active session`)}function s(r,o,s){if(s.trace)return t(`INVALID_ARGS`,`trace already in progress`);let c=e.expandHome(r.positionals?.[1]??o.defaultTracePath(s));return a.mkdirSync(i.dirname(c),{recursive:!0}),a.appendFileSync(c,``),s.trace={outPath:c,startedAt:Date.now()},n(o,s,r,r.command,{action:`start`,outPath:c}),{ok:!0,data:{trace:`started`,outPath:c}}}function c(e,r,a){if(!a.trace)return t(`INVALID_ARGS`,`no active trace`);let o=l(a.trace.outPath,e.positionals?.[1]);a.trace=void 0,n(r,a,e,e.command,{action:`stop`,outPath:o});let s=e.meta?.clientArtifactPaths?.outPath??o;return{ok:!0,data:{trace:`stopped`,outPath:o,artifacts:[{field:`outPath`,artifactType:`trace-log`,path:o,localPath:s,fileName:i.basename(s)}]}}}function l(t,n){if(!n)return t;let r=e.expandHome(n);return a.mkdirSync(i.dirname(r),{recursive:!0}),a.existsSync(t)?a.renameSync(t,r):a.appendFileSync(r,``),r}async function u(e){let{req:t,sessionName:n,sessionStore:i}=e,a=t.command;return a===`record`?r({req:t,sessionName:n,sessionStore:i,bindDevice:e.bindDevice,bindExactDevice:e.bindExactDevice,admissionLedger:e.admissionLedger,requestScope:e.requestScope,retainDeviceExecutionLock:e.retainDeviceExecutionLock,throwIfCanceled:e.throwIfCanceled}):a===`trace`?o({req:t,sessionName:n,sessionStore:i}):null}export{u as handleRecordTraceCommands};
1
+ import{x as e}from"./screenshot-result.js";import{a as t}from"./dispatch.js";import{t as n}from"./handler-utils.js";import{t as r}from"./record-runtime.js";import i from"node:path";import a from"node:fs";function o(e){let n=(e.req.positionals?.[0]??``).toLowerCase();if(n!==`start`&&n!==`stop`)return t(`INVALID_ARGS`,`trace requires start|stop`);let r=e.sessionStore.get(e.sessionName);return r?n===`start`?s(e.req,e.sessionStore,r):c(e.req,e.sessionStore,r):t(`SESSION_NOT_FOUND`,`No active session`)}function s(r,o,s){if(s.trace)return t(`INVALID_ARGS`,`trace already in progress`);let c=e.expandHome(r.positionals?.[1]??o.defaultTracePath(s));return a.mkdirSync(i.dirname(c),{recursive:!0}),a.appendFileSync(c,``),s.trace={outPath:c,startedAt:Date.now()},n(o,s,r,r.command,{action:`start`,outPath:c}),{ok:!0,data:{trace:`started`,outPath:c}}}function c(e,r,a){if(!a.trace)return t(`INVALID_ARGS`,`no active trace`);let o=l(a.trace.outPath,e.positionals?.[1]);a.trace=void 0,n(r,a,e,e.command,{action:`stop`,outPath:o});let s=e.meta?.clientArtifactPaths?.outPath??o;return{ok:!0,data:{trace:`stopped`,outPath:o,artifacts:[{field:`outPath`,artifactType:`trace-log`,path:o,localPath:s,fileName:i.basename(s)}]}}}function l(t,n){if(!n)return t;let r=e.expandHome(n);return a.mkdirSync(i.dirname(r),{recursive:!0}),a.existsSync(t)?a.renameSync(t,r):a.appendFileSync(r,``),r}async function u(e){let{req:t,sessionName:n,sessionStore:i}=e,a=t.command;return a===`record`?r({req:t,sessionName:n,sessionStore:i,bindDevice:e.bindDevice,bindExactDevice:e.bindExactDevice,admissionLedger:e.admissionLedger,requestScope:e.requestScope,retainDeviceExecutionLock:e.retainDeviceExecutionLock,throwIfCanceled:e.throwIfCanceled}):a===`trace`?o({req:t,sessionName:n,sessionStore:i}):null}export{u as handleRecordTraceCommands};
@@ -0,0 +1 @@
1
+ const e=[`medium`,`high`],t=`medium`;function n(t){return e.includes(t)}function r(e){let t=typeof e==`number`?e:i(e);return t!==void 0&&Number.isInteger(t)&&t>=5&&t<=10?t:void 0}function i(e){return typeof e==`string`&&/^\d+$/.test(e)?Number(e):void 0}function a(e){if(n(e))return e;let t=r(e);if(t!==void 0)return t<=7?`medium`:`high`}export{e as n,a as r,t};