agent-scenario-loop 0.1.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 (170) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -0
  3. package/app/profile-session.ts +812 -0
  4. package/core/config-template.json +41 -0
  5. package/dist/core/agent-summary.d.ts +15 -0
  6. package/dist/core/agent-summary.js +177 -0
  7. package/dist/core/artifact-contract.d.ts +151 -0
  8. package/dist/core/artifact-contract.js +897 -0
  9. package/dist/core/artifact-layout.d.ts +56 -0
  10. package/dist/core/artifact-layout.js +61 -0
  11. package/dist/core/artifact-writer.d.ts +44 -0
  12. package/dist/core/artifact-writer.js +55 -0
  13. package/dist/core/comparison.d.ts +133 -0
  14. package/dist/core/comparison.js +294 -0
  15. package/dist/core/evidence-interpreter.d.ts +28 -0
  16. package/dist/core/evidence-interpreter.js +69 -0
  17. package/dist/core/execution-plan.d.ts +44 -0
  18. package/dist/core/execution-plan.js +95 -0
  19. package/dist/core/planner.d.ts +132 -0
  20. package/dist/core/planner.js +812 -0
  21. package/dist/core/ports.d.ts +198 -0
  22. package/dist/core/ports.js +146 -0
  23. package/dist/core/run-index.d.ts +62 -0
  24. package/dist/core/run-index.js +143 -0
  25. package/dist/core/schema-validator.d.ts +86 -0
  26. package/dist/core/schema-validator.js +407 -0
  27. package/dist/index.d.ts +11 -0
  28. package/dist/index.js +27 -0
  29. package/dist/runner/agent-device-driver.d.ts +126 -0
  30. package/dist/runner/agent-device-driver.js +168 -0
  31. package/dist/runner/agent-device.d.ts +295 -0
  32. package/dist/runner/agent-device.js +1271 -0
  33. package/dist/runner/android-adb-driver.d.ts +175 -0
  34. package/dist/runner/android-adb-driver.js +399 -0
  35. package/dist/runner/android-adb.d.ts +254 -0
  36. package/dist/runner/android-adb.js +1618 -0
  37. package/dist/runner/argent-driver.d.ts +183 -0
  38. package/dist/runner/argent-driver.js +297 -0
  39. package/dist/runner/argent.d.ts +349 -0
  40. package/dist/runner/argent.js +1211 -0
  41. package/dist/runner/check-plan.d.ts +45 -0
  42. package/dist/runner/check-plan.js +210 -0
  43. package/dist/runner/cli.d.ts +20 -0
  44. package/dist/runner/cli.js +23 -0
  45. package/dist/runner/compare-latest.d.ts +99 -0
  46. package/dist/runner/compare-latest.js +233 -0
  47. package/dist/runner/compare.d.ts +58 -0
  48. package/dist/runner/compare.js +157 -0
  49. package/dist/runner/demo-loop.d.ts +45 -0
  50. package/dist/runner/demo-loop.js +170 -0
  51. package/dist/runner/example-android-live.d.ts +137 -0
  52. package/dist/runner/example-android-live.js +454 -0
  53. package/dist/runner/example-ios-live.d.ts +137 -0
  54. package/dist/runner/example-ios-live.js +471 -0
  55. package/dist/runner/host-doctor.d.ts +131 -0
  56. package/dist/runner/host-doctor.js +628 -0
  57. package/dist/runner/init-project.d.ts +88 -0
  58. package/dist/runner/init-project.js +263 -0
  59. package/dist/runner/ios-simctl-driver.d.ts +69 -0
  60. package/dist/runner/ios-simctl-driver.js +97 -0
  61. package/dist/runner/ios-simctl.d.ts +254 -0
  62. package/dist/runner/ios-simctl.js +1415 -0
  63. package/dist/runner/live-android.d.ts +137 -0
  64. package/dist/runner/live-android.js +539 -0
  65. package/dist/runner/live-comparison.d.ts +67 -0
  66. package/dist/runner/live-comparison.js +147 -0
  67. package/dist/runner/live-ios.d.ts +137 -0
  68. package/dist/runner/live-ios.js +460 -0
  69. package/dist/runner/live-proof-summary.d.ts +263 -0
  70. package/dist/runner/live-proof-summary.js +465 -0
  71. package/dist/runner/live-proof.d.ts +467 -0
  72. package/dist/runner/live-proof.js +920 -0
  73. package/dist/runner/local-env.d.ts +64 -0
  74. package/dist/runner/local-env.js +155 -0
  75. package/dist/runner/profile-android.d.ts +82 -0
  76. package/dist/runner/profile-android.js +671 -0
  77. package/dist/runner/profile-ios.d.ts +108 -0
  78. package/dist/runner/profile-ios.js +532 -0
  79. package/dist/runner/profile-mobile.d.ts +254 -0
  80. package/dist/runner/profile-mobile.js +1307 -0
  81. package/dist/runner/validate-project.d.ts +273 -0
  82. package/dist/runner/validate-project.js +1501 -0
  83. package/docs/adapters.md +145 -0
  84. package/docs/api.md +94 -0
  85. package/docs/authoring.md +196 -0
  86. package/docs/concepts.md +136 -0
  87. package/docs/consumer-rehearsal.md +115 -0
  88. package/docs/contracts.md +267 -0
  89. package/docs/live-proofs.md +270 -0
  90. package/docs/principles.md +46 -0
  91. package/examples/event-logs/app-startup-baseline.log +4 -0
  92. package/examples/event-logs/app-startup-current.log +4 -0
  93. package/examples/minimal-app/README.md +70 -0
  94. package/examples/mobile-app/README.md +302 -0
  95. package/examples/mobile-app/app.json +22 -0
  96. package/examples/mobile-app/asl/package-scripts.json +32 -0
  97. package/examples/mobile-app/asl.config.json +37 -0
  98. package/examples/mobile-app/event-logs/android-app-startup.log +4 -0
  99. package/examples/mobile-app/event-logs/android-open-close-cycle.log +12 -0
  100. package/examples/mobile-app/event-logs/android-scroll-settle.log +12 -0
  101. package/examples/mobile-app/event-logs/app-startup.log +4 -0
  102. package/examples/mobile-app/event-logs/open-close-cycle.log +12 -0
  103. package/examples/mobile-app/event-logs/scroll-settle.log +12 -0
  104. package/examples/mobile-app/index.ts +20 -0
  105. package/examples/mobile-app/metro.config.js +20 -0
  106. package/examples/mobile-app/package.json +62 -0
  107. package/examples/mobile-app/patches/expo-modules-jsi@56.0.10.patch +19 -0
  108. package/examples/mobile-app/plugins/with-ios-build-compat.js +271 -0
  109. package/examples/mobile-app/pnpm-lock.yaml +4440 -0
  110. package/examples/mobile-app/runner-manifests/evidence-provider.json +79 -0
  111. package/examples/mobile-app/runner-manifests/primary-runner.json +19 -0
  112. package/examples/mobile-app/scenarios/android/app-startup-video.json +73 -0
  113. package/examples/mobile-app/scenarios/android/app-startup.json +44 -0
  114. package/examples/mobile-app/scenarios/android/open-close-cycle.json +54 -0
  115. package/examples/mobile-app/scenarios/android/scroll-settle.json +49 -0
  116. package/examples/mobile-app/scenarios/ios/app-startup.json +44 -0
  117. package/examples/mobile-app/scenarios/ios/open-close-cycle.json +54 -0
  118. package/examples/mobile-app/scenarios/ios/scroll-settle.json +49 -0
  119. package/examples/mobile-app/scenarios/mobile/app-startup.json +91 -0
  120. package/examples/mobile-app/scenarios/mobile/open-close-cycle.json +160 -0
  121. package/examples/mobile-app/scenarios/mobile/scroll-settle.json +148 -0
  122. package/examples/mobile-app/scripts/asl-capture-accessibility-provider.mjs +112 -0
  123. package/examples/mobile-app/scripts/asl-capture-profiler-provider.mjs +127 -0
  124. package/examples/mobile-app/src/devtools/profile-session.ts +7 -0
  125. package/examples/mobile-app/src/example-screen.tsx +322 -0
  126. package/examples/mobile-app/tsconfig.json +16 -0
  127. package/examples/mobile-app/tsconfig.typecheck.json +13 -0
  128. package/examples/runners/README.md +44 -0
  129. package/examples/runners/adb-android.json +25 -0
  130. package/examples/runners/agent-device-android.json +27 -0
  131. package/examples/runners/agent-device-ios.json +27 -0
  132. package/examples/runners/argent-android.json +32 -0
  133. package/examples/runners/argent-ios.json +32 -0
  134. package/examples/runners/argent-react-profiler-provider.json +15 -0
  135. package/examples/runners/axe-accessibility-provider.json +24 -0
  136. package/examples/runners/manual-log-ingest.json +9 -0
  137. package/examples/runners/rozenite-profiler-provider.json +9 -0
  138. package/examples/runners/script-accessibility-provider.json +24 -0
  139. package/examples/runners/script-memory-provider.json +24 -0
  140. package/examples/runners/script-network-provider.json +24 -0
  141. package/examples/runners/script-profiler-provider.json +30 -0
  142. package/examples/runners/xcodebuildmcp-ios.json +29 -0
  143. package/examples/scenarios/ios/app-startup.json +28 -0
  144. package/examples/scenarios/ios/open-close-cycle.json +35 -0
  145. package/examples/scenarios/mobile/app-startup.json +72 -0
  146. package/examples/scenarios/mobile/media-open-close.json +141 -0
  147. package/examples/scenarios/mobile/open-close-cycle.json +135 -0
  148. package/examples/scenarios/mobile/scroll-settle.json +106 -0
  149. package/package.json +240 -0
  150. package/schemas/budget-verdict.schema.json +115 -0
  151. package/schemas/causal-run.schema.json +279 -0
  152. package/schemas/comparison.schema.json +196 -0
  153. package/schemas/health.schema.json +108 -0
  154. package/schemas/live-proof-set.schema.json +195 -0
  155. package/schemas/live-proof.schema.json +413 -0
  156. package/schemas/manifest.schema.json +204 -0
  157. package/schemas/metrics.schema.json +137 -0
  158. package/schemas/project-validation.schema.json +343 -0
  159. package/schemas/runner-capabilities.schema.json +217 -0
  160. package/schemas/scenario.schema.json +400 -0
  161. package/schemas/verdict.schema.json +88 -0
  162. package/templates/evidence-provider.json +83 -0
  163. package/templates/gitignore-snippet +9 -0
  164. package/templates/integration-readme.md +125 -0
  165. package/templates/mobile-scenario.json +133 -0
  166. package/templates/package-scripts.json +32 -0
  167. package/templates/primary-runner.json +19 -0
  168. package/templates/project.config.json +37 -0
  169. package/templates/scripts/asl-capture-accessibility-provider.mjs +112 -0
  170. package/templates/scripts/asl-capture-profiler-provider.mjs +127 -0
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAgentDeviceGlobalArgs = buildAgentDeviceGlobalArgs;
4
+ exports.createAgentDeviceDriver = createAgentDeviceDriver;
5
+ exports.formatAgentDeviceRawOutput = formatAgentDeviceRawOutput;
6
+ exports.formatAgentDeviceSelector = formatAgentDeviceSelector;
7
+ /**
8
+ * Adds stable driver metadata to one agent-device command result.
9
+ *
10
+ * @param {{action: string, capturePath?: string, rawFileName: string, result: Awaited<ReturnType<AgentDeviceCommandExecutor>>}} options
11
+ * @returns {AgentDeviceCommandResult}
12
+ */
13
+ function buildAgentDeviceResult({ action, capturePath, rawFileName, result, }) {
14
+ return {
15
+ action,
16
+ args: result.args,
17
+ command: result.command,
18
+ exitCode: result.exitCode,
19
+ rawFileName,
20
+ stderr: result.stderr,
21
+ stdout: result.stdout,
22
+ ...(capturePath ? { capturePath } : {}),
23
+ };
24
+ }
25
+ /**
26
+ * Builds global CLI flags shared by all agent-device driver actions.
27
+ *
28
+ * @param {AgentDeviceDriverOptions} options
29
+ * @returns {string[]}
30
+ */
31
+ function buildAgentDeviceGlobalArgs(options) {
32
+ const args = ['--platform', options.platform];
33
+ if (options.target) {
34
+ args.push('--target', options.target);
35
+ }
36
+ if (options.device) {
37
+ args.push('--device', options.device);
38
+ }
39
+ if (options.udid) {
40
+ args.push('--udid', options.udid);
41
+ }
42
+ if (options.serial) {
43
+ args.push('--serial', options.serial);
44
+ }
45
+ if (options.session) {
46
+ args.push('--session', options.session);
47
+ }
48
+ if (options.extraArgs?.length) {
49
+ args.push(...options.extraArgs);
50
+ }
51
+ if (options.json !== false) {
52
+ args.push('--json');
53
+ }
54
+ return args;
55
+ }
56
+ /**
57
+ * Formats one portable selector as an agent-device selector expression.
58
+ *
59
+ * @param {AgentDeviceSelector} selector
60
+ * @returns {string}
61
+ */
62
+ function formatAgentDeviceSelector(selector) {
63
+ if (selector.match && selector.match !== 'exact') {
64
+ throw new Error(`agent-device selector match \`${selector.match}\` is not supported yet.`);
65
+ }
66
+ const escapedValue = selector.value.replace(/\\/gu, '\\\\').replace(/"/gu, '\\"');
67
+ if (selector.kind === 'accessibilityId' || selector.kind === 'resourceId' || selector.kind === 'testId') {
68
+ return `id="${escapedValue}"`;
69
+ }
70
+ if (selector.kind === 'accessibilityLabel') {
71
+ return `label="${escapedValue}"`;
72
+ }
73
+ if (selector.kind === 'text') {
74
+ return `text="${escapedValue}"`;
75
+ }
76
+ if (selector.kind === 'xpath') {
77
+ return `xpath="${escapedValue}"`;
78
+ }
79
+ throw new Error(`Unsupported agent-device selector kind \`${selector.kind}\`.`);
80
+ }
81
+ /**
82
+ * Combines stdout and stderr into the raw evidence text written by callers.
83
+ *
84
+ * @param {{stdout: string, stderr: string}} result
85
+ * @returns {string}
86
+ */
87
+ function formatAgentDeviceRawOutput(result) {
88
+ return [result.stdout, result.stderr].filter(Boolean).join('\n');
89
+ }
90
+ /**
91
+ * Creates an agent-device-backed driver for portable mobile actions.
92
+ *
93
+ * The adapter shells out through an injected executor so consumers can choose
94
+ * local, remote, or test doubles without making agent-device a package dependency.
95
+ *
96
+ * @param {AgentDeviceDriverOptions} options
97
+ * @returns {AgentDeviceDriver}
98
+ */
99
+ function createAgentDeviceDriver(options) {
100
+ const globalArgs = buildAgentDeviceGlobalArgs(options);
101
+ const run = async (action, rawFileName, commandArgs, capturePath) => {
102
+ const result = await options.executor(options.agentDevicePath, [...commandArgs, ...globalArgs]);
103
+ return buildAgentDeviceResult({
104
+ action,
105
+ rawFileName,
106
+ result,
107
+ ...(capturePath ? { capturePath } : {}),
108
+ });
109
+ };
110
+ return {
111
+ async alert({ action = 'get', rawFileName = 'agent-device-alert.txt', timeoutMs, } = {}) {
112
+ const args = ['alert', action];
113
+ if (typeof timeoutMs === 'number' && Number.isFinite(timeoutMs)) {
114
+ args.push(String(timeoutMs));
115
+ }
116
+ return run('alert', rawFileName, args);
117
+ },
118
+ async assertVisible({ rawFileName = 'agent-device-assert-visible.txt', selector, }) {
119
+ return run('assertVisible', rawFileName, ['is', 'visible', formatAgentDeviceSelector(selector)]);
120
+ },
121
+ async close(app) {
122
+ return run('close', 'agent-device-close.txt', ['close', app]);
123
+ },
124
+ async inspectTree({ interactive = true, rawFileName = 'agent-device-snapshot.txt', } = {}) {
125
+ return run('inspectTree', rawFileName, ['snapshot', ...(interactive ? ['-i'] : [])]);
126
+ },
127
+ async open({ appOrUrl, rawFileName = 'agent-device-open.txt', url, }) {
128
+ return run('open', rawFileName, ['open', appOrUrl, ...(url ? [url] : [])]);
129
+ },
130
+ async readLogs({ rawFileName = 'agent-device-logs.txt', } = {}) {
131
+ return run('readLogs', rawFileName, ['logs', 'path']);
132
+ },
133
+ async screenshot({ outputPath, rawFileName = 'agent-device-screenshot.txt', }) {
134
+ return run('screenshot', rawFileName, ['screenshot', outputPath], outputPath);
135
+ },
136
+ async scroll({ amount, direction = 'down', durationMs, endX, endY, pixels, rawFileName = 'agent-device-scroll.txt', startX, startY, } = {}) {
137
+ const hasCoordinates = [startX, startY, endX, endY].every((value) => typeof value === 'number');
138
+ if (hasCoordinates) {
139
+ return run('scroll', rawFileName, [
140
+ 'swipe',
141
+ String(startX),
142
+ String(startY),
143
+ String(endX),
144
+ String(endY),
145
+ ...(typeof durationMs === 'number' ? [String(durationMs)] : []),
146
+ ]);
147
+ }
148
+ return run('scroll', rawFileName, [
149
+ 'scroll',
150
+ direction,
151
+ ...(amount ? [amount] : []),
152
+ ...(typeof pixels === 'number' ? ['--pixels', String(pixels)] : []),
153
+ ]);
154
+ },
155
+ async tap({ rawFileName = 'agent-device-tap.txt', ref, selector, x, y, }) {
156
+ if (selector) {
157
+ return run('tap', rawFileName, ['click', formatAgentDeviceSelector(selector)]);
158
+ }
159
+ if (ref) {
160
+ return run('tap', rawFileName, ['click', ref.startsWith('@') ? ref : `@${ref}`]);
161
+ }
162
+ if (typeof x === 'number' && typeof y === 'number') {
163
+ return run('tap', rawFileName, ['click', String(x), String(y)]);
164
+ }
165
+ throw new Error('agent-device tap requires a selector, ref, or x/y coordinates.');
166
+ },
167
+ };
168
+ }
@@ -0,0 +1,295 @@
1
+ #!/usr/bin/env node
2
+ type CliArgs = {
3
+ app?: string | boolean;
4
+ 'agent-device'?: string | boolean;
5
+ check?: string | boolean;
6
+ 'command-timeout-ms'?: string | boolean;
7
+ device?: string | boolean;
8
+ open?: string | boolean;
9
+ out?: string | boolean;
10
+ platform?: string | boolean;
11
+ 'require-platforms'?: string | boolean;
12
+ 'run-id'?: string | boolean;
13
+ scenario?: string | boolean;
14
+ serial?: string | boolean;
15
+ session?: string | boolean;
16
+ 'session-mode'?: string | boolean;
17
+ target?: string | boolean;
18
+ udid?: string | boolean;
19
+ 'wait-ms'?: string | boolean;
20
+ [key: string]: string | boolean | undefined;
21
+ };
22
+ type CommandResult = {
23
+ args: string[];
24
+ command: string;
25
+ exitCode: number;
26
+ stderr: string;
27
+ stdout: string;
28
+ };
29
+ type CommandExecutor = (command: string, args: string[]) => Promise<CommandResult>;
30
+ type ScenarioExecutionStep = import('../core/execution-plan').ScenarioExecutionStep;
31
+ type AgentDeviceSessionMode = 'bind' | 'reuse';
32
+ type AgentDeviceAvailabilityOptions = {
33
+ agentDevicePath?: string;
34
+ commandTimeoutMs?: number;
35
+ executor?: CommandExecutor;
36
+ requiredCommands?: string[];
37
+ requiredPlatforms?: import('./agent-device-driver').AgentDevicePlatform[];
38
+ };
39
+ type AgentDeviceAvailabilityCheck = {
40
+ args: string[];
41
+ code: string;
42
+ command: string;
43
+ exitCode: number;
44
+ metadata?: Record<string, string | number | boolean | null>;
45
+ message: string;
46
+ name: string;
47
+ stderrPreview?: string;
48
+ status: 'failed' | 'passed';
49
+ stdoutPreview?: string;
50
+ };
51
+ type AgentDeviceAvailabilityResult = {
52
+ agentDevicePath: string;
53
+ checks: AgentDeviceAvailabilityCheck[];
54
+ devices: Array<Record<string, unknown>>;
55
+ requiredCommands: string[];
56
+ requiredPlatforms: string[];
57
+ sessions: Array<Record<string, unknown>>;
58
+ status: 'failed' | 'passed';
59
+ };
60
+ type AgentDeviceAvailabilityArtifactOptions = {
61
+ outputDir: string;
62
+ result: AgentDeviceAvailabilityResult;
63
+ runId?: string;
64
+ };
65
+ type AgentDeviceDriverStep = {
66
+ amount?: string;
67
+ captureFileName?: string;
68
+ direction?: string;
69
+ driverAction: 'assertVisible' | 'inspectTree' | 'readLogs' | 'screenshot' | 'scroll' | 'tap';
70
+ durationMs?: number;
71
+ endX?: number;
72
+ endY?: number;
73
+ pixels?: number;
74
+ rawFileName?: string;
75
+ ref?: string;
76
+ required?: boolean;
77
+ selector?: import('./agent-device-driver').AgentDeviceSelector;
78
+ stepId?: string;
79
+ startX?: number;
80
+ startY?: number;
81
+ waitMs?: number;
82
+ x?: number;
83
+ y?: number;
84
+ };
85
+ type AgentDeviceCaptureOptions = {
86
+ agentDevicePath?: string;
87
+ app?: string | null;
88
+ commandTimeoutMs?: number;
89
+ delay?: (ms: number) => Promise<void>;
90
+ device?: string | null;
91
+ driverSteps?: AgentDeviceDriverStep[];
92
+ executor?: CommandExecutor;
93
+ open?: boolean;
94
+ outputDir?: string;
95
+ platform: import('./agent-device-driver').AgentDevicePlatform;
96
+ runId?: string;
97
+ scenario?: Record<string, unknown> | null;
98
+ serial?: string | null;
99
+ session?: string | null;
100
+ sessionMode?: AgentDeviceSessionMode;
101
+ target?: 'desktop' | 'mobile' | 'tv';
102
+ udid?: string | null;
103
+ waitMs?: number;
104
+ };
105
+ type AgentDeviceCaptureResult = {
106
+ agentSummary: string;
107
+ captures: {
108
+ screenshots: string[];
109
+ };
110
+ health: Record<string, unknown>;
111
+ metadata: Record<string, unknown>;
112
+ raw: Record<string, string>;
113
+ runDir: string;
114
+ verdict: Record<string, unknown>;
115
+ };
116
+ /**
117
+ * Prints CLI usage.
118
+ *
119
+ * @returns {void}
120
+ */
121
+ declare function usage(output?: {
122
+ write: (message: string) => unknown;
123
+ }): void;
124
+ /**
125
+ * Parses `--key value` CLI arguments.
126
+ *
127
+ * @param {string[]} argv
128
+ * @returns {CliArgs}
129
+ */
130
+ declare function parseArgs(argv: string[]): CliArgs;
131
+ /**
132
+ * Runs a command and captures stdout, stderr, and exit code without throwing.
133
+ *
134
+ * @param {string} command
135
+ * @param {string[]} args
136
+ * @returns {Promise<CommandResult>}
137
+ */
138
+ declare function execFileCommand(command: string, args: string[]): Promise<CommandResult>;
139
+ /**
140
+ * Runs a command with a bounded timeout and captures stdout, stderr, and exit code without throwing.
141
+ *
142
+ * @param {string} command
143
+ * @param {string[]} args
144
+ * @param {number} [timeoutMs]
145
+ * @returns {Promise<CommandResult>}
146
+ */
147
+ declare function execFileCommandWithTimeout(command: string, args: string[], timeoutMs?: number): Promise<CommandResult>;
148
+ /**
149
+ * Parses a comma-separated platform requirement list for availability checks.
150
+ *
151
+ * @param {unknown} value
152
+ * @returns {import('./agent-device-driver').AgentDevicePlatform[]}
153
+ */
154
+ declare function parseRequiredPlatforms(value: unknown): import('./agent-device-driver').AgentDevicePlatform[];
155
+ /**
156
+ * Parses how a named agent-device session should participate in target selection.
157
+ *
158
+ * @param {unknown} value
159
+ * @returns {AgentDeviceSessionMode}
160
+ */
161
+ declare function parseAgentDeviceSessionMode(value: unknown): AgentDeviceSessionMode;
162
+ /**
163
+ * Parses agent-device active session JSON.
164
+ *
165
+ * @param {CommandResult} result
166
+ * @returns {Array<Record<string, unknown>>}
167
+ */
168
+ declare function readAgentDeviceSessions(result: CommandResult): Array<Record<string, unknown>>;
169
+ /**
170
+ * Verifies that the configured agent-device command exposes ASL-required surfaces.
171
+ *
172
+ * @param {AgentDeviceAvailabilityOptions} options
173
+ * @returns {Promise<AgentDeviceAvailabilityResult>}
174
+ */
175
+ declare function checkAgentDeviceAvailability({ agentDevicePath, commandTimeoutMs, executor, requiredCommands, requiredPlatforms, }?: AgentDeviceAvailabilityOptions): Promise<AgentDeviceAvailabilityResult>;
176
+ /**
177
+ * Builds a health artifact from agent-device capture checks.
178
+ *
179
+ * @param {{runId: string, checks: Record<string, unknown>[]}} options
180
+ * @returns {Record<string, unknown>}
181
+ */
182
+ declare function buildAgentDeviceHealth({ runId, checks }: {
183
+ runId: string;
184
+ checks: Record<string, unknown>[];
185
+ }): Record<string, unknown>;
186
+ /**
187
+ * Builds a verdict artifact for agent-device capture readiness.
188
+ *
189
+ * @param {{runId: string, health: Record<string, unknown>}} options
190
+ * @returns {Record<string, unknown>}
191
+ */
192
+ declare function buildAgentDeviceVerdict({ runId, health }: {
193
+ runId: string;
194
+ health: Record<string, unknown>;
195
+ }): Record<string, unknown>;
196
+ /**
197
+ * Writes ASL artifacts for an agent-device command-surface availability check.
198
+ *
199
+ * @param {AgentDeviceAvailabilityArtifactOptions} options
200
+ * @returns {Promise<{agentSummary: string, health: Record<string, unknown>, runDir: string, verdict: Record<string, unknown>}>}
201
+ */
202
+ declare function writeAgentDeviceAvailabilityArtifacts({ outputDir, result, runId, }: AgentDeviceAvailabilityArtifactOptions): Promise<{
203
+ agentSummary: string;
204
+ health: Record<string, unknown>;
205
+ runDir: string;
206
+ verdict: Record<string, unknown>;
207
+ }>;
208
+ /**
209
+ * Reads agent-device adapter metadata from a normalized scenario step.
210
+ *
211
+ * @param {ScenarioExecutionStep} step
212
+ * @returns {Record<string, unknown>}
213
+ */
214
+ declare function readAgentDeviceStepOptions(step: ScenarioExecutionStep): Record<string, unknown>;
215
+ /**
216
+ * Returns true when a normalized step has a portable selector.
217
+ *
218
+ * @param {unknown} value
219
+ * @returns {value is import('./agent-device-driver').AgentDeviceSelector}
220
+ */
221
+ declare function isAgentDeviceSelector(value: unknown): value is import('./agent-device-driver').AgentDeviceSelector;
222
+ /**
223
+ * Returns the default raw file name for one agent-device action.
224
+ *
225
+ * @param {{driverAction: AgentDeviceDriverStep['driverAction'], index: number}} options
226
+ * @returns {string}
227
+ */
228
+ declare function defaultAgentDeviceRawFileName({ driverAction, index, }: {
229
+ driverAction: AgentDeviceDriverStep['driverAction'];
230
+ index: number;
231
+ }): string;
232
+ /**
233
+ * Returns the default capture file name for one agent-device action.
234
+ *
235
+ * @param {{driverAction: AgentDeviceDriverStep['driverAction'], index: number}} options
236
+ * @returns {string}
237
+ */
238
+ declare function defaultAgentDeviceCaptureFileName({ driverAction, index, }: {
239
+ driverAction: AgentDeviceDriverStep['driverAction'];
240
+ index: number;
241
+ }): string;
242
+ /**
243
+ * Expands normalized scenario steps into agent-device driver actions.
244
+ *
245
+ * @param {Record<string, unknown>} scenario
246
+ * @returns {AgentDeviceDriverStep[]}
247
+ */
248
+ declare function resolveAgentDeviceDriverSteps(scenario: Record<string, any>): AgentDeviceDriverStep[];
249
+ /**
250
+ * Returns profile-time validation errors for agent-device driver steps.
251
+ *
252
+ * @param {AgentDeviceDriverStep[]} driverSteps
253
+ * @returns {string[]}
254
+ */
255
+ declare function validateAgentDeviceDriverSteps(driverSteps: AgentDeviceDriverStep[]): string[];
256
+ /**
257
+ * Builds scalar health metadata for one portable selector.
258
+ *
259
+ * @param {import('./agent-device-driver').AgentDeviceSelector | undefined} selector
260
+ * @returns {Record<string, string>}
261
+ */
262
+ declare function buildAgentDeviceSelectorHealthMetadata(selector?: import('./agent-device-driver').AgentDeviceSelector): Record<string, string>;
263
+ /**
264
+ * Runs one agent-device driver action.
265
+ *
266
+ * @param {{capturesDir: string, driver: import('./agent-device-driver').AgentDeviceDriver, driverStep: AgentDeviceDriverStep}} options
267
+ * @returns {Promise<import('./agent-device-driver').AgentDeviceCommandResult>}
268
+ */
269
+ declare function runAgentDeviceDriverStep({ capturesDir, driver, driverStep, }: {
270
+ capturesDir: string;
271
+ driver: import('./agent-device-driver').AgentDeviceDriver;
272
+ driverStep: AgentDeviceDriverStep;
273
+ }): Promise<import('./agent-device-driver').AgentDeviceCommandResult>;
274
+ /**
275
+ * Builds a stable health code suffix for one agent-device driver action.
276
+ *
277
+ * @param {AgentDeviceDriverStep['driverAction']} driverAction
278
+ * @returns {string}
279
+ */
280
+ declare function agentDeviceDriverActionCode(driverAction: AgentDeviceDriverStep['driverAction']): string;
281
+ /**
282
+ * Runs scenario-declared portable actions through agent-device and writes artifacts.
283
+ *
284
+ * @param {AgentDeviceCaptureOptions} options
285
+ * @returns {Promise<AgentDeviceCaptureResult>}
286
+ */
287
+ declare function runAgentDeviceCapture({ agentDevicePath, app, commandTimeoutMs, delay: wait, device, driverSteps, executor, open, outputDir, platform, runId, scenario, serial, session, sessionMode, target, udid, waitMs, }: AgentDeviceCaptureOptions): Promise<AgentDeviceCaptureResult>;
288
+ /**
289
+ * Runs the agent-device capture CLI.
290
+ *
291
+ * @returns {Promise<void>}
292
+ */
293
+ declare function main(): Promise<void>;
294
+ export { agentDeviceDriverActionCode, buildAgentDeviceHealth, buildAgentDeviceVerdict, buildAgentDeviceSelectorHealthMetadata, checkAgentDeviceAvailability, defaultAgentDeviceCaptureFileName, defaultAgentDeviceRawFileName, execFileCommand, execFileCommandWithTimeout, isAgentDeviceSelector, main, parseArgs, parseAgentDeviceSessionMode, parseRequiredPlatforms, readAgentDeviceSessions, readAgentDeviceStepOptions, resolveAgentDeviceDriverSteps, runAgentDeviceCapture, runAgentDeviceDriverStep, usage, validateAgentDeviceDriverSteps, writeAgentDeviceAvailabilityArtifacts, };
295
+ export type { AgentDeviceCaptureOptions, AgentDeviceCaptureResult, AgentDeviceDriverStep, AgentDeviceAvailabilityOptions, AgentDeviceAvailabilityResult, AgentDeviceAvailabilityCheck, AgentDeviceSessionMode, CliArgs, CommandExecutor, CommandResult, };