agent-device 0.18.2 → 0.19.0
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-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.2.apk → agent-device-android-multitouch-helper-0.19.0.apk} +0 -0
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.0.apk.sha256 +1 -0
- package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.2.manifest.json → agent-device-android-multitouch-helper-0.19.0.manifest.json} +4 -4
- package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.2.apk → agent-device-android-snapshot-helper-0.19.0.apk} +0 -0
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.0.apk.sha256 +1 -0
- package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.2.manifest.json → agent-device-android-snapshot-helper-0.19.0.manifest.json} +6 -6
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +28 -0
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +9 -120
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +132 -66
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +155 -0
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +67 -0
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +20 -74
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +64 -0
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +0 -177
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +81 -48
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +102 -129
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +208 -46
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +82 -11
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +72 -0
- package/dist/src/agent-browser-tool.js +1 -0
- package/dist/src/android-adb.d.ts +64 -234
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android.js +1 -5
- package/dist/src/app-lifecycle.js +7 -0
- package/dist/src/apple-runner-options.js +1 -0
- package/dist/src/apps.js +5 -11
- package/dist/src/artifacts.d.ts +4 -3
- package/dist/src/artifacts.js +1 -1
- package/dist/src/audio-probe.js +1 -1
- package/dist/src/batch.d.ts +2 -177
- package/dist/src/batch.js +1 -1
- package/dist/src/cli-help.js +64 -38
- package/dist/src/cli-output.js +1 -1
- package/dist/src/cli-runner.js +2 -0
- package/dist/src/cli.js +12 -41
- package/dist/src/client-metro-companion.js +1 -0
- package/dist/src/client.js +3 -0
- package/dist/src/command-metadata.js +1 -0
- package/dist/src/command-schema.js +22 -0
- package/dist/src/command-surface.js +1 -1
- package/dist/src/contracts.d.ts +2 -213
- package/dist/src/contracts.js +1 -1
- package/dist/src/debug-symbols.js +5 -3
- package/dist/src/device-input-state.js +2 -0
- package/dist/src/device-rotation.js +14 -0
- package/dist/src/devices.js +1 -1
- package/dist/src/devices2.js +1 -0
- package/dist/src/devices3.js +1 -0
- package/dist/src/find.js +1 -1
- package/dist/src/finders.d.ts +2 -81
- package/dist/src/finders.js +1 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/handler-utils.js +1 -1
- package/dist/src/helper.js +2 -0
- package/dist/src/host-process.js +2 -0
- package/dist/src/index.d.ts +1265 -1768
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +3 -1
- package/dist/src/input-actions2.js +1 -0
- package/dist/src/install-source.d.ts +13 -14
- package/dist/src/install-source.js +1 -1
- package/dist/src/install-source2.js +1 -0
- package/dist/src/interaction-snapshot.js +1 -0
- package/dist/src/interaction.js +1 -1
- package/dist/src/interactor.js +2 -1
- package/dist/src/internal/bin.d.ts +1 -1
- package/dist/src/internal/bin.js +2 -5
- package/dist/src/internal/companion-tunnel.d.ts +1 -1
- package/dist/src/internal/companion-tunnel.js +1 -1
- package/dist/src/internal/daemon.d.ts +1 -1
- package/dist/src/internal/daemon.js +16 -1
- package/dist/src/internal/png-worker.d.ts +29 -26
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/internal/update-check-entry.d.ts +1 -1
- package/dist/src/internal/update-check-entry.js +1 -1
- package/dist/src/io.d.ts +2 -85
- package/dist/src/io.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/linux.js +1 -1
- package/dist/src/logcat.js +6 -0
- package/dist/src/manifest.js +1 -0
- package/dist/src/metro.d.ts +70 -113
- package/dist/src/metro.js +1 -1
- package/dist/src/metro2.js +1 -0
- package/dist/src/notifications.js +1 -1
- package/dist/src/output-path.js +1 -0
- package/dist/src/path-resolution.js +1 -0
- package/dist/src/png-worker-contract.js +1 -0
- package/dist/src/points.js +4 -0
- package/dist/src/project-runtime.js +1 -0
- package/dist/src/provider.js +1 -1
- package/dist/src/providers.js +1 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-trace-recording.js +2 -5
- package/dist/src/record-trace.js +1 -1
- package/dist/src/recording-provider.js +1 -1
- package/dist/src/registry.js +37 -0
- package/dist/src/remote-config.d.ts +2 -83
- package/dist/src/reporting.js +9 -0
- package/dist/src/rolldown-runtime.js +1 -0
- package/dist/src/runner-client.js +1 -0
- package/dist/src/runner-provider.js +1 -0
- package/dist/src/runner-sequence.js +1 -1
- package/dist/src/runtime-transport.js +1 -0
- package/dist/src/runtime.js +3 -0
- package/dist/src/scoped-provider.js +1 -0
- package/dist/src/sdk-android-adb.d.ts +144 -0
- package/dist/src/sdk-android-adb.js +4 -0
- package/dist/src/sdk-app-inventory.d.ts +4 -0
- package/dist/src/sdk-app-inventory.js +1 -0
- package/dist/src/sdk-batch-runner.d.ts +40 -0
- package/dist/src/sdk-batch-runner.js +2 -0
- package/dist/src/sdk-batch.js +2 -0
- package/dist/src/sdk-contracts.d.ts +386 -0
- package/dist/src/sdk-contracts.js +2 -0
- package/dist/src/sdk-finders.d.ts +61 -0
- package/dist/src/sdk-finders.js +1 -0
- package/dist/src/sdk-io.d.ts +79 -0
- package/dist/src/sdk-io.js +1 -0
- package/dist/src/sdk-remote-config.d.ts +140 -0
- package/dist/src/sdk-remote-config.js +1 -0
- package/dist/src/sdk-selectors.js +1 -0
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.d.ts +39 -137
- package/dist/src/selectors.js +1 -1
- package/dist/src/selectors2.js +1 -0
- package/dist/src/server.js +3 -2
- package/dist/src/session.js +10 -11
- package/dist/src/setting-state.js +1 -0
- package/dist/src/simctl.js +1 -0
- package/dist/src/simulator.js +1 -2
- package/dist/src/snapshot-diagnostics.js +3 -0
- package/dist/src/snapshot-helper.js +5 -0
- package/dist/src/snapshot-quality.js +1 -0
- package/dist/src/snapshot.js +1 -2
- package/dist/src/snapshot2.js +2 -0
- package/dist/src/{5560.js → timeouts.js} +1 -1
- package/dist/src/tool-provider.js +3 -0
- package/dist/src/tool-provider2.js +1 -0
- package/dist/src/ttl-memo.js +1 -0
- package/dist/src/update-check.js +1 -0
- package/dist/src/url.js +1 -0
- package/dist/src/version.js +1 -0
- package/dist/src/web.js +1 -1
- package/dist/src/xml.js +2 -0
- package/package.json +12 -19
- package/server.json +2 -2
- package/skills/agent-device/SKILL.md +2 -0
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.18.2.apk.sha256 +0 -1
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.18.2.apk.sha256 +0 -1
- package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +0 -443
- package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -169
- package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +0 -220
- package/dist/src/1404.js +0 -1
- package/dist/src/1986.js +0 -1
- package/dist/src/2748.js +0 -1
- package/dist/src/2948.js +0 -30
- package/dist/src/3006.js +0 -1
- package/dist/src/314.js +0 -1
- package/dist/src/3340.js +0 -8
- package/dist/src/4418.js +0 -1
- package/dist/src/4428.js +0 -3
- package/dist/src/485.js +0 -1
- package/dist/src/4917.js +0 -1
- package/dist/src/495.js +0 -5
- package/dist/src/5448.js +0 -3
- package/dist/src/5484.js +0 -1
- package/dist/src/5643.js +0 -1
- package/dist/src/587.js +0 -1
- package/dist/src/5913.js +0 -4
- package/dist/src/6849.js +0 -1
- package/dist/src/6918.js +0 -1
- package/dist/src/6967.js +0 -1
- package/dist/src/760.js +0 -1
- package/dist/src/7871.js +0 -1
- package/dist/src/8184.js +0 -1
- package/dist/src/8225.js +0 -1
- package/dist/src/8391.js +0 -1
- package/dist/src/8404.js +0 -2
- package/dist/src/8414.js +0 -2
- package/dist/src/8875.js +0 -4
- package/dist/src/893.js +0 -1
- package/dist/src/8936.js +0 -1
- package/dist/src/9414.js +0 -1
- package/dist/src/9581.js +0 -22
- package/dist/src/9612.js +0 -1
- package/dist/src/9624.js +0 -1
- package/dist/src/9722.js +0 -38
- package/dist/src/devices~1.js +0 -1
- package/dist/src/devices~2.js +0 -1
- package/dist/src/input-actions~1.js +0 -1
- package/dist/src/rslib-runtime.js +0 -1
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/xcshareddata/xcschemes/AgentDeviceRunner.xcscheme +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests.entitlements +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.h +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.m +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests.xctestplan +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-resize.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-trim.swift +0 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
//#region src/kernel/device.d.ts
|
|
2
|
+
declare const APPLE_OS_VALUES: readonly ['ios', 'ipados', 'tvos', 'watchos', 'visionos', 'macos'];
|
|
3
|
+
type AppleOS = (typeof APPLE_OS_VALUES)[number];
|
|
4
|
+
declare const PLATFORMS: readonly ['apple', 'android', 'linux', 'web'];
|
|
5
|
+
type Platform = (typeof PLATFORMS)[number];
|
|
6
|
+
declare const PUBLIC_PLATFORMS: readonly ['ios', 'macos', 'android', 'linux', 'web'];
|
|
7
|
+
type PublicPlatform = (typeof PUBLIC_PLATFORMS)[number];
|
|
8
|
+
declare const PLATFORM_SELECTORS: readonly ["apple", "android", "linux", "web", "ios", "macos"];
|
|
9
|
+
type PlatformSelector = (typeof PLATFORM_SELECTORS)[number];
|
|
10
|
+
declare const DEVICE_KINDS: readonly ['simulator', 'emulator', 'device'];
|
|
11
|
+
type DeviceKind = (typeof DEVICE_KINDS)[number];
|
|
12
|
+
declare const DEVICE_TARGETS: readonly ['mobile', 'tv', 'desktop'];
|
|
13
|
+
type DeviceTarget = (typeof DEVICE_TARGETS)[number];
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/kernel/errors.d.ts
|
|
16
|
+
type KnownAppErrorCode = 'INVALID_ARGS' | 'DEVICE_NOT_FOUND' | 'DEVICE_IN_USE' | 'TOOL_MISSING' | 'APP_NOT_INSTALLED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_OPERATION' | 'NOT_IMPLEMENTED' | 'COMMAND_FAILED' | 'SESSION_NOT_FOUND' | 'UNAUTHORIZED' | 'AMBIGUOUS_MATCH' | 'UNKNOWN';
|
|
17
|
+
type AppErrorCode = KnownAppErrorCode | (string & {});
|
|
18
|
+
/**
|
|
19
|
+
* Details bag for AppError. Free-form context is allowed, but these keys carry
|
|
20
|
+
* meaning at normalize/render time and must keep their types:
|
|
21
|
+
* - `hint` — overrides `defaultHintForCode`; re-wraps preserve an existing hint.
|
|
22
|
+
* - `diagnosticId` / `logPath` — lifted onto the normalized error, stripped from details.
|
|
23
|
+
* - `processExitError` + `stdout`/`stderr`/`exitCode` — marks a wrap of a real
|
|
24
|
+
* process exit so normalizeError can surface the first meaningful stderr line;
|
|
25
|
+
* build these via `execFailureDetails`/`requireExecSuccess` in src/utils/exec.ts
|
|
26
|
+
* rather than by hand.
|
|
27
|
+
* - `retriable` — typed retry signal hoisted to the wire error shape.
|
|
28
|
+
* - `reason` — machine-dispatchable sub-classification within a code.
|
|
29
|
+
*/
|
|
30
|
+
type AppErrorDetails = Record<string, unknown> & {
|
|
31
|
+
hint?: string;
|
|
32
|
+
diagnosticId?: string;
|
|
33
|
+
logPath?: string;
|
|
34
|
+
retriable?: boolean;
|
|
35
|
+
supportedOn?: string;
|
|
36
|
+
processExitError?: boolean;
|
|
37
|
+
stdout?: string;
|
|
38
|
+
stderr?: string;
|
|
39
|
+
exitCode?: number | null;
|
|
40
|
+
reason?: string;
|
|
41
|
+
};
|
|
42
|
+
type NormalizedError = {
|
|
43
|
+
code: string;
|
|
44
|
+
message: string;
|
|
45
|
+
hint?: string;
|
|
46
|
+
diagnosticId?: string;
|
|
47
|
+
logPath?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Lifted from `details.retriable` when a throw site classified the failure as
|
|
50
|
+
* clearly transient (or clearly not). Included only when set, so the default
|
|
51
|
+
* error wire shape is unchanged.
|
|
52
|
+
*/
|
|
53
|
+
retriable?: boolean;
|
|
54
|
+
supportedOn?: string;
|
|
55
|
+
details?: Record<string, unknown>;
|
|
56
|
+
};
|
|
57
|
+
declare class AppError extends Error {
|
|
58
|
+
code: AppErrorCode;
|
|
59
|
+
details?: AppErrorDetails;
|
|
60
|
+
cause?: unknown;
|
|
61
|
+
constructor(code: AppErrorCode, message: string, details?: AppErrorDetails, cause?: unknown);
|
|
62
|
+
}
|
|
63
|
+
declare function isAgentDeviceError(err: unknown): err is AppError;
|
|
64
|
+
declare function normalizeAgentDeviceError(err: unknown, context?: {
|
|
65
|
+
diagnosticId?: string;
|
|
66
|
+
logPath?: string;
|
|
67
|
+
}): NormalizedError;
|
|
68
|
+
declare function normalizeError(err: unknown, context?: {
|
|
69
|
+
diagnosticId?: string;
|
|
70
|
+
logPath?: string;
|
|
71
|
+
}): NormalizedError;
|
|
72
|
+
declare function defaultHintForCode(code: string): string | undefined;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/contracts/debug-symbols.d.ts
|
|
75
|
+
type DebugSymbolsOptions = {
|
|
76
|
+
action?: 'symbols';
|
|
77
|
+
artifact: string;
|
|
78
|
+
dsym?: string;
|
|
79
|
+
searchPath?: string;
|
|
80
|
+
out?: string;
|
|
81
|
+
cwd?: string;
|
|
82
|
+
};
|
|
83
|
+
type DebugSymbolsImage = {
|
|
84
|
+
name: string;
|
|
85
|
+
uuid: string;
|
|
86
|
+
arch?: string;
|
|
87
|
+
dsymPath: string;
|
|
88
|
+
binaryPath: string;
|
|
89
|
+
};
|
|
90
|
+
type DebugSymbolsCrashFrame = {
|
|
91
|
+
index: number;
|
|
92
|
+
image: string;
|
|
93
|
+
address: string;
|
|
94
|
+
symbol?: string;
|
|
95
|
+
};
|
|
96
|
+
type DebugSymbolsCrashSummary = {
|
|
97
|
+
format: 'ips' | 'text';
|
|
98
|
+
appName?: string;
|
|
99
|
+
bundleId?: string;
|
|
100
|
+
version?: string;
|
|
101
|
+
incident?: string;
|
|
102
|
+
timestamp?: string;
|
|
103
|
+
exceptionType?: string;
|
|
104
|
+
exceptionCodes?: string;
|
|
105
|
+
terminationReason?: string;
|
|
106
|
+
crashedThread?: number;
|
|
107
|
+
topFrames: DebugSymbolsCrashFrame[];
|
|
108
|
+
findings: string[];
|
|
109
|
+
};
|
|
110
|
+
type DebugSymbolsResult = {
|
|
111
|
+
kind: 'debugSymbols';
|
|
112
|
+
platform: 'apple';
|
|
113
|
+
artifactPath: string;
|
|
114
|
+
outPath: string;
|
|
115
|
+
crash: DebugSymbolsCrashSummary;
|
|
116
|
+
matchedImages: DebugSymbolsImage[];
|
|
117
|
+
symbolicatedFrames: number;
|
|
118
|
+
skippedImages: number;
|
|
119
|
+
warnings?: string[];
|
|
120
|
+
message: string;
|
|
121
|
+
};
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/kernel/snapshot.d.ts
|
|
124
|
+
/**
|
|
125
|
+
* Structured quality verdict computed once by the iOS runner's snapshot capture plan.
|
|
126
|
+
* The daemon renders it; it never re-derives degradation from node shapes.
|
|
127
|
+
*
|
|
128
|
+
* Defined here (the foundational snapshot type module) rather than in
|
|
129
|
+
* snapshot-quality.ts so SnapshotNode can reference it without a cyclic import;
|
|
130
|
+
* snapshot-quality.ts (the validation logic) re-exports it for existing callers.
|
|
131
|
+
*/
|
|
132
|
+
type SnapshotQualityVerdict = {
|
|
133
|
+
state: 'healthy' | 'recovered' | 'sparse';
|
|
134
|
+
backend: 'tree' | 'queries' | 'private-ax';
|
|
135
|
+
reason?: string;
|
|
136
|
+
reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed';
|
|
137
|
+
effectiveDepth?: number;
|
|
138
|
+
collapsedLeafIndexes?: number[];
|
|
139
|
+
};
|
|
140
|
+
type Rect = {
|
|
141
|
+
x: number;
|
|
142
|
+
y: number;
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
};
|
|
146
|
+
type Point = {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
};
|
|
150
|
+
type RawSnapshotNode = {
|
|
151
|
+
index: number;
|
|
152
|
+
type?: string;
|
|
153
|
+
role?: string;
|
|
154
|
+
subrole?: string;
|
|
155
|
+
label?: string;
|
|
156
|
+
value?: string;
|
|
157
|
+
identifier?: string;
|
|
158
|
+
rect?: Rect;
|
|
159
|
+
enabled?: boolean;
|
|
160
|
+
selected?: boolean;
|
|
161
|
+
focused?: boolean;
|
|
162
|
+
visibleToUser?: boolean;
|
|
163
|
+
hittable?: boolean;
|
|
164
|
+
depth?: number;
|
|
165
|
+
parentIndex?: number;
|
|
166
|
+
pid?: number;
|
|
167
|
+
bundleId?: string;
|
|
168
|
+
appName?: string;
|
|
169
|
+
windowTitle?: string;
|
|
170
|
+
surface?: string;
|
|
171
|
+
hiddenContentAbove?: boolean;
|
|
172
|
+
hiddenContentBelow?: boolean;
|
|
173
|
+
interactionBlocked?: 'covered';
|
|
174
|
+
presentationHints?: string[];
|
|
175
|
+
};
|
|
176
|
+
type SnapshotNode = RawSnapshotNode & {
|
|
177
|
+
ref: string;
|
|
178
|
+
/**
|
|
179
|
+
* Output-only marker set by client-serialization dedup (see
|
|
180
|
+
* ../snapshot/snapshot-label-dedup.ts) when `label`/`identifier` was omitted
|
|
181
|
+
* because it string-equals the nearest ancestor's value in the parent chain.
|
|
182
|
+
* Never set on the in-daemon session tree used by selectors/wait/replay.
|
|
183
|
+
*/
|
|
184
|
+
inheritsLabel?: true;
|
|
185
|
+
inheritsIdentifier?: true;
|
|
186
|
+
};
|
|
187
|
+
type SnapshotBackend = 'xctest' | 'android' | 'macos-helper' | 'linux-atspi' | 'web';
|
|
188
|
+
type SnapshotState = {
|
|
189
|
+
nodes: SnapshotNode[];
|
|
190
|
+
createdAt: number;
|
|
191
|
+
truncated?: boolean;
|
|
192
|
+
backend?: SnapshotBackend;
|
|
193
|
+
snapshotQuality?: SnapshotQualityVerdict;
|
|
194
|
+
comparisonSafe?: boolean;
|
|
195
|
+
presentationKey?: string;
|
|
196
|
+
};
|
|
197
|
+
type SnapshotUnchanged = {
|
|
198
|
+
ageMs: number;
|
|
199
|
+
nodeCount: number;
|
|
200
|
+
interactiveOnly?: boolean;
|
|
201
|
+
scope?: string;
|
|
202
|
+
};
|
|
203
|
+
type SnapshotVisibilityReason = 'offscreen-nodes' | 'scroll-hidden-above' | 'scroll-hidden-below';
|
|
204
|
+
type SnapshotVisibility = {
|
|
205
|
+
partial: boolean;
|
|
206
|
+
visibleNodeCount: number;
|
|
207
|
+
totalNodeCount: number;
|
|
208
|
+
reasons: SnapshotVisibilityReason[];
|
|
209
|
+
};
|
|
210
|
+
type ScreenshotOverlayRef = {
|
|
211
|
+
ref: string;
|
|
212
|
+
label?: string;
|
|
213
|
+
rect: Rect;
|
|
214
|
+
overlayRect: Rect;
|
|
215
|
+
center: Point;
|
|
216
|
+
};
|
|
217
|
+
declare function centerOfRect(rect: Rect): Point;
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/kernel/contracts.d.ts
|
|
220
|
+
type SessionRuntimeHints = {
|
|
221
|
+
platform?: 'ios' | 'android';
|
|
222
|
+
metroHost?: string;
|
|
223
|
+
metroPort?: number;
|
|
224
|
+
bundleUrl?: string;
|
|
225
|
+
launchUrl?: string;
|
|
226
|
+
};
|
|
227
|
+
type DaemonInstallSource = {
|
|
228
|
+
kind: 'url';
|
|
229
|
+
url: string;
|
|
230
|
+
headers?: Record<string, string>;
|
|
231
|
+
} | {
|
|
232
|
+
kind: 'path';
|
|
233
|
+
path: string;
|
|
234
|
+
} | ({
|
|
235
|
+
kind: 'github-actions-artifact';
|
|
236
|
+
owner: string;
|
|
237
|
+
repo: string;
|
|
238
|
+
} & ({
|
|
239
|
+
artifactId: number;
|
|
240
|
+
} | {
|
|
241
|
+
runId: number;
|
|
242
|
+
artifactName: string;
|
|
243
|
+
} | {
|
|
244
|
+
artifactName: string;
|
|
245
|
+
}));
|
|
246
|
+
declare const DAEMON_LOCK_POLICIES: readonly ['reject', 'strip'];
|
|
247
|
+
type DaemonLockPolicy = (typeof DAEMON_LOCK_POLICIES)[number];
|
|
248
|
+
declare const LEASE_BACKENDS: readonly ['ios-simulator', 'ios-instance', 'android-instance'];
|
|
249
|
+
type LeaseBackend = (typeof LEASE_BACKENDS)[number];
|
|
250
|
+
declare const DAEMON_SERVER_MODES: readonly ['socket', 'http', 'dual'];
|
|
251
|
+
type DaemonServerMode = (typeof DAEMON_SERVER_MODES)[number];
|
|
252
|
+
declare const DAEMON_TRANSPORT_PREFERENCES: readonly ['auto', 'socket', 'http'];
|
|
253
|
+
type DaemonTransportPreference = (typeof DAEMON_TRANSPORT_PREFERENCES)[number];
|
|
254
|
+
declare const SESSION_ISOLATION_MODES: readonly ['none', 'tenant'];
|
|
255
|
+
type SessionIsolationMode = (typeof SESSION_ISOLATION_MODES)[number];
|
|
256
|
+
declare const NETWORK_INCLUDE_MODES: readonly ['summary', 'headers', 'body', 'all'];
|
|
257
|
+
type NetworkIncludeMode = (typeof NETWORK_INCLUDE_MODES)[number];
|
|
258
|
+
declare const RESPONSE_LEVELS: readonly ['digest', 'default', 'full'];
|
|
259
|
+
type ResponseLevel = (typeof RESPONSE_LEVELS)[number];
|
|
260
|
+
type DaemonRequestMeta = {
|
|
261
|
+
requestId?: string;
|
|
262
|
+
debug?: boolean;
|
|
263
|
+
includeCost?: boolean;
|
|
264
|
+
responseLevel?: ResponseLevel;
|
|
265
|
+
cwd?: string;
|
|
266
|
+
sessionExplicit?: boolean;
|
|
267
|
+
tenantId?: string;
|
|
268
|
+
runId?: string;
|
|
269
|
+
leaseId?: string;
|
|
270
|
+
leaseTtlMs?: number;
|
|
271
|
+
leaseBackend?: LeaseBackend;
|
|
272
|
+
leaseProvider?: string;
|
|
273
|
+
deviceKey?: string;
|
|
274
|
+
clientId?: string;
|
|
275
|
+
sessionIsolation?: SessionIsolationMode;
|
|
276
|
+
uploadedArtifactId?: string;
|
|
277
|
+
clientArtifactPaths?: Record<string, string>;
|
|
278
|
+
installSource?: DaemonInstallSource;
|
|
279
|
+
retainMaterializedPaths?: boolean;
|
|
280
|
+
materializedPathRetentionMs?: number;
|
|
281
|
+
materializationId?: string;
|
|
282
|
+
lockPolicy?: DaemonLockPolicy;
|
|
283
|
+
lockPlatform?: PlatformSelector;
|
|
284
|
+
requestProgress?: 'replay-test' | 'command';
|
|
285
|
+
};
|
|
286
|
+
type DaemonRequest = {
|
|
287
|
+
token?: string;
|
|
288
|
+
session?: string;
|
|
289
|
+
command: string;
|
|
290
|
+
positionals: string[];
|
|
291
|
+
flags?: Record<string, unknown>;
|
|
292
|
+
runtime?: SessionRuntimeHints;
|
|
293
|
+
meta?: DaemonRequestMeta;
|
|
294
|
+
};
|
|
295
|
+
type DaemonArtifactKnownType = 'screenshot' | 'screenshot-diff' | 'screen-recording' | 'screen-recording-chunk' | 'screen-recording-telemetry' | 'trace-log';
|
|
296
|
+
type DaemonArtifactType = DaemonArtifactKnownType | (string & {});
|
|
297
|
+
type DaemonArtifact = {
|
|
298
|
+
field: string;
|
|
299
|
+
artifactType?: DaemonArtifactType;
|
|
300
|
+
artifactId?: string;
|
|
301
|
+
fileName?: string;
|
|
302
|
+
localPath?: string;
|
|
303
|
+
path?: string;
|
|
304
|
+
};
|
|
305
|
+
type ResponseCost = {
|
|
306
|
+
wallClockMs: number;
|
|
307
|
+
runnerRoundTrips: number;
|
|
308
|
+
nodeCount?: number;
|
|
309
|
+
};
|
|
310
|
+
type DaemonResponseData = Record<string, unknown> & {
|
|
311
|
+
artifacts?: DaemonArtifact[];
|
|
312
|
+
cost?: ResponseCost;
|
|
313
|
+
};
|
|
314
|
+
type DaemonError = {
|
|
315
|
+
code: string;
|
|
316
|
+
message: string;
|
|
317
|
+
hint?: string;
|
|
318
|
+
diagnosticId?: string;
|
|
319
|
+
logPath?: string;
|
|
320
|
+
details?: Record<string, unknown>;
|
|
321
|
+
/**
|
|
322
|
+
* Machine-readable typed-error signals (Phase 2). Additive: present only when
|
|
323
|
+
* derivable, so the default error wire shape is unchanged.
|
|
324
|
+
*
|
|
325
|
+
* `retriable` flags a transient failure an agent should retry (vs. a
|
|
326
|
+
* deterministic one where a retry is wasted). `supportedOn` lists the platform
|
|
327
|
+
* families that DO support the command (derived from the capability matrix),
|
|
328
|
+
* surfaced on platform-mismatch errors so an agent self-corrects without a
|
|
329
|
+
* wasted round-trip.
|
|
330
|
+
*/
|
|
331
|
+
retriable?: boolean;
|
|
332
|
+
supportedOn?: string;
|
|
333
|
+
};
|
|
334
|
+
type DaemonResponse = {
|
|
335
|
+
ok: true;
|
|
336
|
+
data?: DaemonResponseData;
|
|
337
|
+
} | {
|
|
338
|
+
ok: false;
|
|
339
|
+
error: DaemonError;
|
|
340
|
+
};
|
|
341
|
+
type LeaseAllocatePayload = {
|
|
342
|
+
token?: string;
|
|
343
|
+
session?: string;
|
|
344
|
+
tenantId?: string;
|
|
345
|
+
tenant?: string;
|
|
346
|
+
runId?: string;
|
|
347
|
+
ttlMs?: number;
|
|
348
|
+
backend?: LeaseBackend;
|
|
349
|
+
leaseProvider?: string;
|
|
350
|
+
deviceKey?: string;
|
|
351
|
+
clientId?: string;
|
|
352
|
+
};
|
|
353
|
+
type LeaseHeartbeatPayload = {
|
|
354
|
+
token?: string;
|
|
355
|
+
session?: string;
|
|
356
|
+
tenantId?: string;
|
|
357
|
+
tenant?: string;
|
|
358
|
+
runId?: string;
|
|
359
|
+
leaseId?: string;
|
|
360
|
+
ttlMs?: number;
|
|
361
|
+
backend?: LeaseBackend;
|
|
362
|
+
leaseProvider?: string;
|
|
363
|
+
deviceKey?: string;
|
|
364
|
+
clientId?: string;
|
|
365
|
+
};
|
|
366
|
+
type LeaseReleasePayload = {
|
|
367
|
+
token?: string;
|
|
368
|
+
session?: string;
|
|
369
|
+
tenantId?: string;
|
|
370
|
+
tenant?: string;
|
|
371
|
+
runId?: string;
|
|
372
|
+
leaseId?: string;
|
|
373
|
+
backend?: LeaseBackend;
|
|
374
|
+
leaseProvider?: string;
|
|
375
|
+
deviceKey?: string;
|
|
376
|
+
clientId?: string;
|
|
377
|
+
};
|
|
378
|
+
type JsonRpcId = string | number | null;
|
|
379
|
+
type JsonRpcRequestEnvelope<TParams = unknown> = {
|
|
380
|
+
jsonrpc?: string;
|
|
381
|
+
id?: JsonRpcId;
|
|
382
|
+
method?: string;
|
|
383
|
+
params?: TParams;
|
|
384
|
+
};
|
|
385
|
+
//#endregion
|
|
386
|
+
export { AppError as A, PlatformSelector as B, SnapshotQualityVerdict as C, centerOfRect as D, SnapshotVisibility as E, normalizeError as F, AppleOS as I, DeviceKind as L, defaultHintForCode as M, isAgentDeviceError as N, DebugSymbolsOptions as O, normalizeAgentDeviceError as P, DeviceTarget as R, SnapshotNode as S, SnapshotUnchanged as T, PublicPlatform as V, ResponseLevel as _, DaemonRequest as a, Point as b, DaemonServerMode as c, JsonRpcRequestEnvelope as d, LeaseAllocatePayload as f, NetworkIncludeMode as g, LeaseReleasePayload as h, DaemonLockPolicy as i, NormalizedError as j, DebugSymbolsResult as k, DaemonTransportPreference as l, LeaseHeartbeatPayload as m, DaemonError as n, DaemonResponse as o, LeaseBackend as p, DaemonInstallSource as r, DaemonResponseData as s, DaemonArtifactType as t, JsonRpcId as u, SessionIsolationMode as v, SnapshotState as w, ScreenshotOverlayRef as x, SessionRuntimeHints as y, Platform as z };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=/(token|secret|password|authorization|cookie|api[_-]?key|access[_-]?key|private[_-]?key|user[_-]?code|device[_-]?code|refresh[_-]?credential)/i,t=/\b(?:bearer\s+[a-z0-9._-]+|adc_(?:agent|live|refresh|cli)_[a-z0-9._-]+)\b/gi,n=/\b([a-z0-9_-]*(?:api[_-]?key|token|secret|password|user[_-]?code|device[_-]?code|refresh[_-]?credential)[a-z0-9_-]*)(\s*[=:]\s*)("[^"]*"|'[^']*'|\S+)/gi,r=/https?:\/\/[^\s"'<>]+/gi;function i(e){return a(e,new WeakSet)}function a(t,n,r){if(t==null)return t;if(typeof t==`string`)return o(t,r);if(typeof t!=`object`)return t;if(n.has(t))return`[Circular]`;if(n.add(t),Array.isArray(t))return t.map(e=>a(e,n));let i={};for(let[r,o]of Object.entries(t)){if(e.test(r)){i[r]=`[REDACTED]`;continue}i[r]=a(o,n,r)}return i}function o(r,i){let a=r.trim();if(!a)return r;if(i&&e.test(i))return`[REDACTED]`;let o=s(a);return o=o.replace(t,`[REDACTED]`),o=o.replace(n,(e,t,n,r,i,a)=>l({key:t,separator:n,rawValue:r,offset:i,input:a})||c(r)?e:`${t}${n}[REDACTED]`),o===a?a.length>400?`${a.slice(0,200)}...<truncated>`:a:o}function s(e){return e.replace(r,e=>u(e)??e)}function c(e){return/^adc_(?:agent|live|refresh|cli)_\.\.\.$/i.test(e)}function l(e){if(e.key.toLowerCase()!==`token`||!e.separator.includes(`:`))return!1;try{return new URL(e.rawValue).pathname.replace(/\/+$/,``)===`/api-keys`?/(?:^|\b)(?:service\/)?api\s+$/i.test(e.input.slice(0,e.offset)):!1}catch{return!1}}function u(e){try{let t=new URL(e);return t.search&&=`?REDACTED`,(t.username||t.password)&&(t.username=`REDACTED`,t.password=`REDACTED`),t.toString()}catch{return null}}function d(e,t=`COMMAND_FAILED`){return typeof e==`string`&&e.length>0?e:t}var f=class extends Error{code;details;cause;constructor(e,t,n,r){super(t),this.code=e,this.details=n,this.cause=r}};function p(e,t=`UNKNOWN`){return e instanceof f?e:e instanceof Error?new f(t,e.message,void 0,e):new f(t,`Unknown error`,{err:e})}function ee(e){return e instanceof f}function m(e,t={}){return h(e,t)}function h(e,t={}){let n=p(e),r=n.details?i(n.details):void 0,a=y(r,`diagnosticId`)??t.diagnosticId,o=y(r,`logPath`)??t.logPath,s=y(r,`hint`)??x(n.code),c=re(r,`retriable`)??b(n.code),l=y(r,`supportedOn`),u=ie(r),d=ne(n.code,n.message,r);return{code:n.code,message:d,hint:s,diagnosticId:a,logPath:o,...c===void 0?{}:{retriable:c},...l===void 0?{}:{supportedOn:l},details:u}}const te=/^\S+ exited with code -?\d+$/;function ne(e,t,n){if(e!==`COMMAND_FAILED`||n?.processExitError!==!0)return t;let r=v(typeof n?.stderr==`string`?n.stderr:``);return r?te.test(t)?r:t.includes(r)?t:`${t}: ${r}`:t}const g=[/^an error was encountered processing the command/i,/^underlying error\b/i,/^simulator device failed to complete the requested operation/i],_=/^(?:(?:adb|xcrun|simctl):\s*)?(?:error:\s*)?/i;function v(e){for(let t of e.split(`
|
|
2
|
+
`)){let e=t.trim();if(!e||g.some(t=>t.test(e)))continue;let n=e.replace(_,``).trim();if(n)return n.length>200?`${n.slice(0,200)}...`:n}return null}function y(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function re(e,t){let n=e?.[t];return typeof n==`boolean`?n:void 0}function ie(e){if(!e)return;let t={...e};return delete t.hint,delete t.diagnosticId,delete t.logPath,delete t.retriable,delete t.supportedOn,Object.keys(t).length>0?t:void 0}function b(e){switch(e){case`DEVICE_IN_USE`:return!0;default:return}}function x(e){switch(e){case`INVALID_ARGS`:return`Check command arguments and run --help for usage examples.`;case`SESSION_NOT_FOUND`:return`Run open first or pass an explicit device selector.`;case`TOOL_MISSING`:return`Install required platform tooling and ensure it is available in PATH.`;case`DEVICE_NOT_FOUND`:return`Verify the target device is booted/connected and selectors match.`;case`APP_NOT_INSTALLED`:return`Run apps to discover the exact installed package or bundle id, or install the app before open.`;case`UNSUPPORTED_OPERATION`:return`This command is not available for the selected platform/device.`;case`UNSUPPORTED_PLATFORM`:return`This platform is not supported for the requested operation; run devices to inspect available targets.`;case`AMBIGUOUS_MATCH`:return`Multiple candidates matched. Narrow the query or pass an exact identifier.`;case`DEVICE_IN_USE`:return`The device is busy with another agent-device request; retry once it frees up.`;case`NOT_IMPLEMENTED`:return`This command is part of the planned API but is not implemented yet.`;case`COMMAND_FAILED`:return`Retry with --debug and inspect diagnostics log for details.`;case`UNAUTHORIZED`:return`Refresh daemon metadata and retry the command.`;case`UNKNOWN`:return`Unexpected internal error. Retry with --debug and report the diagnostics log if it persists.`;default:return`Retry with --debug and inspect diagnostics log for details.`}}function ae(e){return e===`xctest`||e===`android`||e===`macos-helper`||e===`linux-atspi`||e===`web`}function oe(e){return e===void 0||e===`xctest`||e===`android`}function se(e){return e.map((e,t)=>({...e,ref:`e${t+1}`}))}const ce=/^~s(\d+)$/,le=`Refs look like @e12, optionally pinned to the snapshot generation that minted them: @e12~s3 (the ref, then "~s" and the refsGeneration reported by the issuing snapshot/find response).`;function S(e){let t=e.trim(),n=t.indexOf(`~`);if(n===-1)return{base:t};let r=ce.exec(t.slice(n));return!r||n===0?null:{base:t.slice(0,n),generation:Number(r[1])}}function ue(e){let t=S(e);if(!t)return null;let n=t.base;return n.startsWith(`@`)?n.slice(1)||null:n.startsWith(`e`)?n:null}function de(e,t){return e.find(e=>e.ref===t)??null}function fe(e){return JSON.stringify({interactiveOnly:e?.interactiveOnly===!0,depth:typeof e?.depth==`number`?e.depth:null,scope:e?.scope?.trim()||null,raw:e?.raw===!0})}function pe(e){if(e)return{depth:e.snapshotDepth,interactiveOnly:e.snapshotInteractiveOnly,raw:e.snapshotRaw,scope:e.snapshotScope}}function me(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}const C=[`ios`,`ipados`,`tvos`,`watchos`,`visionos`,`macos`],w=[`apple`,`android`,`linux`,`web`],T=[`ios`,`macos`,`android`,`linux`,`web`],E=[...w,`ios`,`macos`],D=[`mobile`,`tv`,`desktop`];function O(e){return e===`apple`||e===`ios`||e===`macos`}function k(e){return e.appleOs===`macos`||e.platform===`macos`}function A(e){return O(e.platform)&&!k(e)}function j(e){return e.platform===`android`||O(e.platform)&&!k(e)}function M(e){return O(e.platform)?k(e)?`macos`:`ios`:e.platform}function N(e){return e===`macos`?{platform:`apple`,appleOs:`macos`}:e===`ios`?{platform:`apple`}:{platform:e}}function P(e){return O(e.platform)&&e.target===`tv`}function F(e){return T.includes(e)}function I(e){return C.includes(e)}function L(e,t){return t?t===`apple`?O(e.platform):t===`ios`?O(e.platform)&&!k(e):t===`macos`?O(e.platform)&&k(e):e.platform===t:!0}function R(e,t){return t?z(t):e===`macos`||e===`desktop`?`macOS`:e===`tv`?`tvOS`:`iOS`}function z(e){switch(e){case`tvos`:return`tvOS`;case`macos`:return`macOS`;case`visionos`:return`visionOS`;default:return`iOS`}}function he(e){let{simulatorSetPath:t,platform:n,target:r}=e;if(t&&!(n===`macos`||r===`desktop`))return t}function B(e){return e.map((e,t)=>({device:e,index:t})).sort((e,t)=>be(e,t)).map(({device:e})=>e)}function ge(e){return!e||e===`apple`||e===`ios`}async function _e(e,t,n={}){let r=e.filter(e=>V(e,t));if(t.udid){let e=r.find(e=>e.id===t.udid&&O(e.platform));if(!e)throw new f(`DEVICE_NOT_FOUND`,`No Apple device with UDID ${t.udid}`);return e}if(t.serial){let e=r.find(e=>e.id===t.serial&&e.platform===`android`);if(!e)throw new f(`DEVICE_NOT_FOUND`,`No Android device with serial ${t.serial}`);return e}if(n.allowStoppedAndroidAvdPlaceholders!==!0&&(r=r.filter(e=>!ve(e))),t.deviceName){let e=U(t.deviceName),n=r.find(t=>U(t.name)===e);if(!n)throw new f(`DEVICE_NOT_FOUND`,`No device named ${t.deviceName}`);return n}K(r)&&(r=B(r));let i=r[0];if(i!==void 0&&r.length===1)return i;r.length===0&&H(t,n);let a=r.filter(e=>e.kind!==`device`),o=a.length>0?a:r,s=o.filter(e=>e.booted),c=s[0];if(c&&s.length===1&&!K(o))return c;let l=K(o)?o[0]:s[0]??o[0];return l||H(t,n),l}function ve(e){return e.platform===`android`&&e.kind===`emulator`&&e.booted===!1&&!/^emulator-\d+$/.test(e.id)}function V(e,t,n={}){return L(e,t.platform)&&(!t.target||(e.target??`mobile`)===t.target)&&(!n.includeExplicitSelectors||ye(e,t))}function ye(e,t){return!(t.udid&&!(e.id===t.udid&&O(e.platform))||t.serial&&!(e.id===t.serial&&e.platform===`android`)||t.deviceName&&U(e.name)!==U(t.deviceName))}function H(e,t){let n=t.simulatorSetPath;throw n&&ge(e.platform)?new f(`DEVICE_NOT_FOUND`,`No devices found in the scoped simulator set`,{simulatorSetPath:n,hint:`The simulator set at "${n}" appears to be empty. Create a compatible simulator first with xcrun simctl --set "${n}" create, or remove the scoped simulator set.`,selector:e}):new f(`DEVICE_NOT_FOUND`,`No devices found`,{selector:e})}function U(e){return e.toLowerCase().replace(/_/g,` `).replace(/\s+/g,` `).trim()}function be(e,t){return W(e.device)-W(t.device)||Number(t.device.booted===!0)-Number(e.device.booted===!0)||e.device.name.localeCompare(t.device.name)||e.index-t.index}function W(e){return e.kind===`simulator`?G(e,0,1,2,3):e.kind===`device`&&O(e.platform)&&!k(e)?G(e,10,11,12,13):14}function G(e,t,n,r,i){return{mobile:xe(e.name)?n:t,tv:r,desktop:i}[e.target??`mobile`]}function K(e){return e.length>0&&e.every(e=>O(e.platform))}function xe(e){return/\bipad\b/i.test(e)}const Se=[`summary`,`headers`,`body`,`all`],Ce=[`digest`,`default`,`full`];function we(e){return e!==void 0&&e!=="default"}function q(e){return{parse(t){return e(t,`$`)}}}function J(e,t){throw Error(`${e}: ${t}`)}function Y(e,t){return(!e||typeof e!=`object`||Array.isArray(e))&&J(t,`Expected an object`),e}function X(e,t){return typeof e!=`string`&&J(t,`Expected a string`),e}function Te(e,t){return Number.isInteger(e)||J(t,`Expected an integer`),e}function Z(e,t){return Array.isArray(e)||J(t,`Expected an array`),e}function Q(e,t,n){let r=e[t];return r===void 0?void 0:X(r,`${n}.${t}`)}function Ee(e,t,n){let r=e[t];if(r!==void 0)return Z(r,`${n}.${t}`).map((e,r)=>X(e,`${n}.${t}[${String(r)}]`))}function De(e,t,n){let r=e[t];return r===void 0?void 0:Te(r,`${n}.${t}`)}function $(e,t,n){let r=e[t];return r===void 0?void 0:Y(r,`${n}.${t}`)}function Oe(e,t,n,r){let i=e[t];if(i!==void 0)return(typeof i!=`string`||!n.includes(i))&&J(`${r}.${t}`,`Expected one of: ${n.join(`, `)}`),i}const ke=q((e,t)=>{let n=Y(e,t);return{platform:Oe(n,`platform`,[`ios`,`android`],t),metroHost:Q(n,`metroHost`,t),metroPort:De(n,`metroPort`,t),bundleUrl:Q(n,`bundleUrl`,t),launchUrl:Q(n,`launchUrl`,t)}});function Ae(e,t){let n=e.id;return n==null||typeof n!=`string`&&typeof n!=`number`&&J(`${t}.id`,`Expected a string, number, or null`),n}const je=q((e,t)=>{let n=Y(e,t);return{jsonrpc:Q(n,`jsonrpc`,t),id:Ae(n,t),method:Q(n,`method`,t),params:n.params}}),Me=q((e,t)=>{let n=Y(e,t);return{token:Q(n,`token`,t),session:Q(n,`session`,t),command:Q(n,`command`,t),positionals:Ee(n,`positionals`,t),flags:$(n,`flags`,t),runtime:$(n,`runtime`,t),meta:$(n,`meta`,t)}});export{ae as A,h as B,_e as C,fe as D,se as E,f as F,d as H,p as I,x as L,pe as M,S as N,me as O,oe as P,ee as R,he as S,le as T,i as U,b as V,P as _,we as a,M as b,w as c,I as d,O as f,F as g,j as h,ke as i,ue as j,de as k,E as l,k as m,Ce as n,je as o,A as p,Me as r,D as s,Se as t,N as u,V as v,B as w,R as x,L as y,m as z};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { S as SnapshotNode } from "./sdk-contracts.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/selectors-parse.d.ts
|
|
4
|
+
type SelectorKey = 'id' | 'role' | 'text' | 'label' | 'value' | 'appname' | 'windowtitle' | 'visible' | 'hidden' | 'editable' | 'selected' | 'enabled' | 'hittable';
|
|
5
|
+
type SelectorTerm = {
|
|
6
|
+
key: SelectorKey;
|
|
7
|
+
value: string | boolean;
|
|
8
|
+
};
|
|
9
|
+
type Selector = {
|
|
10
|
+
raw: string;
|
|
11
|
+
terms: SelectorTerm[];
|
|
12
|
+
};
|
|
13
|
+
type SelectorChain = {
|
|
14
|
+
raw: string;
|
|
15
|
+
selectors: Selector[];
|
|
16
|
+
};
|
|
17
|
+
declare function parseSelectorChain(expression: string): SelectorChain;
|
|
18
|
+
declare function tryParseSelectorChain(expression: string): SelectorChain | null;
|
|
19
|
+
declare function isSelectorToken(token: string): boolean;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/utils/finders.d.ts
|
|
22
|
+
declare const FIND_LOCATORS: readonly ['any', 'text', 'label', 'value', 'role', 'id'];
|
|
23
|
+
type FindLocator = (typeof FIND_LOCATORS)[number];
|
|
24
|
+
type FindAction = {
|
|
25
|
+
kind: 'click';
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'focus';
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'fill';
|
|
30
|
+
value: string;
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'type';
|
|
33
|
+
value: string;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'get_text';
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'get_attrs';
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'exists';
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'wait';
|
|
42
|
+
timeoutMs?: number;
|
|
43
|
+
};
|
|
44
|
+
declare function parseFindArgs(args: string[]): {
|
|
45
|
+
locator: FindLocator;
|
|
46
|
+
query: string;
|
|
47
|
+
action: FindAction['kind'];
|
|
48
|
+
value?: string;
|
|
49
|
+
timeoutMs?: number;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/finders.d.ts
|
|
53
|
+
type FindMatchOptions = {
|
|
54
|
+
requireRect?: boolean;
|
|
55
|
+
};
|
|
56
|
+
declare function findBestMatchesByLocator(nodes: SnapshotNode[], locator: FindLocator, query: string, options?: boolean | FindMatchOptions): {
|
|
57
|
+
matches: SnapshotNode[];
|
|
58
|
+
score: number;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Selector as a, parseSelectorChain as c, parseFindArgs as i, tryParseSelectorChain as l, findBestMatchesByLocator as n, SelectorChain as o, FindLocator as r, isSelectorToken as s, FindMatchOptions as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as e}from"./sdk-contracts.js";import{y as t}from"./sdk-batch.js";const n=[`any`,`text`,`label`,`value`,`role`,`id`],r=[`text`,`label`,`value`,`role`,`id`];function i(e,t,n,r={}){let i=c(n);if(!i)return{matches:[],score:0};let o=0,s=[];for(let n of e){if(r.requireRect&&!n.rect)continue;let e=a(n,t,i);if(!(e<=0)){if(e>o){o=e,s.length=0,s.push(n);continue}e===o&&s.push(n)}}return{matches:s,score:o}}function a(e,t,n){switch(t){case`role`:return s(e.type,n);case`label`:return o(e.label,n);case`value`:return o(e.value,n);case`id`:return o(e.identifier,n);default:return Math.max(o(e.label,n),o(e.value,n),o(e.identifier,n))}}function o(e,t){let n=c(e??``);return n?n===t?2:+!!n.includes(t):0}function s(e,t){let n=l(e??``);return n?n===t?2:+!!n.includes(t):0}function c(e){return e.trim().toLowerCase().replace(/\s+/g,` `)}function l(e){let t=e.trim();return t?(t=(t.split(`.`).pop()??t).replace(/XCUIElementType/gi,``).toLowerCase(),t):``}function u(t){let n=`any`,i=0;r.includes(t[0])&&(n=t[0],i=1);let a=t[i]??``,o=t.slice(i+1);if(o.length===0)return{locator:n,query:a,action:`click`};let s=o[0]?.toLowerCase();if(s===`get`){let t=o[1]?.toLowerCase();if(t===`text`)return{locator:n,query:a,action:`get_text`};if(t===`attrs`)return{locator:n,query:a,action:`get_attrs`};throw new e(`INVALID_ARGS`,`find get only supports text or attrs`)}if(s===`wait`){let e=f(o[1]);return{locator:n,query:a,action:`wait`,timeoutMs:e??void 0}}if(s===`exists`)return{locator:n,query:a,action:`exists`};if(s===`click`)return{locator:n,query:a,action:`click`};if(s===`focus`)return{locator:n,query:a,action:`focus`};if(s===`fill`){let e=o.slice(1).join(` `);return{locator:n,query:a,action:`fill`,value:e}}if(s===`type`){let e=o.slice(1).join(` `);return{locator:n,query:a,action:`type`,value:e}}throw new e(`INVALID_ARGS`,`Unsupported find action: ${o[0]}`)}function d(e,n){return e!==`any`||!n.includes(`=`)&&!n.includes(`||`)?null:t(n)}function f(e){if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null}function p(e,t,n,r){return i(e,t,n,typeof r==`boolean`?{requireRect:r}:r)}export{u as a,c as i,n,d as o,i as r,p as t};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { t as DaemonArtifactType } from "./sdk-contracts.js";
|
|
2
|
+
|
|
3
|
+
//#region src/io.d.ts
|
|
4
|
+
type FileInputRef = {
|
|
5
|
+
kind: 'path';
|
|
6
|
+
path: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'uploadedArtifact';
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
type FileOutputRef = {
|
|
12
|
+
kind: 'path';
|
|
13
|
+
path: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'downloadableArtifact';
|
|
16
|
+
clientPath?: string;
|
|
17
|
+
fileName?: string;
|
|
18
|
+
};
|
|
19
|
+
type ArtifactDescriptor = {
|
|
20
|
+
kind: 'localPath';
|
|
21
|
+
field: string;
|
|
22
|
+
artifactType: DaemonArtifactType | undefined;
|
|
23
|
+
path: string;
|
|
24
|
+
fileName?: string;
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'artifact';
|
|
28
|
+
field: string;
|
|
29
|
+
artifactType: DaemonArtifactType | undefined;
|
|
30
|
+
artifactId: string;
|
|
31
|
+
fileName?: string;
|
|
32
|
+
url?: string;
|
|
33
|
+
clientPath?: string;
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
};
|
|
36
|
+
type OutputVisibility = 'client-visible' | 'internal';
|
|
37
|
+
type ResolvedInputFile = {
|
|
38
|
+
path: string;
|
|
39
|
+
cleanup?: () => Promise<void>;
|
|
40
|
+
};
|
|
41
|
+
type ReservedOutputFile = {
|
|
42
|
+
path: string;
|
|
43
|
+
visibility: OutputVisibility;
|
|
44
|
+
publish: () => Promise<ArtifactDescriptor | undefined>;
|
|
45
|
+
cleanup?: () => Promise<void>;
|
|
46
|
+
};
|
|
47
|
+
type TemporaryFile = {
|
|
48
|
+
path: string;
|
|
49
|
+
visibility: 'internal';
|
|
50
|
+
cleanup: () => Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
type ResolveInputOptions = {
|
|
53
|
+
usage: string;
|
|
54
|
+
field?: string;
|
|
55
|
+
};
|
|
56
|
+
type ReserveOutputOptions = {
|
|
57
|
+
field: string;
|
|
58
|
+
ext: string;
|
|
59
|
+
artifactType: DaemonArtifactType | undefined;
|
|
60
|
+
requestedClientPath?: string;
|
|
61
|
+
visibility?: OutputVisibility;
|
|
62
|
+
};
|
|
63
|
+
type CreateTempFileOptions = {
|
|
64
|
+
prefix: string;
|
|
65
|
+
ext: string;
|
|
66
|
+
};
|
|
67
|
+
type ArtifactAdapter = {
|
|
68
|
+
resolveInput(ref: FileInputRef, options: ResolveInputOptions): Promise<ResolvedInputFile>;
|
|
69
|
+
reserveOutput(ref: FileOutputRef | undefined, options: ReserveOutputOptions): Promise<ReservedOutputFile>;
|
|
70
|
+
createTempFile(options: CreateTempFileOptions): Promise<TemporaryFile>;
|
|
71
|
+
};
|
|
72
|
+
type LocalArtifactAdapterOptions = {
|
|
73
|
+
cwd?: string;
|
|
74
|
+
tempDir?: string;
|
|
75
|
+
rootDir?: string;
|
|
76
|
+
};
|
|
77
|
+
declare function createLocalArtifactAdapter(options?: LocalArtifactAdapterOptions): ArtifactAdapter;
|
|
78
|
+
//#endregion
|
|
79
|
+
export { FileOutputRef as a, ReserveOutputOptions as c, ResolvedInputFile as d, TemporaryFile as f, FileInputRef as i, ReservedOutputFile as l, ArtifactDescriptor as n, LocalArtifactAdapterOptions as o, createLocalArtifactAdapter as p, CreateTempFileOptions as r, OutputVisibility as s, ArtifactAdapter as t, ResolveInputOptions as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./rolldown-runtime.js";import{F as t}from"./sdk-contracts.js";import{promises as n}from"node:fs";import r from"node:os";import i from"node:path";var a=e({createLocalArtifactAdapter:()=>o});function o(e={}){let a=e.cwd??process.cwd(),o=e.tempDir??r.tmpdir(),c=e.rootDir?s(e.rootDir,a):void 0;return{resolveInput:async e=>{if(e.kind===`uploadedArtifact`)throw new t(`UNSUPPORTED_OPERATION`,`Uploaded artifact inputs require a custom artifact adapter`);return{path:s(e.path,a,c)}},reserveOutput:async(e,t)=>{let r,l=t.visibility??`client-visible`,u=e?.kind===`path`?s(e.path,a,c):i.join(r=await n.mkdtemp(i.join(o,`agent-device-${t.field}-`)),`${t.field}${t.ext}`);return await n.mkdir(i.dirname(u),{recursive:!0}),{path:u,visibility:l,...r?{cleanup:async()=>{await n.rm(r,{recursive:!0,force:!0})}}:{},publish:async()=>e?.kind===`downloadableArtifact`?{kind:`localPath`,field:t.field,artifactType:t.artifactType,path:u,fileName:e.fileName??i.basename(e.clientPath??u)}:void 0}},createTempFile:async e=>{let t=await n.mkdtemp(i.join(o,`${e.prefix}-`));return{path:i.join(t,`file${e.ext}`),visibility:`internal`,cleanup:async()=>{await n.rm(t,{recursive:!0,force:!0})}}}}}function s(e,n,r){let a=i.isAbsolute(e)?e:i.resolve(n,e);if(r&&!c(a,r))throw new t(`INVALID_ARGS`,`Local path is outside the artifact adapter root`,{path:a,rootDir:r});return a}function c(e,t){let n=i.relative(t,e);return n===``||!n.startsWith(`..`)&&!i.isAbsolute(n)}export{a as n,o as t};
|