agent-device 0.20.2 → 0.20.4
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.20.2.apk → agent-device-android-ime-helper-0.20.4.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.4.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.2.manifest.json → agent-device-android-ime-helper-0.20.4.manifest.json} +4 -4
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.4.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.4.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.2.manifest.json → agent-device-android-snapshot-helper-0.20.4.manifest.json} +6 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +57 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +45 -185
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +257 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +1 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +3 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +1 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +8 -2
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/android-adb.d.ts +4 -27
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android.js +1 -1
- package/dist/src/app-helpers.js +1 -0
- package/dist/src/app-inventory.d.ts +4 -0
- package/dist/src/app-lifecycle.js +7 -7
- package/dist/src/app-resolution.js +1 -1
- package/dist/src/apps.js +5 -5
- package/dist/src/boot-diagnostics.js +1 -1
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +27 -19
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +15 -14
- package/dist/src/client-metro.js +1 -1
- package/dist/src/{tv-remote.d.ts → cloud-artifacts.d.ts} +109 -126
- package/dist/src/command-metadata.js +1 -1
- package/dist/src/command-schema.js +1 -1
- package/dist/src/command-surface.js +1 -1
- package/dist/src/context.js +1 -1
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/debug-symbols.js +4 -4
- package/dist/src/device-input-state.d.ts +26 -0
- package/dist/src/device-input-state.js +1 -1
- package/dist/src/device.js +1 -9
- package/dist/src/devices2.js +1 -1
- package/dist/src/entities.js +1 -0
- package/dist/src/find.js +1 -1
- package/dist/src/finders.d.ts +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/helper.js +2 -2
- package/dist/src/ime-lifecycle.js +9 -0
- package/dist/src/index.d.ts +593 -556
- package/dist/src/input-actions.js +4 -4
- package/dist/src/install-artifact.js +4 -4
- package/dist/src/install-artifact2.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-snapshot.js +1 -1
- package/dist/src/interaction.d.ts +7 -4
- package/dist/src/interaction.js +1 -1
- package/dist/src/interactor.js +2 -2
- package/dist/src/interactor2.js +1 -1
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +14 -14
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/lease-context.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun.d.ts +171 -190
- package/dist/src/limrun.js +1 -1
- package/dist/src/linux.js +1 -1
- package/dist/src/logcat.js +1 -1
- package/dist/src/manifest.js +1 -1
- package/dist/src/metro.d.ts +1 -1
- package/dist/src/parser.js +2 -0
- package/dist/src/path-resolution.js +1 -1
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/plist-xml.js +1 -0
- package/dist/src/plist.js +1 -1
- package/dist/src/png-worker-contract.js +1 -1
- package/dist/src/process-lock.js +1 -1
- package/dist/src/provider-limrun-runtime.js +1 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-trace.js +1 -1
- package/dist/src/register-builtins.js +1 -1
- package/dist/src/registry.js +22 -22
- package/dist/src/remote-config2.js +1 -1
- package/dist/src/reporting.js +7 -7
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-disposal.js +1 -1
- package/dist/src/runner-lease.js +1 -1
- package/dist/src/runner-provider.js +1 -1
- package/dist/src/runner-sequence.js +1 -1
- package/dist/src/runtime-transport.js +1 -1
- package/dist/src/runtime.js +3 -3
- package/dist/src/screenshot-geometry.js +1 -0
- package/dist/src/screenshot-result.js +6 -0
- package/dist/src/sdk-android-adb.d.ts +5 -6
- package/dist/src/sdk-android-adb.js +3 -3
- package/dist/src/sdk-batch-runner.d.ts +2 -2
- package/dist/src/sdk-batch-runner.js +3 -3
- package/dist/src/sdk-contracts.d.ts +21 -25
- package/dist/src/sdk-contracts.js +2 -2
- package/dist/src/sdk-finders.d.ts +1 -1
- package/dist/src/sdk-finders.js +1 -1
- package/dist/src/sdk-io.js +1 -1
- package/dist/src/sdk-remote-config.d.ts +19 -4
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selector-vocabulary.js +1 -1
- package/dist/src/selectors.d.ts +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/server.js +2 -2
- package/dist/src/session-target-evidence.js +1 -1
- package/dist/src/session.js +8 -8
- package/dist/src/setting-state.js +1 -1
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot.js +1 -1
- package/dist/src/snapshot2.js +1 -1
- package/dist/src/src.js +1 -0
- package/dist/src/tool-provider.js +3 -3
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/tool-provider3.js +1 -1
- package/dist/src/update-check.js +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/viewport-dimension.js +14 -0
- package/package.json +28 -19
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.2.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.2.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.2.apk.sha256 +0 -1
- package/dist/src/android-input-method-overlays.js +0 -1
- package/dist/src/android-input-ownership.js +0 -1
- package/dist/src/apple-multitouch-support.js +0 -1
- package/dist/src/click-button.d.ts +0 -5
- package/dist/src/compatibility-policy.js +0 -1
- package/dist/src/gesture-plan-types.js +0 -1
- package/dist/src/gesture-plan.js +0 -1
- package/dist/src/launch-console.js +0 -1
- package/dist/src/recording-export-quality.js +0 -15
- package/dist/src/rolldown-runtime.js +0 -1
- package/dist/src/runtime2.js +0 -1
- package/dist/src/sdk-app-inventory.d.ts +0 -4
- package/dist/src/sdk-app-inventory.js +0 -1
- package/dist/src/snapshot-diagnostics.js +0 -6
- package/dist/src/xml.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"../png-worker-contract.js";import{S as a}from"../sdk-contracts.js";import{parentPort as o}from"node:worker_threads";function s(a){switch(a.kind){case`decode`:{let e=t(i(a.png),a.label);return{kind:`decode`,width:e.width,height:e.height,data:e.data}}case`encode`:{let t=new e.PNG({width:a.width,height:a.height});return t.data=i(a.data),{kind:`encode`,png:e.PNG.sync.write(t)}}case`rgb-difference`:return{kind:`rgb-difference`,...n(t(i(a.firstPng),a.label),t(i(a.secondPng),a.label))};case`diff-pixels`:return{kind:`diff-pixels`,...r(a)}}}function c(e){return e.buffer instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength}function l(e){return u(e).filter(c).map(e=>e.buffer)}function u(e){switch(e.kind){case`decode`:return[e.data];case`encode`:return[e.png];case`rgb-difference`:return[];case`diff-pixels`:return[e.diffData,e.diffMask]}}const d=o;d&&d.on(`message`,e=>{let t;try{t={id:e.id,ok:!0,result:s(e)}}catch(n){t={id:e.id,ok:!1,error:a(n)}}d.postMessage(t,t.ok?l(t.result):[])});export{l as resultTransferList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ln as e}from"./viewport-dimension.js";import{it as t}from"./sdk-batch-runner.js";function n(t){return e(t)}function r(e,r){let i=n(e),a=i.leaseId??r?.leaseId,o=i.tenantId??r?.tenantId,s=i.runId??r?.runId;if(!(!o||!s||!a))return t({tenantId:o,runId:s,leaseId:a,leaseBackend:i.leaseBackend??r?.backend,leaseProvider:i.leaseProvider??r?.leaseProvider,deviceKey:i.deviceKey??r?.deviceKey,clientId:i.clientId??r?.clientId,expiresAt:r?.expiresAt})}function i(e,r){let i=n(e),a=r?.lease??r?.deviceLease??void 0;return t({tenantId:i.tenantId??a?.tenantId,runId:i.runId??a?.runId,leaseId:i.leaseId??a?.leaseId,leaseTtlMs:i.leaseTtlMs,leaseBackend:i.leaseBackend??a?.leaseBackend,leaseProvider:i.leaseProvider??a?.leaseProvider,deviceKey:i.deviceKey??a?.deviceKey,clientId:i.clientId??a?.clientId})}function a(e){let n=e.meta,r=t({leaseId:o(n?.leaseId),clientId:o(n?.clientId),tenantId:o(n?.tenantId),runId:o(n?.runId),leaseProvider:o(n?.leaseProvider),deviceKey:o(n?.deviceKey)});return Object.keys(r).length>0?r:void 0}function o(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}export{a as i,n,i as r,r as t};
|
package/dist/src/lease.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./sdk-contracts.js";import{
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";import{Ht as t,hn as n,pn as r,sn as i,un as a}from"./viewport-dimension.js";import{n as o,r as s}from"./lease-context.js";import{_n as c}from"./internal/daemon.js";async function l(e){let{req:i,sessionName:c,sessionStore:l,leaseRegistry:p,providerRuntimeIds:m,providerRuntimeRequiredIds:h,leaseLifecycleProvider:g,cloudArtifactProvider:_}=e,v=o(i);switch(i.command){case t.artifacts:return{ok:!0,data:await f(i,s(i,l.get(c)),_)};case`lease_allocate`:{d(v.leaseProvider,m,h);let e=p.allocateLease(a(v)),t;try{t=await g?.allocate?.(e,u(i))}catch(t){throw p.releaseLease(n({leaseId:e.leaseId,tenantId:e.tenantId,runId:e.runId,leaseBackend:e.backend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId})),t}return{ok:!0,data:{lease:e,...t?{provider:t}:{}}}}case`lease_heartbeat`:{let e=p.heartbeatLease(r(v)),t=await g?.heartbeat?.(e,u(i));return{ok:!0,data:{lease:e,...t?{provider:t}:{}}}}case`lease_release`:{let e=n(v),t=p.getLease(e),r=t?await g?.release?.(t,u(i)):void 0;return{ok:!0,data:{released:p.releaseLease(e).released,...r?{provider:r}:{}}}}default:return null}}function u(e){return{flags:e.flags,cwd:typeof e.meta?.cwd==`string`?e.meta.cwd:void 0}}function d(t,n,r){if(!(!t||n===void 0||r===void 0||!r.includes(t)||n.includes(t)))throw new e(`UNSUPPORTED_OPERATION`,`Provider "${t}" is not available in this daemon runtime.`,{provider:t,hint:`Restart the daemon with ${t} configured, then retry lease allocation.`})}async function f(e,t,n){let r=g(e.flags,`providerSessionId`);return p(t,r)?await m(t.tenantId):await h(t,r,n)}function p(e,t){return i(e)||!e.leaseProvider&&!t}async function m(e){let t=await c(e);return{source:`daemon`,status:`ready`,artifacts:t,...t.length===0?{message:`No daemon artifacts available.`}:{}}}async function h(t,n,r){if(!t.leaseProvider)throw new e(`INVALID_ARGS`,`artifacts requires --provider for provider session lookup or an active cloud connection.`);if(!t.leaseId&&!n)throw new e(`INVALID_ARGS`,`artifacts requires an active cloud lease or --provider-session <id>.`);let i=await r?.listCloudArtifacts?.({provider:t.leaseProvider,leaseId:t.leaseId,providerSessionId:n});if(!i)throw new e(`UNSUPPORTED_OPERATION`,`Cloud artifacts are not available for provider "${t.leaseProvider}".`);return i}function g(e,t){let n=e?.[t];return typeof n==`string`&&n.length>0?n:void 0}export{l as handleLeaseCommands};
|
package/dist/src/limrun.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as
|
|
5
|
-
|
|
1
|
+
import { B as DeviceTarget, D as Rect, E as RawSnapshotNode, H as PlatformSelector, R as DeviceInfo, T as Point, f as LeaseBackend, j as SnapshotOptions$1, k as SnapshotBackend } from "./sdk-contracts.js";
|
|
2
|
+
import { c as ScrollDirection, o as GesturePlan, r as AndroidAdbProvider } from "./sdk-android-adb.js";
|
|
3
|
+
import { a as BackendSnapshotResult, d as DeviceRotation, f as BackMode, l as SessionSurface, n as CloudArtifactProvider, u as TvRemoteButton } from "./cloud-artifacts.js";
|
|
4
|
+
import { t as AppsFilter } from "./app-inventory.js";
|
|
5
|
+
import { n as AndroidKeyboardState, s as AndroidInputOwner, t as AndroidKeyboardDismissResult } from "./device-input-state.js";
|
|
6
|
+
import Limrun from "@limrun/api";
|
|
7
|
+
import "@limrun/api/instance-client";
|
|
8
|
+
import "@limrun/api/ios-client";
|
|
9
|
+
//#region packages/contracts/src/settings.d.ts
|
|
6
10
|
type SettingOptions = {
|
|
7
11
|
permissionTarget?: string;
|
|
8
12
|
permissionMode?: string;
|
|
@@ -10,18 +14,7 @@ type SettingOptions = {
|
|
|
10
14
|
longitude?: number;
|
|
11
15
|
};
|
|
12
16
|
//#endregion
|
|
13
|
-
//#region src/
|
|
14
|
-
type BackendSnapshotResult = {
|
|
15
|
-
nodes?: SnapshotNode[];
|
|
16
|
-
truncated?: boolean;
|
|
17
|
-
backend?: string;
|
|
18
|
-
snapshot?: SnapshotState;
|
|
19
|
-
appName?: string;
|
|
20
|
-
appBundleId?: string;
|
|
21
|
-
snapshotDiagnostics?: SnapshotDiagnosticsSummary;
|
|
22
|
-
} & SnapshotCaptureAnnotations;
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/contracts/runner-lease-context.d.ts
|
|
17
|
+
//#region packages/contracts/src/runner-lease-context.d.ts
|
|
25
18
|
type RunnerLogicalLeaseContext = {
|
|
26
19
|
leaseId?: string;
|
|
27
20
|
clientId?: string;
|
|
@@ -31,9 +24,10 @@ type RunnerLogicalLeaseContext = {
|
|
|
31
24
|
deviceKey?: string;
|
|
32
25
|
};
|
|
33
26
|
//#endregion
|
|
34
|
-
//#region
|
|
27
|
+
//#region packages/contracts/src/interactor-types.d.ts
|
|
35
28
|
type RunnerContext = {
|
|
36
29
|
requestId?: string;
|
|
30
|
+
signal?: AbortSignal;
|
|
37
31
|
appBundleId?: string;
|
|
38
32
|
verbose?: boolean;
|
|
39
33
|
logPath?: string;
|
|
@@ -62,6 +56,7 @@ type ElementSelectorTapOptions = {
|
|
|
62
56
|
};
|
|
63
57
|
type SnapshotOptions = SnapshotOptions$1 & {
|
|
64
58
|
appBundleId?: string;
|
|
59
|
+
signal?: AbortSignal;
|
|
65
60
|
includeRects?: boolean;
|
|
66
61
|
includeHiddenContentHints?: boolean;
|
|
67
62
|
surface?: SessionSurface;
|
|
@@ -111,7 +106,7 @@ type Interactor = {
|
|
|
111
106
|
setSetting(setting: string, state: string, appId?: string, options?: SettingOptions): Promise<Record<string, unknown> | void>;
|
|
112
107
|
};
|
|
113
108
|
//#endregion
|
|
114
|
-
//#region
|
|
109
|
+
//#region packages/contracts/src/device-inventory.d.ts
|
|
115
110
|
type DeviceInventoryRequest = {
|
|
116
111
|
platform?: PlatformSelector;
|
|
117
112
|
target?: DeviceTarget;
|
|
@@ -126,7 +121,7 @@ type DeviceInventoryRequest = {
|
|
|
126
121
|
androidSerialAllowlist?: string[];
|
|
127
122
|
};
|
|
128
123
|
//#endregion
|
|
129
|
-
//#region
|
|
124
|
+
//#region packages/contracts/src/device-provider.d.ts
|
|
130
125
|
type DeviceLease = {
|
|
131
126
|
leaseId: string;
|
|
132
127
|
tenantId: string;
|
|
@@ -140,7 +135,8 @@ type DeviceLease = {
|
|
|
140
135
|
expiresAt: number;
|
|
141
136
|
};
|
|
142
137
|
type LeaseLifecycleContext = {
|
|
143
|
-
|
|
138
|
+
flags?: Readonly<Record<string, unknown>>;
|
|
139
|
+
cwd?: string;
|
|
144
140
|
};
|
|
145
141
|
type LeaseLifecycleProvider = {
|
|
146
142
|
allocate?: (lease: DeviceLease, context?: LeaseLifecycleContext) => Promise<Record<string, unknown> | undefined>;
|
|
@@ -149,137 +145,7 @@ type LeaseLifecycleProvider = {
|
|
|
149
145
|
};
|
|
150
146
|
type DeviceInventoryProvider = (request: DeviceInventoryRequest) => Promise<DeviceInfo[] | null | undefined>;
|
|
151
147
|
//#endregion
|
|
152
|
-
//#region src/
|
|
153
|
-
declare class Deadline {
|
|
154
|
-
private readonly startedAtMs;
|
|
155
|
-
private readonly expiresAtMs;
|
|
156
|
-
private constructor();
|
|
157
|
-
static fromTimeoutMs(timeoutMs: number, nowMs?: number): Deadline;
|
|
158
|
-
remainingMs(nowMs?: number): number;
|
|
159
|
-
elapsedMs(nowMs?: number): number;
|
|
160
|
-
isExpired(nowMs?: number): boolean;
|
|
161
|
-
}
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/platforms/apple/core/runner/runner-cache.d.ts
|
|
164
|
-
type RunnerXctestrunCacheKind = 'exact' | 'restore-key' | 'miss' | 'external';
|
|
165
|
-
//#endregion
|
|
166
|
-
//#region src/platforms/apple/core/runner/runner-artifact.d.ts
|
|
167
|
-
type RunnerXctestrunArtifactState = 'valid' | 'rebuilt';
|
|
168
|
-
type ExternalXctestRunnerOptions = {
|
|
169
|
-
iosXctestrunFile?: string;
|
|
170
|
-
iosXctestDerivedDataPath?: string;
|
|
171
|
-
iosXctestEnvDir?: string;
|
|
172
|
-
};
|
|
173
|
-
//#endregion
|
|
174
|
-
//#region src/platforms/apple/core/runner/runner-contract.d.ts
|
|
175
|
-
type RunnerCommand = {
|
|
176
|
-
command: 'tap' | 'mouseClick' | 'longPress' | 'drag' | 'remotePress' | 'type' | 'swipe' | 'scroll' | 'desktopScroll' | 'findText' | 'querySelector' | 'readText' | 'snapshot' | 'screenshot' | 'back' | 'backInApp' | 'backSystem' | 'home' | 'rotate' | 'gesture' | 'gestureViewport' | 'appSwitcher' | 'keyboardDismiss' | 'keyboardReturn' | 'alert' | 'sequence' | 'recordStart' | 'recordStop' | 'status' | 'uptime' | 'activate' | 'terminate' | 'targetReset' | 'shutdown';
|
|
177
|
-
commandId?: string;
|
|
178
|
-
statusCommandId?: string;
|
|
179
|
-
appBundleId?: string;
|
|
180
|
-
text?: string;
|
|
181
|
-
selectorKey?: ElementSelectorKey;
|
|
182
|
-
selectorValue?: string;
|
|
183
|
-
allowNonHittableCoordinateFallback?: boolean;
|
|
184
|
-
delayMs?: number;
|
|
185
|
-
textEntryMode?: 'append' | 'replace';
|
|
186
|
-
action?: 'get' | 'accept' | 'dismiss';
|
|
187
|
-
x?: number;
|
|
188
|
-
y?: number;
|
|
189
|
-
button?: ClickButton;
|
|
190
|
-
remoteButton?: 'select' | 'menu' | 'home' | 'up' | 'down' | 'left' | 'right';
|
|
191
|
-
x2?: number;
|
|
192
|
-
y2?: number;
|
|
193
|
-
durationMs?: number;
|
|
194
|
-
/** Remaining request budget for runner work that performs bounded XCTest queries. */
|
|
195
|
-
timeoutMs?: number;
|
|
196
|
-
direction?: ScrollDirection;
|
|
197
|
-
amount?: number;
|
|
198
|
-
pixels?: number;
|
|
199
|
-
orientation?: DeviceRotation;
|
|
200
|
-
/** Canonical pointer samples planned by the portable gesture runtime. */
|
|
201
|
-
gesturePlan?: GesturePlan;
|
|
202
|
-
outPath?: string;
|
|
203
|
-
fps?: number;
|
|
204
|
-
maxSize?: number;
|
|
205
|
-
interactiveOnly?: boolean;
|
|
206
|
-
depth?: number;
|
|
207
|
-
scope?: string;
|
|
208
|
-
raw?: boolean;
|
|
209
|
-
fullscreen?: boolean;
|
|
210
|
-
inlineScreenshot?: boolean;
|
|
211
|
-
synthesized?: boolean;
|
|
212
|
-
steps?: RunnerSequenceStep[];
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* One allowlisted coordinate gesture step inside a fused `sequence` runner command.
|
|
216
|
-
* The kind set is intentionally narrow (tap/doubleTap/longPress) and validated on both the
|
|
217
|
-
* daemon and runner sides — see runner-sequence.ts (the single interpretation point).
|
|
218
|
-
*/
|
|
219
|
-
type RunnerSequenceStep = {
|
|
220
|
-
kind: 'tap' | 'doubleTap' | 'longPress';
|
|
221
|
-
x: number;
|
|
222
|
-
y: number;
|
|
223
|
-
durationMs?: number;
|
|
224
|
-
pauseMs?: number;
|
|
225
|
-
/**
|
|
226
|
-
* For `tap` steps on iOS non-tv: use the synthesized HID tap (synthesizedTapAt) fast path
|
|
227
|
-
* instead of the drag-based XCUICoordinate tapAt, matching the individual `tap` command.
|
|
228
|
-
*/
|
|
229
|
-
synthesized?: boolean;
|
|
230
|
-
};
|
|
231
|
-
//#endregion
|
|
232
|
-
//#region src/platforms/apple/core/runner/runner-provider.d.ts
|
|
233
|
-
type AppleRunnerCommandOptions = ExternalXctestRunnerOptions & {
|
|
234
|
-
verbose?: boolean;
|
|
235
|
-
logPath?: string;
|
|
236
|
-
traceLogPath?: string;
|
|
237
|
-
cleanStaleBundles?: boolean;
|
|
238
|
-
startupTimeoutMs?: number;
|
|
239
|
-
requestId?: string;
|
|
240
|
-
runnerLeaseContext?: RunnerLogicalLeaseContext;
|
|
241
|
-
};
|
|
242
|
-
type AppleRunnerLifecycleOptions = AppleRunnerCommandOptions & {
|
|
243
|
-
buildTimeoutMs?: number;
|
|
244
|
-
forceRunnerXctestrunRebuild?: boolean;
|
|
245
|
-
};
|
|
246
|
-
type AppleRunnerPrewarmOptions = AppleRunnerLifecycleOptions;
|
|
247
|
-
type AppleRunnerPrepareOptions = AppleRunnerLifecycleOptions & {
|
|
248
|
-
healthTimeoutMs: number;
|
|
249
|
-
prepareDeadline?: Deadline;
|
|
250
|
-
};
|
|
251
|
-
type AppleRunnerPrepareResult = {
|
|
252
|
-
runner: Record<string, unknown>;
|
|
253
|
-
cache?: RunnerXctestrunCacheKind;
|
|
254
|
-
artifact?: RunnerXctestrunArtifactState;
|
|
255
|
-
buildMs?: number;
|
|
256
|
-
connectMs: number;
|
|
257
|
-
healthCheckMs: number;
|
|
258
|
-
xctestrunPath?: string;
|
|
259
|
-
recoveryReason?: string;
|
|
260
|
-
failureReason?: string;
|
|
261
|
-
};
|
|
262
|
-
type AppleRunnerCommandExecutor = (device: DeviceInfo, command: RunnerCommand, options: AppleRunnerCommandOptions) => Promise<Record<string, unknown>>;
|
|
263
|
-
type AppleRunnerPrepareExecutor = (device: DeviceInfo, options: AppleRunnerPrepareOptions) => Promise<AppleRunnerPrepareResult>;
|
|
264
|
-
type AppleRunnerPrewarmExecutor = (device: DeviceInfo, options: AppleRunnerPrewarmOptions) => Promise<void>;
|
|
265
|
-
type AppleRunnerProvider = {
|
|
266
|
-
/**
|
|
267
|
-
* Executes a runner protocol command for an already resolved Apple target.
|
|
268
|
-
* Scoped providers may adapt this call to a request-local transport.
|
|
269
|
-
*/
|
|
270
|
-
runCommand: AppleRunnerCommandExecutor;
|
|
271
|
-
/**
|
|
272
|
-
* Proves a runner can answer a cheap command after any required local setup.
|
|
273
|
-
* Command-only providers may omit this and let callers fall back to uptime.
|
|
274
|
-
*/
|
|
275
|
-
prepare?: AppleRunnerPrepareExecutor;
|
|
276
|
-
/**
|
|
277
|
-
* Starts runner setup opportunistically. This must remain best-effort.
|
|
278
|
-
*/
|
|
279
|
-
prewarm?: AppleRunnerPrewarmExecutor;
|
|
280
|
-
};
|
|
281
|
-
//#endregion
|
|
282
|
-
//#region src/provider-device-runtime.d.ts
|
|
148
|
+
//#region packages/contracts/src/provider-device-runtime.d.ts
|
|
283
149
|
type ProviderDeviceInstallResult = {
|
|
284
150
|
bundleId?: string;
|
|
285
151
|
packageName?: string;
|
|
@@ -291,6 +157,15 @@ type ProviderDeviceInstallOptions = {
|
|
|
291
157
|
appIdentifierHint?: string;
|
|
292
158
|
packageNameHint?: string;
|
|
293
159
|
};
|
|
160
|
+
type ProviderPortReverseOptions = {
|
|
161
|
+
leaseId: string;
|
|
162
|
+
provider?: string;
|
|
163
|
+
devicePort: number;
|
|
164
|
+
hostPort: number;
|
|
165
|
+
name: string;
|
|
166
|
+
};
|
|
167
|
+
type ProviderExpiredLeaseRecovery = (lease: DeviceLease) => Promise<void>;
|
|
168
|
+
/** Provider adapter contract; root owns active-runtime and request composition. */
|
|
294
169
|
type ProviderDeviceRuntime = {
|
|
295
170
|
provider: string;
|
|
296
171
|
leaseLifecycle: LeaseLifecycleProvider;
|
|
@@ -298,64 +173,170 @@ type ProviderDeviceRuntime = {
|
|
|
298
173
|
cloudArtifacts?: CloudArtifactProvider;
|
|
299
174
|
deviceInventoryProvider: DeviceInventoryProvider;
|
|
300
175
|
ownsDevice(device: DeviceInfo): boolean;
|
|
301
|
-
/**
|
|
302
|
-
* Builds the interactor for an owned device. `runnerContext` carries the
|
|
303
|
-
* per-request context (requestId for cancellation, appBundleId, log paths);
|
|
304
|
-
* runtimes composing the shared Apple interactor should thread it through so
|
|
305
|
-
* runner calls stay attributable to the request that issued them.
|
|
306
|
-
*/
|
|
307
176
|
getInteractor(device: DeviceInfo, runnerContext?: RunnerContext): Interactor | undefined;
|
|
308
|
-
/**
|
|
309
|
-
* Apple runner transport for an owned device. When present, the daemon scopes
|
|
310
|
-
* the WHOLE request with it (via the `appleRunnerProvider` request resolver),
|
|
311
|
-
* so daemon routes that issue runner commands outside interactor methods
|
|
312
|
-
* (keyboard, native alert, point read, iOS sequences) reach the provider
|
|
313
|
-
* transport instead of the local XCTest runtime.
|
|
314
|
-
*/
|
|
315
|
-
getAppleRunnerProvider?(device: DeviceInfo): AppleRunnerProvider | AppleRunnerCommandExecutor | undefined;
|
|
316
177
|
installApp?(device: DeviceInfo, app: string, appPath: string, options?: ProviderDeviceInstallOptions): Promise<ProviderDeviceInstallResult | undefined>;
|
|
317
178
|
installInstallablePath?(device: DeviceInfo, installablePath: string, options?: ProviderDeviceInstallOptions): Promise<ProviderDeviceInstallResult | undefined>;
|
|
318
179
|
configurePortReverse?(options: ProviderPortReverseOptions): Promise<Record<string, unknown> | undefined>;
|
|
319
180
|
shutdown(): Promise<void>;
|
|
320
181
|
};
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region packages/provider-limrun/src/runtime-dependencies.d.ts
|
|
184
|
+
type LimrunAdbCommandOptions = {
|
|
185
|
+
allowFailure?: boolean;
|
|
186
|
+
binaryStdout?: boolean;
|
|
187
|
+
stdin?: string | Buffer;
|
|
188
|
+
timeoutMs?: number;
|
|
189
|
+
signal?: AbortSignal;
|
|
190
|
+
};
|
|
191
|
+
type LimrunAdbCommandResult = {
|
|
192
|
+
exitCode: number;
|
|
193
|
+
stdout: string;
|
|
194
|
+
stderr: string;
|
|
195
|
+
stdoutBuffer?: Buffer;
|
|
196
|
+
};
|
|
197
|
+
type LimrunAdbExecutor = (args: string[], options?: LimrunAdbCommandOptions) => Promise<LimrunAdbCommandResult>;
|
|
198
|
+
type LimrunPortReverseEndpoint = `tcp:${number}` | `localabstract:${string}`;
|
|
199
|
+
type LimrunPortReverseMapping = {
|
|
200
|
+
local: LimrunPortReverseEndpoint;
|
|
201
|
+
remote: LimrunPortReverseEndpoint;
|
|
202
|
+
ownerId?: string;
|
|
203
|
+
};
|
|
204
|
+
type LimrunPortReverseOptions = {
|
|
205
|
+
signal?: AbortSignal;
|
|
206
|
+
timeoutMs?: number;
|
|
207
|
+
};
|
|
208
|
+
type LimrunPortReverse = {
|
|
209
|
+
ensure(mapping: LimrunPortReverseMapping, options?: LimrunPortReverseOptions): Promise<void>;
|
|
210
|
+
remove(local: LimrunPortReverseEndpoint, options?: LimrunPortReverseOptions): Promise<void>;
|
|
211
|
+
removeAllOwned(ownerId: string, options?: LimrunPortReverseOptions): Promise<void>;
|
|
212
|
+
list?(options?: LimrunPortReverseOptions): Promise<LimrunPortReverseMapping[]>;
|
|
213
|
+
};
|
|
214
|
+
type LimrunAdbProvider = {
|
|
215
|
+
exec: LimrunAdbExecutor;
|
|
216
|
+
reverse?: LimrunPortReverse;
|
|
217
|
+
text?: (request: {
|
|
218
|
+
action: 'type' | 'fill';
|
|
219
|
+
text: string;
|
|
220
|
+
delayMs?: number;
|
|
221
|
+
target?: {
|
|
222
|
+
x: number;
|
|
223
|
+
y: number;
|
|
224
|
+
};
|
|
225
|
+
}) => Promise<void>;
|
|
226
|
+
};
|
|
227
|
+
type LimrunAndroidKeyboardState = {
|
|
228
|
+
visible: boolean;
|
|
229
|
+
inputType?: string;
|
|
230
|
+
type?: 'text' | 'number' | 'email' | 'phone' | 'password' | 'datetime' | 'unknown';
|
|
231
|
+
inputMethodPackage?: string;
|
|
232
|
+
focusedPackage?: string;
|
|
233
|
+
focusedResourceId?: string;
|
|
234
|
+
inputOwner: AndroidInputOwner;
|
|
235
|
+
};
|
|
236
|
+
type LimrunAndroidKeyboardDismissResult = LimrunAndroidKeyboardState & {
|
|
237
|
+
attempts: number;
|
|
238
|
+
wasVisible: boolean;
|
|
239
|
+
dismissed: boolean;
|
|
327
240
|
};
|
|
328
|
-
type ProviderExpiredLeaseRecovery = (lease: DeviceLease) => Promise<void>;
|
|
329
241
|
//#endregion
|
|
330
|
-
//#region
|
|
242
|
+
//#region packages/provider-limrun/src/ios.d.ts
|
|
243
|
+
type LimrunIosRemoteInstallOptions = {
|
|
244
|
+
md5?: string;
|
|
245
|
+
relaunch?: boolean;
|
|
246
|
+
appIdentifierHint?: string;
|
|
247
|
+
};
|
|
248
|
+
type LimrunIosRemoteInstallResult = {
|
|
249
|
+
appId?: string;
|
|
250
|
+
};
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region packages/provider-limrun/src/device-session.d.ts
|
|
253
|
+
type LimrunRecordingQuality = 5 | 6 | 7 | 8 | 9 | 10;
|
|
254
|
+
type LimrunInstalledApp = {
|
|
255
|
+
id: string;
|
|
256
|
+
name?: string;
|
|
257
|
+
installType?: string;
|
|
258
|
+
};
|
|
259
|
+
type LimrunForegroundApp = {
|
|
260
|
+
appId?: string;
|
|
261
|
+
activity?: string;
|
|
262
|
+
};
|
|
263
|
+
type LimrunIosCommandResult = {
|
|
264
|
+
code: number;
|
|
265
|
+
stdout: string;
|
|
266
|
+
stderr: string;
|
|
267
|
+
};
|
|
268
|
+
type LimrunIosCommandExecution = {
|
|
269
|
+
on(event: 'line-stdout' | 'line-stderr', listener: (line: string) => void): LimrunIosCommandExecution;
|
|
270
|
+
on(event: 'exit', listener: (code: number) => void): LimrunIosCommandExecution;
|
|
271
|
+
on(event: 'error', listener: (error: Error) => void): LimrunIosCommandExecution;
|
|
272
|
+
off(event: 'line-stdout' | 'line-stderr', listener: (line: string) => void): LimrunIosCommandExecution;
|
|
273
|
+
off(event: 'exit', listener: (code: number) => void): LimrunIosCommandExecution;
|
|
274
|
+
off(event: 'error', listener: (error: Error) => void): LimrunIosCommandExecution;
|
|
275
|
+
wait(): Promise<LimrunIosCommandResult>;
|
|
276
|
+
stop(): void;
|
|
277
|
+
};
|
|
278
|
+
type LimrunDeviceSessionBase = {
|
|
279
|
+
readonly platform: 'android' | 'ios';
|
|
280
|
+
readonly device: DeviceInfo;
|
|
281
|
+
readonly interactor: Interactor;
|
|
282
|
+
listApps(filter?: AppsFilter): Promise<LimrunInstalledApp[]>;
|
|
283
|
+
pressKey(key: string, modifiers?: string[]): Promise<void>;
|
|
284
|
+
startRecording(options?: {
|
|
285
|
+
quality?: LimrunRecordingQuality;
|
|
286
|
+
}): Promise<void>;
|
|
287
|
+
stopRecording(options: {
|
|
288
|
+
outPath: string;
|
|
289
|
+
}): Promise<string>;
|
|
290
|
+
};
|
|
291
|
+
type LimrunAndroidDeviceSession$1 = LimrunDeviceSessionBase & {
|
|
292
|
+
readonly platform: 'android';
|
|
293
|
+
readonly adb: LimrunAdbProvider;
|
|
294
|
+
getForegroundApp(): Promise<LimrunForegroundApp | undefined>;
|
|
295
|
+
getKeyboardState(): Promise<LimrunAndroidKeyboardState>;
|
|
296
|
+
dismissKeyboard(): Promise<LimrunAndroidKeyboardDismissResult>;
|
|
297
|
+
readLogs(lineLimit: number): Promise<string>;
|
|
298
|
+
installRemoteApp(url: string): Promise<void>;
|
|
299
|
+
};
|
|
300
|
+
type LimrunIosDeviceSession = LimrunDeviceSessionBase & {
|
|
301
|
+
readonly platform: 'ios';
|
|
302
|
+
readonly viewport: {
|
|
303
|
+
width: number;
|
|
304
|
+
height: number;
|
|
305
|
+
};
|
|
306
|
+
readLogs(appId: string, lineLimit: number): Promise<string>;
|
|
307
|
+
installRemoteApp(url: string, options?: LimrunIosRemoteInstallOptions): Promise<LimrunIosRemoteInstallResult>;
|
|
308
|
+
runSimctl(args: string[]): LimrunIosCommandExecution;
|
|
309
|
+
};
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region packages/provider-limrun/src/runtime.d.ts
|
|
331
312
|
type LimrunRuntimeOptions = {
|
|
332
313
|
apiKey: string;
|
|
333
314
|
region?: string;
|
|
334
315
|
};
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/sdk/limrun-runtime-types.d.ts
|
|
318
|
+
type LimrunAndroidDeviceSession = Omit<LimrunAndroidDeviceSession$1, 'adb' | 'getKeyboardState' | 'dismissKeyboard'> & {
|
|
319
|
+
readonly adb: AndroidAdbProvider;
|
|
320
|
+
getKeyboardState(): Promise<AndroidKeyboardState>;
|
|
321
|
+
dismissKeyboard(): Promise<AndroidKeyboardDismissResult>;
|
|
322
|
+
};
|
|
323
|
+
type LimrunDeviceSession = LimrunAndroidDeviceSession | LimrunIosDeviceSession;
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/provider-limrun-runtime.d.ts
|
|
335
326
|
declare class LimrunRuntime implements ProviderDeviceRuntime {
|
|
336
|
-
private readonly
|
|
337
|
-
private readonly sessions;
|
|
338
|
-
private readonly options;
|
|
327
|
+
private readonly implementation;
|
|
339
328
|
readonly provider = "limrun";
|
|
340
|
-
readonly leaseLifecycle: LeaseLifecycleProvider;
|
|
341
|
-
readonly recoverExpiredLease: ProviderExpiredLeaseRecovery;
|
|
342
|
-
readonly deviceInventoryProvider: DeviceInventoryProvider;
|
|
343
329
|
constructor(options: LimrunRuntimeOptions);
|
|
330
|
+
get leaseLifecycle(): LeaseLifecycleProvider;
|
|
331
|
+
get recoverExpiredLease(): ProviderExpiredLeaseRecovery;
|
|
332
|
+
get deviceInventoryProvider(): DeviceInventoryProvider;
|
|
344
333
|
ownsDevice(device: DeviceInfo): boolean;
|
|
345
334
|
getInteractor(device: DeviceInfo): Interactor | undefined;
|
|
335
|
+
getDeviceSession(device: DeviceInfo): LimrunDeviceSession | undefined;
|
|
346
336
|
installApp(device: DeviceInfo, app: string, appPath: string, options?: ProviderDeviceInstallOptions): Promise<ProviderDeviceInstallResult | undefined>;
|
|
347
337
|
installInstallablePath(device: DeviceInfo, installablePath: string, options?: ProviderDeviceInstallOptions): Promise<ProviderDeviceInstallResult | undefined>;
|
|
348
338
|
configurePortReverse(options: ProviderPortReverseOptions): Promise<Record<string, unknown> | undefined>;
|
|
349
339
|
shutdown(): Promise<void>;
|
|
350
|
-
private allocate;
|
|
351
|
-
private createIosSession;
|
|
352
|
-
private createAndroidSession;
|
|
353
|
-
private buildInstanceMetadata;
|
|
354
|
-
private release;
|
|
355
|
-
private releaseRecoveredSession;
|
|
356
|
-
private terminateSession;
|
|
357
|
-
private getSessionForDevice;
|
|
358
|
-
private requireAndroidPortReverseSession;
|
|
359
340
|
}
|
|
360
341
|
//#endregion
|
|
361
|
-
export { LimrunRuntime, type LimrunRuntimeOptions };
|
|
342
|
+
export { type LimrunAndroidDeviceSession, type LimrunDeviceSession, type LimrunIosCommandExecution, type LimrunIosDeviceSession, LimrunRuntime, type LimrunRuntimeOptions };
|
package/dist/src/limrun.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./
|
|
1
|
+
import{t as e}from"./provider-limrun-runtime.js";export{e as LimrunRuntime};
|
package/dist/src/linux.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./sdk-contracts.js";import{
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";import{w as t}from"./screenshot-geometry.js";import{I as n}from"./sdk-android-adb.js";import{t as r}from"./snapshot.js";import{t as i}from"./tool-provider2.js";import{doubleClickLinux as a,fillLinux as o,focusLinux as s,longPressLinux as c,pressLinux as l,scrollLinux as u,sendKey as d,swipeLinux as f,typeLinux as p}from"./input-actions2.js";async function m(e){await i().desktop.openTarget(e)}async function h(e){await i().desktop.closeApp(e)}async function g(){await d(`alt+Left`,[`56:1`,`105:1`,`105:0`,`56:0`])}async function _(){await d(`super+d`,[`125:1`,`32:1`,`32:0`,`125:0`])}async function v(){return await i().clipboard.readText()}async function y(e){await i().clipboard.writeText(e)}async function b(e,t){await i().screenshot.capture(e,t)}function x(){return{open:e=>m(e),openDevice:()=>Promise.resolve(),close:e=>h(e),tap:(e,t)=>l(e,t),doubleTap:(e,t)=>a(e,t),longPress:(e,t,n)=>c(e,t,n),focus:(e,t)=>s(e,t),type:(e,t)=>p(e,t),fill:(e,t,n,r)=>o(e,t,n,r),scroll:(e,t)=>u(e,t),performGesture:async n=>{if(n.topology===`two`)throw new e(`UNSUPPORTED_OPERATION`,`Multi-touch gestures are not supported on Linux`);let{start:r,end:i}=t(n);await f(r.x,r.y,i.x,i.y,n.durationMs)},screenshot:(e,t)=>b(e,t),snapshot:async e=>{let t=await n(`snapshot_capture`,async()=>await r(e?.surface,e?.signal),{backend:`linux-atspi`});return{nodes:t.nodes??[],truncated:t.truncated??!1,backend:`linux-atspi`}},back:()=>g(),home:()=>_(),setOrientation:()=>{throw new e(`UNSUPPORTED_OPERATION`,`orientation not supported on Linux`)},appSwitcher:()=>{throw new e(`UNSUPPORTED_OPERATION`,`appSwitcher not yet supported on Linux`)},tvRemote:()=>{throw new e(`UNSUPPORTED_OPERATION`,`tv-remote not supported on Linux`)},readClipboard:()=>v(),writeClipboard:e=>y(e),setSetting:()=>{throw new e(`UNSUPPORTED_OPERATION`,`setSetting not supported on Linux`)}}}export{x as createLinuxInteractor};
|
package/dist/src/logcat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{o as e}from"./png-worker-contract.js";import{_ as t}from"./sdk-contracts.js";import{n}from"./sdk-android-adb.js";import"node:fs";var r=e({captureAndroidLogcatWithAdb:()=>i,streamAndroidLogcatWithAdb:()=>a});async function i(e,t={}){let r=[`logcat`,`-d`,`-v`,`time`];t.lines!==void 0&&r.push(`-t`,String(Math.max(1,Math.floor(t.lines))));let i=await e(r,{allowFailure:!0,timeoutMs:t.timeoutMs,signal:t.signal});if(i.exitCode!==0)throw n(`Failed to capture Android logcat`,i);return i.stdout}function a(e,n={}){if(!e.spawn)throw new t(`UNSUPPORTED_OPERATION`,`Android ADB provider does not support streams`,{capability:`adb.spawn`});let r=[`logcat`,`-v`,`time`];n.pid&&r.push(`--pid`,n.pid);let i=e.spawn(r,{stdio:[`ignore`,`pipe`,`pipe`],signal:n.signal});return n.output&&i.stdout&&i.stdout.pipe(n.output,{end:!1}),i}export{r as n,a as r,i as t};
|
package/dist/src/manifest.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e,v as t}from"./sdk-android-adb.js";import
|
|
1
|
+
import{m as e,v as t}from"./sdk-android-adb.js";import n from"node:path";import{TextDecoder as r}from"node:util";import{promises as i}from"node:fs";import a from"node:os";import o from"node:fs/promises";const s=[`emulator`,`platform-tools`,n.join(`cmdline-tools`,`latest`,`bin`),n.join(`cmdline-tools`,`tools`,`bin`)];function c(e){let t=new Set,n=[];for(let r of e){let e=r.trim();!e||t.has(e)||(t.add(e),n.push(e))}return n}function l(e=process.env){let t=e.ANDROID_SDK_ROOT?.trim(),r=e.ANDROID_HOME?.trim(),i=e.HOME?.trim()||a.homedir(),o=i?n.join(i,`Android`,`Sdk`):``;return c([t??``,r??``,o])}async function u(e){try{return await i.access(e,i.constants.X_OK),!0}catch{return!1}}async function d(e=process.env){let t=[],r;for(let i of l(e)){let e=[];for(let t of s){let r=n.join(i,t);await u(r)&&e.push(r)}e.length!==0&&(r||=i,t.push(...e))}if(r&&(e.ANDROID_SDK_ROOT=e.ANDROID_SDK_ROOT?.trim()||r,e.ANDROID_HOME=e.ANDROID_HOME?.trim()||r),t.length===0)return;let i=(e.PATH??``).split(n.delimiter).map(e=>e.trim()).filter(e=>e.length>0);e.PATH=c([...t,...i]).join(n.delimiter)}const f=new r(`utf-16le`);let p;async function m(e){for(let t of[`AndroidManifest.xml`,`base/manifest/AndroidManifest.xml`]){let n=await h(e,t);if(!n)continue;let r=g(n);if(r)return r}return await T(e)}async function h(e,n){try{let r=await t(`unzip`,[`-p`,e,n],{allowFailure:!0,binaryStdout:!0});return r.exitCode!==0||!r.stdoutBuffer||r.stdoutBuffer.length===0?void 0:r.stdoutBuffer}catch{return}}function g(e){return e.subarray(0,Math.min(e.length,128)).toString(`utf8`).trimStart().startsWith(`<`)?_(e.toString(`utf8`)):v(e)}function _(e){return e.match(/<manifest\b[^>]*\bpackage\s*=\s*["']([^"']+)["']/i)?.[1]}function v(e){if(e.length<8||e.readUInt16LE(0)!==3)return;let t;for(let n=e.readUInt16LE(2);n+8<=e.length;){let r=e.readUInt16LE(n),i=e.readUInt16LE(n+2),a=e.readUInt32LE(n+4);if(a<=0||n+a>e.length)return;if(r===1)t=b(e.subarray(n,n+a));else if(r===258&&t){let r=y(e,n,i,t);if(r)return r}n+=a}}function y(e,t,n,r){if(n<36||t+n>e.length||r[e.readUInt32LE(t+20)]!==`manifest`)return;let i=e.readUInt16LE(t+24),a=e.readUInt16LE(t+26),o=e.readUInt16LE(t+28),s=t+i;for(let t=0;t<o;t+=1){let n=s+t*a;if(n+20>e.length)return;if(r[e.readUInt32LE(n+4)]!==`package`)continue;let i=e.readUInt32LE(n+8);if(i!==4294967295)return r[i];let o=e.readUInt8(n+15),c=e.readUInt32LE(n+16);return o===3?r[c]:void 0}}function b(e){if(e.length<28)return[];let t=e.readUInt32LE(8),n=e.readUInt32LE(16),r=e.readUInt32LE(20),i=(n&256)!=0,a=[];for(let n=0;n<t;n+=1){let t=28+n*4;if(t+4>e.length)return a;let o=r+e.readUInt32LE(t);a.push(i?x(e,o):S(e,o))}return a}function x(e,t){let[,n]=C(e,t),[r,i]=C(e,t+n),a=t+n+i;return e.subarray(a,a+r).toString(`utf8`)}function S(e,t){let[n,r]=w(e,t),i=t+r;return f.decode(e.subarray(i,i+n*2))}function C(e,t){let n=e.readUInt8(t);if(!(n&128))return[n,1];let r=e.readUInt8(t+1);return[(n&127)<<8|r,2]}function w(e,t){let n=e.readUInt16LE(t);if(!(n&32768))return[n,2];let r=e.readUInt16LE(t+2);return[(n&32767)<<16|r,4]}async function T(e){let n=await E();if(!n)return;let r=await t(n,[`dump`,`badging`,e],{allowFailure:!0});if(r.exitCode===0)return r.stdout.match(/package:\s+name='([^']+)'/)?.[1]}async function E(){if(p!==void 0)return p??void 0;try{for(let t of l()){let r=n.join(t,`build-tools`);try{let t=(await o.readdir(r)).sort((e,t)=>t.localeCompare(e,void 0,{numeric:!0}));for(let i of t){let t=n.join(r,i,`aapt`);if(n.isAbsolute(t)&&await e(t))return p=t,t}}catch{}}}catch{}p=null}export{d as n,m as t};
|
package/dist/src/metro.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as SessionRuntimeHints } from "./sdk-contracts.js";
|
|
2
2
|
import { d as PrepareMetroRuntimeResult, f as ReloadMetroResult, o as MetroPrepareKind, p as MetroBridgeScope } from "./sdk-remote-config.js";
|
|
3
3
|
//#region src/utils/url.d.ts
|
|
4
4
|
declare function normalizeBaseUrl(input: string): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./entities.js";const t=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.:-`),n=new Set([` `,` `,`
|
|
2
|
+
`,`\r`]),r=new Set([`__defineGetter__`,`__defineSetter__`,`__proto__`,`constructor`,`prototype`]);function i(e,t={}){let n=t.maxDocumentChars??134217728;if(e.length>n)throw Error(`XML document exceeds maximum supported size of ${n} characters.`);return new a(e).parse()}var a=class{roots=[];stack=[];index=0;xml;constructor(e){this.xml=e}parse(){for(this.skipByteOrderMark();this.index<this.xml.length;)this.readNextToken();return this.assertFullyClosed(),this.roots}readNextToken(){if(this.xml[this.index]!==`<`){this.readText();return}this.resolveMarkupReader()()}resolveMarkupReader(){return this.startsWith(`<!--`)?()=>this.skipUntil(`-->`,`Comment is not closed.`):this.startsWith(`<?`)?()=>this.skipUntil(`?>`,`Processing instruction is not closed.`):this.startsWith(`<![CDATA[`)?()=>this.readCdata():this.startsWith(`<!`)?()=>this.skipDeclaration():this.startsWith(`</`)?()=>this.readClosingTag():()=>this.readOpeningTag()}assertFullyClosed(){if(this.stack.length>0){let e=this.stack[this.stack.length-1];throw Error(`Unclosed XML tag <${e?.name??`unknown`}>.`)}}skipByteOrderMark(){this.xml.charCodeAt(0)===65279&&(this.index=1)}readOpeningTag(){this.index+=1,this.skipWhitespace();let e=this.readRequiredName(`Missing XML tag name at offset ${this.index}.`),{attributes:t,selfClosing:n}=this.readOpeningTagBody(),r={name:e,attributes:t,text:null,children:[]};this.addNode(r),n||this.pushOpenNode(r)}readOpeningTagBody(){let e={};for(;;){this.skipWhitespace();let t=this.readOpeningTagEnd();if(t)return{attributes:e,selfClosing:t===`self-closing`};let n=this.readAttribute();e[n.name]=n.value}}readOpeningTagEnd(){if(this.index>=this.xml.length)throw Error(`Opening XML tag is not closed.`);return this.xml[this.index]===`>`?(this.index+=1,`open`):this.xml[this.index]===`/`&&this.xml[this.index+1]===`>`?(this.index+=2,`self-closing`):null}readAttribute(){let e=this.readRequiredName(`Invalid XML attribute at offset ${this.index}.`);if(f(e),this.skipWhitespace(),this.xml[this.index]!==`=`)throw Error(`Missing value for XML attribute "${e}".`);return this.index+=1,this.skipWhitespace(),{name:e,value:this.readAttributeValue(e)}}pushOpenNode(e){if(this.stack.length>=256)throw Error(`Maximum XML nesting depth of 256 exceeded.`);this.stack.push(e)}readClosingTag(){this.index+=2,this.skipWhitespace();let e=this.readName();if(this.skipWhitespace(),this.xml[this.index]!==`>`)throw Error(`Closing XML tag </${e}> is not closed.`);this.index+=1;let t=this.stack.pop();if(!t)throw Error(`Unexpected closing XML tag </${e}>.`);if(t.name!==e)throw Error(`Expected </${t.name}> before </${e}>.`)}readText(){let e=this.xml.indexOf(`<`,this.index),t=e===-1?this.xml.length:e;this.appendText(this.xml.slice(this.index,t),!0),this.index=t}readCdata(){let e=this.index+9,t=this.xml.indexOf(`]]>`,e);if(t===-1)throw Error(`CDATA section is not closed.`);this.appendText(this.xml.slice(e,t),!1),this.index=t+3}appendText(t,n){let r=t.trim();if(!r)return;let i=this.stack[this.stack.length-1];i&&(i.text=`${i.text??``}${n?e(r):r}`)}addNode(e){let t=this.stack[this.stack.length-1];t?t.children.push(e):this.roots.push(e)}readName(){let e=this.index;for(;this.index<this.xml.length&&o(this.xml[this.index]);)this.index+=1;return this.xml.slice(e,this.index)}readRequiredName(e){let t=this.readName();if(!t)throw Error(e);return t}readAttributeValue(t){let n=this.xml[this.index];if(n!==`"`&&n!==`'`)throw Error(`XML attribute "${t}" must use a quoted value.`);this.index+=1;let r=this.index,i=this.xml.indexOf(n,r);if(i===-1)throw Error(`XML attribute "${t}" is not closed.`);return this.index=i+1,e(this.xml.slice(r,i).trim())}skipDeclaration(){let e={quote:null,bracketDepth:0};for(let t=this.index+2;t<this.xml.length;t+=1)if(c(e,this.xml[t])){this.index=t+1;return}throw Error(`XML declaration is not closed.`)}skipUntil(e,t){let n=this.xml.indexOf(e,this.index+e.length);if(n===-1)throw Error(t);this.index=n+e.length}skipWhitespace(){for(;this.index<this.xml.length&&s(this.xml[this.index]);)this.index+=1}startsWith(e){return this.xml.startsWith(e,this.index)}};function o(e){return e!==void 0&&t.has(e)}function s(e){return e!==void 0&&n.has(e)}function c(e,t){return t===void 0||l(e,t)?!1:(u(e,t),d(e,t))}function l(e,t){return e.quote?(t===e.quote&&(e.quote=null),!0):t===`"`||t===`'`?(e.quote=t,!0):!1}function u(e,t){if(t===`[`){e.bracketDepth+=1;return}t===`]`&&e.bracketDepth>0&&--e.bracketDepth}function d(e,t){return t===`>`&&e.bracketDepth===0}function f(e){if(r.has(e))throw Error(`Unsupported XML attribute name "${e}".`)}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"node:
|
|
1
|
+
import e from"node:path";import t from"node:os";function n(e){return e?.HOME?.trim()||t.homedir()}function r(t,r={}){return t===`~`?n(r.env):t.startsWith(`~/`)?e.join(n(r.env),t.slice(2)):t}function i(t,n={}){let i=r(t,n);return e.isAbsolute(i)?i:e.resolve(n.cwd??process.cwd(),i)}export{i as n,r as t};
|