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
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2438 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,366 +1,16 @@
1
- /*! peach v0.1.2438 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
-
3
- // src/capture-contract.ts
4
- var RNX_SCREEN_CAPTURE_VERSION = 1;
5
- function isLiveRasterSource(node) {
6
- const source = node.props?.source;
7
- return node.type === "image" && !!source && typeof source === "object" && "uri" in source && typeof source.uri === "string" && source.uri.startsWith("live:");
8
- }
9
- function rasterLayerFrame(node) {
10
- const visible = node.visibleFrame;
11
- if (isLiveRasterSource(node) && visible && visible.width > 0 && visible.height > 0) {
12
- return { x: visible.x, y: visible.y, width: visible.width, height: visible.height };
13
- }
14
- return node.frame ?? {
15
- x: node.absolutePosition.x,
16
- y: node.absolutePosition.y,
17
- width: node.layout.width,
18
- height: node.layout.height
19
- };
20
- }
21
- function selectRnxRasterNodeIds(tree, pixelRatio) {
22
- const nodesById = new Map(tree.nodes.map((node) => [node.nodeId, node]));
23
- const maxLayerArea = tree.width * tree.height * 0.25;
24
- const eligible = /* @__PURE__ */ new Map();
25
- for (const node of tree.nodes) {
26
- const liveVideo = isLiveRasterSource(node);
27
- const visibleFrame = liveVideo ? rasterLayerFrame(node) : node.visibleFrame ?? node.frame;
28
- if (!visibleFrame || visibleFrame.width <= 0 || visibleFrame.height <= 0) continue;
29
- const glass = node.style._liquidGlass !== void 0 || node.style._liquidGlassEdge !== void 0 || node.style._liquidGlassMaterialTint !== void 0;
30
- const unsupported = node.type === "masked-view" || liveVideo || node.type === "text" && typeof node.text === "string" && (/\p{Emoji_Presentation}/u.test(node.text) || /\uFE0F|\u200D|\u20E3|\p{Emoji_Modifier}|\p{Regional_Indicator}/u.test(
31
- node.text
32
- )) || glass;
33
- if (!unsupported) continue;
34
- const captured = rasterLayerFrame(node);
35
- const area = captured.width * captured.height;
36
- if (liveVideo || area <= maxLayerArea) {
37
- eligible.set(node.nodeId, { nodeId: node.nodeId, area, liveVideo, ownPaint: false });
38
- } else if (glass) {
39
- eligible.set(node.nodeId, { nodeId: node.nodeId, area, liveVideo, ownPaint: true });
40
- }
41
- }
42
- for (const nodeId of [...eligible.keys()]) {
43
- let parentNodeId = nodesById.get(nodeId)?.parentNodeId ?? null;
44
- while (parentNodeId !== null) {
45
- const parent = eligible.get(parentNodeId);
46
- if (parent && !parent.ownPaint) {
47
- eligible.delete(nodeId);
48
- break;
49
- }
50
- parentNodeId = nodesById.get(parentNodeId)?.parentNodeId ?? null;
51
- }
52
- }
53
- const candidates = [...eligible.values()].sort(
54
- (left, right) => Number(right.liveVideo) - Number(left.liveVideo) || Number(right.ownPaint) - Number(left.ownPaint) || left.area - right.area || left.nodeId - right.nodeId
55
- );
56
- const screenArea = tree.width * tree.height;
57
- const selection = { nodeIds: /* @__PURE__ */ new Set(), ownPaint: /* @__PURE__ */ new Set() };
58
- let atlasArea = 0;
59
- let layerArea = 0;
60
- for (const candidate of candidates) {
61
- const leading = candidate.liveVideo || candidate.ownPaint;
62
- if (atlasArea + candidate.area > screenArea * (leading ? 1 : 1.25) || !leading && layerArea + candidate.area > screenArea * 0.5) {
63
- continue;
64
- }
65
- selection.nodeIds.add(candidate.nodeId);
66
- if (candidate.ownPaint) selection.ownPaint.add(candidate.nodeId);
67
- atlasArea += candidate.area;
68
- if (!leading) layerArea += candidate.area;
69
- }
70
- const picked = [...selection.nodeIds];
71
- while (picked.length > 0) {
72
- const fits = fitRnxCaptureRegions(
73
- rnxRasterRegionRequests(tree, selection),
74
- pixelRatio,
75
- {
76
- pixelWidth: Math.round(tree.width * pixelRatio),
77
- pixelHeight: Math.round(tree.height * pixelRatio)
78
- }
79
- );
80
- if (fits) break;
81
- const dropped = picked.pop();
82
- selection.nodeIds.delete(dropped);
83
- selection.ownPaint.delete(dropped);
84
- }
85
- return selection;
86
- }
87
- function rnxRasterFrames(tree, nodeIds) {
88
- const frames = /* @__PURE__ */ new Map();
89
- for (const node of tree.nodes) {
90
- if (!nodeIds.has(node.nodeId)) continue;
91
- const frame = rasterLayerFrame(node);
92
- const glassOutset = liquidGlassPaintOutset(node.style._liquidGlass, frame);
93
- const shadowRadius = typeof node.style.shadowRadius === "number" ? node.style.shadowRadius : 0;
94
- const shadowOffset = node.style.shadowOffset;
95
- const shadowOffsetX = shadowOffset && typeof shadowOffset === "object" && typeof Reflect.get(shadowOffset, "width") === "number" ? Reflect.get(shadowOffset, "width") : 0;
96
- const shadowOffsetY = shadowOffset && typeof shadowOffset === "object" && typeof Reflect.get(shadowOffset, "height") === "number" ? Reflect.get(shadowOffset, "height") : 0;
97
- const left = Math.max(
98
- 0,
99
- frame.x - Math.max(glassOutset.x, shadowRadius - shadowOffsetX, 0)
100
- );
101
- const top = Math.max(
102
- 0,
103
- frame.y - Math.max(glassOutset.top, shadowRadius - shadowOffsetY, 0)
104
- );
105
- const right = Math.min(
106
- tree.width,
107
- frame.x + frame.width + Math.max(glassOutset.x, shadowRadius + shadowOffsetX, 0)
108
- );
109
- const bottom = Math.min(
110
- tree.height,
111
- frame.y + frame.height + Math.max(glassOutset.bottom, shadowRadius + shadowOffsetY, 0)
112
- );
113
- if (right > left && bottom > top) {
114
- frames.set(node.nodeId, {
115
- x: left,
116
- y: top,
117
- width: right - left,
118
- height: bottom - top
119
- });
120
- }
121
- }
122
- return frames;
123
- }
124
- function liquidGlassPaintOutset(glass, frame) {
125
- const outset = { x: 0, top: 0, bottom: 0 };
126
- if (!glass || typeof glass !== "object") return outset;
127
- const contour = Reflect.get(glass, "contour");
128
- const shadows = [
129
- Reflect.get(glass, "shadow"),
130
- Math.min(frame.width, frame.height) > 62 ? Reflect.get(glass, "tallShadow") : null,
131
- ...Array.isArray(contour) ? contour : []
132
- ];
133
- for (const shadow of shadows) {
134
- if (!shadow || typeof shadow !== "object") continue;
135
- const sigma = Reflect.get(shadow, "sigma");
136
- if (typeof sigma !== "number") continue;
137
- const offsetY = Reflect.get(shadow, "offsetY");
138
- const spread = Reflect.get(shadow, "spread");
139
- const [spreadX, spreadY] = typeof spread === "number" ? [spread, spread] : Array.isArray(spread) && typeof spread[0] === "number" && typeof spread[1] === "number" ? [spread[0], spread[1]] : [0, 0];
140
- const dy = typeof offsetY === "number" ? offsetY : 0;
141
- const blur = sigma * 3;
142
- outset.x = Math.max(outset.x, spreadX + blur);
143
- outset.top = Math.max(outset.top, spreadY + blur - dy);
144
- outset.bottom = Math.max(outset.bottom, spreadY + blur + dy);
145
- }
146
- return outset;
147
- }
148
- function rnxCaptureRasterRegions(capture, pixelRatio) {
149
- const tree = {
150
- width: capture.tree.viewport.width,
151
- height: capture.tree.viewport.height,
152
- nodes: capture.tree.nodes.map((node) => ({
153
- nodeId: node.nodeId,
154
- parentNodeId: node.parentNodeId,
155
- type: node.type,
156
- props: node.props,
157
- text: node.text,
158
- style: node.style.resolved,
159
- layout: node.layout.local,
160
- frame: node.layout.frame,
161
- absolutePosition: node.layout.absolutePosition,
162
- visibleFrame: node.layout.visibleFrame
163
- }))
164
- };
165
- const selection = selectRnxRasterNodeIds(tree, pixelRatio);
166
- return rnxRasterRegionRequests(tree, selection);
167
- }
168
- function rnxRasterRegionRequests(tree, selection) {
169
- const frames = rnxRasterFrames(tree, selection.nodeIds);
170
- return [...selection.nodeIds].flatMap((nodeId) => {
171
- const frame = frames.get(nodeId);
172
- if (!frame) return [];
173
- return [
174
- {
175
- key: String(nodeId),
176
- nodeId,
177
- frame,
178
- ...selection.ownPaint.has(nodeId) ? { ownPaint: true } : {}
179
- }
180
- ];
181
- });
182
- }
183
- function packRnxCaptureRegions(regions, pixelRatio, surface) {
184
- const packed = fitRnxCaptureRegions(regions, pixelRatio, surface);
185
- if (!packed) throw new Error("capture regions cannot fit in one bounded atlas");
186
- return packed;
187
- }
188
- function fitRnxCaptureRegions(regions, pixelRatio, surface) {
189
- const physical = regions.map((region) => {
190
- let left = Math.floor(region.frame.x * pixelRatio);
191
- let top = Math.floor(region.frame.y * pixelRatio);
192
- let right = Math.ceil((region.frame.x + region.frame.width) * pixelRatio);
193
- let bottom = Math.ceil((region.frame.y + region.frame.height) * pixelRatio);
194
- if (left / pixelRatio > region.frame.x) left -= 1;
195
- if (top / pixelRatio > region.frame.y) top -= 1;
196
- if (left / pixelRatio + (right - left) / pixelRatio < region.frame.x + region.frame.width)
197
- right += 1;
198
- if (top / pixelRatio + (bottom - top) / pixelRatio < region.frame.y + region.frame.height)
199
- bottom += 1;
200
- if (left < 0 || top < 0 || right > surface.pixelWidth || bottom > surface.pixelHeight || right <= left || bottom <= top) {
201
- throw new Error(`capture region ${region.key} is outside the app surface`);
202
- }
203
- return {
204
- key: region.key,
205
- nodeId: region.nodeId,
206
- ...region.ownPaint ? { ownPaint: true } : {},
207
- frame: {
208
- x: left / pixelRatio,
209
- y: top / pixelRatio,
210
- width: (right - left) / pixelRatio,
211
- height: (bottom - top) / pixelRatio
212
- },
213
- sourceX: left,
214
- sourceY: top,
215
- pixelWidth: right - left,
216
- pixelHeight: bottom - top
217
- };
218
- });
219
- const largestWidth = Math.max(...physical.map((region) => region.pixelWidth));
220
- const totalArea = physical.reduce(
221
- (area, region) => area + region.pixelWidth * region.pixelHeight,
222
- 0
223
- );
224
- if (totalArea > 4194304) return null;
225
- const candidates = [
226
- largestWidth,
227
- Math.max(largestWidth, Math.ceil(Math.sqrt(totalArea))),
228
- Math.max(largestWidth, surface.pixelWidth),
229
- 4096
230
- ];
231
- const ordered = [...physical].sort(
232
- (left, right) => right.pixelHeight - left.pixelHeight || right.pixelWidth - left.pixelWidth || left.key.localeCompare(right.key)
233
- );
234
- let best = null;
235
- for (const candidate of [...new Set(candidates)]) {
236
- if (candidate > 4096) continue;
237
- let x = 0;
238
- let y = 0;
239
- let rowHeight = 0;
240
- let usedWidth = 0;
241
- const packed = [];
242
- for (const region of ordered) {
243
- if (x > 0 && x + region.pixelWidth > candidate) {
244
- y += rowHeight;
245
- x = 0;
246
- rowHeight = 0;
247
- }
248
- packed.push({ ...region, atlasX: x, atlasY: y });
249
- x += region.pixelWidth;
250
- rowHeight = Math.max(rowHeight, region.pixelHeight);
251
- usedWidth = Math.max(usedWidth, x);
252
- }
253
- const height2 = y + rowHeight;
254
- if (height2 > 4096 || usedWidth * height2 > 4194304) continue;
255
- const result = { width: usedWidth, height: height2, regions: packed };
256
- if (!best || result.width * result.height < best.width * best.height) best = result;
257
- }
258
- if (!best) return null;
259
- const width = best.width / pixelRatio;
260
- const height = best.height / pixelRatio;
261
- return {
262
- width,
263
- height,
264
- pixelWidth: best.width,
265
- pixelHeight: best.height,
266
- regions: best.regions,
267
- atlasRegions: best.regions.map((region) => ({
268
- key: region.key,
269
- nodeId: region.nodeId,
270
- ...region.ownPaint ? { ownPaint: true } : {},
271
- frame: region.frame,
272
- // a region flush with the far edge is anchored to the logical edge so
273
- // its source never runs past the atlas by a rounding hair
274
- source: {
275
- x: region.atlasX + region.pixelWidth === best.width ? width - region.frame.width : region.atlasX / pixelRatio,
276
- y: region.atlasY + region.pixelHeight === best.height ? height - region.frame.height : region.atlasY / pixelRatio,
277
- width: region.frame.width,
278
- height: region.frame.height
279
- }
280
- }))
281
- };
282
- }
283
- function captureRecord(value) {
284
- return value !== null && typeof value === "object" && !Array.isArray(value);
285
- }
286
- function captureInteger(value) {
287
- return typeof value === "number" && Number.isSafeInteger(value);
288
- }
289
- function captureNumber(value) {
290
- return typeof value === "number" && Number.isFinite(value);
291
- }
292
- function captureNullableString(value) {
293
- return value === null || typeof value === "string";
294
- }
295
- function captureRect(value) {
296
- return captureRecord(value) && captureNumber(value.x) && captureNumber(value.y) && captureNumber(value.width) && captureNumber(value.height);
297
- }
298
- function captureOptionalString(value) {
299
- return value === void 0 || typeof value === "string";
300
- }
301
- function captureOptionalNullableString(value) {
302
- return value === void 0 || captureNullableString(value);
303
- }
304
- function captureFontRegistration(value) {
305
- return captureRecord(value) && typeof value.family === "string" && value.family.length > 0 && captureOptionalString(value.url) && captureOptionalString(value.sourceLabel) && captureOptionalNullableString(value.parsedFamily) && captureOptionalNullableString(value.parsedPostScript) && captureOptionalNullableString(value.fullName);
306
- }
307
- function capturePoint(value) {
308
- return captureRecord(value) && captureNumber(value.x) && captureNumber(value.y);
309
- }
310
- function captureNode(value) {
311
- if (!captureRecord(value) || !captureInteger(value.nodeId) || !(value.parentNodeId === null || captureInteger(value.parentNodeId)) || !Array.isArray(value.childNodeIds) || !value.childNodeIds.every(captureInteger) || !captureInteger(value.paintIndex) || typeof value.type !== "string" || !captureNullableString(value.id) || !captureNullableString(value.testID) || !captureNullableString(value.text) || !captureInteger(value.childCount) || !captureRecord(value.accessibility) || !captureRecord(value.interaction) || !captureRecord(value.layout) || !captureRecord(value.style) || !captureRecord(value.source) || !captureRecord(value.props) || !captureRecord(value.inspection)) {
312
- return false;
313
- }
314
- const accessibility = value.accessibility;
315
- if (typeof accessibility.accessible !== "boolean" || !captureNullableString(accessibility.label) || !captureNullableString(accessibility.role) || !captureNullableString(accessibility.hint) || !(accessibility.liveRegion === null || accessibility.liveRegion === "none" || accessibility.liveRegion === "polite" || accessibility.liveRegion === "assertive") || !(accessibility.state === null || captureRecord(accessibility.state)) || !(accessibility.value === null || captureRecord(accessibility.value))) {
316
- return false;
317
- }
318
- const interaction = value.interaction;
319
- if (typeof interaction.pressed !== "boolean" || typeof interaction.pressable !== "boolean" || typeof interaction.textInput !== "boolean" || !(interaction.textSelection === null || captureRecord(interaction.textSelection)) || typeof interaction.secureTextEntry !== "boolean" || !captureNullableString(interaction.placeholder) || !capturePoint(interaction.scrollOffset) || !(interaction.zoomScale === null || captureNumber(interaction.zoomScale)) || typeof interaction.nativePinchEnabled !== "boolean" || !(interaction.contentOffsetProp === null || captureRecord(interaction.contentOffsetProp)) || !(interaction.strokeDashoffsetProp === null || captureNumber(interaction.strokeDashoffsetProp))) {
320
- return false;
321
- }
322
- const layout = value.layout;
323
- if (!captureRect(layout.local) || !(layout.frame === null || captureRect(layout.frame)) || !capturePoint(layout.absolutePosition) || !(layout.visibleFrame === null || captureRect(layout.visibleFrame))) {
324
- return false;
325
- }
326
- const style = value.style;
327
- return captureRecord(style.resolved) && captureRecord(style.authored) && captureRecord(style.computed) && captureRecord(style.tokenBindings) && (value.textLines === void 0 || Array.isArray(value.textLines));
328
- }
329
- function isRnxScreenCapture(value) {
330
- if (!captureRecord(value) || value.contractVersion !== RNX_SCREEN_CAPTURE_VERSION || !captureInteger(value.capturedAt) || !(value.committedRoute === void 0 || value.committedRoute === null || captureRecord(value.committedRoute) && typeof value.committedRoute.href === "string" && value.committedRoute.href.startsWith("/")) || !captureRecord(value.tree) || !(value.fonts === void 0 || Array.isArray(value.fonts) && value.fonts.length <= 200 && value.fonts.every(captureFontRegistration)) || !(value.visual === void 0 || captureRecord(value.visual))) {
331
- return false;
332
- }
333
- const tree = value.tree;
334
- const visual = value.visual;
335
- return captureRecord(tree.viewport) && captureInteger(tree.viewport.width) && tree.viewport.width > 0 && captureInteger(tree.viewport.height) && tree.viewport.height > 0 && captureInteger(tree.rootNodeId) && (tree.commitRevision === void 0 || captureInteger(tree.commitRevision)) && Array.isArray(tree.nodes) && tree.nodes.every(captureNode) && (visual === void 0 || visual.kind === "png" && (visual.producer === "headless-cpu-app-surface" || visual.producer === "browser-compositor-app-surface") && typeof visual.dataUri === "string" && visual.dataUri.startsWith("data:image/png;base64,") && captureInteger(visual.pixelWidth) && visual.pixelWidth > 0 && captureInteger(visual.pixelHeight) && visual.pixelHeight > 0);
336
- }
337
- function isRnxCaptureRegionAtlas(value) {
338
- if (!captureRecord(value) || value.kind !== "png-atlas" || value.producer !== "headless-cpu-app-surface" && value.producer !== "browser-compositor-app-surface" || typeof value.dataUri !== "string" || !value.dataUri.startsWith("data:image/png;base64,") || !captureNumber(value.width) || value.width <= 0 || !captureNumber(value.height) || value.height <= 0 || !captureInteger(value.pixelWidth) || value.pixelWidth <= 0 || !captureInteger(value.pixelHeight) || value.pixelHeight <= 0 || !Array.isArray(value.regions) || value.regions.length === 0 || value.regions.length > 256) {
339
- return false;
340
- }
341
- const scale = value.pixelWidth / value.width;
342
- if (!Number.isInteger(scale) || scale < 1 || scale > 4 || Math.abs(value.height * scale - value.pixelHeight) > 1e-6) {
343
- return false;
344
- }
345
- const keys = /* @__PURE__ */ new Set();
346
- for (const region of value.regions) {
347
- if (!captureRecord(region) || typeof region.key !== "string" || region.key.length === 0 || keys.has(region.key) || !captureInteger(region.nodeId) || region.nodeId <= 0 || region.ownPaint !== void 0 && region.ownPaint !== true || !captureRect(region.frame) || region.frame.width <= 0 || region.frame.height <= 0 || !captureRect(region.source) || region.source.x < 0 || region.source.y < 0 || region.source.width !== region.frame.width || region.source.height !== region.frame.height || region.source.x + region.source.width > value.width || region.source.y + region.source.height > value.height) {
348
- return false;
349
- }
350
- keys.add(region.key);
351
- }
352
- return true;
353
- }
354
- function describeInvalidScreenCapture(value) {
355
- if (!captureRecord(value)) return `capture is ${value === null ? "null" : typeof value}`;
356
- const tree = value.tree;
357
- if (!captureRecord(tree) || !Array.isArray(tree.nodes))
358
- return `capture tree is not a node list; keys ${Object.keys(value).join(",")}`;
359
- const index = tree.nodes.findIndex((node) => !captureNode(node));
360
- if (index < 0)
361
- return `tree nodes are valid; contractVersion ${String(value.contractVersion)}, capturedAt ${String(value.capturedAt)}, viewport ${JSON.stringify(tree.viewport)}, rootNodeId ${String(tree.rootNodeId)}`;
362
- return `node ${index} of ${tree.nodes.length} is invalid: ${JSON.stringify(tree.nodes[index])?.slice(0, 2e3)}`;
363
- }
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ import {
3
+ RNX_SCREEN_CAPTURE_VERSION,
4
+ describeInvalidScreenCapture,
5
+ isRnxCaptureRegionAtlas,
6
+ isRnxScreenCapture,
7
+ packRnxCaptureRegions,
8
+ rnxCaptureRasterRegions,
9
+ rnxRasterFrames,
10
+ rnxRasterRegionRequests,
11
+ selectRnxRasterNodeIds
12
+ } from "./esm-chunks/chunk-DADGQELM.mjs";
13
+ import "./esm-chunks/chunk-IWJUYJQO.mjs";
364
14
  export {
365
15
  RNX_SCREEN_CAPTURE_VERSION,
366
16
  describeInvalidScreenCapture,
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2438 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,158 +1,37 @@
1
- /*! peach v0.1.2438 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
-
3
- // src/cloud-contract.ts
4
- var AGENT_IDENTITY_MAX_CHARS = 200;
5
- function readAgentIdentity(value) {
6
- if (value === void 0) return void 0;
7
- if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
8
- const text = (key) => {
9
- const field = Reflect.get(value, key);
10
- return typeof field === "string" && field.trim() !== "" && field.length <= AGENT_IDENTITY_MAX_CHARS ? field : null;
11
- };
12
- const id = text("id");
13
- const name = text("name");
14
- const machine = text("machine");
15
- const step = text("step");
16
- if (id === null || name === null || machine === null || step === null) return null;
17
- return { id, name, machine, step };
18
- }
19
- var TEXT_FIELD_TYPE = /text ?(input|field)/i;
20
- function agentActionTarget(target) {
21
- if (!target) return void 0;
22
- const clean = (value) => {
23
- const text2 = value?.trim().replace(/\s+/g, " ");
24
- return text2 ? text2.slice(0, AGENT_IDENTITY_MAX_CHARS) : void 0;
25
- };
26
- const id = clean(target.id);
27
- const testID = clean(target.testID);
28
- const text = TEXT_FIELD_TYPE.test(target.type ?? "") ? void 0 : clean(target.text);
29
- if (!id && !testID && !text) return void 0;
30
- return { ...id && { id }, ...testID && { testID }, ...text && { text } };
31
- }
32
- function agentActionTargetName(target) {
33
- const safe = agentActionTarget(target);
34
- return safe?.text ?? safe?.testID ?? safe?.id ?? null;
35
- }
36
- var RNX_CLOUD_MAX_ARTIFACT_BYTES = 40761776;
37
- var RNX_CLOUD_DESIGN_MAX_STORAGE_ENTRIES = 256;
38
- var RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES = 1024 * 1024;
39
- var RNX_CLOUD_TEST_FILES_MAX_COUNT = 256;
40
- var RNX_CLOUD_TEST_FILES_MAX_BYTES = 5e5;
41
- function isSafeCloudTestFilePath(path) {
42
- return path !== "" && !path.startsWith("/") && !path.includes("\\") && !path.split("/").some((segment) => !segment || segment === "." || segment === "..");
43
- }
44
- var RNX_CLOUD_COMMAND_SCOPE_SET = /* @__PURE__ */ new Set([
45
- "read",
46
- "drive",
47
- "reset",
48
- "media",
49
- "debug",
50
- "watch"
51
- ]);
52
- function isRnxCloudCommandScope(value) {
53
- return RNX_CLOUD_COMMAND_SCOPE_SET.has(value);
54
- }
55
- var RNX_CLOUD_SCOPED_TOKEN_PREFIX = "sk_rnx_sim_";
56
- var RNX_CLOUD_SCOPED_TOKEN_DEFAULT_TTL_SECONDS = 3600;
57
- var RNX_CLOUD_SCOPED_TOKEN_MIN_TTL_SECONDS = 1;
58
- var RNX_CLOUD_SCOPED_TOKEN_MAX_TTL_SECONDS = 14400;
59
- var RNX_CLOUD_SCOPED_TOKEN_MAX_ORIGINS = 16;
60
- var RNX_CLOUD_COMMAND_SCOPES = {
61
- state: "read",
62
- tree: "read",
63
- query: "read",
64
- resolve: "read",
65
- screenshot: "read",
66
- capture: "read",
67
- captureRegions: "read",
68
- memory: "read",
69
- diagnostics: "read",
70
- storageSnapshot: "read",
71
- perform: "drive",
72
- waitFor: "drive",
73
- tap: "drive",
74
- longPress: "drive",
75
- settle: "drive",
76
- openUrl: "drive",
77
- setAppearance: "drive",
78
- keyboard: "drive",
79
- focus: "drive",
80
- flowStatus: "drive",
81
- reset: "reset",
82
- recorder: "drive",
83
- camera: "media",
84
- location: "media",
85
- // string evaluation and arbitrary bridge calls are maestro's boundary: the
86
- // customer sdk never carries this scope, and the service grants it only to
87
- // the account api key caller. close rides along, since ending the page ends
88
- // the sim and belongs to the sim's owner rather than any driver.
89
- evaluate: "debug",
90
- call: "debug",
91
- close: "debug"
92
- };
93
- function scopeTableKeys() {
94
- return Object.keys(RNX_CLOUD_COMMAND_SCOPES).filter(
95
- (key) => Object.prototype.hasOwnProperty.call(RNX_CLOUD_COMMAND_SCOPES, key)
96
- );
97
- }
98
- var RNX_CLOUD_COMMAND_TYPES = Object.freeze(scopeTableKeys());
99
- var RNX_CLOUD_COMMAND_TYPE_SET = new Set(RNX_CLOUD_COMMAND_TYPES);
100
- function isRnxCloudCommandType(value) {
101
- return RNX_CLOUD_COMMAND_TYPE_SET.has(value);
102
- }
103
- function rnxCloudCommandScope(type) {
104
- return RNX_CLOUD_COMMAND_SCOPES[type];
105
- }
106
- var RNX_CLOUD_TOKEN_SCOPES = Object.freeze([
107
- "read",
108
- "drive",
109
- "reset",
110
- "media"
111
- ]);
112
- var RNX_CLOUD_ALL_COMMAND_SCOPES = Object.freeze(["read", "drive", "reset", "media", "debug"]);
113
- function rnxCloudScopesAllowCommand(scopes, type) {
114
- return scopes.includes(RNX_CLOUD_COMMAND_SCOPES[type]);
115
- }
116
- var RNX_CLOUD_LABELS_MAX_COUNT = 16;
117
- var RNX_CLOUD_LABEL_MAX_LENGTH = 63;
118
- var RNX_CLOUD_LABEL_CONTROL = /[\u0000-\u001f\u007f]/;
119
- function isValidRnxCloudLabel(key, value) {
120
- return key.length > 0 && key.length <= RNX_CLOUD_LABEL_MAX_LENGTH && value.length <= RNX_CLOUD_LABEL_MAX_LENGTH && !key.includes(",") && !key.includes("=") && !value.includes(",") && !RNX_CLOUD_LABEL_CONTROL.test(key) && !RNX_CLOUD_LABEL_CONTROL.test(value);
121
- }
122
- function parseRnxCloudLabels(value) {
123
- if (value === "") return {};
124
- const entries = value.split(",");
125
- if (entries.length > RNX_CLOUD_LABELS_MAX_COUNT) return null;
126
- const labels = {};
127
- for (const entry of entries) {
128
- const separator = entry.indexOf("=");
129
- if (separator < 1) return null;
130
- const key = entry.slice(0, separator).trim();
131
- const label = entry.slice(separator + 1).trim();
132
- if (!isValidRnxCloudLabel(key, label)) return null;
133
- if (Object.hasOwn(labels, key)) return null;
134
- labels[key] = label;
135
- }
136
- return labels;
137
- }
138
- function readRnxCloudLabels(value) {
139
- if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
140
- const entries = Object.entries(value);
141
- if (entries.length > RNX_CLOUD_LABELS_MAX_COUNT) return null;
142
- const labels = {};
143
- for (const [key, label] of entries) {
144
- if (typeof label !== "string") return null;
145
- if (!isValidRnxCloudLabel(key, label)) return null;
146
- labels[key] = label;
147
- }
148
- return labels;
149
- }
150
- function matchesRnxCloudLabels(labels, selector) {
151
- return Object.entries(selector).every(([key, value]) => labels[key] === value);
152
- }
153
- function isRnxCloudSimStatus(value) {
154
- return value === "creating" || value === "open" || value === "hibernated" || value === "deleting" || value === "deleted";
155
- }
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ import {
3
+ AGENT_IDENTITY_MAX_CHARS,
4
+ RNX_CLOUD_ALL_COMMAND_SCOPES,
5
+ RNX_CLOUD_COMMAND_SCOPES,
6
+ RNX_CLOUD_COMMAND_TYPES,
7
+ RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES,
8
+ RNX_CLOUD_DESIGN_MAX_STORAGE_ENTRIES,
9
+ RNX_CLOUD_LABELS_MAX_COUNT,
10
+ RNX_CLOUD_LABEL_MAX_LENGTH,
11
+ RNX_CLOUD_MAX_ARTIFACT_BYTES,
12
+ RNX_CLOUD_SCOPED_TOKEN_DEFAULT_TTL_SECONDS,
13
+ RNX_CLOUD_SCOPED_TOKEN_MAX_ORIGINS,
14
+ RNX_CLOUD_SCOPED_TOKEN_MAX_TTL_SECONDS,
15
+ RNX_CLOUD_SCOPED_TOKEN_MIN_TTL_SECONDS,
16
+ RNX_CLOUD_SCOPED_TOKEN_PREFIX,
17
+ RNX_CLOUD_TEST_FILES_MAX_BYTES,
18
+ RNX_CLOUD_TEST_FILES_MAX_COUNT,
19
+ RNX_CLOUD_TOKEN_SCOPES,
20
+ agentActionTarget,
21
+ agentActionTargetName,
22
+ isRnxCloudCommandScope,
23
+ isRnxCloudCommandType,
24
+ isRnxCloudSimStatus,
25
+ isSafeCloudTestFilePath,
26
+ isValidRnxCloudLabel,
27
+ matchesRnxCloudLabels,
28
+ parseRnxCloudLabels,
29
+ readAgentIdentity,
30
+ readRnxCloudLabels,
31
+ rnxCloudCommandScope,
32
+ rnxCloudScopesAllowCommand
33
+ } from "./esm-chunks/chunk-7HANEMO4.mjs";
34
+ import "./esm-chunks/chunk-IWJUYJQO.mjs";
156
35
  export {
157
36
  AGENT_IDENTITY_MAX_CHARS,
158
37
  RNX_CLOUD_ALL_COMMAND_SCOPES,
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2438 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,5 @@
1
- /*! peach v0.1.2438 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ import "./esm-chunks/chunk-IWJUYJQO.mjs";
2
3
 
3
4
  // src/cloud-test-args.ts
4
5
  var CLOUD_TEST_ARGS_MAX_COUNT = 32;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2438 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;