peachsim 0.1.2438 → 0.1.2439

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 (175) hide show
  1. package/README.md +30 -98
  2. package/cli/app-catalog.ts +4 -73
  3. package/cli/catalog/content.ts +1 -1
  4. package/cli/cloud-box-artifact.ts +26 -39
  5. package/cli/cloud-client.ts +69 -117
  6. package/cli/cloud-session.ts +2 -9
  7. package/cli/commands/box.ts +6 -6
  8. package/cli/commands/control.ts +4 -11
  9. package/cli/commands/flow.ts +5 -9
  10. package/cli/commands/kotlin.ts +2 -1
  11. package/cli/commands/platform.ts +21 -39
  12. package/cli/commands/record-three.ts +1 -1
  13. package/cli/commands/shell-url.ts +29 -23
  14. package/cli/dev-build-freshness.ts +4 -3
  15. package/cli/native-input.ts +2 -2
  16. package/cli/outbound-endpoints.ts +20 -45
  17. package/cli/remote-project-bundle.ts +8 -14
  18. package/cli/remote-simulators.ts +1 -1
  19. package/cli/send-to-box.ts +2 -1
  20. package/detox/jest-preset.cjs +1 -1
  21. package/detox/jest-transform.cjs +40 -2
  22. package/dist-lib/agent-daemon-client.cjs +34 -24
  23. package/dist-lib/agent-events.cjs +1 -1
  24. package/dist-lib/attached-projects.cjs +19 -17
  25. package/dist-lib/auth/shared-session.cjs +18 -16
  26. package/dist-lib/backend-origin.cjs +1 -1
  27. package/dist-lib/beta.cjs +1 -1
  28. package/dist-lib/beta.mjs +2 -1
  29. package/dist-lib/bridge-constants.cjs +1 -1
  30. package/dist-lib/bridge-contract-input.cjs +1 -1
  31. package/dist-lib/bridge-contract-input.mjs +20 -583
  32. package/dist-lib/bridge-contract.cjs +1 -1
  33. package/dist-lib/bridge-contract.mjs +17 -99
  34. package/dist-lib/bundle-channel.cjs +8718 -5552
  35. package/dist-lib/capture-contract.cjs +1 -1
  36. package/dist-lib/capture-contract.mjs +13 -363
  37. package/dist-lib/cloud-contract.cjs +1 -1
  38. package/dist-lib/cloud-contract.mjs +34 -155
  39. package/dist-lib/cloud-test-args.cjs +1 -1
  40. package/dist-lib/cloud-test-args.mjs +2 -1
  41. package/dist-lib/cloud.cjs +1 -1
  42. package/dist-lib/cloud.mjs +26 -155
  43. package/dist-lib/config.cjs +1 -4
  44. package/dist-lib/config.mjs +11 -30
  45. package/dist-lib/detox/index.cjs +2554 -230
  46. package/dist-lib/detox/jest-preset.cjs +1 -1
  47. package/dist-lib/detox/jest-transform.cjs +40 -2
  48. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  49. package/dist-lib/esm-chunks/acorn-FGE4PYDJ.mjs +50 -0
  50. package/dist-lib/esm-chunks/chunk-2EUHEBIJ.mjs +664 -0
  51. package/dist-lib/esm-chunks/chunk-2NPABFPN.mjs +5719 -0
  52. package/dist-lib/esm-chunks/chunk-4ZFNH7TU.mjs +10 -0
  53. package/dist-lib/esm-chunks/chunk-5T4XBUJP.mjs +1353 -0
  54. package/dist-lib/esm-chunks/chunk-6VY6HTJC.mjs +18951 -0
  55. package/dist-lib/esm-chunks/chunk-7HANEMO4.mjs +188 -0
  56. package/dist-lib/esm-chunks/chunk-C3WBGYP6.mjs +186 -0
  57. package/dist-lib/esm-chunks/chunk-CVGDRROP.mjs +57 -0
  58. package/dist-lib/esm-chunks/chunk-DADGQELM.mjs +375 -0
  59. package/dist-lib/esm-chunks/chunk-DEGYKHN7.mjs +12 -0
  60. package/dist-lib/esm-chunks/chunk-HIDNO3RP.mjs +10992 -0
  61. package/dist-lib/esm-chunks/chunk-HSADZOVN.mjs +30 -0
  62. package/dist-lib/esm-chunks/chunk-IWJUYJQO.mjs +42 -0
  63. package/dist-lib/esm-chunks/chunk-JCKI3VZ6.mjs +10 -0
  64. package/dist-lib/esm-chunks/chunk-KSQ5KM5Y.mjs +17 -0
  65. package/dist-lib/esm-chunks/chunk-KVTIDLBK.mjs +598 -0
  66. package/dist-lib/esm-chunks/chunk-MIQSRBVU.mjs +10 -0
  67. package/dist-lib/esm-chunks/chunk-YB27R6JG.mjs +115 -0
  68. package/dist-lib/esm-chunks/metro-layout-parser-MVUAXRUJ.mjs +58 -0
  69. package/dist-lib/expo-swift-bundle.cjs +7856 -4707
  70. package/dist-lib/expo-swift-metadata.cjs +1 -1
  71. package/dist-lib/expo-swift-metadata.mjs +16 -165
  72. package/dist-lib/home-paths.cjs +1 -1
  73. package/dist-lib/host/bridge-host.cjs +15658 -11404
  74. package/dist-lib/host/fetch-proxy-handler.cjs +3927 -342
  75. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  76. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -1
  77. package/dist-lib/host/replacement-module-handler.cjs +4 -4
  78. package/dist-lib/host/websocket-proxy.cjs +1 -1
  79. package/dist-lib/index.cjs +9145 -32150
  80. package/dist-lib/jump-to-source-babel.cjs +1 -1
  81. package/dist-lib/jump-to-source-native.cjs +2 -2
  82. package/dist-lib/kotlin-host.cjs +260 -253
  83. package/dist-lib/menu.cjs +1 -1
  84. package/dist-lib/menu.mjs +5 -13
  85. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  86. package/dist-lib/metro-fingerprint-registry.mjs +5 -6
  87. package/dist-lib/metro-production-bundle.cjs +22 -3
  88. package/dist-lib/metro-production-bundle.mjs +26 -92
  89. package/dist-lib/native-app-identity-project.cjs +663 -451
  90. package/dist-lib/native-app-identity-project.mjs +509 -2318
  91. package/dist-lib/native-app-identity.cjs +1 -1
  92. package/dist-lib/native-app-identity.mjs +27 -1340
  93. package/dist-lib/native-firebase-metadata.cjs +1 -1
  94. package/dist-lib/native-firebase-metadata.mjs +5 -18
  95. package/dist-lib/pdfium-raster.cjs +1 -1
  96. package/dist-lib/pdfium-raster.mjs +2 -1
  97. package/dist-lib/plist.cjs +2 -2
  98. package/dist-lib/plist.mjs +5 -7
  99. package/dist-lib/profiles.cjs +2 -1
  100. package/dist-lib/public-brand.cjs +1 -1
  101. package/dist-lib/public-origins-lib-esm.json +246 -187
  102. package/dist-lib/public-origins-lib-static.json +1 -1
  103. package/dist-lib/public-origins-lib.json +1059 -1238
  104. package/dist-lib/react-native-host-modules.cjs +1 -1
  105. package/dist-lib/react-native-host-modules.mjs +2 -1
  106. package/dist-lib/reap-browser.cjs +18 -7
  107. package/dist-lib/scripts/dev-server-scanner.cjs +6 -230
  108. package/dist-lib/sdk.cjs +1 -1
  109. package/dist-lib/sdk.mjs +22 -78
  110. package/dist-lib/skills.cjs +21657 -17374
  111. package/dist-lib/swift-compile.cjs +1343 -1318
  112. package/dist-lib/swift-compile.mjs +68 -19013
  113. package/dist-lib/swift-package.cjs +1 -1
  114. package/dist-lib/swift-package.mjs +35 -630
  115. package/dist-lib/swift-submit.cjs +1 -1
  116. package/dist-lib/swift-submit.mjs +9 -24
  117. package/dist-lib/swift-toolchain.cjs +1 -1
  118. package/dist-lib/swift.cjs +1 -1
  119. package/dist-lib/vendor/@peculiar/x509.cjs +18061 -0
  120. package/dist-lib/vendor/acorn.cjs +5699 -0
  121. package/dist-lib/vendor/bplist-parser.cjs +1589 -0
  122. package/dist-lib/vendor/ignore.cjs +455 -0
  123. package/dist-lib/vendor/magic-string.cjs +1693 -0
  124. package/dist-lib/vendor/plist.cjs +10978 -0
  125. package/dist-lib/vendor/smol-toml.cjs +768 -0
  126. package/dist-lib/vendor/stream-json.cjs +1997 -0
  127. package/dist-lib/vendor/sucrase/dist/index.js.cjs +23593 -0
  128. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +15750 -0
  129. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +11316 -0
  130. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +482 -0
  131. package/dist-lib/vendor/sucrase.cjs +23593 -0
  132. package/dist-lib/vendor/terser.cjs +36874 -0
  133. package/dist-lib/vendor/valibot.cjs +6253 -0
  134. package/dist-lib/vendor/zod.cjs +23262 -0
  135. package/dist-lib/worklet-executable.cjs +3 -3
  136. package/dist-lib/worklet-executable.mjs +11 -16
  137. package/dist-types/packages/peach-engine/src/config.d.ts +1 -1
  138. package/kotlin/fork/NOTICE +3 -0
  139. package/kotlin/sdk.tar.gz +0 -0
  140. package/kotlin/toolchain.json +6 -6
  141. package/package.json +17 -121
  142. package/runtime-companion.json +1 -1
  143. package/scripts/dev-server-scanner.ts +13 -223
  144. package/src/android-autolinking.ts +2 -2
  145. package/src/bundle-channel.mjs +3 -15
  146. package/src/cloud-contract.ts +3 -4
  147. package/src/config.ts +0 -5
  148. package/src/host/bridge-host.ts +19 -1
  149. package/src/host/server-scan-handler.ts +1 -9
  150. package/src/index.ts +0 -2
  151. package/src/kotlin-host.ts +1 -2
  152. package/src/kotlinDiscoveryContract.ts +1 -0
  153. package/src/metro-production-bundle.ts +28 -6
  154. package/src/native-seam-manifest.ts +0 -13
  155. package/src/one-native-app-catalog.ts +8 -27
  156. package/src/one-native-app-config.ts +95 -0
  157. package/src/one-native-source.ts +250 -0
  158. package/src/one-widget-metadata.ts +45 -126
  159. package/src/oneWidgetContract.ts +80 -117
  160. package/src/serverDiscoveryContract.ts +0 -1
  161. package/src/simulator-route.ts +8 -0
  162. package/src/vite-plugin.ts +2 -2
  163. package/src/xcode-project.ts +1 -1
  164. package/dist-lib/metro.cjs +0 -27984
  165. package/dist-lib/vite-swift.cjs +0 -43376
  166. package/dist-lib/vite.cjs +0 -21456
  167. package/src/androidAutolinkingContract.ts +0 -48
  168. package/src/androidRootModuleContract.ts +0 -39
  169. package/src/dev-server-open.ts +0 -92
  170. package/src/metro-plugin.ts +0 -578
  171. package/src/one-widget-discovery.ts +0 -23
  172. package/src/swift-vite-lifetime.ts +0 -42
  173. package/src/vite-plugin-one.ts +0 -746
  174. package/src/vite-plugin-swift.ts +0 -225
  175. package/src/vite.d.ts +0 -10
@@ -0,0 +1,598 @@
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ import {
3
+ SIM_LONG_PRESS_MAX_MS
4
+ } from "./chunk-YB27R6JG.mjs";
5
+ import {
6
+ isRecord
7
+ } from "./chunk-JCKI3VZ6.mjs";
8
+
9
+ // src/bridge-contract-input.ts
10
+ var BridgeInputError = class extends Error {
11
+ constructor(message) {
12
+ super(message);
13
+ this.name = "BridgeInputError";
14
+ }
15
+ };
16
+ var SEMANTIC_WAIT_MAX_TIMEOUT_MS = 3e4;
17
+ function parseRecorderCommand(value) {
18
+ const step = recordValue(value, "recorder");
19
+ const method = stringValue(step.method, "recorder.method");
20
+ if (method === "available" || method === "stop") return { method };
21
+ if (method === "hold")
22
+ return { method, durationMs: numberValue(step.durationMs, "recorder.durationMs") };
23
+ const options = step.options === void 0 ? {} : recordValue(step.options, "recorder.options");
24
+ const layers = options.layers;
25
+ if (layers !== void 0 && layers !== "full" && layers !== "tenant" && layers !== "shell")
26
+ validationFailure("recorder.options.layers", "must be full, tenant or shell");
27
+ if (method === "getBlobBase64")
28
+ return {
29
+ method,
30
+ options: {
31
+ chunk: optionalNumber(options, "chunk", "recorder.options"),
32
+ offset: optionalNumber(options, "offset", "recorder.options")
33
+ }
34
+ };
35
+ if (method === "getFrameCaptureResult")
36
+ return {
37
+ method,
38
+ requestId: numberValue(step.requestId, "recorder.requestId"),
39
+ options: step.options === void 0 ? void 0 : {
40
+ offset: numberValue(options.offset, "recorder.options.offset"),
41
+ limit: numberValue(options.limit, "recorder.options.limit")
42
+ }
43
+ };
44
+ if (method === "startFrameCapture") {
45
+ const observation = options.observation;
46
+ if (observation !== void 0 && observation !== "presented")
47
+ validationFailure("recorder.options.observation", "must be presented");
48
+ return {
49
+ method,
50
+ options: {
51
+ count: numberValue(options.count, "recorder.options.count"),
52
+ durationMs: numberValue(options.durationMs, "recorder.options.durationMs"),
53
+ layers,
54
+ maxWidth: optionalNumber(options, "maxWidth", "recorder.options"),
55
+ observation,
56
+ surfaceId: options.surfaceId === void 0 ? void 0 : stringValue(options.surfaceId, "recorder.options.surfaceId")
57
+ }
58
+ };
59
+ }
60
+ if (method === "captureGif")
61
+ return {
62
+ method,
63
+ options: {
64
+ frames: numberValue(options.frames, "recorder.options.frames"),
65
+ durationMs: numberValue(options.durationMs, "recorder.options.durationMs"),
66
+ layers,
67
+ maxWidth: optionalNumber(options, "maxWidth", "recorder.options")
68
+ }
69
+ };
70
+ if (method === "start") {
71
+ const format = options.format;
72
+ if (format !== void 0 && format !== "webm" && format !== "mp4")
73
+ validationFailure("recorder.options.format", "must be webm or mp4");
74
+ return {
75
+ method,
76
+ options: {
77
+ format,
78
+ layers,
79
+ fps: optionalNumber(options, "fps", "recorder.options"),
80
+ durationMs: optionalNumber(options, "durationMs", "recorder.options"),
81
+ scene: optionalBoolean(options, "scene", "recorder.options"),
82
+ sceneWithVideo: optionalBoolean(options, "sceneWithVideo", "recorder.options")
83
+ }
84
+ };
85
+ }
86
+ return validationFailure("recorder.method", `is unsupported: ${method}`);
87
+ }
88
+ function validationFailure(path, expectation) {
89
+ throw new BridgeInputError(`${path} ${expectation}`);
90
+ }
91
+ function recordValue(value, path) {
92
+ if (!isRecord(value)) {
93
+ validationFailure(path, "must be an object");
94
+ }
95
+ return value;
96
+ }
97
+ function stringValue(value, path) {
98
+ if (typeof value !== "string") validationFailure(path, "must be a string");
99
+ return value;
100
+ }
101
+ function numberValue(value, path) {
102
+ if (typeof value !== "number" || !Number.isFinite(value)) {
103
+ validationFailure(path, "must be a finite number");
104
+ }
105
+ return value;
106
+ }
107
+ function booleanValue(value, path) {
108
+ if (typeof value !== "boolean") validationFailure(path, "must be a boolean");
109
+ return value;
110
+ }
111
+ function optionalNumber(record, key, path) {
112
+ return record[key] === void 0 ? void 0 : numberValue(record[key], `${path}.${key}`);
113
+ }
114
+ function optionalPointerId(record, path) {
115
+ const pointerId = optionalNumber(record, "pointerId", path);
116
+ if (pointerId !== void 0 && !Number.isSafeInteger(pointerId)) {
117
+ validationFailure(`${path}.pointerId`, "must be a safe integer");
118
+ }
119
+ return pointerId;
120
+ }
121
+ function optionalBoolean(record, key, path) {
122
+ return record[key] === void 0 ? void 0 : booleanValue(record[key], `${path}.${key}`);
123
+ }
124
+ function semanticWaitTimeout(record, path) {
125
+ const timeoutMs = optionalNumber(record, "timeoutMs", path);
126
+ if (timeoutMs !== void 0 && timeoutMs > SEMANTIC_WAIT_MAX_TIMEOUT_MS) {
127
+ validationFailure(
128
+ `${path}.timeoutMs`,
129
+ `must be at most ${SEMANTIC_WAIT_MAX_TIMEOUT_MS}`
130
+ );
131
+ }
132
+ return timeoutMs;
133
+ }
134
+ function parsePerformStep(value, index) {
135
+ const path = `perform.steps[${index}]`;
136
+ const step = recordValue(value, path);
137
+ const type = stringValue(step.type, `${path}.type`);
138
+ switch (type) {
139
+ case "touchDown":
140
+ case "touchMove":
141
+ case "touchUp": {
142
+ const pointerId = optionalPointerId(step, path);
143
+ return {
144
+ type,
145
+ x: numberValue(step.x, `${path}.x`),
146
+ y: numberValue(step.y, `${path}.y`),
147
+ ...pointerId === void 0 ? {} : { pointerId }
148
+ };
149
+ }
150
+ case "touchCancel": {
151
+ const pointerId = optionalPointerId(step, path);
152
+ return { type, ...pointerId === void 0 ? {} : { pointerId } };
153
+ }
154
+ case "tap":
155
+ return {
156
+ type,
157
+ target: parseTapTarget(step.target),
158
+ x: numberValue(step.x, `${path}.x`),
159
+ y: numberValue(step.y, `${path}.y`)
160
+ };
161
+ case "tapId":
162
+ return { type, id: stringValue(step.id, `${path}.id`) };
163
+ case "tapText":
164
+ return { type, text: stringValue(step.text, `${path}.text`) };
165
+ case "doubleTap": {
166
+ const gapMs = optionalNumber(step, "gapMs", path);
167
+ return {
168
+ type,
169
+ x: numberValue(step.x, `${path}.x`),
170
+ y: numberValue(step.y, `${path}.y`),
171
+ ...gapMs === void 0 ? {} : { gapMs }
172
+ };
173
+ }
174
+ case "longPress": {
175
+ const durationMs = optionalNumber(step, "durationMs", path);
176
+ if (durationMs !== void 0 && (!Number.isInteger(durationMs) || durationMs < 1 || durationMs > SIM_LONG_PRESS_MAX_MS)) {
177
+ validationFailure(
178
+ `${path}.durationMs`,
179
+ `must be an integer between 1 and ${SIM_LONG_PRESS_MAX_MS}`
180
+ );
181
+ }
182
+ return {
183
+ type,
184
+ x: numberValue(step.x, `${path}.x`),
185
+ y: numberValue(step.y, `${path}.y`),
186
+ ...durationMs === void 0 ? {} : { durationMs }
187
+ };
188
+ }
189
+ case "drag": {
190
+ const steps = optionalNumber(step, "steps", path);
191
+ const stepMs = optionalNumber(step, "stepMs", path);
192
+ return {
193
+ type,
194
+ fromX: numberValue(step.fromX, `${path}.fromX`),
195
+ fromY: numberValue(step.fromY, `${path}.fromY`),
196
+ toX: numberValue(step.toX, `${path}.toX`),
197
+ toY: numberValue(step.toY, `${path}.toY`),
198
+ ...steps === void 0 ? {} : { steps },
199
+ ...stepMs === void 0 ? {} : { stepMs }
200
+ };
201
+ }
202
+ case "pinch": {
203
+ const steps = optionalNumber(step, "steps", path);
204
+ const stepMs = optionalNumber(step, "stepMs", path);
205
+ return {
206
+ type,
207
+ fromX1: numberValue(step.fromX1, `${path}.fromX1`),
208
+ fromY1: numberValue(step.fromY1, `${path}.fromY1`),
209
+ fromX2: numberValue(step.fromX2, `${path}.fromX2`),
210
+ fromY2: numberValue(step.fromY2, `${path}.fromY2`),
211
+ toX1: numberValue(step.toX1, `${path}.toX1`),
212
+ toY1: numberValue(step.toY1, `${path}.toY1`),
213
+ toX2: numberValue(step.toX2, `${path}.toX2`),
214
+ toY2: numberValue(step.toY2, `${path}.toY2`),
215
+ ...steps === void 0 ? {} : { steps },
216
+ ...stepMs === void 0 ? {} : { stepMs }
217
+ };
218
+ }
219
+ case "scroll": {
220
+ const x = optionalNumber(step, "x", path);
221
+ const y = optionalNumber(step, "y", path);
222
+ const animated = optionalBoolean(step, "animated", path);
223
+ return {
224
+ type,
225
+ id: stringValue(step.id, `${path}.id`),
226
+ ...x === void 0 ? {} : { x },
227
+ ...y === void 0 ? {} : { y },
228
+ ...animated === void 0 ? {} : { animated }
229
+ };
230
+ }
231
+ case "type":
232
+ return { type, text: stringValue(step.text, `${path}.text`) };
233
+ case "typeInto": {
234
+ const nodeId = numberValue(step.nodeId, `${path}.nodeId`);
235
+ if (!Number.isSafeInteger(nodeId) || nodeId === 0) {
236
+ validationFailure(`${path}.nodeId`, "must be a nonzero safe integer");
237
+ }
238
+ return {
239
+ type,
240
+ text: stringValue(step.text, `${path}.text`),
241
+ nodeId
242
+ };
243
+ }
244
+ case "key":
245
+ return { type, key: stringValue(step.key, `${path}.key`) };
246
+ case "dismissKeyboard":
247
+ return { type };
248
+ case "setElementValue": {
249
+ const submit = optionalBoolean(step, "submit", path);
250
+ return {
251
+ type,
252
+ id: stringValue(step.id, `${path}.id`),
253
+ text: stringValue(step.text, `${path}.text`),
254
+ ...submit === void 0 ? {} : { submit }
255
+ };
256
+ }
257
+ case "toggleKeyboard":
258
+ return { type };
259
+ case "openUrl": {
260
+ const url = stringValue(step.url, `${path}.url`);
261
+ if (url.length === 0) validationFailure(`${path}.url`, "must be non-empty");
262
+ return { type, url };
263
+ }
264
+ case "keyDown":
265
+ case "keyUp":
266
+ return { type, key: stringValue(step.key, `${path}.key`) };
267
+ case "setOrientation": {
268
+ const orientation = stringValue(step.orientation, `${path}.orientation`);
269
+ if (orientation !== "portrait" && orientation !== "landscape") {
270
+ validationFailure(`${path}.orientation`, "must be portrait or landscape");
271
+ }
272
+ return { type, orientation };
273
+ }
274
+ case "deviceInfo":
275
+ return { type };
276
+ case "buttonDown":
277
+ case "buttonUp": {
278
+ const button = step.button === void 0 ? void 0 : stringValue(step.button, `${path}.button`);
279
+ return { type, ...button === void 0 ? {} : { button } };
280
+ }
281
+ case "incrementElement":
282
+ case "decrementElement":
283
+ return { type, id: stringValue(step.id, `${path}.id`) };
284
+ case "discoverStoreKitConfig":
285
+ case "clearStoreKitConfig":
286
+ return { type };
287
+ case "wait":
288
+ return { type, ms: numberValue(step.ms, `${path}.ms`) };
289
+ case "waitFor": {
290
+ const timeoutMs = semanticWaitTimeout(step, path);
291
+ const condition = step.condition === void 0 ? void 0 : stringValue(step.condition, `${path}.condition`);
292
+ if (condition !== void 0 && condition !== "present" && condition !== "mounted" && condition !== "absent") {
293
+ return validationFailure(
294
+ `${path}.condition`,
295
+ "must be present, mounted, or absent"
296
+ );
297
+ }
298
+ const selector = step.testID === void 0 ? { id: stringValue(step.id, `${path}.id`) } : { testID: stringValue(step.testID, `${path}.testID`) };
299
+ return {
300
+ type,
301
+ ...selector,
302
+ ...condition === void 0 ? {} : { condition },
303
+ ...timeoutMs === void 0 ? {} : { timeoutMs }
304
+ };
305
+ }
306
+ default:
307
+ return validationFailure(`${path}.type`, "is not a supported perform step");
308
+ }
309
+ }
310
+ function findInvalidPointerSequence(steps) {
311
+ const open = /* @__PURE__ */ new Map();
312
+ for (const [index, step] of steps.entries()) {
313
+ if (step.type !== "touchDown" && step.type !== "touchMove" && step.type !== "touchUp" && step.type !== "touchCancel") {
314
+ continue;
315
+ }
316
+ const pointerId = step.pointerId ?? 999;
317
+ if (!Number.isSafeInteger(pointerId)) {
318
+ return {
319
+ index,
320
+ error: `perform.steps[${index}] (${step.type}) has an invalid pointer id`
321
+ };
322
+ }
323
+ if (step.type === "touchDown") {
324
+ if (open.has(pointerId)) {
325
+ return {
326
+ index,
327
+ error: `perform.steps[${index}] (touchDown) starts pointer ${pointerId} before its previous touchUp or touchCancel`
328
+ };
329
+ }
330
+ open.set(pointerId, index);
331
+ continue;
332
+ }
333
+ if (!open.has(pointerId)) {
334
+ return {
335
+ index,
336
+ error: `perform.steps[${index}] (${step.type}) has no matching touchDown for pointer ${pointerId}`
337
+ };
338
+ }
339
+ if (step.type === "touchUp" || step.type === "touchCancel") {
340
+ open.delete(pointerId);
341
+ }
342
+ }
343
+ const next = open.entries().next();
344
+ if (next.done) return null;
345
+ return {
346
+ index: next.value[1],
347
+ error: `perform.steps[${next.value[1]}] (touchDown) has no matching touchUp or touchCancel for pointer ${next.value[0]}`
348
+ };
349
+ }
350
+ function diagnosticsChannels(value, path) {
351
+ if (!Array.isArray(value)) validationFailure(path, "must be a list of channel names");
352
+ return value.map((channel) => stringValue(channel, path));
353
+ }
354
+ function parseDiagnosticsResult(value) {
355
+ if (!isRecord(value) || !Array.isArray(value.channels) || !value.channels.every((channel) => typeof channel === "string") || !Array.isArray(value.availableChannels) || !value.availableChannels.every((channel) => typeof channel === "string") || !Array.isArray(value.events)) {
356
+ validationFailure(
357
+ "remote diagnostics",
358
+ "returned an incompatible native host response"
359
+ );
360
+ }
361
+ return {
362
+ channels: value.channels,
363
+ availableChannels: value.availableChannels,
364
+ runtime: value.runtime,
365
+ found: value.found,
366
+ events: value.events
367
+ };
368
+ }
369
+ function parseDiagnosticsOptions(value) {
370
+ const options = recordValue(value, "diagnostics");
371
+ const channels = options.channels === void 0 ? void 0 : diagnosticsChannels(options.channels, "diagnostics.channels");
372
+ let channelControl;
373
+ if (options.channelControl !== void 0) {
374
+ if (channels !== void 0) {
375
+ validationFailure("diagnostics.channelControl", "cannot be combined with channels");
376
+ }
377
+ const control = recordValue(options.channelControl, "diagnostics.channelControl");
378
+ const action = control.action;
379
+ if (action !== "enable" && action !== "disable" && action !== "toggle") {
380
+ validationFailure(
381
+ "diagnostics.channelControl.action",
382
+ "must be enable, disable, or toggle"
383
+ );
384
+ }
385
+ const selected = diagnosticsChannels(
386
+ control.channels,
387
+ "diagnostics.channelControl.channels"
388
+ );
389
+ if (action === "toggle" && (selected.length !== 1 || selected[0] === "all")) {
390
+ validationFailure("diagnostics.channelControl", "toggle requires one channel");
391
+ }
392
+ channelControl = { action, channels: selected };
393
+ }
394
+ const find = options.find;
395
+ if (find !== void 0 && find !== "sheets" && find !== "portals" && find !== "boundaries") {
396
+ validationFailure("diagnostics.find", "must be sheets, portals, or boundaries");
397
+ }
398
+ return {
399
+ ...channels === void 0 ? {} : { channels },
400
+ ...channelControl === void 0 ? {} : { channelControl },
401
+ ...find === void 0 ? {} : { find },
402
+ ...options.recentChannel === void 0 ? {} : {
403
+ recentChannel: stringValue(options.recentChannel, "diagnostics.recentChannel")
404
+ },
405
+ ...options.recentLimit === void 0 ? {} : {
406
+ recentLimit: numberValue(options.recentLimit, "diagnostics.recentLimit")
407
+ }
408
+ };
409
+ }
410
+ function parseStateOptions(value) {
411
+ const input = recordValue(value, "state");
412
+ const route = optionalBoolean(input, "route", "state");
413
+ const errors = optionalBoolean(input, "errors", "state");
414
+ const logs = optionalBoolean(input, "logs", "state");
415
+ const depth = optionalNumber(input, "depth", "state");
416
+ const errorLimit = optionalNumber(input, "errorLimit", "state");
417
+ const logLimit = optionalNumber(input, "logLimit", "state");
418
+ const layers = input.layers === void 0 ? void 0 : stringValue(input.layers, "state.layers");
419
+ if (layers !== void 0 && layers !== "full" && layers !== "tenant" && layers !== "shell") {
420
+ return validationFailure("state.layers", "must be full, tenant, or shell");
421
+ }
422
+ return {
423
+ screenshot: optionalBoolean(input, "screenshot", "state") ?? true,
424
+ tree: optionalBoolean(input, "tree", "state") ?? true,
425
+ ...route === void 0 ? {} : { route },
426
+ ...errors === void 0 ? {} : { errors },
427
+ ...logs === void 0 ? {} : { logs },
428
+ ...depth === void 0 ? {} : { depth },
429
+ ...layers === void 0 ? {} : { layers },
430
+ ...errorLimit === void 0 ? {} : { errorLimit },
431
+ ...logLimit === void 0 ? {} : { logLimit }
432
+ };
433
+ }
434
+ function parseSemanticSelector(value, path) {
435
+ const selector = recordValue(value, path);
436
+ if (selector.testID !== void 0) {
437
+ return { testID: stringValue(selector.testID, `${path}.testID`) };
438
+ }
439
+ if (selector.text !== void 0) {
440
+ return { text: stringValue(selector.text, `${path}.text`) };
441
+ }
442
+ if (selector.role !== void 0) {
443
+ return { role: stringValue(selector.role, `${path}.role`) };
444
+ }
445
+ if (selector.type !== void 0) {
446
+ return { type: stringValue(selector.type, `${path}.type`) };
447
+ }
448
+ if (selector.pressable !== void 0) {
449
+ if (booleanValue(selector.pressable, `${path}.pressable`) !== true) {
450
+ return validationFailure(`${path}.pressable`, "must be true");
451
+ }
452
+ return { pressable: true };
453
+ }
454
+ if (selector.visible !== void 0) {
455
+ if (booleanValue(selector.visible, `${path}.visible`) !== true) {
456
+ return validationFailure(`${path}.visible`, "must be true");
457
+ }
458
+ return { visible: true };
459
+ }
460
+ return validationFailure(
461
+ path,
462
+ "must select testID, text, role, type, pressable, or visible"
463
+ );
464
+ }
465
+ function parseSemanticQuery(value) {
466
+ const query = recordValue(value, "query");
467
+ const kind = stringValue(query.kind, "query.kind");
468
+ if (kind === "count") return { kind };
469
+ if (kind === "accessibility") return { kind };
470
+ if (kind === "tree") {
471
+ const depth = optionalNumber(query, "depth", "query");
472
+ return { kind, ...depth === void 0 ? {} : { depth } };
473
+ }
474
+ if (kind === "find") {
475
+ return { kind, selector: parseSemanticSelector(query.selector, "query.selector") };
476
+ }
477
+ return validationFailure("query.kind", "must be tree, find, count, or accessibility");
478
+ }
479
+ function semanticResolveSelector(value, path) {
480
+ const selector = recordValue(value, path);
481
+ if (selector.testID !== void 0) {
482
+ return { testID: stringValue(selector.testID, `${path}.testID`) };
483
+ }
484
+ if (selector.text !== void 0) {
485
+ return { text: stringValue(selector.text, `${path}.text`) };
486
+ }
487
+ return validationFailure(path, "must select testID or text");
488
+ }
489
+ function parseSemanticResolveSelector(value) {
490
+ const selector = recordValue(value, "selector");
491
+ if (selector.nodeId !== void 0) {
492
+ const nodeId = numberValue(selector.nodeId, "selector.nodeId");
493
+ if (!Number.isSafeInteger(nodeId)) {
494
+ return validationFailure("selector.nodeId", "must be an integer");
495
+ }
496
+ return { nodeId };
497
+ }
498
+ return semanticResolveSelector(value, "selector");
499
+ }
500
+ function parseSemanticWaitOptions(value) {
501
+ const input = recordValue(value, "waitFor");
502
+ const condition = recordValue(input.condition, "waitFor.condition");
503
+ const type = stringValue(condition.type, "waitFor.condition.type");
504
+ const timeoutMs = semanticWaitTimeout(input, "waitFor");
505
+ if (type === "ready") {
506
+ const stableMs = optionalNumber(condition, "stableMs", "waitFor.condition");
507
+ if (stableMs !== void 0 && stableMs < 0) {
508
+ return validationFailure("waitFor.condition.stableMs", "must not be negative");
509
+ }
510
+ return {
511
+ condition: { type, ...stableMs === void 0 ? {} : { stableMs } },
512
+ ...timeoutMs === void 0 ? {} : { timeoutMs }
513
+ };
514
+ }
515
+ if (type !== "present" && type !== "mounted" && type !== "absent") {
516
+ return validationFailure(
517
+ "waitFor.condition.type",
518
+ "must be ready, present, mounted, or absent"
519
+ );
520
+ }
521
+ return {
522
+ condition: {
523
+ type,
524
+ selector: semanticResolveSelector(condition.selector, "waitFor.condition.selector")
525
+ },
526
+ ...timeoutMs === void 0 ? {} : { timeoutMs }
527
+ };
528
+ }
529
+ function parseResetOptions(value) {
530
+ const input = recordValue(value, "reset");
531
+ const strategy = input.strategy === void 0 ? "data" : stringValue(input.strategy, "reset.strategy");
532
+ if (strategy !== "data" && strategy !== "full") {
533
+ return validationFailure("reset.strategy", "must be data or full");
534
+ }
535
+ const from = input.from;
536
+ if (from !== void 0 && (typeof from !== "string" || from.length === 0 || from.length > 64)) {
537
+ return validationFailure("reset.from", "must name a simulator");
538
+ }
539
+ return {
540
+ strategy,
541
+ relaunch: optionalBoolean(input, "relaunch", "reset") ?? true,
542
+ ...from === void 0 ? {} : { from }
543
+ };
544
+ }
545
+ function parseScreenshotOptions(value) {
546
+ const input = recordValue(value, "screenshot");
547
+ const layers = input.layers === void 0 ? void 0 : stringValue(input.layers, "screenshot.layers");
548
+ if (layers !== void 0 && layers !== "full" && layers !== "tenant" && layers !== "shell") {
549
+ return validationFailure("screenshot.layers", "must be full, tenant, or shell");
550
+ }
551
+ const crop = input.crop === void 0 ? void 0 : recordValue(input.crop, "screenshot.crop");
552
+ return {
553
+ ...layers === void 0 ? {} : { layers },
554
+ ...crop === void 0 ? {} : {
555
+ crop: {
556
+ x: numberValue(crop.x, "screenshot.crop.x"),
557
+ y: numberValue(crop.y, "screenshot.crop.y"),
558
+ w: numberValue(crop.w, "screenshot.crop.w"),
559
+ h: numberValue(crop.h, "screenshot.crop.h")
560
+ }
561
+ }
562
+ };
563
+ }
564
+ function parseTapTarget(value) {
565
+ if (value === void 0) return void 0;
566
+ const input = recordValue(value, "tap.target");
567
+ const target = {};
568
+ if (input.nodeId !== void 0 && input.nodeId !== null) {
569
+ const nodeId = numberValue(input.nodeId, "tap.target.nodeId");
570
+ if (!Number.isSafeInteger(nodeId))
571
+ validationFailure("tap.target.nodeId", "must be an integer");
572
+ target.nodeId = nodeId;
573
+ }
574
+ for (const key of ["id", "testID", "text", "type"]) {
575
+ if (input[key] !== void 0 && input[key] !== null)
576
+ target[key] = stringValue(input[key], `tap.target.${key}`);
577
+ }
578
+ if (target.nodeId === void 0 && !target.testID && !target.id)
579
+ validationFailure("tap.target", "requires nodeId, testID or id");
580
+ return target;
581
+ }
582
+
583
+ export {
584
+ BridgeInputError,
585
+ SEMANTIC_WAIT_MAX_TIMEOUT_MS,
586
+ parseRecorderCommand,
587
+ parsePerformStep,
588
+ findInvalidPointerSequence,
589
+ parseDiagnosticsResult,
590
+ parseDiagnosticsOptions,
591
+ parseStateOptions,
592
+ parseSemanticQuery,
593
+ parseSemanticResolveSelector,
594
+ parseSemanticWaitOptions,
595
+ parseResetOptions,
596
+ parseScreenshotOptions,
597
+ parseTapTarget
598
+ };
@@ -0,0 +1,10 @@
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+
3
+ // src/sleep.ts
4
+ function sleep(ms) {
5
+ return new Promise((resolve) => setTimeout(resolve, ms));
6
+ }
7
+
8
+ export {
9
+ sleep
10
+ };