taphound 0.2.0-dev.1

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 (176) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +200 -0
  3. package/README.zh-CN.md +200 -0
  4. package/assets/brand/taphound-mark.svg +9 -0
  5. package/assets/skills/taphound-ai-journey/GUIDE.md +862 -0
  6. package/assets/skills/taphound-ai-journey/SKILL.md +377 -0
  7. package/assets/skills/taphound-ai-journey/prompts/analyze-project.md +526 -0
  8. package/assets/skills/taphound-ai-journey/prompts/check-completion.md +52 -0
  9. package/assets/skills/taphound-ai-journey/prompts/generate-step.md +109 -0
  10. package/assets/skills/taphound-ai-journey/schemas/observe-output.json +42 -0
  11. package/assets/skills/taphound-ai-journey/schemas/project-context.json +81 -0
  12. package/assets/skills/taphound-ai-journey/schemas/proposed-step-envelope.json +267 -0
  13. package/assets/skills/taphound-ai-journey/templates/project-context.example.json +49 -0
  14. package/dist/adapters/adb/adb-adapter.d.ts +23 -0
  15. package/dist/adapters/adb/adb-adapter.js +218 -0
  16. package/dist/adapters/android-cli/android-cli-adapter.d.ts +11 -0
  17. package/dist/adapters/android-cli/android-cli-adapter.js +64 -0
  18. package/dist/adapters/android-cli/layout-parser.d.ts +3 -0
  19. package/dist/adapters/android-cli/layout-parser.js +174 -0
  20. package/dist/adapters/clock/system-clock.d.ts +5 -0
  21. package/dist/adapters/clock/system-clock.js +13 -0
  22. package/dist/adapters/filesystem/artifact-store.d.ts +4 -0
  23. package/dist/adapters/filesystem/artifact-store.js +73 -0
  24. package/dist/adapters/filesystem/generation-meta-writer.d.ts +16 -0
  25. package/dist/adapters/filesystem/generation-meta-writer.js +34 -0
  26. package/dist/adapters/filesystem/generation-session-store.d.ts +68 -0
  27. package/dist/adapters/filesystem/generation-session-store.js +1603 -0
  28. package/dist/adapters/filesystem/journey-writer.d.ts +16 -0
  29. package/dist/adapters/filesystem/journey-writer.js +34 -0
  30. package/dist/adapters/filesystem/project-bound-file.d.ts +6 -0
  31. package/dist/adapters/filesystem/project-bound-file.js +240 -0
  32. package/dist/adapters/filesystem/project-file-inspector.d.ts +8 -0
  33. package/dist/adapters/filesystem/project-file-inspector.js +198 -0
  34. package/dist/adapters/filesystem/skill-installer.d.ts +10 -0
  35. package/dist/adapters/filesystem/skill-installer.js +39 -0
  36. package/dist/adapters/process/node-process-runner.d.ts +8 -0
  37. package/dist/adapters/process/node-process-runner.js +155 -0
  38. package/dist/adapters/prompt/inquirer-generation-prompt.d.ts +55 -0
  39. package/dist/adapters/prompt/inquirer-generation-prompt.js +213 -0
  40. package/dist/adapters/prompt/inquirer-init-prompt.d.ts +32 -0
  41. package/dist/adapters/prompt/inquirer-init-prompt.js +55 -0
  42. package/dist/adapters/prompt/inquirer-recorder-prompt.d.ts +47 -0
  43. package/dist/adapters/prompt/inquirer-recorder-prompt.js +157 -0
  44. package/dist/application/assertion/expectation-evaluator.d.ts +61 -0
  45. package/dist/application/assertion/expectation-evaluator.js +207 -0
  46. package/dist/application/collector/logcat-collector.d.ts +39 -0
  47. package/dist/application/collector/logcat-collector.js +107 -0
  48. package/dist/application/context/context-validator.d.ts +27 -0
  49. package/dist/application/context/context-validator.js +120 -0
  50. package/dist/application/doctor/doctor-service.d.ts +35 -0
  51. package/dist/application/doctor/doctor-service.js +178 -0
  52. package/dist/application/generation/focused-input.d.ts +2 -0
  53. package/dist/application/generation/focused-input.js +9 -0
  54. package/dist/application/generation/generation-confirmation-service.d.ts +76 -0
  55. package/dist/application/generation/generation-confirmation-service.js +383 -0
  56. package/dist/application/generation/generation-finalizer.d.ts +67 -0
  57. package/dist/application/generation/generation-finalizer.js +646 -0
  58. package/dist/application/generation/generation-publisher.d.ts +46 -0
  59. package/dist/application/generation/generation-publisher.js +178 -0
  60. package/dist/application/generation/generation-starter.d.ts +31 -0
  61. package/dist/application/generation/generation-starter.js +102 -0
  62. package/dist/application/generation/generation-step-executor.d.ts +52 -0
  63. package/dist/application/generation/generation-step-executor.js +668 -0
  64. package/dist/application/generation/proposed-step-validator.d.ts +11 -0
  65. package/dist/application/generation/proposed-step-validator.js +88 -0
  66. package/dist/application/generation/risk-evaluator.d.ts +9 -0
  67. package/dist/application/generation/risk-evaluator.js +14 -0
  68. package/dist/application/generation/runtime-observer.d.ts +39 -0
  69. package/dist/application/generation/runtime-observer.js +157 -0
  70. package/dist/application/init/init-service.d.ts +17 -0
  71. package/dist/application/init/init-service.js +44 -0
  72. package/dist/application/interaction/action-executor.d.ts +25 -0
  73. package/dist/application/interaction/action-executor.js +103 -0
  74. package/dist/application/interaction/fallback-resolver.d.ts +24 -0
  75. package/dist/application/interaction/fallback-resolver.js +48 -0
  76. package/dist/application/interaction/scroll-to-executor.d.ts +40 -0
  77. package/dist/application/interaction/scroll-to-executor.js +191 -0
  78. package/dist/application/locator/locator-resolver.d.ts +20 -0
  79. package/dist/application/locator/locator-resolver.js +89 -0
  80. package/dist/application/project/project-describer.d.ts +14 -0
  81. package/dist/application/project/project-describer.js +8 -0
  82. package/dist/application/recorder/locator-selector.d.ts +10 -0
  83. package/dist/application/recorder/locator-selector.js +80 -0
  84. package/dist/application/recorder/recorder-service.d.ts +41 -0
  85. package/dist/application/recorder/recorder-service.js +331 -0
  86. package/dist/application/report/report-writer.d.ts +10 -0
  87. package/dist/application/report/report-writer.js +39 -0
  88. package/dist/application/runtime/activity-waiter.d.ts +33 -0
  89. package/dist/application/runtime/activity-waiter.js +73 -0
  90. package/dist/application/runtime/launch-failure.d.ts +2 -0
  91. package/dist/application/runtime/launch-failure.js +20 -0
  92. package/dist/application/runtime/process-waiter.d.ts +27 -0
  93. package/dist/application/runtime/process-waiter.js +73 -0
  94. package/dist/application/runtime/step-runner.d.ts +50 -0
  95. package/dist/application/runtime/step-runner.js +429 -0
  96. package/dist/application/runtime/verify-runtime.d.ts +44 -0
  97. package/dist/application/runtime/verify-runtime.js +350 -0
  98. package/dist/application/wait/idle-waiter.d.ts +30 -0
  99. package/dist/application/wait/idle-waiter.js +90 -0
  100. package/dist/cli/commands/context.d.ts +3 -0
  101. package/dist/cli/commands/context.js +94 -0
  102. package/dist/cli/commands/doctor.d.ts +3 -0
  103. package/dist/cli/commands/doctor.js +51 -0
  104. package/dist/cli/commands/generation.d.ts +3 -0
  105. package/dist/cli/commands/generation.js +518 -0
  106. package/dist/cli/commands/init.d.ts +3 -0
  107. package/dist/cli/commands/init.js +104 -0
  108. package/dist/cli/commands/project.d.ts +3 -0
  109. package/dist/cli/commands/project.js +58 -0
  110. package/dist/cli/commands/record.d.ts +3 -0
  111. package/dist/cli/commands/record.js +88 -0
  112. package/dist/cli/commands/verify.d.ts +3 -0
  113. package/dist/cli/commands/verify.js +106 -0
  114. package/dist/cli/dependencies.d.ts +66 -0
  115. package/dist/cli/dependencies.js +204 -0
  116. package/dist/cli/main.d.ts +8 -0
  117. package/dist/cli/main.js +73 -0
  118. package/dist/cli/output.d.ts +16 -0
  119. package/dist/cli/output.js +22 -0
  120. package/dist/cli/program.d.ts +3 -0
  121. package/dist/cli/program.js +43 -0
  122. package/dist/domain/activity.d.ts +7 -0
  123. package/dist/domain/activity.js +65 -0
  124. package/dist/domain/app-process.d.ts +7 -0
  125. package/dist/domain/app-process.js +10 -0
  126. package/dist/domain/config.d.ts +15 -0
  127. package/dist/domain/config.js +17 -0
  128. package/dist/domain/failure.d.ts +4 -0
  129. package/dist/domain/failure.js +43 -0
  130. package/dist/domain/generation.d.ts +912 -0
  131. package/dist/domain/generation.js +342 -0
  132. package/dist/domain/init.d.ts +42 -0
  133. package/dist/domain/init.js +114 -0
  134. package/dist/domain/journey.d.ts +673 -0
  135. package/dist/domain/journey.js +109 -0
  136. package/dist/domain/layout.d.ts +35 -0
  137. package/dist/domain/layout.js +33 -0
  138. package/dist/domain/locator.d.ts +8 -0
  139. package/dist/domain/locator.js +5 -0
  140. package/dist/domain/project-context.d.ts +101 -0
  141. package/dist/domain/project-context.js +64 -0
  142. package/dist/domain/proposed-step.d.ts +341 -0
  143. package/dist/domain/proposed-step.js +87 -0
  144. package/dist/domain/report.d.ts +349 -0
  145. package/dist/domain/report.js +135 -0
  146. package/dist/domain/runtime-snapshot.d.ts +16 -0
  147. package/dist/domain/runtime-snapshot.js +46 -0
  148. package/dist/ports/adb.d.ts +42 -0
  149. package/dist/ports/adb.js +1 -0
  150. package/dist/ports/android-cli.d.ts +21 -0
  151. package/dist/ports/android-cli.js +1 -0
  152. package/dist/ports/artifact-store.d.ts +12 -0
  153. package/dist/ports/artifact-store.js +1 -0
  154. package/dist/ports/clock.d.ts +4 -0
  155. package/dist/ports/clock.js +1 -0
  156. package/dist/ports/generation-meta-writer.d.ts +10 -0
  157. package/dist/ports/generation-meta-writer.js +1 -0
  158. package/dist/ports/generation-prompt.d.ts +19 -0
  159. package/dist/ports/generation-prompt.js +6 -0
  160. package/dist/ports/generation-session-store.d.ts +32 -0
  161. package/dist/ports/generation-session-store.js +26 -0
  162. package/dist/ports/init-prompt.d.ts +8 -0
  163. package/dist/ports/init-prompt.js +6 -0
  164. package/dist/ports/journey-writer.d.ts +10 -0
  165. package/dist/ports/journey-writer.js +1 -0
  166. package/dist/ports/process-runner.d.ts +32 -0
  167. package/dist/ports/process-runner.js +1 -0
  168. package/dist/ports/project-bound-file.d.ts +8 -0
  169. package/dist/ports/project-bound-file.js +1 -0
  170. package/dist/ports/project-file-inspector.d.ts +33 -0
  171. package/dist/ports/project-file-inspector.js +1 -0
  172. package/dist/ports/recorder-prompt.d.ts +29 -0
  173. package/dist/ports/recorder-prompt.js +1 -0
  174. package/dist/ports/skill-installer.d.ts +8 -0
  175. package/dist/ports/skill-installer.js +1 -0
  176. package/package.json +64 -0
@@ -0,0 +1,341 @@
1
+ import { z } from "zod";
2
+ export declare const ProposalBindingSchema: z.ZodObject<{
3
+ generationId: z.ZodString;
4
+ baseRevision: z.ZodNumber;
5
+ snapshotHash: z.ZodString;
6
+ }, z.core.$strict>;
7
+ export declare const ProposedStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
8
+ binding: z.ZodObject<{
9
+ generationId: z.ZodString;
10
+ baseRevision: z.ZodNumber;
11
+ snapshotHash: z.ZodString;
12
+ }, z.core.$strict>;
13
+ activity: z.ZodObject<{
14
+ before: z.ZodString;
15
+ }, z.core.$strict>;
16
+ expect: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
17
+ type: z.ZodLiteral<"activity">;
18
+ value: z.ZodString;
19
+ timeoutMs: z.ZodNumber;
20
+ }, z.core.$strict>, z.ZodObject<{
21
+ type: z.ZodLiteral<"element">;
22
+ locator: z.ZodObject<{
23
+ resourceId: z.ZodOptional<z.ZodString>;
24
+ text: z.ZodOptional<z.ZodString>;
25
+ contentDescription: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strict>;
27
+ timeoutMs: z.ZodNumber;
28
+ }, z.core.$strict>, z.ZodObject<{
29
+ type: z.ZodLiteral<"logcat">;
30
+ tag: z.ZodString;
31
+ level: z.ZodOptional<z.ZodEnum<{
32
+ V: "V";
33
+ D: "D";
34
+ I: "I";
35
+ W: "W";
36
+ E: "E";
37
+ F: "F";
38
+ A: "A";
39
+ }>>;
40
+ pattern: z.ZodString;
41
+ match: z.ZodDefault<z.ZodEnum<{
42
+ literal: "literal";
43
+ regex: "regex";
44
+ }>>;
45
+ timeoutMs: z.ZodNumber;
46
+ }, z.core.$strict>], "type">>;
47
+ action: z.ZodLiteral<"click">;
48
+ locator: z.ZodObject<{
49
+ resourceId: z.ZodOptional<z.ZodString>;
50
+ text: z.ZodOptional<z.ZodString>;
51
+ contentDescription: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strict>;
53
+ }, z.core.$strict>, z.ZodObject<{
54
+ binding: z.ZodObject<{
55
+ generationId: z.ZodString;
56
+ baseRevision: z.ZodNumber;
57
+ snapshotHash: z.ZodString;
58
+ }, z.core.$strict>;
59
+ activity: z.ZodObject<{
60
+ before: z.ZodString;
61
+ }, z.core.$strict>;
62
+ expect: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
63
+ type: z.ZodLiteral<"activity">;
64
+ value: z.ZodString;
65
+ timeoutMs: z.ZodNumber;
66
+ }, z.core.$strict>, z.ZodObject<{
67
+ type: z.ZodLiteral<"element">;
68
+ locator: z.ZodObject<{
69
+ resourceId: z.ZodOptional<z.ZodString>;
70
+ text: z.ZodOptional<z.ZodString>;
71
+ contentDescription: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$strict>;
73
+ timeoutMs: z.ZodNumber;
74
+ }, z.core.$strict>, z.ZodObject<{
75
+ type: z.ZodLiteral<"logcat">;
76
+ tag: z.ZodString;
77
+ level: z.ZodOptional<z.ZodEnum<{
78
+ V: "V";
79
+ D: "D";
80
+ I: "I";
81
+ W: "W";
82
+ E: "E";
83
+ F: "F";
84
+ A: "A";
85
+ }>>;
86
+ pattern: z.ZodString;
87
+ match: z.ZodDefault<z.ZodEnum<{
88
+ literal: "literal";
89
+ regex: "regex";
90
+ }>>;
91
+ timeoutMs: z.ZodNumber;
92
+ }, z.core.$strict>], "type">>;
93
+ action: z.ZodLiteral<"longClick">;
94
+ locator: z.ZodObject<{
95
+ resourceId: z.ZodOptional<z.ZodString>;
96
+ text: z.ZodOptional<z.ZodString>;
97
+ contentDescription: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>;
99
+ durationMs: z.ZodDefault<z.ZodNumber>;
100
+ }, z.core.$strict>, z.ZodObject<{
101
+ binding: z.ZodObject<{
102
+ generationId: z.ZodString;
103
+ baseRevision: z.ZodNumber;
104
+ snapshotHash: z.ZodString;
105
+ }, z.core.$strict>;
106
+ activity: z.ZodObject<{
107
+ before: z.ZodString;
108
+ }, z.core.$strict>;
109
+ expect: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
110
+ type: z.ZodLiteral<"activity">;
111
+ value: z.ZodString;
112
+ timeoutMs: z.ZodNumber;
113
+ }, z.core.$strict>, z.ZodObject<{
114
+ type: z.ZodLiteral<"element">;
115
+ locator: z.ZodObject<{
116
+ resourceId: z.ZodOptional<z.ZodString>;
117
+ text: z.ZodOptional<z.ZodString>;
118
+ contentDescription: z.ZodOptional<z.ZodString>;
119
+ }, z.core.$strict>;
120
+ timeoutMs: z.ZodNumber;
121
+ }, z.core.$strict>, z.ZodObject<{
122
+ type: z.ZodLiteral<"logcat">;
123
+ tag: z.ZodString;
124
+ level: z.ZodOptional<z.ZodEnum<{
125
+ V: "V";
126
+ D: "D";
127
+ I: "I";
128
+ W: "W";
129
+ E: "E";
130
+ F: "F";
131
+ A: "A";
132
+ }>>;
133
+ pattern: z.ZodString;
134
+ match: z.ZodDefault<z.ZodEnum<{
135
+ literal: "literal";
136
+ regex: "regex";
137
+ }>>;
138
+ timeoutMs: z.ZodNumber;
139
+ }, z.core.$strict>], "type">>;
140
+ action: z.ZodLiteral<"inputText">;
141
+ text: z.ZodString;
142
+ }, z.core.$strict>, z.ZodObject<{
143
+ binding: z.ZodObject<{
144
+ generationId: z.ZodString;
145
+ baseRevision: z.ZodNumber;
146
+ snapshotHash: z.ZodString;
147
+ }, z.core.$strict>;
148
+ activity: z.ZodObject<{
149
+ before: z.ZodString;
150
+ }, z.core.$strict>;
151
+ expect: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
152
+ type: z.ZodLiteral<"activity">;
153
+ value: z.ZodString;
154
+ timeoutMs: z.ZodNumber;
155
+ }, z.core.$strict>, z.ZodObject<{
156
+ type: z.ZodLiteral<"element">;
157
+ locator: z.ZodObject<{
158
+ resourceId: z.ZodOptional<z.ZodString>;
159
+ text: z.ZodOptional<z.ZodString>;
160
+ contentDescription: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strict>;
162
+ timeoutMs: z.ZodNumber;
163
+ }, z.core.$strict>, z.ZodObject<{
164
+ type: z.ZodLiteral<"logcat">;
165
+ tag: z.ZodString;
166
+ level: z.ZodOptional<z.ZodEnum<{
167
+ V: "V";
168
+ D: "D";
169
+ I: "I";
170
+ W: "W";
171
+ E: "E";
172
+ F: "F";
173
+ A: "A";
174
+ }>>;
175
+ pattern: z.ZodString;
176
+ match: z.ZodDefault<z.ZodEnum<{
177
+ literal: "literal";
178
+ regex: "regex";
179
+ }>>;
180
+ timeoutMs: z.ZodNumber;
181
+ }, z.core.$strict>], "type">>;
182
+ action: z.ZodLiteral<"swipe">;
183
+ locator: z.ZodObject<{
184
+ resourceId: z.ZodOptional<z.ZodString>;
185
+ text: z.ZodOptional<z.ZodString>;
186
+ contentDescription: z.ZodOptional<z.ZodString>;
187
+ }, z.core.$strict>;
188
+ direction: z.ZodEnum<{
189
+ left: "left";
190
+ right: "right";
191
+ up: "up";
192
+ down: "down";
193
+ }>;
194
+ distancePercent: z.ZodDefault<z.ZodNumber>;
195
+ durationMs: z.ZodDefault<z.ZodNumber>;
196
+ }, z.core.$strict>, z.ZodObject<{
197
+ binding: z.ZodObject<{
198
+ generationId: z.ZodString;
199
+ baseRevision: z.ZodNumber;
200
+ snapshotHash: z.ZodString;
201
+ }, z.core.$strict>;
202
+ activity: z.ZodObject<{
203
+ before: z.ZodString;
204
+ }, z.core.$strict>;
205
+ expect: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
206
+ type: z.ZodLiteral<"activity">;
207
+ value: z.ZodString;
208
+ timeoutMs: z.ZodNumber;
209
+ }, z.core.$strict>, z.ZodObject<{
210
+ type: z.ZodLiteral<"element">;
211
+ locator: z.ZodObject<{
212
+ resourceId: z.ZodOptional<z.ZodString>;
213
+ text: z.ZodOptional<z.ZodString>;
214
+ contentDescription: z.ZodOptional<z.ZodString>;
215
+ }, z.core.$strict>;
216
+ timeoutMs: z.ZodNumber;
217
+ }, z.core.$strict>, z.ZodObject<{
218
+ type: z.ZodLiteral<"logcat">;
219
+ tag: z.ZodString;
220
+ level: z.ZodOptional<z.ZodEnum<{
221
+ V: "V";
222
+ D: "D";
223
+ I: "I";
224
+ W: "W";
225
+ E: "E";
226
+ F: "F";
227
+ A: "A";
228
+ }>>;
229
+ pattern: z.ZodString;
230
+ match: z.ZodDefault<z.ZodEnum<{
231
+ literal: "literal";
232
+ regex: "regex";
233
+ }>>;
234
+ timeoutMs: z.ZodNumber;
235
+ }, z.core.$strict>], "type">>;
236
+ action: z.ZodLiteral<"scrollTo">;
237
+ locator: z.ZodObject<{
238
+ resourceId: z.ZodOptional<z.ZodString>;
239
+ text: z.ZodOptional<z.ZodString>;
240
+ contentDescription: z.ZodOptional<z.ZodString>;
241
+ }, z.core.$strict>;
242
+ container: z.ZodObject<{
243
+ resourceId: z.ZodOptional<z.ZodString>;
244
+ text: z.ZodOptional<z.ZodString>;
245
+ contentDescription: z.ZodOptional<z.ZodString>;
246
+ }, z.core.$strict>;
247
+ direction: z.ZodEnum<{
248
+ left: "left";
249
+ right: "right";
250
+ up: "up";
251
+ down: "down";
252
+ }>;
253
+ maxSwipes: z.ZodDefault<z.ZodNumber>;
254
+ distancePercent: z.ZodDefault<z.ZodNumber>;
255
+ durationMs: z.ZodDefault<z.ZodNumber>;
256
+ }, z.core.$strict>, z.ZodObject<{
257
+ binding: z.ZodObject<{
258
+ generationId: z.ZodString;
259
+ baseRevision: z.ZodNumber;
260
+ snapshotHash: z.ZodString;
261
+ }, z.core.$strict>;
262
+ activity: z.ZodObject<{
263
+ before: z.ZodString;
264
+ }, z.core.$strict>;
265
+ expect: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
266
+ type: z.ZodLiteral<"activity">;
267
+ value: z.ZodString;
268
+ timeoutMs: z.ZodNumber;
269
+ }, z.core.$strict>, z.ZodObject<{
270
+ type: z.ZodLiteral<"element">;
271
+ locator: z.ZodObject<{
272
+ resourceId: z.ZodOptional<z.ZodString>;
273
+ text: z.ZodOptional<z.ZodString>;
274
+ contentDescription: z.ZodOptional<z.ZodString>;
275
+ }, z.core.$strict>;
276
+ timeoutMs: z.ZodNumber;
277
+ }, z.core.$strict>, z.ZodObject<{
278
+ type: z.ZodLiteral<"logcat">;
279
+ tag: z.ZodString;
280
+ level: z.ZodOptional<z.ZodEnum<{
281
+ V: "V";
282
+ D: "D";
283
+ I: "I";
284
+ W: "W";
285
+ E: "E";
286
+ F: "F";
287
+ A: "A";
288
+ }>>;
289
+ pattern: z.ZodString;
290
+ match: z.ZodDefault<z.ZodEnum<{
291
+ literal: "literal";
292
+ regex: "regex";
293
+ }>>;
294
+ timeoutMs: z.ZodNumber;
295
+ }, z.core.$strict>], "type">>;
296
+ action: z.ZodLiteral<"back">;
297
+ }, z.core.$strict>, z.ZodObject<{
298
+ binding: z.ZodObject<{
299
+ generationId: z.ZodString;
300
+ baseRevision: z.ZodNumber;
301
+ snapshotHash: z.ZodString;
302
+ }, z.core.$strict>;
303
+ activity: z.ZodObject<{
304
+ before: z.ZodString;
305
+ }, z.core.$strict>;
306
+ expect: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
307
+ type: z.ZodLiteral<"activity">;
308
+ value: z.ZodString;
309
+ timeoutMs: z.ZodNumber;
310
+ }, z.core.$strict>, z.ZodObject<{
311
+ type: z.ZodLiteral<"element">;
312
+ locator: z.ZodObject<{
313
+ resourceId: z.ZodOptional<z.ZodString>;
314
+ text: z.ZodOptional<z.ZodString>;
315
+ contentDescription: z.ZodOptional<z.ZodString>;
316
+ }, z.core.$strict>;
317
+ timeoutMs: z.ZodNumber;
318
+ }, z.core.$strict>, z.ZodObject<{
319
+ type: z.ZodLiteral<"logcat">;
320
+ tag: z.ZodString;
321
+ level: z.ZodOptional<z.ZodEnum<{
322
+ V: "V";
323
+ D: "D";
324
+ I: "I";
325
+ W: "W";
326
+ E: "E";
327
+ F: "F";
328
+ A: "A";
329
+ }>>;
330
+ pattern: z.ZodString;
331
+ match: z.ZodDefault<z.ZodEnum<{
332
+ literal: "literal";
333
+ regex: "regex";
334
+ }>>;
335
+ timeoutMs: z.ZodNumber;
336
+ }, z.core.$strict>], "type">>;
337
+ action: z.ZodLiteral<"wait">;
338
+ }, z.core.$strict>], "action">;
339
+ export type ProposedStep = z.infer<typeof ProposedStepSchema>;
340
+ export type ProposalBinding = z.infer<typeof ProposalBindingSchema>;
341
+ export declare function hashProposedStep(step: unknown): string;
@@ -0,0 +1,87 @@
1
+ import { createHash } from "node:crypto";
2
+ import { z } from "zod";
3
+ import { ExpectSchema } from "./journey.js";
4
+ import { LocatorSchema } from "./layout.js";
5
+ const QualifiedActivitySchema = z.string().regex(/^(?:[A-Za-z_$][\w$]*\.)+[A-Za-z_$][\w$]*$/, "Activity checkpoint must be fully qualified");
6
+ const ProposedActivitySchema = z.strictObject({
7
+ before: QualifiedActivitySchema
8
+ });
9
+ export const ProposalBindingSchema = z.strictObject({
10
+ generationId: z.string().regex(/^[A-Za-z\d](?:[A-Za-z\d._-]*[A-Za-z\d])?$/),
11
+ baseRevision: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
12
+ snapshotHash: z.string().regex(/^[a-f\d]{64}$/)
13
+ });
14
+ const CommonStepShape = {
15
+ binding: ProposalBindingSchema,
16
+ activity: ProposedActivitySchema,
17
+ expect: ExpectSchema.optional()
18
+ };
19
+ const ClickStepSchema = z.strictObject({
20
+ action: z.literal("click"),
21
+ locator: LocatorSchema,
22
+ ...CommonStepShape
23
+ });
24
+ const LongClickStepSchema = z.strictObject({
25
+ action: z.literal("longClick"),
26
+ locator: LocatorSchema,
27
+ durationMs: z.number().int().positive().default(800),
28
+ ...CommonStepShape
29
+ });
30
+ const InputTextStepSchema = z.strictObject({
31
+ action: z.literal("inputText"),
32
+ text: z.string().min(1),
33
+ ...CommonStepShape
34
+ });
35
+ const SwipeStepSchema = z.strictObject({
36
+ action: z.literal("swipe"),
37
+ locator: LocatorSchema,
38
+ direction: z.enum(["up", "down", "left", "right"]),
39
+ distancePercent: z.number().positive().max(1).default(0.6),
40
+ durationMs: z.number().int().positive().default(300),
41
+ ...CommonStepShape
42
+ });
43
+ const ScrollToStepSchema = z.strictObject({
44
+ action: z.literal("scrollTo"),
45
+ locator: LocatorSchema,
46
+ container: LocatorSchema,
47
+ direction: z.enum(["up", "down", "left", "right"]),
48
+ maxSwipes: z.number().int().positive().max(30).default(20),
49
+ distancePercent: z.number().positive().max(1).default(0.6),
50
+ durationMs: z.number().int().positive().default(300),
51
+ ...CommonStepShape
52
+ });
53
+ const BackStepSchema = z.strictObject({
54
+ action: z.literal("back"),
55
+ ...CommonStepShape
56
+ });
57
+ const WaitStepSchema = z.strictObject({
58
+ action: z.literal("wait"),
59
+ ...CommonStepShape
60
+ });
61
+ export const ProposedStepSchema = z.discriminatedUnion("action", [
62
+ ClickStepSchema,
63
+ LongClickStepSchema,
64
+ InputTextStepSchema,
65
+ SwipeStepSchema,
66
+ ScrollToStepSchema,
67
+ BackStepSchema,
68
+ WaitStepSchema
69
+ ]);
70
+ function canonicalize(value) {
71
+ if (Array.isArray(value)) {
72
+ return value.map(canonicalize);
73
+ }
74
+ if (value !== null && typeof value === "object") {
75
+ return Object.fromEntries(Object.entries(value)
76
+ .filter(([, item]) => item !== undefined)
77
+ .sort(([left], [right]) => left.localeCompare(right))
78
+ .map(([key, item]) => [key, canonicalize(item)]));
79
+ }
80
+ return value;
81
+ }
82
+ export function hashProposedStep(step) {
83
+ const parsed = ProposedStepSchema.parse(step);
84
+ return createHash("sha256")
85
+ .update(JSON.stringify(canonicalize(parsed)))
86
+ .digest("hex");
87
+ }