sootsim 0.1.83 → 0.1.85

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 (209) hide show
  1. package/README.md +0 -1
  2. package/detox/colors.ts +54 -0
  3. package/detox/config-loader.ts +135 -0
  4. package/detox/element-types.ts +36 -0
  5. package/detox/expectations.ts +477 -0
  6. package/detox/gestures.ts +442 -0
  7. package/detox/index.ts +1403 -0
  8. package/detox/jest-environment.ts +86 -0
  9. package/detox/jest-preset.cjs +50 -0
  10. package/detox/matchers.ts +29 -0
  11. package/detox/navigation.ts +43 -0
  12. package/detox/run-test.ts +113 -0
  13. package/detox/screenshots/animated-color-test-rest-norngh.png +0 -0
  14. package/detox/screenshots/color-test-after-drag-norngh.png +0 -0
  15. package/detox/screenshots/color-test-rest-norngh.png +0 -0
  16. package/detox/screenshots/theme-blue-toggle.png +0 -0
  17. package/detox/screenshots/theme-blue.png +0 -0
  18. package/detox/screenshots/theme-red-toggle.png +0 -0
  19. package/detox/screenshots/theme-red.png +0 -0
  20. package/dist-cli/bin.js +3 -3
  21. package/dist-cli/chunks/{agent-MQ7GLVIB.js → agent-T3DUH5YJ.js} +2 -2
  22. package/dist-cli/chunks/{agent-wrapper-7KAFDQCN.js → agent-wrapper-NSBF4THI.js} +2 -2
  23. package/dist-cli/chunks/{assert-TV46GUNU.js → assert-X3F7TRCZ.js} +2 -2
  24. package/dist-cli/chunks/auto-bootstrap-47RN2V5G.js +2 -0
  25. package/dist-cli/chunks/beta-BRCGAF2N.js +2 -0
  26. package/dist-cli/chunks/chunk-36RPD6JI.js +2 -0
  27. package/dist-cli/chunks/{chunk-PM5NVKLP.js → chunk-3WGHC7JN.js} +2 -2
  28. package/dist-cli/chunks/chunk-4DBPNLGI.js +1 -0
  29. package/dist-cli/chunks/{chunk-J2GYISVJ.js → chunk-4EVSIUNB.js} +2 -2
  30. package/dist-cli/chunks/{chunk-JHJNODXN.js → chunk-4QZHZ6BC.js} +2 -2
  31. package/dist-cli/chunks/{chunk-F3HP444U.js → chunk-5DIGWOY7.js} +1 -1
  32. package/dist-cli/chunks/{chunk-DP7O5MHK.js → chunk-5N3V7OCG.js} +2 -2
  33. package/dist-cli/chunks/{chunk-Y4BUVURT.js → chunk-5S6D7K4L.js} +2 -2
  34. package/dist-cli/chunks/{chunk-ECJBV65H.js → chunk-7LKUN46F.js} +2 -2
  35. package/dist-cli/chunks/{chunk-WTKTOL3C.js → chunk-AC6QGW22.js} +2 -2
  36. package/dist-cli/chunks/{chunk-IBNRRAES.js → chunk-AFNDVS4E.js} +2 -2
  37. package/dist-cli/chunks/{chunk-6TNANCQC.js → chunk-BESAZ2HA.js} +2 -2
  38. package/dist-cli/chunks/{chunk-WN7M3QON.js → chunk-BHZJ6RIH.js} +2 -2
  39. package/dist-cli/chunks/{chunk-277XAALA.js → chunk-BZL6D4TV.js} +3 -3
  40. package/dist-cli/chunks/{chunk-CYV6Y6YV.js → chunk-CF2LPRXD.js} +2 -2
  41. package/dist-cli/chunks/chunk-DWTLRPEN.js +79 -0
  42. package/dist-cli/chunks/{chunk-CJY3AVI7.js → chunk-E2QE5FFP.js} +1 -1
  43. package/dist-cli/chunks/chunk-EBEL6TTJ.js +4 -0
  44. package/dist-cli/chunks/{chunk-DM6WT7QM.js → chunk-EFM53PZ5.js} +1 -1
  45. package/dist-cli/chunks/{chunk-YUELRHGB.js → chunk-EKXK3SWK.js} +2 -2
  46. package/dist-cli/chunks/{chunk-4LS5MZAI.js → chunk-G7CIZ5S3.js} +3 -3
  47. package/dist-cli/chunks/{chunk-6NN2D4EJ.js → chunk-GTAD6IUV.js} +1 -1
  48. package/dist-cli/chunks/{chunk-OYMFNU3M.js → chunk-H44IQHKZ.js} +1 -1
  49. package/dist-cli/chunks/{chunk-IP3QJLRH.js → chunk-HQDJ5BOF.js} +1 -1
  50. package/dist-cli/chunks/{chunk-5DJXZIFZ.js → chunk-KUSQ4NNJ.js} +1 -1
  51. package/dist-cli/chunks/{chunk-HAWOAQAG.js → chunk-MAO7F5PH.js} +3 -3
  52. package/dist-cli/chunks/{chunk-572VSFNP.js → chunk-NVTL3JQG.js} +1 -1
  53. package/dist-cli/chunks/{chunk-6XZOEBTZ.js → chunk-O6N2CEET.js} +2 -2
  54. package/dist-cli/chunks/{chunk-HNWEELAE.js → chunk-OISHLFON.js} +1 -1
  55. package/dist-cli/chunks/{chunk-2PY3UZVO.js → chunk-OUNLJM56.js} +2 -2
  56. package/dist-cli/chunks/chunk-OXOARRKR.js +67 -0
  57. package/dist-cli/chunks/{chunk-NXATOWWF.js → chunk-PHPXGLME.js} +1 -1
  58. package/dist-cli/chunks/{chunk-JQ7ZXOXJ.js → chunk-PQFFUJR6.js} +2 -2
  59. package/dist-cli/chunks/{chunk-KASUZ5XV.js → chunk-QLJNSOS7.js} +1 -1
  60. package/dist-cli/chunks/chunk-QQAECG5B.js +2 -0
  61. package/dist-cli/chunks/{chunk-FJYT7XL2.js → chunk-RZHREO3M.js} +2 -2
  62. package/dist-cli/chunks/{chunk-FRM355UL.js → chunk-SBGOUA6F.js} +2 -2
  63. package/dist-cli/chunks/chunk-SSCA2AEA.js +1 -0
  64. package/dist-cli/chunks/{chunk-Y2VJBRSP.js → chunk-UYRGCJ4N.js} +1 -1
  65. package/dist-cli/chunks/{chunk-2AWQ7OB2.js → chunk-WGDL5V6C.js} +1 -1
  66. package/dist-cli/chunks/{chunk-VMXWC2JO.js → chunk-Y5PLPEEU.js} +2 -2
  67. package/dist-cli/chunks/chunk-ZFAM4N5B.js +1 -0
  68. package/dist-cli/chunks/{chunk-RH4F2TF7.js → chunk-ZO3VHP6W.js} +1 -1
  69. package/dist-cli/chunks/cli-version-WPFDM2A6.js +2 -0
  70. package/dist-cli/chunks/{compat-QLLWBTS3.js → compat-PCXGGZBZ.js} +3 -3
  71. package/dist-cli/chunks/{config-2DSLDCXV.js → config-LULEVEYL.js} +2 -2
  72. package/dist-cli/chunks/control-6P6HY7UF.js +2 -0
  73. package/dist-cli/chunks/{cpu-profile-GEIKHCPC.js → cpu-profile-NOK73ZYW.js} +2 -2
  74. package/dist-cli/chunks/{daemon-4EBUFN4D.js → daemon-4A3DMUYL.js} +2 -2
  75. package/dist-cli/chunks/{debug-WGD6XWOF.js → debug-74BWB2ZG.js} +3 -3
  76. package/dist-cli/chunks/{detox-LNKGRZU6.js → detox-HEOMINSC.js} +2 -2
  77. package/dist-cli/chunks/{device-AYKXKVIQ.js → device-TTXXBJFZ.js} +2 -2
  78. package/dist-cli/chunks/{diagnose-TMXSDOOC.js → diagnose-QZ3GOHSE.js} +2 -2
  79. package/dist-cli/chunks/drivers-QRPWNOIT.js +2 -0
  80. package/dist-cli/chunks/{electron-QFPF7TBY.js → electron-QVOWV44R.js} +3 -3
  81. package/dist-cli/chunks/flow-QMA7GVN6.js +2 -0
  82. package/dist-cli/chunks/{hints-MXKRR4TG.js → hints-YKWRNMJC.js} +2 -2
  83. package/dist-cli/chunks/{home-paths-REMWQDAO.js → home-paths-SFADSTJM.js} +2 -2
  84. package/dist-cli/chunks/{inspect-XGSQNFV7.js → inspect-LEWGQCIU.js} +3 -3
  85. package/dist-cli/chunks/install-7N2N7Q32.js +2 -0
  86. package/dist-cli/chunks/{install-desktop-NQG3RZSA.js → install-desktop-22HYQZ2G.js} +3 -3
  87. package/dist-cli/chunks/{keys-5QZWXL3F.js → keys-3ZT3MICU.js} +2 -2
  88. package/dist-cli/chunks/{launch-SBXOZWKO.js → launch-ZXW2NFLG.js} +3 -3
  89. package/dist-cli/chunks/{login-EACQXE24.js → login-NJKJ7GZO.js} +4 -4
  90. package/dist-cli/chunks/{logout-IBQLMUML.js → logout-VMMQL7CB.js} +2 -2
  91. package/dist-cli/chunks/{maestro-LFYXUX7O.js → maestro-OJY4MTI7.js} +2 -2
  92. package/dist-cli/chunks/{preview-U4SBOEGQ.js → preview-QU2GXTEV.js} +2 -2
  93. package/dist-cli/chunks/{profile-GWS5ECMY.js → profile-7APWK47T.js} +2 -2
  94. package/dist-cli/chunks/{react-QDHLMVYL.js → react-RSVO5JZZ.js} +2 -2
  95. package/dist-cli/chunks/{record-BUEUWPDI.js → record-UWH4MDEO.js} +2 -2
  96. package/dist-cli/chunks/runtime-3FUENRHM.js +2 -0
  97. package/dist-cli/chunks/{runtime-delivery-G7L6RVZ7.js → runtime-delivery-QMKGRV7N.js} +2 -2
  98. package/dist-cli/chunks/{screenshot-T2HBA3VI.js → screenshot-43M27ALE.js} +2 -2
  99. package/dist-cli/chunks/{screenshot-mode-EG5HMIH3.js → screenshot-mode-EBYYN6TY.js} +2 -2
  100. package/dist-cli/chunks/{screenshots-S52AFHTV.js → screenshots-7TQZL6Z6.js} +2 -2
  101. package/dist-cli/chunks/{server-MFFVYUGG.js → server-VCFM25Z6.js} +2 -2
  102. package/dist-cli/chunks/setup-repo-HFH4VKJQ.js +2 -0
  103. package/dist-cli/chunks/{skills-HQGWBS2O.js → skills-RQA6EJQL.js} +2 -2
  104. package/dist-cli/chunks/{start-E3DRYY7W.js → start-ZT6MBYND.js} +4 -4
  105. package/dist-cli/chunks/store-BJBTDSZE.js +2 -0
  106. package/dist-cli/chunks/telemetry-ZZZKTILZ.js +2 -0
  107. package/dist-cli/chunks/{test-ZY3EF62K.js → test-RNRX5SWV.js} +3 -3
  108. package/dist-cli/chunks/{three-mode-WSPKQCJ5.js → three-mode-TQZH25ZO.js} +2 -2
  109. package/dist-cli/chunks/{timeline-3XAB5EWZ.js → timeline-GGN3AY6P.js} +2 -2
  110. package/dist-cli/chunks/{upgrade-WNENPFM5.js → upgrade-XT22D67C.js} +2 -2
  111. package/dist-cli/chunks/upload-NC2AYLC5.js +2 -0
  112. package/dist-cli/chunks/{web-D2AOZY44.js → web-KEHVF5MB.js} +2 -2
  113. package/dist-cli/chunks/{what-happened-F43KNSG6.js → what-happened-PATQRJ5T.js} +2 -2
  114. package/dist-cli/chunks/{whoami-T22VBR7C.js → whoami-CXVY26VV.js} +2 -2
  115. package/dist-lib/agent-daemon-client.cjs +1 -1
  116. package/dist-lib/agent-events.cjs +1 -1
  117. package/dist-lib/agent-sessions.cjs +1 -1
  118. package/dist-lib/attached-projects.cjs +1 -1
  119. package/dist-lib/auth/shared-session.cjs +1 -1
  120. package/dist-lib/backend-origin.cjs +1 -1
  121. package/dist-lib/beta.cjs +44 -0
  122. package/dist-lib/bridge-constants.cjs +1 -1
  123. package/dist-lib/cli-constants.cjs +1 -1
  124. package/dist-lib/config.cjs +1 -1
  125. package/dist-lib/detox/index.cjs +1770 -0
  126. package/dist-lib/detox/jest-preset.cjs +50 -0
  127. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  128. package/dist-lib/home-paths.cjs +1 -1
  129. package/dist-lib/host/bridge-host.cjs +1 -1
  130. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  131. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  132. package/dist-lib/index.cjs +136 -138
  133. package/dist-lib/metro.cjs +31 -26
  134. package/dist-lib/profiles.cjs +1 -1
  135. package/dist-lib/render-mode.cjs +1 -1
  136. package/dist-lib/scripts/demo-app-registry.cjs +809 -0
  137. package/dist-lib/scripts/dev-server-scanner.cjs +1269 -0
  138. package/dist-lib/skills.cjs +17766 -0
  139. package/dist-lib/vite.cjs +129 -39
  140. package/package.json +39 -14
  141. package/scripts/demo-app-registry.ts +989 -0
  142. package/scripts/dev-server-scanner.ts +674 -0
  143. package/src/agent-daemon-client.ts +390 -0
  144. package/src/agent-events.ts +71 -0
  145. package/src/agent-prompt.ts +71 -0
  146. package/src/agent-sessions.ts +572 -0
  147. package/src/attached-projects.ts +536 -0
  148. package/src/auth/shared-session.ts +199 -0
  149. package/src/backend-origin.ts +49 -0
  150. package/src/beta.ts +21 -0
  151. package/src/bridge-constants.ts +10 -0
  152. package/src/cli-constants.ts +1 -0
  153. package/src/cli-version.ts +30 -0
  154. package/src/codex-client.ts +215 -0
  155. package/src/config.ts +110 -0
  156. package/src/dev-bundle-resolution.ts +180 -0
  157. package/src/home-paths.ts +382 -0
  158. package/src/host/agent-host.ts +576 -0
  159. package/src/host/bridge-host.ts +2293 -0
  160. package/src/host/fetch-proxy-handler.ts +288 -0
  161. package/src/host/fetch-proxy-overrides.ts +39 -0
  162. package/src/host/open-url.ts +234 -0
  163. package/src/index.ts +9 -0
  164. package/src/metro-plugin.ts +139 -0
  165. package/src/native-dev-bundle-url.ts +62 -0
  166. package/src/native-seam-manifest.ts +313 -0
  167. package/src/profiles.ts +179 -0
  168. package/src/render-mode.ts +27 -0
  169. package/src/runtime-assets.ts +84 -0
  170. package/src/runtime-delivery.ts +334 -0
  171. package/src/screenshots/compose.ts +422 -0
  172. package/src/screenshots/frame-compose.ts +438 -0
  173. package/src/screenshots/orchestrate.ts +244 -0
  174. package/src/screenshots/registry.ts +58 -0
  175. package/src/screenshots/schema.ts +364 -0
  176. package/src/skills/builtin/a11y-review.ts +126 -0
  177. package/src/skills/builtin/compat-check.ts +104 -0
  178. package/src/skills/builtin/perf-profile.ts +84 -0
  179. package/src/skills/builtin/screenshot-all.ts +46 -0
  180. package/src/skills/builtin/test-flow.ts +118 -0
  181. package/src/skills/builtin/visual-diff.ts +94 -0
  182. package/src/skills/registry.ts +107 -0
  183. package/src/skills/types.ts +41 -0
  184. package/src/vite-plugin-one.ts +189 -0
  185. package/src/vite-plugin.ts +1381 -0
  186. package/src/worklets-babel.ts +132 -0
  187. package/dist-cli/chunks/auto-bootstrap-FQS4ZD2K.js +0 -2
  188. package/dist-cli/chunks/beta-VG7CDY2U.js +0 -2
  189. package/dist-cli/chunks/chunk-2OIBDYHW.js +0 -1
  190. package/dist-cli/chunks/chunk-6BNLVMXA.js +0 -1
  191. package/dist-cli/chunks/chunk-6XD6CBJM.js +0 -2
  192. package/dist-cli/chunks/chunk-CHQTO426.js +0 -1
  193. package/dist-cli/chunks/chunk-FAPYGVIU.js +0 -4
  194. package/dist-cli/chunks/chunk-PEHFE3LG.js +0 -64
  195. package/dist-cli/chunks/chunk-RXH2SLKF.js +0 -2
  196. package/dist-cli/chunks/chunk-UXQWC5ZR.js +0 -79
  197. package/dist-cli/chunks/chunk-XFQL74PF.js +0 -5
  198. package/dist-cli/chunks/cli-version-PWF6I6LY.js +0 -2
  199. package/dist-cli/chunks/control-UIOXGYXU.js +0 -2
  200. package/dist-cli/chunks/demo-app-registry-G3BDOFWC.js +0 -2
  201. package/dist-cli/chunks/drivers-IDQF34HP.js +0 -2
  202. package/dist-cli/chunks/flow-3JN3Y7RF.js +0 -2
  203. package/dist-cli/chunks/install-2N3YOOSN.js +0 -2
  204. package/dist-cli/chunks/runtime-PVB4VGUH.js +0 -2
  205. package/dist-cli/chunks/setup-repo-YOF7NV5D.js +0 -2
  206. package/dist-cli/chunks/store-MAI6D3UO.js +0 -2
  207. package/dist-cli/chunks/telemetry-RCQKCJTH.js +0 -2
  208. package/dist-cli/chunks/upload-YLJ4RA73.js +0 -2
  209. package/dist-lib/vite-base.cjs +0 -6937
@@ -0,0 +1,84 @@
1
+ // built-in skill: performance profiling
2
+
3
+ import type { SootSimSkill } from '../types'
4
+
5
+ interface OverlayProfile {
6
+ syncCount?: number
7
+ avgSyncMs?: number
8
+ [key: string]: unknown
9
+ }
10
+
11
+ export const skill: SootSimSkill = {
12
+ name: 'perf-profile',
13
+ description: 'Profile render performance of the app',
14
+ type: 'performance',
15
+ version: '1.0.0',
16
+ triggers: ['performance', 'profile', 'render time', 'benchmark', 'perf'],
17
+ tools: [
18
+ {
19
+ name: 'profile_render',
20
+ description: 'Profile render performance of the current screen',
21
+ parameters: {
22
+ duration: {
23
+ type: 'number',
24
+ description: 'Profile duration in seconds (default: 5)',
25
+ },
26
+ interactions: {
27
+ type: 'boolean',
28
+ description: 'Include user interactions in profiling',
29
+ },
30
+ },
31
+ async execute(params, context) {
32
+ const { chromium } = await import('playwright')
33
+ const path = await import('path')
34
+ const fs = await import('fs')
35
+
36
+ const browser = await chromium.launch({ headless: true })
37
+ const page = await browser.newPage({ viewport: { width: 500, height: 900 } })
38
+
39
+ try {
40
+ await page.goto(context.url, { waitUntil: 'networkidle' })
41
+ await page.waitForFunction('window.__sootsimTest && window.__sootsimA11y', {
42
+ timeout: 10000,
43
+ })
44
+ await page.waitForTimeout(1000)
45
+
46
+ // reset profiler
47
+ await page.evaluate('window.__sootsimA11y.resetProfile()')
48
+
49
+ // wait for profile duration
50
+ const duration = (params.duration || 5) * 1000
51
+ await page.waitForTimeout(duration)
52
+
53
+ // collect results
54
+ const profile = (await page.evaluate(
55
+ 'window.__sootsimA11y.profile()',
56
+ )) as OverlayProfile
57
+ const nodeCount = await page.evaluate('window.__sootsimTest.getNodeCount()')
58
+ const syncCount = profile.syncCount ?? 0
59
+
60
+ const report = {
61
+ timestamp: new Date().toISOString(),
62
+ duration: params.duration || 5,
63
+ nodeCount,
64
+ ...profile,
65
+ fps: syncCount > 0 ? (syncCount / (duration / 1000)).toFixed(1) : '0',
66
+ }
67
+
68
+ const reportPath = path.join(context.outputDir, 'perf-report.json')
69
+ fs.mkdirSync(path.dirname(reportPath), { recursive: true })
70
+ fs.writeFileSync(reportPath, JSON.stringify(report, null, 2))
71
+
72
+ return {
73
+ success: true,
74
+ message: `${report.fps} fps, ${profile.avgSyncMs?.toFixed(1)}ms avg sync, ${nodeCount} nodes`,
75
+ artifacts: [{ type: 'report', name: 'perf-report', path: reportPath }],
76
+ data: report,
77
+ }
78
+ } finally {
79
+ await browser.close()
80
+ }
81
+ },
82
+ },
83
+ ],
84
+ }
@@ -0,0 +1,46 @@
1
+ // built-in skill: capture all screens in light/dark mode
2
+
3
+ import type { SootSimSkill } from '../types'
4
+
5
+ export const skill: SootSimSkill = {
6
+ name: 'screenshot-all',
7
+ description: 'Capture screenshots of all screens in the app',
8
+ type: 'screenshot',
9
+ version: '1.0.0',
10
+ triggers: ['screenshot', 'capture screens', 'capture all', 'take screenshots'],
11
+ tools: [
12
+ {
13
+ name: 'capture_screenshot',
14
+ description: 'Capture a screenshot of the current screen',
15
+ parameters: {
16
+ name: { type: 'string', description: 'Screenshot name', required: true },
17
+ theme: { type: 'string', description: 'Color scheme: light or dark' },
18
+ },
19
+ async execute(params, context) {
20
+ const { chromium } = await import('playwright')
21
+ const path = await import('path')
22
+ const fs = await import('fs')
23
+
24
+ const browser = await chromium.launch({ headless: true })
25
+ const page = await browser.newPage({ viewport: { width: 500, height: 900 } })
26
+
27
+ try {
28
+ await page.goto(context.url, { waitUntil: 'networkidle' })
29
+ await page.waitForTimeout(2000)
30
+
31
+ const outputPath = path.join(context.outputDir, `${params.name}.png`)
32
+ fs.mkdirSync(path.dirname(outputPath), { recursive: true })
33
+ await page.screenshot({ path: outputPath })
34
+
35
+ return {
36
+ success: true,
37
+ message: `Screenshot saved: ${params.name}`,
38
+ artifacts: [{ type: 'screenshot', name: params.name, path: outputPath }],
39
+ }
40
+ } finally {
41
+ await browser.close()
42
+ }
43
+ },
44
+ },
45
+ ],
46
+ }
@@ -0,0 +1,118 @@
1
+ // built-in skill: run test flows against the app
2
+
3
+ import type { SootSimSkill } from '../types'
4
+
5
+ function sleep(ms: number) {
6
+ return new Promise((resolve) => setTimeout(resolve, ms))
7
+ }
8
+
9
+ export const skill: SootSimSkill = {
10
+ name: 'test-flow',
11
+ description: 'Run YAML test flows against the app',
12
+ type: 'testing',
13
+ version: '1.0.0',
14
+ triggers: ['run test', 'test flow', 'run flow', 'test the app'],
15
+ tools: [
16
+ {
17
+ name: 'run_flow',
18
+ description: 'Run a YAML flow against the app',
19
+ parameters: {
20
+ flowPath: {
21
+ type: 'string',
22
+ description: 'Path to the YAML flow file',
23
+ required: true,
24
+ },
25
+ record: { type: 'boolean', description: 'Record video of the flow' },
26
+ },
27
+ async execute(params, context) {
28
+ const fs = await import('fs')
29
+ const path = await import('path')
30
+ const yaml = await import('yaml')
31
+ const { DEFAULT_SOOTSIM_BRIDGE_PORT } = await import('../../bridge-constants')
32
+ const { SootSimBridgeHost } = await import('../../host/bridge-host')
33
+ const { createBridge } = await import('../../../cli/ws-bridge')
34
+ const { SootSimBridgeFlowRunner } =
35
+ await import('../../../cli/bridge-flow-runner')
36
+
37
+ const host = new SootSimBridgeHost({ port: DEFAULT_SOOTSIM_BRIDGE_PORT })
38
+ host.start({ silent: true })
39
+
40
+ try {
41
+ const flowContent = fs.readFileSync(params.flowPath, 'utf8')
42
+ const fmMatch = flowContent.match(/^---\n([\s\S]*?)\n---\n?/)
43
+ const stepsBody = fmMatch ? flowContent.slice(fmMatch[0].length) : flowContent
44
+ const steps = yaml.parse(stepsBody)
45
+ const beforeIds = new Set(host.listSims().map((sim) => sim.id))
46
+
47
+ await host.openUrl(context.url)
48
+
49
+ let simId: string | null = null
50
+ for (let i = 0; i < 60; i++) {
51
+ const sims = host.listSims()
52
+ const opened =
53
+ sims.find((sim) => !beforeIds.has(sim.id) && sim.readyState === 'open') ||
54
+ sims.find((sim) => sim.readyState === 'open')
55
+ if (opened) {
56
+ simId = opened.id
57
+ break
58
+ }
59
+ await sleep(500)
60
+ }
61
+
62
+ if (!simId) {
63
+ throw new Error('no sim connected to the bridge host')
64
+ }
65
+
66
+ const bridge = createBridge(DEFAULT_SOOTSIM_BRIDGE_PORT, {
67
+ simId,
68
+ commandTimeoutMs: 15000,
69
+ })
70
+ const driver = new SootSimBridgeFlowRunner(bridge, {
71
+ screenshotDir: context.outputDir,
72
+ flowDir: path.dirname(path.resolve(params.flowPath)),
73
+ simId,
74
+ recordingOutputDir: params.record ? context.outputDir : undefined,
75
+ })
76
+
77
+ let videoPath: string | null = null
78
+
79
+ try {
80
+ await driver.waitForTree(120000)
81
+ if (params.record) {
82
+ await driver.startRecording()
83
+ }
84
+ await driver.runFlow(steps)
85
+ if (params.record) {
86
+ videoPath = await driver.stopRecording()
87
+ }
88
+
89
+ return {
90
+ success: true,
91
+ message: `Flow completed: ${steps.length} steps passed`,
92
+ data: {
93
+ steps: steps.length,
94
+ simId,
95
+ videoPath: videoPath || undefined,
96
+ },
97
+ artifacts: videoPath
98
+ ? [{ type: 'video', name: path.basename(videoPath), path: videoPath }]
99
+ : undefined,
100
+ }
101
+ } finally {
102
+ try {
103
+ await bridge.closeSim(simId)
104
+ } catch {}
105
+ bridge.close()
106
+ }
107
+ } catch (err: any) {
108
+ return {
109
+ success: false,
110
+ message: `Flow failed: ${err.message}`,
111
+ }
112
+ } finally {
113
+ await host.close().catch(() => {})
114
+ }
115
+ },
116
+ },
117
+ ],
118
+ }
@@ -0,0 +1,94 @@
1
+ // built-in skill: visual diff against baselines
2
+
3
+ import type { SootSimSkill } from '../types'
4
+
5
+ export const skill: SootSimSkill = {
6
+ name: 'visual-diff',
7
+ description: 'Compare current rendering against baseline screenshots',
8
+ type: 'review',
9
+ version: '1.0.0',
10
+ triggers: ['visual diff', 'compare', 'visual regression', 'diff screenshots'],
11
+ tools: [
12
+ {
13
+ name: 'visual_diff',
14
+ description: 'Compare current screen against a baseline screenshot',
15
+ parameters: {
16
+ baseline: {
17
+ type: 'string',
18
+ description: 'Path to baseline screenshot',
19
+ required: true,
20
+ },
21
+ name: { type: 'string', description: 'Name for the diff output', required: true },
22
+ threshold: {
23
+ type: 'number',
24
+ description: 'Pixel match threshold (0-1, default 0.1)',
25
+ },
26
+ },
27
+ async execute(params, context) {
28
+ const { chromium } = await import('playwright')
29
+ const path = await import('path')
30
+ const fs = await import('fs')
31
+
32
+ const browser = await chromium.launch({ headless: true })
33
+ const page = await browser.newPage({ viewport: { width: 500, height: 900 } })
34
+
35
+ try {
36
+ await page.goto(context.url, { waitUntil: 'networkidle' })
37
+ await page.waitForTimeout(2000)
38
+
39
+ // capture current
40
+ const currentPath = path.join(context.outputDir, `${params.name}-current.png`)
41
+ fs.mkdirSync(path.dirname(currentPath), { recursive: true })
42
+ await page.screenshot({ path: currentPath })
43
+
44
+ // compare using pixelmatch if available
45
+ try {
46
+ const { PNG } = await import('pngjs')
47
+ const pixelmatch = (await import('pixelmatch')).default
48
+
49
+ const baseline = PNG.sync.read(fs.readFileSync(params.baseline))
50
+ const current = PNG.sync.read(fs.readFileSync(currentPath))
51
+
52
+ const { width, height } = baseline
53
+ const diff = new PNG({ width, height })
54
+
55
+ const numDiffPixels = pixelmatch(
56
+ baseline.data,
57
+ current.data,
58
+ diff.data,
59
+ width,
60
+ height,
61
+ { threshold: params.threshold || 0.1 },
62
+ )
63
+
64
+ const diffPath = path.join(context.outputDir, `${params.name}-diff.png`)
65
+ fs.writeFileSync(diffPath, PNG.sync.write(diff))
66
+
67
+ const totalPixels = width * height
68
+ const diffPercent = ((numDiffPixels / totalPixels) * 100).toFixed(2)
69
+
70
+ return {
71
+ success: numDiffPixels === 0,
72
+ message: `${diffPercent}% difference (${numDiffPixels} pixels)`,
73
+ artifacts: [
74
+ { type: 'screenshot', name: `${params.name}-current`, path: currentPath },
75
+ { type: 'screenshot', name: `${params.name}-diff`, path: diffPath },
76
+ ],
77
+ data: { diffPixels: numDiffPixels, totalPixels, diffPercent },
78
+ }
79
+ } catch {
80
+ return {
81
+ success: true,
82
+ message: 'Screenshot captured (pixelmatch not available for comparison)',
83
+ artifacts: [
84
+ { type: 'screenshot', name: `${params.name}-current`, path: currentPath },
85
+ ],
86
+ }
87
+ }
88
+ } finally {
89
+ await browser.close()
90
+ }
91
+ },
92
+ },
93
+ ],
94
+ }
@@ -0,0 +1,107 @@
1
+ // skill registry — load, discover, and match skills
2
+
3
+ import * as fs from 'fs'
4
+ import * as path from 'path'
5
+ import { skill as a11yReviewSkill } from './builtin/a11y-review'
6
+ import { skill as compatCheckSkill } from './builtin/compat-check'
7
+ import { skill as perfProfileSkill } from './builtin/perf-profile'
8
+ import { skill as screenshotAllSkill } from './builtin/screenshot-all'
9
+ import { skill as testFlowSkill } from './builtin/test-flow'
10
+ import { skill as visualDiffSkill } from './builtin/visual-diff'
11
+ import type { SootSimSkill, SkillContext } from './types'
12
+
13
+ const _skills: Map<string, SootSimSkill> = new Map()
14
+ const BUILTIN_SKILLS = [
15
+ a11yReviewSkill,
16
+ compatCheckSkill,
17
+ perfProfileSkill,
18
+ screenshotAllSkill,
19
+ testFlowSkill,
20
+ visualDiffSkill,
21
+ ]
22
+
23
+ export const skillRegistry = {
24
+ register(skill: SootSimSkill) {
25
+ _skills.set(skill.name, skill)
26
+ },
27
+
28
+ get(name: string): SootSimSkill | undefined {
29
+ return _skills.get(name)
30
+ },
31
+
32
+ listAll(): SootSimSkill[] {
33
+ return Array.from(_skills.values())
34
+ },
35
+
36
+ // match skills by natural language query against triggers
37
+ match(query: string): SootSimSkill[] {
38
+ const q = query.toLowerCase()
39
+ return this.listAll().filter((skill) =>
40
+ skill.triggers.some((trigger) => q.includes(trigger.toLowerCase())),
41
+ )
42
+ },
43
+
44
+ // load built-in skills
45
+ async loadBuiltins() {
46
+ for (const skill of BUILTIN_SKILLS) {
47
+ this.register(skill)
48
+ }
49
+ },
50
+
51
+ // load skills from a project manifest (sootsim-skills.json)
52
+ async loadFromManifest(projectDir: string) {
53
+ const manifestPath = path.join(projectDir, 'sootsim-skills.json')
54
+ if (!fs.existsSync(manifestPath)) return
55
+
56
+ try {
57
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
58
+ if (Array.isArray(manifest.skills)) {
59
+ for (const entry of manifest.skills) {
60
+ if (typeof entry === 'string') {
61
+ // npm package name
62
+ try {
63
+ const mod = await import(entry)
64
+ if (mod.skill) this.register(mod.skill)
65
+ } catch {}
66
+ } else if (entry.file) {
67
+ // local file
68
+ try {
69
+ const mod = await import(path.resolve(projectDir, entry.file))
70
+ if (mod.skill) this.register(mod.skill)
71
+ } catch {}
72
+ }
73
+ }
74
+ }
75
+ } catch {}
76
+ },
77
+
78
+ // auto-discover skills based on project dependencies
79
+ suggestSkills(projectDir: string): string[] {
80
+ const suggestions: string[] = []
81
+ const pkgPath = path.join(projectDir, 'package.json')
82
+ if (!fs.existsSync(pkgPath)) return suggestions
83
+
84
+ try {
85
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
86
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies }
87
+
88
+ // suggest testing skill if detox or maestro is in deps
89
+ if (deps['detox'] || deps['maestro']) {
90
+ suggestions.push('test-flow')
91
+ }
92
+
93
+ // suggest a11y review if no a11y testing library
94
+ if (!deps['jest-axe'] && !deps['@testing-library/jest-dom']) {
95
+ suggestions.push('a11y-review')
96
+ }
97
+
98
+ // always suggest visual-diff and screenshot
99
+ suggestions.push('visual-diff', 'screenshot-all')
100
+
101
+ // suggest perf if app has many screens
102
+ suggestions.push('perf-profile')
103
+ } catch {}
104
+
105
+ return suggestions
106
+ },
107
+ }
@@ -0,0 +1,41 @@
1
+ // skill type definitions — self-contained agent capabilities
2
+
3
+ export type SkillType = 'testing' | 'screenshot' | 'review' | 'performance' | 'custom'
4
+
5
+ export interface SkillTool {
6
+ name: string
7
+ description: string
8
+ parameters: Record<string, { type: string; description: string; required?: boolean }>
9
+ execute: (params: Record<string, any>, context: SkillContext) => Promise<SkillResult>
10
+ }
11
+
12
+ export interface SkillContext {
13
+ url: string // sootsim URL
14
+ projectDir: string // project root
15
+ outputDir: string // where to write artifacts
16
+ verbose: boolean
17
+ }
18
+
19
+ export interface SkillResult {
20
+ success: boolean
21
+ message: string
22
+ artifacts?: SkillArtifact[]
23
+ data?: Record<string, any>
24
+ }
25
+
26
+ export interface SkillArtifact {
27
+ type: 'screenshot' | 'video' | 'report' | 'flow' | 'json'
28
+ name: string
29
+ path: string
30
+ }
31
+
32
+ export interface SootSimSkill {
33
+ name: string
34
+ description: string
35
+ type: SkillType
36
+ version: string
37
+ triggers: string[] // natural language patterns that activate this skill
38
+ tools: SkillTool[]
39
+ setup?: (context: SkillContext) => Promise<void>
40
+ teardown?: (context: SkillContext) => Promise<void>
41
+ }
@@ -0,0 +1,189 @@
1
+ // sootsim plugin for One/Vite — serves the installed sootsim runtime at /__soot/
2
+ // from ~/.sootsim/runtimes/<version>.
3
+ //
4
+ // usage in vite.config.ts:
5
+ // import { sootsimPlugin } from 'sootsim/vite'
6
+ // export default { plugins: [one(), sootsimPlugin()] }
7
+
8
+ import fs from 'fs'
9
+ import path from 'path'
10
+ import {
11
+ isRootRuntimeAssetPath,
12
+ resolveActiveRuntimeRoot,
13
+ resolveRuntimeFilePath,
14
+ serveRuntimeFile,
15
+ SOOTSIM_RUNTIME_MISSING_MESSAGE,
16
+ } from './runtime-assets'
17
+ import type { Plugin } from 'vite'
18
+
19
+ const sootsimRoot = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..')
20
+
21
+ export interface SootPluginOptions {
22
+ // custom bundle URL (default: auto-detect from One's metro)
23
+ bundleUrl?: string
24
+ // path prefix (default: '/__soot')
25
+ prefix?: string
26
+ // disable sootsim
27
+ enabled?: boolean
28
+ // open the desktop app after the dev server starts (default true)
29
+ open?: boolean
30
+ }
31
+
32
+ export function sootsimPlugin(options: SootPluginOptions = {}): Plugin[] {
33
+ if (options.enabled === false) return []
34
+
35
+ const prefix = options.prefix || '/__soot'
36
+
37
+ return [
38
+ {
39
+ name: 'sootsim-one',
40
+
41
+ configureServer(server) {
42
+ const bundleUrl =
43
+ options.bundleUrl ||
44
+ '/node_modules/one/metro-entry.bundle?platform=ios&dev=true&minify=false'
45
+
46
+ // mirror Set-Cookie into a readable header for sootsim's fetch wrapper
47
+ server.middlewares.use((req, res, next) => {
48
+ const origWriteHead = res.writeHead.bind(res)
49
+ res.writeHead = function (statusCode: number, ...args: unknown[]) {
50
+ const setCookie = res.getHeader('set-cookie')
51
+ if (setCookie) {
52
+ const value = Array.isArray(setCookie)
53
+ ? setCookie.join(', ')
54
+ : String(setCookie)
55
+ res.setHeader('x-sootsim-set-cookie', value)
56
+ res.setHeader('access-control-expose-headers', 'x-sootsim-set-cookie')
57
+ }
58
+ return (origWriteHead as (...args: unknown[]) => typeof res)(
59
+ statusCode,
60
+ ...args,
61
+ )
62
+ } as typeof res.writeHead
63
+ next()
64
+ })
65
+
66
+ server.middlewares.use((req, res, next) => {
67
+ const url = req.url || ''
68
+ const pathname = url.split('?')[0]
69
+ const runtimeRoot = resolveActiveRuntimeRoot()
70
+
71
+ if (!runtimeRoot) {
72
+ if (
73
+ pathname === prefix ||
74
+ pathname === prefix + '/' ||
75
+ pathname.startsWith(prefix + '/')
76
+ ) {
77
+ res.statusCode = 500
78
+ res.end(SOOTSIM_RUNTIME_MISSING_MESSAGE)
79
+ return
80
+ }
81
+ next()
82
+ return
83
+ }
84
+
85
+ // root-relative runtime assets emitted by the shell and engine vite
86
+ // builds. only intercept when the asset exists in the active runtime.
87
+ if (isRootRuntimeAssetPath(pathname)) {
88
+ const fullPath = resolveRuntimeFilePath(runtimeRoot, pathname)
89
+ if (fullPath) {
90
+ serveRuntimeFile(res, fullPath)
91
+ return
92
+ }
93
+ }
94
+
95
+ // serve the sootsim HTML shell — inject bundle URL
96
+ if (pathname === prefix || pathname === prefix + '/') {
97
+ const htmlPath = path.join(runtimeRoot, 'index.html')
98
+ let html = fs.readFileSync(htmlPath, 'utf8')
99
+ // inject bundle URL as a query param so main.tsx picks it up
100
+ html = html.replace(
101
+ '</head>',
102
+ `<script>history.replaceState(null,'','${prefix}/?bundle=${encodeURIComponent(bundleUrl)}')</script></head>`,
103
+ )
104
+ res.setHeader('content-type', 'text/html')
105
+ res.end(html)
106
+ return
107
+ }
108
+
109
+ // serve runtime files under /__soot/*.
110
+ if (pathname.startsWith(prefix + '/')) {
111
+ const fullPath = resolveRuntimeFilePath(
112
+ runtimeRoot,
113
+ pathname.slice(prefix.length),
114
+ )
115
+ if (fullPath) {
116
+ serveRuntimeFile(res, fullPath)
117
+ return
118
+ }
119
+
120
+ // extensionless in-shell routes should still load the shell.
121
+ const ext = path.extname(pathname)
122
+ if (!ext) {
123
+ const htmlPath = path.join(runtimeRoot, 'index.html')
124
+ let html = fs.readFileSync(htmlPath, 'utf8')
125
+ html = html.replace(
126
+ '</head>',
127
+ `<script>history.replaceState(null,'','${prefix}/?bundle=${encodeURIComponent(bundleUrl)}')</script></head>`,
128
+ )
129
+ res.setHeader('content-type', 'text/html')
130
+ res.end(html)
131
+ return
132
+ }
133
+ }
134
+
135
+ next()
136
+ })
137
+
138
+ // try to open sootsim electron app
139
+ const port = server.config.server.port || 8081
140
+ const sootsimUrl = `http://localhost:${port}${prefix}/`
141
+ console.log(`[sootsim] serving at ${sootsimUrl}`)
142
+
143
+ if (options.open !== false) {
144
+ openElectronApp(sootsimUrl)
145
+ }
146
+ },
147
+ },
148
+ ]
149
+ }
150
+
151
+ // try to open the sootsim electron app via URL scheme or direct launch
152
+ async function openElectronApp(sootsimUrl: string) {
153
+ if (process.platform !== 'darwin') return
154
+
155
+ const { execSync, exec } = await import('child_process')
156
+
157
+ // try sootsim:// scheme first (works if app registered the protocol)
158
+ const schemeUrl = `sootsim://dev?url=${encodeURIComponent(sootsimUrl)}`
159
+ try {
160
+ exec(`open "${schemeUrl}"`)
161
+ return
162
+ } catch {}
163
+
164
+ // fallback: find the app directly
165
+ const candidates = [
166
+ '/Applications/sootsim.app',
167
+ path.join(process.env.HOME || '', 'Applications/sootsim.app'),
168
+ path.join(sootsimRoot, 'release/mac-arm64/sootsim.app'),
169
+ ]
170
+
171
+ let appPath = candidates.find((p) => fs.existsSync(p))
172
+ if (!appPath) {
173
+ try {
174
+ const found = execSync(
175
+ 'mdfind "kMDItemCFBundleIdentifier == dev.sootsim.simulator"',
176
+ { encoding: 'utf8', timeout: 3000 },
177
+ ).trim()
178
+ if (found) appPath = found.split('\n')[0]
179
+ } catch {}
180
+ }
181
+
182
+ if (appPath) {
183
+ try {
184
+ exec(`open -a "${appPath}" "${sootsimUrl}"`)
185
+ } catch {}
186
+ }
187
+ }
188
+
189
+ export default sootsimPlugin