agent-device 0.7.21 → 0.8.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.
Files changed (135) hide show
  1. package/README.md +86 -0
  2. package/dist/src/224.js +2 -0
  3. package/dist/src/274.js +1 -0
  4. package/dist/src/331.js +3 -0
  5. package/dist/src/bin.d.ts +1 -0
  6. package/dist/src/bin.js +65 -61
  7. package/dist/src/cli-client-commands.d.ts +8 -0
  8. package/dist/src/cli.d.ts +6 -0
  9. package/dist/src/client-normalizers.d.ts +21 -0
  10. package/dist/src/client-types.d.ts +267 -0
  11. package/dist/src/client.d.ts +5 -0
  12. package/dist/src/core/app-events.d.ts +8 -0
  13. package/dist/src/core/batch.d.ts +17 -0
  14. package/dist/src/core/capabilities.d.ts +3 -0
  15. package/dist/src/core/dispatch-payload.d.ts +1 -0
  16. package/dist/src/core/dispatch-resolve.d.ts +28 -0
  17. package/dist/src/core/dispatch-series.d.ts +7 -0
  18. package/dist/src/core/dispatch.d.ts +34 -0
  19. package/dist/src/core/open-target.d.ts +4 -0
  20. package/dist/src/core/settings-contract.d.ts +8 -0
  21. package/dist/src/daemon/action-utils.d.ts +3 -0
  22. package/dist/src/daemon/app-log-android.d.ts +4 -0
  23. package/dist/src/daemon/app-log-ios.d.ts +6 -0
  24. package/dist/src/daemon/app-log-process.d.ts +15 -0
  25. package/dist/src/daemon/app-log-stream.d.ts +19 -0
  26. package/dist/src/daemon/app-log.d.ts +28 -0
  27. package/dist/src/daemon/artifact-archive.d.ts +12 -0
  28. package/dist/src/daemon/artifact-download.d.ts +12 -0
  29. package/dist/src/daemon/artifact-materialization.d.ts +17 -0
  30. package/dist/src/daemon/artifact-registry.d.ts +12 -0
  31. package/dist/src/daemon/config.d.ts +16 -0
  32. package/dist/src/daemon/context.d.ts +22 -0
  33. package/dist/src/daemon/device-ready.d.ts +6 -0
  34. package/dist/src/daemon/handlers/find.d.ts +40 -0
  35. package/dist/src/daemon/handlers/install-source.d.ts +10 -0
  36. package/dist/src/daemon/handlers/interaction.d.ts +14 -0
  37. package/dist/src/daemon/handlers/lease.d.ts +8 -0
  38. package/dist/src/daemon/handlers/parse-utils.d.ts +3 -0
  39. package/dist/src/daemon/handlers/record-trace.d.ts +15 -0
  40. package/dist/src/daemon/handlers/session-replay-heal.d.ts +8 -0
  41. package/dist/src/daemon/handlers/session-replay-script.d.ts +3 -0
  42. package/dist/src/daemon/handlers/session.d.ts +67 -0
  43. package/dist/src/daemon/handlers/snapshot.d.ts +32 -0
  44. package/dist/src/daemon/http-server.d.ts +26 -0
  45. package/dist/src/daemon/is-predicates.d.ts +14 -0
  46. package/dist/src/daemon/lease-context.d.ts +9 -0
  47. package/dist/src/daemon/lease-registry.d.ts +63 -0
  48. package/dist/src/daemon/materialized-path-registry.d.ts +15 -0
  49. package/dist/src/daemon/network-log.d.ts +32 -0
  50. package/dist/src/daemon/request-cancel.d.ts +9 -0
  51. package/dist/src/daemon/request-lock-policy.d.ts +2 -0
  52. package/dist/src/daemon/request-router.d.ts +17 -0
  53. package/dist/src/daemon/runtime-hints.d.ts +19 -0
  54. package/dist/src/daemon/script-utils.d.ts +15 -0
  55. package/dist/src/daemon/scroll-planner.d.ts +12 -0
  56. package/dist/src/daemon/selectors.d.ts +65 -0
  57. package/dist/src/daemon/server-lifecycle.d.ts +23 -0
  58. package/dist/src/daemon/session-routing.d.ts +3 -0
  59. package/dist/src/daemon/session-selector.d.ts +10 -0
  60. package/dist/src/daemon/session-store.d.ts +32 -0
  61. package/dist/src/daemon/snapshot-diff.d.ts +20 -0
  62. package/dist/src/daemon/snapshot-processing.d.ts +8 -0
  63. package/dist/src/daemon/transport.d.ts +6 -0
  64. package/dist/src/daemon/types.d.ts +118 -0
  65. package/dist/src/daemon/upload-registry.d.ts +7 -0
  66. package/dist/src/daemon/upload.d.ts +5 -0
  67. package/dist/src/daemon-client.d.ts +40 -0
  68. package/dist/src/daemon.d.ts +1 -0
  69. package/dist/src/daemon.js +36 -36
  70. package/dist/src/index.d.ts +4 -0
  71. package/dist/src/index.js +1 -0
  72. package/dist/src/platforms/android/adb.d.ts +5 -0
  73. package/dist/src/platforms/android/app-lifecycle.d.ts +30 -0
  74. package/dist/src/platforms/android/device-input-state.d.ts +19 -0
  75. package/dist/src/platforms/android/devices.d.ts +22 -0
  76. package/dist/src/platforms/android/index.d.ts +7 -0
  77. package/dist/src/platforms/android/input-actions.d.ts +12 -0
  78. package/dist/src/platforms/android/install-artifact.d.ts +11 -0
  79. package/dist/src/platforms/android/manifest.d.ts +1 -0
  80. package/dist/src/platforms/android/notifications.d.ts +11 -0
  81. package/dist/src/platforms/android/open-target.d.ts +4 -0
  82. package/dist/src/platforms/android/settings.d.ts +3 -0
  83. package/dist/src/platforms/android/snapshot.d.ts +8 -0
  84. package/dist/src/platforms/android/ui-hierarchy.d.ts +21 -0
  85. package/dist/src/platforms/appearance.d.ts +2 -0
  86. package/dist/src/platforms/boot-diagnostics.d.ts +14 -0
  87. package/dist/src/platforms/install-source.d.ts +26 -0
  88. package/dist/src/platforms/ios/apps.d.ts +34 -0
  89. package/dist/src/platforms/ios/config.d.ts +9 -0
  90. package/dist/src/platforms/ios/devicectl.d.ts +13 -0
  91. package/dist/src/platforms/ios/devices.d.ts +39 -0
  92. package/dist/src/platforms/ios/ensure-simulator.d.ts +18 -0
  93. package/dist/src/platforms/ios/index.d.ts +3 -0
  94. package/dist/src/platforms/ios/install-artifact.d.ts +18 -0
  95. package/dist/src/platforms/ios/launch-diagnostics.d.ts +11 -0
  96. package/dist/src/platforms/ios/plist.d.ts +1 -0
  97. package/dist/src/platforms/ios/runner-client.d.ts +36 -0
  98. package/dist/src/platforms/ios/runner-errors.d.ts +20 -0
  99. package/dist/src/platforms/ios/runner-session.d.ts +25 -0
  100. package/dist/src/platforms/ios/runner-transport.d.ts +10 -0
  101. package/dist/src/platforms/ios/runner-xctestrun.d.ts +18 -0
  102. package/dist/src/platforms/ios/screenshot.d.ts +13 -0
  103. package/dist/src/platforms/ios/simctl.d.ts +7 -0
  104. package/dist/src/platforms/ios/simulator.d.ts +11 -0
  105. package/dist/src/platforms/permission-utils.d.ts +9 -0
  106. package/dist/src/upload-client.d.ts +7 -0
  107. package/dist/src/utils/args.d.ts +27 -0
  108. package/dist/src/utils/cli-config.d.ts +9 -0
  109. package/dist/src/utils/cli-option-schema.d.ts +19 -0
  110. package/dist/src/utils/cli-options.d.ts +13 -0
  111. package/dist/src/utils/command-schema.d.ts +98 -0
  112. package/dist/src/utils/device-isolation.d.ts +3 -0
  113. package/dist/src/utils/device.d.ts +27 -0
  114. package/dist/src/utils/diagnostics.d.ts +30 -0
  115. package/dist/src/utils/errors.d.ts +26 -0
  116. package/dist/src/utils/exec.d.ts +32 -0
  117. package/dist/src/utils/finders.d.ts +12 -0
  118. package/dist/src/utils/interactive.d.ts +1 -0
  119. package/dist/src/utils/interactors.d.ts +31 -0
  120. package/dist/src/utils/json-input.d.ts +1 -0
  121. package/dist/src/utils/keyed-lock.d.ts +1 -0
  122. package/dist/src/utils/output.d.ts +25 -0
  123. package/dist/src/utils/payload-input.d.ts +12 -0
  124. package/dist/src/utils/process-identity.d.ts +11 -0
  125. package/dist/src/utils/retry.d.ts +54 -0
  126. package/dist/src/utils/session-binding.d.ts +18 -0
  127. package/dist/src/utils/snapshot-lines.d.ts +12 -0
  128. package/dist/src/utils/snapshot.d.ts +42 -0
  129. package/dist/src/utils/timeouts.d.ts +3 -0
  130. package/dist/src/utils/version.d.ts +2 -0
  131. package/package.json +9 -1
  132. package/skills/agent-device/SKILL.md +36 -0
  133. package/skills/agent-device/references/remote-tenancy.md +11 -0
  134. package/skills/agent-device/references/session-management.md +37 -1
  135. package/dist/src/678.js +0 -3
@@ -0,0 +1,267 @@
1
+ import type { DaemonInstallSource, DaemonLockPolicy, DaemonRequest, DaemonResponse, SessionRuntimeHints } from './daemon/types.ts';
2
+ import type { DeviceKind, DeviceTarget, Platform, PlatformSelector } from './utils/device.ts';
3
+ import type { SnapshotNode } from './utils/snapshot.ts';
4
+ type DaemonTransportMode = 'auto' | 'socket' | 'http';
5
+ type DaemonServerMode = 'socket' | 'http' | 'dual';
6
+ type SessionIsolationMode = 'none' | 'tenant';
7
+ export type AgentDeviceDaemonTransport = (req: Omit<DaemonRequest, 'token'>) => Promise<DaemonResponse>;
8
+ export type AgentDeviceClientConfig = {
9
+ session?: string;
10
+ lockPolicy?: DaemonLockPolicy;
11
+ lockPlatform?: PlatformSelector;
12
+ requestId?: string;
13
+ stateDir?: string;
14
+ daemonBaseUrl?: string;
15
+ daemonAuthToken?: string;
16
+ daemonTransport?: DaemonTransportMode;
17
+ daemonServerMode?: DaemonServerMode;
18
+ tenant?: string;
19
+ sessionIsolation?: SessionIsolationMode;
20
+ runId?: string;
21
+ leaseId?: string;
22
+ cwd?: string;
23
+ debug?: boolean;
24
+ };
25
+ export type AgentDeviceRequestOverrides = Pick<AgentDeviceClientConfig, 'session' | 'lockPolicy' | 'lockPlatform' | 'requestId' | 'tenant' | 'sessionIsolation' | 'runId' | 'leaseId' | 'cwd' | 'debug'>;
26
+ export type AgentDeviceIdentifiers = {
27
+ session?: string;
28
+ deviceId?: string;
29
+ deviceName?: string;
30
+ udid?: string;
31
+ serial?: string;
32
+ appId?: string;
33
+ appBundleId?: string;
34
+ package?: string;
35
+ };
36
+ export type AgentDeviceSelectionOptions = {
37
+ platform?: PlatformSelector;
38
+ target?: DeviceTarget;
39
+ device?: string;
40
+ udid?: string;
41
+ serial?: string;
42
+ iosSimulatorDeviceSet?: string;
43
+ androidDeviceAllowlist?: string;
44
+ };
45
+ export type AgentDeviceDevice = {
46
+ platform: Platform;
47
+ target: DeviceTarget;
48
+ kind: DeviceKind;
49
+ id: string;
50
+ name: string;
51
+ booted?: boolean;
52
+ identifiers: AgentDeviceIdentifiers;
53
+ ios?: {
54
+ udid: string;
55
+ };
56
+ android?: {
57
+ serial: string;
58
+ };
59
+ };
60
+ export type AgentDeviceSessionDevice = {
61
+ platform: Platform;
62
+ target: DeviceTarget;
63
+ id: string;
64
+ name: string;
65
+ identifiers: AgentDeviceIdentifiers;
66
+ ios?: {
67
+ udid: string;
68
+ simulatorSetPath?: string | null;
69
+ };
70
+ android?: {
71
+ serial: string;
72
+ };
73
+ };
74
+ export type AgentDeviceSession = {
75
+ name: string;
76
+ createdAt: number;
77
+ device: AgentDeviceSessionDevice;
78
+ identifiers: AgentDeviceIdentifiers;
79
+ };
80
+ export type StartupPerfSample = {
81
+ durationMs: number;
82
+ measuredAt: string;
83
+ method: string;
84
+ appTarget?: string;
85
+ appBundleId?: string;
86
+ };
87
+ export type SessionCloseResult = {
88
+ session: string;
89
+ shutdown?: Record<string, unknown>;
90
+ identifiers: AgentDeviceIdentifiers;
91
+ };
92
+ export type EnsureSimulatorOptions = AgentDeviceRequestOverrides & {
93
+ device: string;
94
+ runtime?: string;
95
+ boot?: boolean;
96
+ reuseExisting?: boolean;
97
+ iosSimulatorDeviceSet?: string;
98
+ };
99
+ export type EnsureSimulatorResult = {
100
+ udid: string;
101
+ device: string;
102
+ runtime: string;
103
+ created: boolean;
104
+ booted: boolean;
105
+ iosSimulatorDeviceSet?: string | null;
106
+ identifiers: AgentDeviceIdentifiers;
107
+ };
108
+ export type AppDeployOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
109
+ app: string;
110
+ appPath: string;
111
+ };
112
+ export type AppDeployResult = {
113
+ app: string;
114
+ appPath: string;
115
+ platform: Platform;
116
+ appId?: string;
117
+ bundleId?: string;
118
+ package?: string;
119
+ identifiers: AgentDeviceIdentifiers;
120
+ };
121
+ export type AppOpenOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
122
+ app: string;
123
+ url?: string;
124
+ activity?: string;
125
+ relaunch?: boolean;
126
+ saveScript?: boolean | string;
127
+ noRecord?: boolean;
128
+ runtime?: SessionRuntimeHints;
129
+ };
130
+ export type AppOpenResult = {
131
+ session: string;
132
+ appName?: string;
133
+ appBundleId?: string;
134
+ appId?: string;
135
+ startup?: StartupPerfSample;
136
+ runtime?: SessionRuntimeHints;
137
+ device?: AgentDeviceSessionDevice;
138
+ identifiers: AgentDeviceIdentifiers;
139
+ };
140
+ export type AppCloseOptions = AgentDeviceRequestOverrides & {
141
+ app?: string;
142
+ shutdown?: boolean;
143
+ };
144
+ export type AppCloseResult = {
145
+ session: string;
146
+ closedApp?: string;
147
+ shutdown?: Record<string, unknown>;
148
+ identifiers: AgentDeviceIdentifiers;
149
+ };
150
+ export type AppInstallFromSourceOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
151
+ source: DaemonInstallSource;
152
+ retainPaths?: boolean;
153
+ retentionMs?: number;
154
+ };
155
+ export type AppInstallFromSourceResult = {
156
+ appName?: string;
157
+ appId?: string;
158
+ bundleId?: string;
159
+ packageName?: string;
160
+ launchTarget: string;
161
+ installablePath?: string;
162
+ archivePath?: string;
163
+ materializationId?: string;
164
+ materializationExpiresAt?: string;
165
+ identifiers: AgentDeviceIdentifiers;
166
+ };
167
+ export type MaterializationReleaseOptions = AgentDeviceRequestOverrides & {
168
+ materializationId: string;
169
+ };
170
+ export type MaterializationReleaseResult = {
171
+ released: boolean;
172
+ materializationId: string;
173
+ identifiers: AgentDeviceIdentifiers;
174
+ };
175
+ export type RuntimeShowOptions = AgentDeviceRequestOverrides;
176
+ export type RuntimeSetOptions = AgentDeviceRequestOverrides & {
177
+ platform?: PlatformSelector;
178
+ metroHost?: string;
179
+ metroPort?: number;
180
+ bundleUrl?: string;
181
+ launchUrl?: string;
182
+ };
183
+ export type RuntimeResult = {
184
+ session: string;
185
+ configured: boolean;
186
+ cleared?: boolean;
187
+ runtime?: SessionRuntimeHints;
188
+ identifiers: AgentDeviceIdentifiers;
189
+ };
190
+ export type CaptureSnapshotOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
191
+ interactiveOnly?: boolean;
192
+ compact?: boolean;
193
+ depth?: number;
194
+ scope?: string;
195
+ raw?: boolean;
196
+ };
197
+ export type CaptureSnapshotResult = {
198
+ nodes: SnapshotNode[];
199
+ truncated: boolean;
200
+ appName?: string;
201
+ appBundleId?: string;
202
+ identifiers: AgentDeviceIdentifiers;
203
+ };
204
+ export type CaptureScreenshotOptions = AgentDeviceRequestOverrides & {
205
+ path?: string;
206
+ };
207
+ export type CaptureScreenshotResult = {
208
+ path: string;
209
+ identifiers: AgentDeviceIdentifiers;
210
+ };
211
+ export type InternalRequestOptions = AgentDeviceClientConfig & AgentDeviceSelectionOptions & {
212
+ simulatorRuntimeId?: string;
213
+ runtime?: SessionRuntimeHints;
214
+ boot?: boolean;
215
+ reuseExisting?: boolean;
216
+ activity?: string;
217
+ relaunch?: boolean;
218
+ shutdown?: boolean;
219
+ saveScript?: boolean | string;
220
+ noRecord?: boolean;
221
+ metroHost?: string;
222
+ metroPort?: number;
223
+ bundleUrl?: string;
224
+ launchUrl?: string;
225
+ interactiveOnly?: boolean;
226
+ compact?: boolean;
227
+ depth?: number;
228
+ scope?: string;
229
+ raw?: boolean;
230
+ installSource?: DaemonInstallSource;
231
+ retainMaterializedPaths?: boolean;
232
+ materializedPathRetentionMs?: number;
233
+ materializationId?: string;
234
+ };
235
+ export type AgentDeviceClient = {
236
+ devices: {
237
+ list: (options?: AgentDeviceRequestOverrides & AgentDeviceSelectionOptions) => Promise<AgentDeviceDevice[]>;
238
+ };
239
+ sessions: {
240
+ list: (options?: AgentDeviceRequestOverrides) => Promise<AgentDeviceSession[]>;
241
+ close: (options?: AgentDeviceRequestOverrides & {
242
+ shutdown?: boolean;
243
+ }) => Promise<SessionCloseResult>;
244
+ };
245
+ simulators: {
246
+ ensure: (options: EnsureSimulatorOptions) => Promise<EnsureSimulatorResult>;
247
+ };
248
+ apps: {
249
+ install: (options: AppDeployOptions) => Promise<AppDeployResult>;
250
+ reinstall: (options: AppDeployOptions) => Promise<AppDeployResult>;
251
+ installFromSource: (options: AppInstallFromSourceOptions) => Promise<AppInstallFromSourceResult>;
252
+ open: (options: AppOpenOptions) => Promise<AppOpenResult>;
253
+ close: (options?: AppCloseOptions) => Promise<AppCloseResult>;
254
+ };
255
+ materializations: {
256
+ release: (options: MaterializationReleaseOptions) => Promise<MaterializationReleaseResult>;
257
+ };
258
+ runtime: {
259
+ set: (options: RuntimeSetOptions) => Promise<RuntimeResult>;
260
+ show: (options?: RuntimeShowOptions) => Promise<RuntimeResult>;
261
+ };
262
+ capture: {
263
+ snapshot: (options?: CaptureSnapshotOptions) => Promise<CaptureSnapshotResult>;
264
+ screenshot: (options?: CaptureScreenshotOptions) => Promise<CaptureScreenshotResult>;
265
+ };
266
+ };
267
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { AgentDeviceClient, AgentDeviceClientConfig, AgentDeviceDaemonTransport } from './client-types.ts';
2
+ export declare function createAgentDeviceClient(config?: AgentDeviceClientConfig, deps?: {
3
+ transport?: AgentDeviceDaemonTransport;
4
+ }): AgentDeviceClient;
5
+ export type { AgentDeviceClient, AgentDeviceClientConfig, AgentDeviceDaemonTransport, AgentDeviceDevice, AgentDeviceIdentifiers, AgentDeviceRequestOverrides, AgentDeviceSelectionOptions, AgentDeviceSession, AgentDeviceSessionDevice, AppCloseOptions, AppCloseResult, AppDeployOptions, AppDeployResult, AppInstallFromSourceOptions, AppInstallFromSourceResult, AppOpenOptions, AppOpenResult, CaptureScreenshotOptions, CaptureScreenshotResult, CaptureSnapshotOptions, CaptureSnapshotResult, EnsureSimulatorOptions, EnsureSimulatorResult, MaterializationReleaseOptions, MaterializationReleaseResult, RuntimeResult, RuntimeSetOptions, RuntimeShowOptions, SessionCloseResult, StartupPerfSample, } from './client-types.ts';
@@ -0,0 +1,8 @@
1
+ import type { DeviceInfo } from '../utils/device.ts';
2
+ type AppEventPayload = Record<string, unknown> | undefined;
3
+ export declare function parseTriggerAppEventArgs(positionals: string[]): {
4
+ eventName: string;
5
+ payload: AppEventPayload;
6
+ };
7
+ export declare function resolveAppEventUrl(platform: DeviceInfo['platform'], eventName: string, payload?: AppEventPayload): string;
8
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { BatchStep, CommandFlags } from './dispatch.ts';
2
+ export declare const DEFAULT_BATCH_MAX_STEPS = 100;
3
+ export type NormalizedBatchStep = {
4
+ command: string;
5
+ positionals: string[];
6
+ flags: Partial<CommandFlags>;
7
+ runtime?: unknown;
8
+ };
9
+ export type BatchStepResult = {
10
+ step: number;
11
+ command: string;
12
+ ok: true;
13
+ data: Record<string, unknown>;
14
+ durationMs: number;
15
+ };
16
+ export declare function parseBatchStepsJson(raw: string): BatchStep[];
17
+ export declare function validateAndNormalizeBatchSteps(steps: CommandFlags['batchSteps'], maxSteps: number): NormalizedBatchStep[];
@@ -0,0 +1,3 @@
1
+ import type { DeviceInfo } from '../utils/device.ts';
2
+ export declare function isCommandSupportedOnDevice(command: string, device: DeviceInfo): boolean;
3
+ export declare function listCapabilityCommands(): string[];
@@ -0,0 +1 @@
1
+ export declare function readNotificationPayload(payloadArg: string): Promise<Record<string, unknown>>;
@@ -0,0 +1,28 @@
1
+ import { selectDevice, type DeviceInfo } from '../utils/device.ts';
2
+ import { findBootableIosSimulator } from '../platforms/ios/devices.ts';
3
+ import type { CliFlags } from '../utils/command-schema.ts';
4
+ import type { DeviceTarget } from '../utils/device.ts';
5
+ type ResolveDeviceFlags = Pick<CliFlags, 'platform' | 'target' | 'device' | 'udid' | 'serial' | 'iosSimulatorDeviceSet' | 'androidDeviceAllowlist'>;
6
+ type IosDeviceSelector = {
7
+ platform?: 'ios';
8
+ target?: DeviceTarget;
9
+ deviceName?: string;
10
+ udid?: string;
11
+ serial?: string;
12
+ };
13
+ type ResolveIosDeviceDeps = {
14
+ selectDevice: typeof selectDevice;
15
+ findBootableSimulator: typeof findBootableIosSimulator;
16
+ };
17
+ /**
18
+ * Resolves the best iOS device given pre-fetched candidates. When no explicit
19
+ * device selector was used, physical devices are rejected in favour of a
20
+ * bootable simulator discovered via `findBootableSimulator`.
21
+ *
22
+ * Exported for testing; production callers should use `resolveTargetDevice`.
23
+ */
24
+ export declare function resolveIosDevice(devices: DeviceInfo[], selector: IosDeviceSelector, context: {
25
+ simulatorSetPath?: string;
26
+ }, deps: ResolveIosDeviceDeps): Promise<DeviceInfo>;
27
+ export declare function resolveTargetDevice(flags: ResolveDeviceFlags): Promise<DeviceInfo>;
28
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { DeviceInfo } from '../utils/device.ts';
2
+ export declare function requireIntInRange(value: number, name: string, min: number, max: number): number;
3
+ export declare function clampIosSwipeDuration(durationMs: number): number;
4
+ export declare function shouldUseIosTapSeries(device: DeviceInfo, count: number, holdMs: number, jitterPx: number): boolean;
5
+ export declare function shouldUseIosDragSeries(device: DeviceInfo, count: number): boolean;
6
+ export declare function computeDeterministicJitter(index: number, jitterPx: number): [number, number];
7
+ export declare function runRepeatedSeries(count: number, pauseMs: number, operation: (index: number) => Promise<void>): Promise<void>;
@@ -0,0 +1,34 @@
1
+ import type { DeviceInfo } from '../utils/device.ts';
2
+ import type { CliFlags } from '../utils/command-schema.ts';
3
+ import { shouldUseIosTapSeries, shouldUseIosDragSeries } from './dispatch-series.ts';
4
+ export { resolveTargetDevice } from './dispatch-resolve.ts';
5
+ export { shouldUseIosTapSeries, shouldUseIosDragSeries };
6
+ export type BatchStep = {
7
+ command: string;
8
+ positionals?: string[];
9
+ flags?: Partial<CommandFlags>;
10
+ runtime?: unknown;
11
+ };
12
+ export type CommandFlags = Omit<CliFlags, 'json' | 'help' | 'version' | 'batchSteps'> & {
13
+ batchSteps?: BatchStep[];
14
+ };
15
+ export declare function dispatchCommand(device: DeviceInfo, command: string, positionals: string[], outPath?: string, context?: {
16
+ requestId?: string;
17
+ appBundleId?: string;
18
+ activity?: string;
19
+ verbose?: boolean;
20
+ logPath?: string;
21
+ traceLogPath?: string;
22
+ snapshotInteractiveOnly?: boolean;
23
+ snapshotCompact?: boolean;
24
+ snapshotDepth?: number;
25
+ snapshotScope?: string;
26
+ snapshotRaw?: boolean;
27
+ count?: number;
28
+ intervalMs?: number;
29
+ holdMs?: number;
30
+ jitterPx?: number;
31
+ doubleTap?: boolean;
32
+ pauseMs?: number;
33
+ pattern?: 'one-way' | 'ping-pong';
34
+ }): Promise<Record<string, unknown> | void>;
@@ -0,0 +1,4 @@
1
+ export declare function isDeepLinkTarget(input: string): boolean;
2
+ export declare function isWebUrl(input: string): boolean;
3
+ export declare const IOS_SAFARI_BUNDLE_ID = "com.apple.mobilesafari";
4
+ export declare function resolveIosDeviceDeepLinkBundleId(appBundleId: string | undefined, url: string): string | undefined;
@@ -0,0 +1,8 @@
1
+ export declare const SETTINGS_WIFI_USAGE = "<wifi|airplane|location> <on|off>";
2
+ export declare const SETTINGS_APPEARANCE_USAGE = "appearance <light|dark|toggle>";
3
+ export declare const SETTINGS_FACEID_USAGE = "faceid <match|nonmatch|enroll|unenroll>";
4
+ export declare const SETTINGS_TOUCHID_USAGE = "touchid <match|nonmatch|enroll|unenroll>";
5
+ export declare const SETTINGS_FINGERPRINT_USAGE = "fingerprint <match|nonmatch>";
6
+ export declare const SETTINGS_PERMISSION_USAGE = "permission <grant|deny|reset> <camera|microphone|photos|contacts|contacts-limited|notifications|calendar|location|location-always|media-library|motion|reminders|siri> [full|limited]";
7
+ export declare const SETTINGS_USAGE_OVERRIDE: string;
8
+ export declare const SETTINGS_INVALID_ARGS_MESSAGE = "settings requires <wifi|airplane|location> <on|off>, appearance <light|dark|toggle>, faceid <match|nonmatch|enroll|unenroll>, touchid <match|nonmatch|enroll|unenroll>, fingerprint <match|nonmatch>, or permission <grant|deny|reset> <camera|microphone|photos|contacts|contacts-limited|notifications|calendar|location|location-always|media-library|motion|reminders|siri> [full|limited]";
@@ -0,0 +1,3 @@
1
+ import type { SessionAction } from './types.ts';
2
+ export declare function inferFillText(action: SessionAction): string;
3
+ export declare function uniqueStrings(values: string[]): string[];
@@ -0,0 +1,4 @@
1
+ import fs from 'node:fs';
2
+ import { type AppLogResult } from './app-log-process.ts';
3
+ export declare function assertAndroidPackageArgSafe(appBundleId: string): void;
4
+ export declare function startAndroidAppLog(deviceId: string, appBundleId: string, stream: fs.WriteStream, redactionPatterns: RegExp[], pidPath?: string): Promise<AppLogResult>;
@@ -0,0 +1,6 @@
1
+ import fs from 'node:fs';
2
+ import { type AppLogResult } from './app-log-process.ts';
3
+ export declare function buildIosLogPredicate(appBundleId: string): string;
4
+ export declare function buildIosDeviceLogStreamArgs(deviceId: string): string[];
5
+ export declare function startIosSimulatorAppLog(appBundleId: string, stream: fs.WriteStream, redactionPatterns: RegExp[], pidPath?: string): Promise<AppLogResult>;
6
+ export declare function startIosDeviceAppLog(deviceId: string, stream: fs.WriteStream, redactionPatterns: RegExp[], pidPath?: string): Promise<AppLogResult>;
@@ -0,0 +1,15 @@
1
+ export declare const APP_LOG_PID_FILENAME = "app-log.pid";
2
+ export type AppLogResult = {
3
+ backend: 'ios-simulator' | 'ios-device' | 'android';
4
+ getState: () => 'active' | 'failed';
5
+ startedAt: number;
6
+ stop: () => Promise<void>;
7
+ wait: Promise<{
8
+ stdout: string;
9
+ stderr: string;
10
+ exitCode: number;
11
+ }>;
12
+ };
13
+ export declare function writePidFile(pidPath: string | undefined, pid: number): void;
14
+ export declare function clearPidFile(pidPath: string | undefined): void;
15
+ export declare function cleanupStaleAppLogProcesses(sessionsDir: string): void;
@@ -0,0 +1,19 @@
1
+ import { spawn } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import type { ExecResult } from '../utils/exec.ts';
4
+ export declare function waitForChildExit(wait: Promise<ExecResult>, timeoutMs?: number): Promise<void>;
5
+ export declare function sleep(ms: number): Promise<void>;
6
+ export declare function createLineWriter(stream: fs.WriteStream, options: {
7
+ redactionPatterns: RegExp[];
8
+ includeTokens?: string[];
9
+ }): {
10
+ onChunk: (chunk: string) => void;
11
+ flush: () => void;
12
+ };
13
+ export declare function attachChildToStream(child: ReturnType<typeof spawn>, stream: fs.WriteStream, options: {
14
+ endStreamOnClose: boolean;
15
+ writer: {
16
+ onChunk: (chunk: string) => void;
17
+ flush: () => void;
18
+ };
19
+ }): Promise<ExecResult>;
@@ -0,0 +1,28 @@
1
+ import type { DeviceInfo } from '../utils/device.ts';
2
+ import type { AppLogResult } from './app-log-process.ts';
3
+ export type { AppLogResult } from './app-log-process.ts';
4
+ export { APP_LOG_PID_FILENAME, cleanupStaleAppLogProcesses } from './app-log-process.ts';
5
+ export { assertAndroidPackageArgSafe } from './app-log-android.ts';
6
+ export { buildIosDeviceLogStreamArgs, buildIosLogPredicate } from './app-log-ios.ts';
7
+ export type AppLogDoctorResult = {
8
+ checks: Record<string, boolean>;
9
+ notes: string[];
10
+ };
11
+ export declare function rotateAppLogIfNeeded(outPath: string, config: {
12
+ maxBytes: number;
13
+ maxRotatedFiles: number;
14
+ }): void;
15
+ export declare function getAppLogPathMetadata(outPath: string): {
16
+ exists: boolean;
17
+ sizeBytes: number;
18
+ modifiedAt?: string;
19
+ };
20
+ export declare function startAppLog(device: DeviceInfo, appBundleId: string, outPath: string, pidPath?: string): Promise<AppLogResult>;
21
+ export declare function stopAppLog(appLog: AppLogResult): Promise<void>;
22
+ export declare function runAppLogDoctor(device: DeviceInfo, appBundleId?: string): Promise<AppLogDoctorResult>;
23
+ export declare function appendAppLogMarker(outPath: string, marker: string): void;
24
+ export declare function clearAppLogFiles(outPath: string): {
25
+ path: string;
26
+ cleared: boolean;
27
+ removedRotatedFiles: number;
28
+ };
@@ -0,0 +1,12 @@
1
+ export declare function extractTarInstallableArtifact(params: {
2
+ archivePath: string;
3
+ tempDir: string;
4
+ platform: 'ios' | 'android';
5
+ expectedRootName?: string;
6
+ }): Promise<string>;
7
+ export declare function resolveTarArchiveRootName(params: {
8
+ archivePath: string;
9
+ platform: 'ios' | 'android';
10
+ expectedRootName?: string;
11
+ }): Promise<string>;
12
+ export declare function readZipEntries(archivePath: string): Promise<string[] | null>;
@@ -0,0 +1,12 @@
1
+ export declare function sanitizeArtifactFilename(raw: string): string;
2
+ export declare function createArtifactTempDir(requestId?: string): string;
3
+ export declare function validateArtifactContentLength(rawLength: string | number | undefined): void;
4
+ export declare function streamReadableToFile(source: NodeJS.ReadableStream, destPath: string): Promise<void>;
5
+ export declare function downloadArtifactToTempDir(params: {
6
+ url: string;
7
+ headers?: Record<string, string>;
8
+ requestId?: string;
9
+ tempDir: string;
10
+ }): Promise<{
11
+ archivePath: string;
12
+ }>;
@@ -0,0 +1,17 @@
1
+ export type MaterializeArtifactParams = {
2
+ platform: 'ios' | 'android';
3
+ url: string;
4
+ headers?: Record<string, string>;
5
+ requestId?: string;
6
+ };
7
+ export type MaterializedArtifact = {
8
+ archivePath: string;
9
+ installablePath: string;
10
+ detected: {
11
+ packageName?: string;
12
+ bundleId?: string;
13
+ appName?: string;
14
+ };
15
+ };
16
+ export declare function cleanupMaterializedArtifact(result: MaterializedArtifact): void;
17
+ export declare function materializeArtifact(params: MaterializeArtifactParams): Promise<MaterializedArtifact>;
@@ -0,0 +1,12 @@
1
+ export declare function trackDownloadableArtifact(params: {
2
+ artifactPath: string;
3
+ tenantId?: string;
4
+ fileName?: string;
5
+ deleteAfterDownload?: boolean;
6
+ }): string;
7
+ export declare function prepareDownloadableArtifact(artifactId: string, tenantId?: string): {
8
+ artifactPath: string;
9
+ fileName?: string;
10
+ deleteAfterDownload: boolean;
11
+ };
12
+ export declare function cleanupDownloadableArtifact(artifactId: string): void;
@@ -0,0 +1,16 @@
1
+ export type DaemonServerMode = 'socket' | 'http' | 'dual';
2
+ export type DaemonTransportPreference = 'auto' | 'socket' | 'http';
3
+ export type SessionIsolationMode = 'none' | 'tenant';
4
+ export type DaemonPaths = {
5
+ baseDir: string;
6
+ infoPath: string;
7
+ lockPath: string;
8
+ logPath: string;
9
+ sessionsDir: string;
10
+ };
11
+ export declare function resolveDaemonPaths(stateDir: string | undefined): DaemonPaths;
12
+ export declare function resolveStateDir(raw: string | undefined): string;
13
+ export declare function resolveDaemonServerMode(raw: string | undefined): DaemonServerMode;
14
+ export declare function resolveDaemonTransportPreference(raw: string | undefined): DaemonTransportPreference;
15
+ export declare function resolveSessionIsolationMode(raw: string | undefined): SessionIsolationMode;
16
+ export declare function normalizeTenantId(raw: string | undefined): string | undefined;
@@ -0,0 +1,22 @@
1
+ import type { CommandFlags } from '../core/dispatch.ts';
2
+ export type DaemonCommandContext = {
3
+ requestId?: string;
4
+ appBundleId?: string;
5
+ activity?: string;
6
+ verbose?: boolean;
7
+ logPath?: string;
8
+ traceLogPath?: string;
9
+ snapshotInteractiveOnly?: boolean;
10
+ snapshotCompact?: boolean;
11
+ snapshotDepth?: number;
12
+ snapshotScope?: string;
13
+ snapshotRaw?: boolean;
14
+ count?: number;
15
+ intervalMs?: number;
16
+ holdMs?: number;
17
+ jitterPx?: number;
18
+ doubleTap?: boolean;
19
+ pauseMs?: number;
20
+ pattern?: 'one-way' | 'ping-pong';
21
+ };
22
+ export declare function contextFromFlags(logPath: string, flags: CommandFlags | undefined, appBundleId?: string, traceLogPath?: string, requestId?: string): DaemonCommandContext;
@@ -0,0 +1,6 @@
1
+ import type { DeviceInfo } from '../utils/device.ts';
2
+ export declare function ensureDeviceReady(device: DeviceInfo): Promise<void>;
3
+ export declare function parseIosReadyPayload(payload: unknown): {
4
+ tunnelState?: string;
5
+ };
6
+ export declare function resolveIosReadyHint(stdout: string, stderr: string): string;
@@ -0,0 +1,40 @@
1
+ import { dispatchCommand } from '../../core/dispatch.ts';
2
+ import { type FindLocator } from '../../utils/finders.ts';
3
+ import type { DaemonRequest, DaemonResponse } from '../types.ts';
4
+ import { SessionStore } from '../session-store.ts';
5
+ export declare function handleFindCommands(params: {
6
+ req: DaemonRequest;
7
+ sessionName: string;
8
+ logPath: string;
9
+ sessionStore: SessionStore;
10
+ invoke: (req: DaemonRequest) => Promise<DaemonResponse>;
11
+ dispatch?: typeof dispatchCommand;
12
+ }): Promise<DaemonResponse | null>;
13
+ type FindAction = {
14
+ kind: 'click';
15
+ } | {
16
+ kind: 'focus';
17
+ } | {
18
+ kind: 'fill';
19
+ value: string;
20
+ } | {
21
+ kind: 'type';
22
+ value: string;
23
+ } | {
24
+ kind: 'get_text';
25
+ } | {
26
+ kind: 'get_attrs';
27
+ } | {
28
+ kind: 'exists';
29
+ } | {
30
+ kind: 'wait';
31
+ timeoutMs?: number;
32
+ };
33
+ export declare function parseFindArgs(args: string[]): {
34
+ locator: FindLocator;
35
+ query: string;
36
+ action: FindAction['kind'];
37
+ value?: string;
38
+ timeoutMs?: number;
39
+ };
40
+ export {};
@@ -0,0 +1,10 @@
1
+ import { SessionStore } from '../session-store.ts';
2
+ import type { DaemonRequest, DaemonResponse } from '../types.ts';
3
+ export declare function handleInstallFromSourceCommand(params: {
4
+ req: DaemonRequest;
5
+ sessionName: string;
6
+ sessionStore: SessionStore;
7
+ }): Promise<DaemonResponse>;
8
+ export declare function handleReleaseMaterializedPathsCommand(params: {
9
+ req: DaemonRequest;
10
+ }): Promise<DaemonResponse>;
@@ -0,0 +1,14 @@
1
+ import { dispatchCommand, type CommandFlags } from '../../core/dispatch.ts';
2
+ import type { DaemonCommandContext } from '../context.ts';
3
+ import type { DaemonRequest, DaemonResponse } from '../types.ts';
4
+ import { SessionStore } from '../session-store.ts';
5
+ type ContextFromFlags = (flags: CommandFlags | undefined, appBundleId?: string, traceLogPath?: string) => DaemonCommandContext;
6
+ export declare function handleInteractionCommands(params: {
7
+ req: DaemonRequest;
8
+ sessionName: string;
9
+ sessionStore: SessionStore;
10
+ contextFromFlags: ContextFromFlags;
11
+ dispatch?: typeof dispatchCommand;
12
+ }): Promise<DaemonResponse | null>;
13
+ export declare function unsupportedRefSnapshotFlags(flags: CommandFlags | undefined): string[];
14
+ export {};