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,254 @@
1
+ #!/usr/bin/env node
2
+ type CliArgs = {
3
+ bundle?: string | boolean;
4
+ 'collect-profile-storage'?: string | boolean;
5
+ device?: string | boolean;
6
+ 'diagnostic-reports-dir'?: string | boolean;
7
+ launch?: string | boolean;
8
+ 'log-last'?: string | boolean;
9
+ 'profile-command-storage-key'?: string | boolean;
10
+ 'profile-event-storage-key'?: string | boolean;
11
+ out?: string | boolean;
12
+ 'profile-session-entries-storage-key'?: string | boolean;
13
+ 'profile-session-storage'?: string | boolean;
14
+ 'profile-session-storage-key'?: string | boolean;
15
+ 'profile-signal-storage-key'?: string | boolean;
16
+ 'run-id'?: string | boolean;
17
+ screenshot?: string | boolean;
18
+ 'screenshot-display'?: string | boolean;
19
+ 'screenshot-mask'?: string | boolean;
20
+ 'screenshot-type'?: string | boolean;
21
+ 'terminate-before-launch'?: string | boolean;
22
+ 'wait-ms'?: string | boolean;
23
+ xcrun?: string | boolean;
24
+ [key: string]: string | boolean | undefined;
25
+ };
26
+ type CommandResult = {
27
+ command: string;
28
+ args: string[];
29
+ exitCode: number;
30
+ stderr: string;
31
+ stdout: string;
32
+ };
33
+ type CommandExecutor = (command: string, args: string[]) => Promise<CommandResult>;
34
+ type IosSimulator = {
35
+ name: string;
36
+ state: string;
37
+ udid: string;
38
+ };
39
+ type IosSimctlDeepLink = {
40
+ label?: string;
41
+ url: string;
42
+ waitMs?: number;
43
+ };
44
+ type IosProfileSessionStorageCommand = {
45
+ command: string;
46
+ id?: string;
47
+ label?: string;
48
+ timestamp?: number;
49
+ };
50
+ type IosProfileSessionStorageSeed = {
51
+ commands?: IosProfileSessionStorageCommand[];
52
+ scenario: string;
53
+ runId: string;
54
+ startedAt?: number;
55
+ };
56
+ type ProfileStorageKeys = {
57
+ command: string;
58
+ event: string;
59
+ session: string;
60
+ sessionEntries: string;
61
+ signal: string;
62
+ };
63
+ type IosSimctlCaptureOptions = {
64
+ bundleId?: string | null;
65
+ collectProfileStorage?: boolean;
66
+ conflictingBundleIds?: string[];
67
+ deepLinks?: IosSimctlDeepLink[];
68
+ delay?: (ms: number) => Promise<void>;
69
+ device?: string | null;
70
+ diagnosticReportsDir?: string | null;
71
+ executor?: CommandExecutor;
72
+ launch?: boolean;
73
+ logLast?: string;
74
+ outputDir?: string;
75
+ profileSessionStorage?: IosProfileSessionStorageSeed | null;
76
+ profileStorageKeys?: Partial<ProfileStorageKeys>;
77
+ runId?: string;
78
+ screenshot?: boolean;
79
+ screenshotDisplay?: string;
80
+ screenshotMask?: string;
81
+ screenshotType?: string;
82
+ terminateBeforeLaunch?: boolean;
83
+ waitMs?: number;
84
+ xcrunPath?: string;
85
+ };
86
+ type IosSimctlCaptureResult = {
87
+ agentSummary: string;
88
+ health: Record<string, unknown>;
89
+ captures: {
90
+ screenshot: string | null;
91
+ };
92
+ metadata: Record<string, unknown>;
93
+ raw: Record<string, string>;
94
+ runDir: string;
95
+ simulator: IosSimulator | null;
96
+ verdict: Record<string, unknown>;
97
+ };
98
+ /**
99
+ * Prints CLI usage to stderr.
100
+ *
101
+ * @returns {void}
102
+ */
103
+ declare function usage(output?: {
104
+ write: (message: string) => unknown;
105
+ }): void;
106
+ /**
107
+ * Parses `--key value` arguments for the iOS simctl capture CLI.
108
+ *
109
+ * @param {string[]} argv
110
+ * @returns {CliArgs}
111
+ */
112
+ declare function parseArgs(argv: string[]): CliArgs;
113
+ /**
114
+ * Parses a positive integer CLI value, falling back when absent or invalid.
115
+ *
116
+ * @param {string | boolean | undefined} value
117
+ * @param {number} fallback
118
+ * @returns {number}
119
+ */
120
+ declare function parsePositiveInteger(value: string | boolean | undefined, fallback: number): number;
121
+ /**
122
+ * Normalizes configured sibling bundle ids, excluding the selected target bundle.
123
+ *
124
+ * @param {{bundleId: string | null, conflictingBundleIds: string[]}} options
125
+ * @returns {string[]}
126
+ */
127
+ declare function normalizeConflictingBundleIds({ bundleId, conflictingBundleIds, }: {
128
+ bundleId: string | null;
129
+ conflictingBundleIds: string[];
130
+ }): string[];
131
+ /**
132
+ * Resolves React Native AsyncStorage's iOS storage directory for an app data container.
133
+ *
134
+ * @param {{dataContainer: string, bundleId: string}} options
135
+ * @returns {string}
136
+ */
137
+ declare function resolveAsyncStorageDirectory({ bundleId, dataContainer, }: {
138
+ bundleId: string;
139
+ dataContainer: string;
140
+ }): string;
141
+ /**
142
+ * Returns the native iOS AsyncStorage spill-file name for a key.
143
+ *
144
+ * @param {string} key
145
+ * @returns {string}
146
+ */
147
+ declare function asyncStorageFileNameForKey(key: string): string;
148
+ /**
149
+ * Reads one native iOS AsyncStorage value from an inline manifest or spill file.
150
+ *
151
+ * @param {{key: string, storageDir: string}} options
152
+ * @returns {string | null}
153
+ */
154
+ declare function readAsyncStorageValueSync({ key, storageDir, }: {
155
+ key: string;
156
+ storageDir: string;
157
+ }): string | null;
158
+ /**
159
+ * Seeds the app profile-session AsyncStorage key before launching the iOS app.
160
+ *
161
+ * @param {{bundleId: string, commands?: IosProfileSessionStorageCommand[], dataContainer: string, runId: string, scenario: string, startedAt?: number}} options
162
+ * @returns {Promise<{manifestPath: string, storageDir: string, session: Record<string, unknown>}>}
163
+ */
164
+ declare function seedProfileSessionStorage({ bundleId, commands, dataContainer, profileStorageKeys, runId, scenario, startedAt, }: {
165
+ bundleId: string;
166
+ commands?: IosProfileSessionStorageCommand[];
167
+ dataContainer: string;
168
+ profileStorageKeys?: ProfileStorageKeys;
169
+ runId: string;
170
+ scenario: string;
171
+ startedAt?: number;
172
+ }): Promise<{
173
+ commands: Record<string, unknown>[];
174
+ manifestPath: string;
175
+ storageDir: string;
176
+ session: Record<string, unknown>;
177
+ }>;
178
+ /**
179
+ * Reads JSON stored by the app profile-session AsyncStorage bridge.
180
+ *
181
+ * @param {{bundleId: string, dataContainer: string, key: string, fallback: unknown}} options
182
+ * @returns {unknown}
183
+ */
184
+ declare function readProfileStorageJson({ bundleId, dataContainer, fallback, key, }: {
185
+ bundleId: string;
186
+ dataContainer: string;
187
+ fallback: unknown;
188
+ key: string;
189
+ }): unknown;
190
+ /**
191
+ * Formats stored profile events as the canonical profile-event log payload.
192
+ *
193
+ * @param {Record<string, unknown>[]} events
194
+ * @returns {string}
195
+ */
196
+ declare function formatStoredProfileEventLog(events: Record<string, unknown>[]): string;
197
+ /**
198
+ * Runs a command and captures stdout, stderr, and exit code without throwing.
199
+ *
200
+ * @param {string} command
201
+ * @param {string[]} args
202
+ * @returns {Promise<CommandResult>}
203
+ */
204
+ declare function execFileCommand(command: string, args: string[]): Promise<CommandResult>;
205
+ /**
206
+ * Parses `xcrun simctl list devices` output into simulator rows.
207
+ *
208
+ * @param {string} output
209
+ * @returns {IosSimulator[]}
210
+ */
211
+ declare function parseSimctlDevices(output: string): IosSimulator[];
212
+ /**
213
+ * Selects a simulator by explicit UDID or the first booted simulator.
214
+ *
215
+ * @param {IosSimulator[]} simulators
216
+ * @param {string | null | undefined} device
217
+ * @returns {IosSimulator | null}
218
+ */
219
+ declare function selectSimulator(simulators: IosSimulator[], device?: string | null): IosSimulator | null;
220
+ /**
221
+ * Builds a health artifact from iOS simulator capture checks.
222
+ *
223
+ * @param {{runId: string, checks: Record<string, unknown>[]}} options
224
+ * @returns {Record<string, unknown>}
225
+ */
226
+ declare function buildIosSimctlHealth({ runId, checks }: {
227
+ runId: string;
228
+ checks: Record<string, unknown>[];
229
+ }): Record<string, unknown>;
230
+ /**
231
+ * Builds a verdict artifact for iOS simulator capture readiness.
232
+ *
233
+ * @param {{runId: string, health: Record<string, unknown>}} options
234
+ * @returns {Record<string, unknown>}
235
+ */
236
+ declare function buildIosSimctlVerdict({ runId, health }: {
237
+ runId: string;
238
+ health: Record<string, unknown>;
239
+ }): Record<string, unknown>;
240
+ /**
241
+ * Runs iOS simulator readiness checks and writes raw simctl evidence.
242
+ *
243
+ * @param {IosSimctlCaptureOptions} options
244
+ * @returns {Promise<IosSimctlCaptureResult>}
245
+ */
246
+ declare function runIosSimctlCapture({ bundleId, collectProfileStorage, conflictingBundleIds, deepLinks, delay: wait, device, diagnosticReportsDir, executor, launch, logLast, outputDir, profileSessionStorage, profileStorageKeys: profileStorageKeyOverrides, runId, screenshot, screenshotDisplay, screenshotMask, screenshotType, terminateBeforeLaunch, waitMs, xcrunPath, }?: IosSimctlCaptureOptions): Promise<IosSimctlCaptureResult>;
247
+ /**
248
+ * Runs the ios-simctl capture CLI.
249
+ *
250
+ * @returns {Promise<void>}
251
+ */
252
+ declare function main(): Promise<void>;
253
+ export { buildIosSimctlHealth, buildIosSimctlVerdict, asyncStorageFileNameForKey, execFileCommand, formatStoredProfileEventLog, main, parseArgs, parsePositiveInteger, parseSimctlDevices, normalizeConflictingBundleIds, readAsyncStorageValueSync, readProfileStorageJson, resolveAsyncStorageDirectory, runIosSimctlCapture, seedProfileSessionStorage, selectSimulator, usage, };
254
+ export type { CliArgs, CommandExecutor, CommandResult, IosSimctlCaptureOptions, IosSimctlCaptureResult, IosSimctlDeepLink, IosProfileSessionStorageSeed, IosSimulator, };