tabwright 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (599) hide show
  1. package/LICENSE +21 -0
  2. package/bin.js +4 -0
  3. package/dist/a11y-client.js +204 -0
  4. package/dist/agent-skills/tabwright/SKILL.md +119 -0
  5. package/dist/aria-snapshot.d.ts +262 -0
  6. package/dist/aria-snapshot.d.ts.map +1 -0
  7. package/dist/aria-snapshot.js +1256 -0
  8. package/dist/aria-snapshot.js.map +1 -0
  9. package/dist/aria-snapshot.test.d.ts +2 -0
  10. package/dist/aria-snapshot.test.d.ts.map +1 -0
  11. package/dist/aria-snapshot.test.js +270 -0
  12. package/dist/aria-snapshot.test.js.map +1 -0
  13. package/dist/aria-snapshot.unit.test.d.ts +2 -0
  14. package/dist/aria-snapshot.unit.test.d.ts.map +1 -0
  15. package/dist/aria-snapshot.unit.test.js +542 -0
  16. package/dist/aria-snapshot.unit.test.js.map +1 -0
  17. package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts +5 -0
  18. package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts.map +1 -0
  19. package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js +5 -0
  20. package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js.map +1 -0
  21. package/dist/bippy.js +894 -0
  22. package/dist/browser-config.d.ts +13 -0
  23. package/dist/browser-config.d.ts.map +1 -0
  24. package/dist/browser-config.js +126 -0
  25. package/dist/browser-config.js.map +1 -0
  26. package/dist/browser-install.d.ts +16 -0
  27. package/dist/browser-install.d.ts.map +1 -0
  28. package/dist/browser-install.js +238 -0
  29. package/dist/browser-install.js.map +1 -0
  30. package/dist/browser-launch.d.ts +17 -0
  31. package/dist/browser-launch.d.ts.map +1 -0
  32. package/dist/browser-launch.js +44 -0
  33. package/dist/browser-launch.js.map +1 -0
  34. package/dist/builtin-capabilities.d.ts +28 -0
  35. package/dist/builtin-capabilities.d.ts.map +1 -0
  36. package/dist/builtin-capabilities.js +2673 -0
  37. package/dist/builtin-capabilities.js.map +1 -0
  38. package/dist/capability-agent-skill.d.ts +60 -0
  39. package/dist/capability-agent-skill.d.ts.map +1 -0
  40. package/dist/capability-agent-skill.js +225 -0
  41. package/dist/capability-agent-skill.js.map +1 -0
  42. package/dist/capability-auth-state.d.ts +34 -0
  43. package/dist/capability-auth-state.d.ts.map +1 -0
  44. package/dist/capability-auth-state.js +157 -0
  45. package/dist/capability-auth-state.js.map +1 -0
  46. package/dist/capability-auth.d.ts +36 -0
  47. package/dist/capability-auth.d.ts.map +1 -0
  48. package/dist/capability-auth.js +198 -0
  49. package/dist/capability-auth.js.map +1 -0
  50. package/dist/capability-cli-confirmation.test.d.ts +2 -0
  51. package/dist/capability-cli-confirmation.test.d.ts.map +1 -0
  52. package/dist/capability-cli-confirmation.test.js +79 -0
  53. package/dist/capability-cli-confirmation.test.js.map +1 -0
  54. package/dist/capability-options.d.ts +20 -0
  55. package/dist/capability-options.d.ts.map +1 -0
  56. package/dist/capability-options.js +31 -0
  57. package/dist/capability-options.js.map +1 -0
  58. package/dist/capability-options.test.d.ts +2 -0
  59. package/dist/capability-options.test.d.ts.map +1 -0
  60. package/dist/capability-options.test.js +81 -0
  61. package/dist/capability-options.test.js.map +1 -0
  62. package/dist/capability-package.d.ts +27 -0
  63. package/dist/capability-package.d.ts.map +1 -0
  64. package/dist/capability-package.js +444 -0
  65. package/dist/capability-package.js.map +1 -0
  66. package/dist/capability-package.test.d.ts +2 -0
  67. package/dist/capability-package.test.d.ts.map +1 -0
  68. package/dist/capability-package.test.js +179 -0
  69. package/dist/capability-package.test.js.map +1 -0
  70. package/dist/capability-registry.d.ts +262 -0
  71. package/dist/capability-registry.d.ts.map +1 -0
  72. package/dist/capability-registry.js +931 -0
  73. package/dist/capability-registry.js.map +1 -0
  74. package/dist/capability-registry.test.d.ts +2 -0
  75. package/dist/capability-registry.test.d.ts.map +1 -0
  76. package/dist/capability-registry.test.js +1683 -0
  77. package/dist/capability-registry.test.js.map +1 -0
  78. package/dist/capability-runner.d.ts +99 -0
  79. package/dist/capability-runner.d.ts.map +1 -0
  80. package/dist/capability-runner.js +608 -0
  81. package/dist/capability-runner.js.map +1 -0
  82. package/dist/capability-search-relevance.test.d.ts +2 -0
  83. package/dist/capability-search-relevance.test.d.ts.map +1 -0
  84. package/dist/capability-search-relevance.test.js +67 -0
  85. package/dist/capability-search-relevance.test.js.map +1 -0
  86. package/dist/capability-studio.d.ts +11 -0
  87. package/dist/capability-studio.d.ts.map +1 -0
  88. package/dist/capability-studio.js +593 -0
  89. package/dist/capability-studio.js.map +1 -0
  90. package/dist/capability-studio.test.d.ts +2 -0
  91. package/dist/capability-studio.test.d.ts.map +1 -0
  92. package/dist/capability-studio.test.js +41 -0
  93. package/dist/capability-studio.test.js.map +1 -0
  94. package/dist/cdp-log.d.ts +19 -0
  95. package/dist/cdp-log.d.ts.map +1 -0
  96. package/dist/cdp-log.js +83 -0
  97. package/dist/cdp-log.js.map +1 -0
  98. package/dist/cdp-log.test.d.ts +2 -0
  99. package/dist/cdp-log.test.d.ts.map +1 -0
  100. package/dist/cdp-log.test.js +109 -0
  101. package/dist/cdp-log.test.js.map +1 -0
  102. package/dist/cdp-relay.d.ts +19 -0
  103. package/dist/cdp-relay.d.ts.map +1 -0
  104. package/dist/cdp-relay.js +2375 -0
  105. package/dist/cdp-relay.js.map +1 -0
  106. package/dist/cdp-session.d.ts +37 -0
  107. package/dist/cdp-session.d.ts.map +1 -0
  108. package/dist/cdp-session.js +36 -0
  109. package/dist/cdp-session.js.map +1 -0
  110. package/dist/cdp-types.d.ts +65 -0
  111. package/dist/cdp-types.d.ts.map +1 -0
  112. package/dist/cdp-types.js +91 -0
  113. package/dist/cdp-types.js.map +1 -0
  114. package/dist/channel-owner-inspect.test.d.ts +2 -0
  115. package/dist/channel-owner-inspect.test.d.ts.map +1 -0
  116. package/dist/channel-owner-inspect.test.js +75 -0
  117. package/dist/channel-owner-inspect.test.js.map +1 -0
  118. package/dist/chrome-discovery.d.ts +65 -0
  119. package/dist/chrome-discovery.d.ts.map +1 -0
  120. package/dist/chrome-discovery.js +173 -0
  121. package/dist/chrome-discovery.js.map +1 -0
  122. package/dist/chrome-discovery.test.d.ts +2 -0
  123. package/dist/chrome-discovery.test.d.ts.map +1 -0
  124. package/dist/chrome-discovery.test.js +41 -0
  125. package/dist/chrome-discovery.test.js.map +1 -0
  126. package/dist/clean-html.d.ts +11 -0
  127. package/dist/clean-html.d.ts.map +1 -0
  128. package/dist/clean-html.js +106 -0
  129. package/dist/clean-html.js.map +1 -0
  130. package/dist/cli-help.test.d.ts +2 -0
  131. package/dist/cli-help.test.d.ts.map +1 -0
  132. package/dist/cli-help.test.js +98 -0
  133. package/dist/cli-help.test.js.map +1 -0
  134. package/dist/cli.d.ts +3 -0
  135. package/dist/cli.d.ts.map +1 -0
  136. package/dist/cli.js +2709 -0
  137. package/dist/cli.js.map +1 -0
  138. package/dist/cloud-client.d.ts +56 -0
  139. package/dist/cloud-client.d.ts.map +1 -0
  140. package/dist/cloud-client.js +127 -0
  141. package/dist/cloud-client.js.map +1 -0
  142. package/dist/create-logger.d.ts +9 -0
  143. package/dist/create-logger.d.ts.map +1 -0
  144. package/dist/create-logger.js +27 -0
  145. package/dist/create-logger.js.map +1 -0
  146. package/dist/debugger-api.md +458 -0
  147. package/dist/debugger-examples-types.d.ts +24 -0
  148. package/dist/debugger-examples-types.d.ts.map +1 -0
  149. package/dist/debugger-examples-types.js +2 -0
  150. package/dist/debugger-examples-types.js.map +1 -0
  151. package/dist/debugger-examples.d.ts +6 -0
  152. package/dist/debugger-examples.d.ts.map +1 -0
  153. package/dist/debugger-examples.js +53 -0
  154. package/dist/debugger-examples.js.map +1 -0
  155. package/dist/debugger.d.ts +381 -0
  156. package/dist/debugger.d.ts.map +1 -0
  157. package/dist/debugger.js +630 -0
  158. package/dist/debugger.js.map +1 -0
  159. package/dist/diff-utils.d.ts +20 -0
  160. package/dist/diff-utils.d.ts.map +1 -0
  161. package/dist/diff-utils.js +50 -0
  162. package/dist/diff-utils.js.map +1 -0
  163. package/dist/diff-utils.test.d.ts +2 -0
  164. package/dist/diff-utils.test.d.ts.map +1 -0
  165. package/dist/diff-utils.test.js +137 -0
  166. package/dist/diff-utils.test.js.map +1 -0
  167. package/dist/doctor.d.ts +44 -0
  168. package/dist/doctor.d.ts.map +1 -0
  169. package/dist/doctor.js +246 -0
  170. package/dist/doctor.js.map +1 -0
  171. package/dist/doctor.test.d.ts +2 -0
  172. package/dist/doctor.test.d.ts.map +1 -0
  173. package/dist/doctor.test.js +208 -0
  174. package/dist/doctor.test.js.map +1 -0
  175. package/dist/editor-api.md +374 -0
  176. package/dist/editor-examples.d.ts +11 -0
  177. package/dist/editor-examples.d.ts.map +1 -0
  178. package/dist/editor-examples.js +124 -0
  179. package/dist/editor-examples.js.map +1 -0
  180. package/dist/editor.d.ts +203 -0
  181. package/dist/editor.d.ts.map +1 -0
  182. package/dist/editor.js +363 -0
  183. package/dist/editor.js.map +1 -0
  184. package/dist/env-compat.d.ts +2 -0
  185. package/dist/env-compat.d.ts.map +1 -0
  186. package/dist/env-compat.js +27 -0
  187. package/dist/env-compat.js.map +1 -0
  188. package/dist/executor.d.ts +229 -0
  189. package/dist/executor.d.ts.map +1 -0
  190. package/dist/executor.js +1465 -0
  191. package/dist/executor.js.map +1 -0
  192. package/dist/executor.unit.test.d.ts +2 -0
  193. package/dist/executor.unit.test.d.ts.map +1 -0
  194. package/dist/executor.unit.test.js +143 -0
  195. package/dist/executor.unit.test.js.map +1 -0
  196. package/dist/extension/_locales/en/messages.json +278 -0
  197. package/dist/extension/_locales/zh_CN/messages.json +256 -0
  198. package/dist/extension/assets/options-CYH96Lcx.css +1349 -0
  199. package/dist/extension/background.js +3994 -0
  200. package/dist/extension/icons/SolarCursorSquareBold.png +0 -0
  201. package/dist/extension/icons/icon-black-128.png +0 -0
  202. package/dist/extension/icons/icon-black-16.png +0 -0
  203. package/dist/extension/icons/icon-black-32.png +0 -0
  204. package/dist/extension/icons/icon-black-48.png +0 -0
  205. package/dist/extension/icons/icon-gray-128.png +0 -0
  206. package/dist/extension/icons/icon-gray-16.png +0 -0
  207. package/dist/extension/icons/icon-gray-32.png +0 -0
  208. package/dist/extension/icons/icon-gray-48.png +0 -0
  209. package/dist/extension/icons/icon-green-128.png +0 -0
  210. package/dist/extension/icons/icon-green-16.png +0 -0
  211. package/dist/extension/icons/icon-green-32.png +0 -0
  212. package/dist/extension/icons/icon-green-48.png +0 -0
  213. package/dist/extension/icons/tabwright-icon-black.png +0 -0
  214. package/dist/extension/icons/tabwright-icon-gray-disabled.png +0 -0
  215. package/dist/extension/icons/tabwright-icon-gray-disabled.svg +1 -0
  216. package/dist/extension/manifest.json +54 -0
  217. package/dist/extension/options.js +16145 -0
  218. package/dist/extension/rrweb-recorder.js +12952 -0
  219. package/dist/extension/src/options.html +165 -0
  220. package/dist/extension/src/prism-bash.min.js +1 -0
  221. package/dist/extension/src/prism.min.js +1 -0
  222. package/dist/extension/src/welcome.html +396 -0
  223. package/dist/extension-connection.test.d.ts +2 -0
  224. package/dist/extension-connection.test.d.ts.map +1 -0
  225. package/dist/extension-connection.test.js +708 -0
  226. package/dist/extension-connection.test.js.map +1 -0
  227. package/dist/extension-icon-warning.test.d.ts +2 -0
  228. package/dist/extension-icon-warning.test.d.ts.map +1 -0
  229. package/dist/extension-icon-warning.test.js +33 -0
  230. package/dist/extension-icon-warning.test.js.map +1 -0
  231. package/dist/ghost-browser.d.ts +62 -0
  232. package/dist/ghost-browser.d.ts.map +1 -0
  233. package/dist/ghost-browser.js +107 -0
  234. package/dist/ghost-browser.js.map +1 -0
  235. package/dist/ghost-cursor-client.js +374 -0
  236. package/dist/ghost-cursor-controller.d.ts +46 -0
  237. package/dist/ghost-cursor-controller.d.ts.map +1 -0
  238. package/dist/ghost-cursor-controller.js +98 -0
  239. package/dist/ghost-cursor-controller.js.map +1 -0
  240. package/dist/ghost-cursor.d.ts +27 -0
  241. package/dist/ghost-cursor.d.ts.map +1 -0
  242. package/dist/ghost-cursor.js +79 -0
  243. package/dist/ghost-cursor.js.map +1 -0
  244. package/dist/htmlrewrite.d.ts +8 -0
  245. package/dist/htmlrewrite.d.ts.map +1 -0
  246. package/dist/htmlrewrite.js +339 -0
  247. package/dist/htmlrewrite.js.map +1 -0
  248. package/dist/htmlrewrite.test.d.ts +2 -0
  249. package/dist/htmlrewrite.test.d.ts.map +1 -0
  250. package/dist/htmlrewrite.test.js +7975 -0
  251. package/dist/htmlrewrite.test.js.map +1 -0
  252. package/dist/index.d.ts +20 -0
  253. package/dist/index.d.ts.map +1 -0
  254. package/dist/index.js +11 -0
  255. package/dist/index.js.map +1 -0
  256. package/dist/kill-port.d.ts +29 -0
  257. package/dist/kill-port.d.ts.map +1 -0
  258. package/dist/kill-port.js +190 -0
  259. package/dist/kill-port.js.map +1 -0
  260. package/dist/kitty-graphics.d.ts +22 -0
  261. package/dist/kitty-graphics.d.ts.map +1 -0
  262. package/dist/kitty-graphics.js +71 -0
  263. package/dist/kitty-graphics.js.map +1 -0
  264. package/dist/kitty-graphics.test.d.ts +2 -0
  265. package/dist/kitty-graphics.test.d.ts.map +1 -0
  266. package/dist/kitty-graphics.test.js +125 -0
  267. package/dist/kitty-graphics.test.js.map +1 -0
  268. package/dist/locator-selector.test.d.ts +2 -0
  269. package/dist/locator-selector.test.d.ts.map +1 -0
  270. package/dist/locator-selector.test.js +98 -0
  271. package/dist/locator-selector.test.js.map +1 -0
  272. package/dist/mcp-client.d.ts +20 -0
  273. package/dist/mcp-client.d.ts.map +1 -0
  274. package/dist/mcp-client.js +56 -0
  275. package/dist/mcp-client.js.map +1 -0
  276. package/dist/mcp.d.ts +6 -0
  277. package/dist/mcp.d.ts.map +1 -0
  278. package/dist/mcp.js +511 -0
  279. package/dist/mcp.js.map +1 -0
  280. package/dist/on-mouse-action.test.d.ts +2 -0
  281. package/dist/on-mouse-action.test.d.ts.map +1 -0
  282. package/dist/on-mouse-action.test.js +180 -0
  283. package/dist/on-mouse-action.test.js.map +1 -0
  284. package/dist/options-page.test.d.ts +2 -0
  285. package/dist/options-page.test.d.ts.map +1 -0
  286. package/dist/options-page.test.js +773 -0
  287. package/dist/options-page.test.js.map +1 -0
  288. package/dist/package-paths.d.ts +4 -0
  289. package/dist/package-paths.d.ts.map +1 -0
  290. package/dist/package-paths.js +30 -0
  291. package/dist/package-paths.js.map +1 -0
  292. package/dist/page-markdown.d.ts +40 -0
  293. package/dist/page-markdown.d.ts.map +1 -0
  294. package/dist/page-markdown.js +181 -0
  295. package/dist/page-markdown.js.map +1 -0
  296. package/dist/performance-examples.d.ts +5 -0
  297. package/dist/performance-examples.d.ts.map +1 -0
  298. package/dist/performance-examples.js +112 -0
  299. package/dist/performance-examples.js.map +1 -0
  300. package/dist/performance-profiling.md +417 -0
  301. package/dist/playwright-import.d.ts +19 -0
  302. package/dist/playwright-import.d.ts.map +1 -0
  303. package/dist/playwright-import.js +40 -0
  304. package/dist/playwright-import.js.map +1 -0
  305. package/dist/popup-relocation.test.d.ts +7 -0
  306. package/dist/popup-relocation.test.d.ts.map +1 -0
  307. package/dist/popup-relocation.test.js +139 -0
  308. package/dist/popup-relocation.test.js.map +1 -0
  309. package/dist/product-paths.d.ts +9 -0
  310. package/dist/product-paths.d.ts.map +1 -0
  311. package/dist/product-paths.js +24 -0
  312. package/dist/product-paths.js.map +1 -0
  313. package/dist/product-paths.test.d.ts +2 -0
  314. package/dist/product-paths.test.d.ts.map +1 -0
  315. package/dist/product-paths.test.js +39 -0
  316. package/dist/product-paths.test.js.map +1 -0
  317. package/dist/prompt.md +1004 -0
  318. package/dist/protocol.d.ts +248 -0
  319. package/dist/protocol.d.ts.map +1 -0
  320. package/dist/protocol.js +59 -0
  321. package/dist/protocol.js.map +1 -0
  322. package/dist/protocol.test.d.ts +2 -0
  323. package/dist/protocol.test.d.ts.map +1 -0
  324. package/dist/protocol.test.js +31 -0
  325. package/dist/protocol.test.js.map +1 -0
  326. package/dist/react-source.d.ts +57 -0
  327. package/dist/react-source.d.ts.map +1 -0
  328. package/dist/react-source.js +254 -0
  329. package/dist/react-source.js.map +1 -0
  330. package/dist/readability.js +1674 -0
  331. package/dist/relay-client.d.ts +104 -0
  332. package/dist/relay-client.d.ts.map +1 -0
  333. package/dist/relay-client.js +426 -0
  334. package/dist/relay-client.js.map +1 -0
  335. package/dist/relay-client.test.d.ts +2 -0
  336. package/dist/relay-client.test.d.ts.map +1 -0
  337. package/dist/relay-client.test.js +305 -0
  338. package/dist/relay-client.test.js.map +1 -0
  339. package/dist/relay-core.test.d.ts +2 -0
  340. package/dist/relay-core.test.d.ts.map +1 -0
  341. package/dist/relay-core.test.js +1427 -0
  342. package/dist/relay-core.test.js.map +1 -0
  343. package/dist/relay-navigation.test.d.ts +2 -0
  344. package/dist/relay-navigation.test.d.ts.map +1 -0
  345. package/dist/relay-navigation.test.js +661 -0
  346. package/dist/relay-navigation.test.js.map +1 -0
  347. package/dist/relay-session.test.d.ts +2 -0
  348. package/dist/relay-session.test.d.ts.map +1 -0
  349. package/dist/relay-session.test.js +1121 -0
  350. package/dist/relay-session.test.js.map +1 -0
  351. package/dist/relay-state.d.ts +178 -0
  352. package/dist/relay-state.d.ts.map +1 -0
  353. package/dist/relay-state.js +346 -0
  354. package/dist/relay-state.js.map +1 -0
  355. package/dist/relay-state.test.d.ts +2 -0
  356. package/dist/relay-state.test.d.ts.map +1 -0
  357. package/dist/relay-state.test.js +594 -0
  358. package/dist/relay-state.test.js.map +1 -0
  359. package/dist/replay-ai-index.d.ts +99 -0
  360. package/dist/replay-ai-index.d.ts.map +1 -0
  361. package/dist/replay-ai-index.js +677 -0
  362. package/dist/replay-ai-index.js.map +1 -0
  363. package/dist/replay-ai-index.test.d.ts +2 -0
  364. package/dist/replay-ai-index.test.d.ts.map +1 -0
  365. package/dist/replay-ai-index.test.js +255 -0
  366. package/dist/replay-ai-index.test.js.map +1 -0
  367. package/dist/replay-cli.test.d.ts +2 -0
  368. package/dist/replay-cli.test.d.ts.map +1 -0
  369. package/dist/replay-cli.test.js +275 -0
  370. package/dist/replay-cli.test.js.map +1 -0
  371. package/dist/replay-eval.d.ts +44 -0
  372. package/dist/replay-eval.d.ts.map +1 -0
  373. package/dist/replay-eval.js +902 -0
  374. package/dist/replay-eval.js.map +1 -0
  375. package/dist/replay-handoff.d.ts +29 -0
  376. package/dist/replay-handoff.d.ts.map +1 -0
  377. package/dist/replay-handoff.js +83 -0
  378. package/dist/replay-handoff.js.map +1 -0
  379. package/dist/replay-handoff.test.d.ts +2 -0
  380. package/dist/replay-handoff.test.d.ts.map +1 -0
  381. package/dist/replay-handoff.test.js +123 -0
  382. package/dist/replay-handoff.test.js.map +1 -0
  383. package/dist/replay-workflow-compiler.d.ts +44 -0
  384. package/dist/replay-workflow-compiler.d.ts.map +1 -0
  385. package/dist/replay-workflow-compiler.js +601 -0
  386. package/dist/replay-workflow-compiler.js.map +1 -0
  387. package/dist/replay-workflow-compiler.test.d.ts +2 -0
  388. package/dist/replay-workflow-compiler.test.d.ts.map +1 -0
  389. package/dist/replay-workflow-compiler.test.js +223 -0
  390. package/dist/replay-workflow-compiler.test.js.map +1 -0
  391. package/dist/rrweb-recording-relay.d.ts +56 -0
  392. package/dist/rrweb-recording-relay.d.ts.map +1 -0
  393. package/dist/rrweb-recording-relay.js +299 -0
  394. package/dist/rrweb-recording-relay.js.map +1 -0
  395. package/dist/rrweb-recording-relay.test.d.ts +2 -0
  396. package/dist/rrweb-recording-relay.test.d.ts.map +1 -0
  397. package/dist/rrweb-recording-relay.test.js +85 -0
  398. package/dist/rrweb-recording-relay.test.js.map +1 -0
  399. package/dist/rrweb-recording.d.ts +104 -0
  400. package/dist/rrweb-recording.d.ts.map +1 -0
  401. package/dist/rrweb-recording.js +180 -0
  402. package/dist/rrweb-recording.js.map +1 -0
  403. package/dist/scoped-fs.d.ts +95 -0
  404. package/dist/scoped-fs.d.ts.map +1 -0
  405. package/dist/scoped-fs.js +358 -0
  406. package/dist/scoped-fs.js.map +1 -0
  407. package/dist/scoped-fs.test.d.ts +5 -0
  408. package/dist/scoped-fs.test.d.ts.map +1 -0
  409. package/dist/scoped-fs.test.js +73 -0
  410. package/dist/scoped-fs.test.js.map +1 -0
  411. package/dist/selector-generator.js +7378 -0
  412. package/dist/skill-stub.test.d.ts +2 -0
  413. package/dist/skill-stub.test.d.ts.map +1 -0
  414. package/dist/skill-stub.test.js +22 -0
  415. package/dist/skill-stub.test.js.map +1 -0
  416. package/dist/snapshot-tools.test.d.ts +2 -0
  417. package/dist/snapshot-tools.test.d.ts.map +1 -0
  418. package/dist/snapshot-tools.test.js +856 -0
  419. package/dist/snapshot-tools.test.js.map +1 -0
  420. package/dist/start-relay-server.d.ts +6 -0
  421. package/dist/start-relay-server.d.ts.map +1 -0
  422. package/dist/start-relay-server.js +57 -0
  423. package/dist/start-relay-server.js.map +1 -0
  424. package/dist/styles-api.md +124 -0
  425. package/dist/styles-examples.d.ts +8 -0
  426. package/dist/styles-examples.d.ts.map +1 -0
  427. package/dist/styles-examples.js +64 -0
  428. package/dist/styles-examples.js.map +1 -0
  429. package/dist/styles.d.ts +27 -0
  430. package/dist/styles.d.ts.map +1 -0
  431. package/dist/styles.js +231 -0
  432. package/dist/styles.js.map +1 -0
  433. package/dist/tabwright-agent-skill.d.ts +30 -0
  434. package/dist/tabwright-agent-skill.d.ts.map +1 -0
  435. package/dist/tabwright-agent-skill.js +74 -0
  436. package/dist/tabwright-agent-skill.js.map +1 -0
  437. package/dist/tabwright-agent-skill.test.d.ts +2 -0
  438. package/dist/tabwright-agent-skill.test.d.ts.map +1 -0
  439. package/dist/tabwright-agent-skill.test.js +51 -0
  440. package/dist/tabwright-agent-skill.test.js.map +1 -0
  441. package/dist/test-declarations.d.ts +13 -0
  442. package/dist/test-declarations.d.ts.map +1 -0
  443. package/dist/test-declarations.js +2 -0
  444. package/dist/test-declarations.js.map +1 -0
  445. package/dist/test-utils.d.ts +69 -0
  446. package/dist/test-utils.d.ts.map +1 -0
  447. package/dist/test-utils.js +448 -0
  448. package/dist/test-utils.js.map +1 -0
  449. package/dist/test-utils.test.d.ts +2 -0
  450. package/dist/test-utils.test.d.ts.map +1 -0
  451. package/dist/test-utils.test.js +55 -0
  452. package/dist/test-utils.test.js.map +1 -0
  453. package/dist/utils.d.ts +26 -0
  454. package/dist/utils.d.ts.map +1 -0
  455. package/dist/utils.js +60 -0
  456. package/dist/utils.js.map +1 -0
  457. package/dist/wait-for-page-load.d.ts +16 -0
  458. package/dist/wait-for-page-load.d.ts.map +1 -0
  459. package/dist/wait-for-page-load.js +146 -0
  460. package/dist/wait-for-page-load.js.map +1 -0
  461. package/dist/workflow-capability.d.ts +72 -0
  462. package/dist/workflow-capability.d.ts.map +1 -0
  463. package/dist/workflow-capability.js +316 -0
  464. package/dist/workflow-capability.js.map +1 -0
  465. package/dist/workflow-script-flow.test.d.ts +2 -0
  466. package/dist/workflow-script-flow.test.d.ts.map +1 -0
  467. package/dist/workflow-script-flow.test.js +285 -0
  468. package/dist/workflow-script-flow.test.js.map +1 -0
  469. package/package.json +80 -0
  470. package/src/__snapshots__/x.com.processed.html +1003 -0
  471. package/src/__snapshots__/x.com.processed.withStyles.html +2720 -0
  472. package/src/a11y-client.ts +241 -0
  473. package/src/agent-skills/conan-config/SKILL.md +141 -0
  474. package/src/agent-skills/conan-config/agents/openai.yaml +4 -0
  475. package/src/aria-snapshot.test.ts +311 -0
  476. package/src/aria-snapshot.ts +1681 -0
  477. package/src/aria-snapshot.unit.test.ts +615 -0
  478. package/src/aria-snapshots/github-interactive.txt +193 -0
  479. package/src/aria-snapshots/github-raw.txt +309 -0
  480. package/src/aria-snapshots/hackernews-interactive.txt +477 -0
  481. package/src/aria-snapshots/hackernews-raw.txt +428 -0
  482. package/src/aria-snapshots/prosemirror-interactive.txt +66 -0
  483. package/src/aria-snapshots/prosemirror-raw.txt +145 -0
  484. package/src/assets/aria-labels-hacker-news.png +0 -0
  485. package/src/assets/aria-labels-old-reddit.png +0 -0
  486. package/src/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.ts +5 -0
  487. package/src/assets/cursors/screen-studio/pointer-macos-tahoe.svg +18 -0
  488. package/src/assets/x.com.html +32946 -0
  489. package/src/browser-config.ts +179 -0
  490. package/src/browser-install.ts +284 -0
  491. package/src/browser-launch.ts +75 -0
  492. package/src/builtin-capabilities.ts +2765 -0
  493. package/src/capability-agent-skill.ts +305 -0
  494. package/src/capability-auth-state.ts +197 -0
  495. package/src/capability-auth.ts +249 -0
  496. package/src/capability-cli-confirmation.test.ts +90 -0
  497. package/src/capability-options.test.ts +89 -0
  498. package/src/capability-options.ts +57 -0
  499. package/src/capability-package.test.ts +204 -0
  500. package/src/capability-package.ts +555 -0
  501. package/src/capability-registry.test.ts +1905 -0
  502. package/src/capability-registry.ts +1234 -0
  503. package/src/capability-runner.ts +801 -0
  504. package/src/capability-search-relevance.test.ts +73 -0
  505. package/src/capability-studio.test.ts +45 -0
  506. package/src/capability-studio.ts +641 -0
  507. package/src/cdp-log.test.ts +131 -0
  508. package/src/cdp-log.ts +112 -0
  509. package/src/cdp-relay.ts +2944 -0
  510. package/src/cdp-session.ts +77 -0
  511. package/src/cdp-types.ts +158 -0
  512. package/src/channel-owner-inspect.test.ts +94 -0
  513. package/src/chrome-discovery.test.ts +50 -0
  514. package/src/chrome-discovery.ts +220 -0
  515. package/src/clean-html.ts +141 -0
  516. package/src/cli-help.test.ts +123 -0
  517. package/src/cli.ts +3181 -0
  518. package/src/cloud-client.ts +179 -0
  519. package/src/create-logger.ts +38 -0
  520. package/src/debugger-examples-types.ts +16 -0
  521. package/src/debugger-examples.ts +66 -0
  522. package/src/debugger.ts +708 -0
  523. package/src/diff-utils.test.ts +152 -0
  524. package/src/diff-utils.ts +70 -0
  525. package/src/doctor.test.ts +244 -0
  526. package/src/doctor.ts +321 -0
  527. package/src/editor-examples.ts +158 -0
  528. package/src/editor.ts +426 -0
  529. package/src/env-compat.ts +28 -0
  530. package/src/executor.ts +1824 -0
  531. package/src/executor.unit.test.ts +168 -0
  532. package/src/extension-connection.test.ts +855 -0
  533. package/src/extension-icon-warning.test.ts +45 -0
  534. package/src/ghost-browser.ts +149 -0
  535. package/src/ghost-cursor-client.ts +494 -0
  536. package/src/ghost-cursor-controller.ts +129 -0
  537. package/src/ghost-cursor.ts +123 -0
  538. package/src/htmlrewrite.test.ts +8008 -0
  539. package/src/htmlrewrite.ts +390 -0
  540. package/src/index.ts +53 -0
  541. package/src/kill-port.ts +219 -0
  542. package/src/kitty-graphics.test.ts +139 -0
  543. package/src/kitty-graphics.ts +79 -0
  544. package/src/locator-selector.test.ts +119 -0
  545. package/src/mcp-client.ts +78 -0
  546. package/src/mcp.ts +629 -0
  547. package/src/on-mouse-action.test.ts +226 -0
  548. package/src/options-page.test.ts +839 -0
  549. package/src/package-paths.ts +38 -0
  550. package/src/page-markdown.ts +240 -0
  551. package/src/performance-examples.ts +186 -0
  552. package/src/playwright-import.ts +59 -0
  553. package/src/popup-relocation.test.ts +163 -0
  554. package/src/product-paths.test.ts +47 -0
  555. package/src/product-paths.ts +28 -0
  556. package/src/protocol.test.ts +52 -0
  557. package/src/protocol.ts +351 -0
  558. package/src/react-source.ts +379 -0
  559. package/src/relay-client.test.ts +375 -0
  560. package/src/relay-client.ts +572 -0
  561. package/src/relay-core.test.ts +1603 -0
  562. package/src/relay-navigation.test.ts +790 -0
  563. package/src/relay-session.test.ts +1375 -0
  564. package/src/relay-state.test.ts +729 -0
  565. package/src/relay-state.ts +561 -0
  566. package/src/replay-ai-index.test.ts +278 -0
  567. package/src/replay-ai-index.ts +872 -0
  568. package/src/replay-cli.test.ts +325 -0
  569. package/src/replay-eval.ts +1039 -0
  570. package/src/replay-handoff.test.ts +163 -0
  571. package/src/replay-handoff.ts +109 -0
  572. package/src/replay-workflow-compiler.test.ts +250 -0
  573. package/src/replay-workflow-compiler.ts +700 -0
  574. package/src/resource.md +409 -0
  575. package/src/rrweb-recording-relay.test.ts +99 -0
  576. package/src/rrweb-recording-relay.ts +400 -0
  577. package/src/rrweb-recording.ts +322 -0
  578. package/src/scoped-fs.test.ts +80 -0
  579. package/src/scoped-fs.ts +420 -0
  580. package/src/skill-stub.test.ts +24 -0
  581. package/src/skill.md +1413 -0
  582. package/src/snapshot-tools.test.ts +1017 -0
  583. package/src/snapshots/hacker-news-accessibility-full.md +81 -0
  584. package/src/snapshots/hacker-news-accessibility-interactive.md +43 -0
  585. package/src/snapshots/page-markdown-output.txt +16 -0
  586. package/src/snapshots/shadcn-ui-accessibility-full.md +201 -0
  587. package/src/snapshots/shadcn-ui-accessibility-interactive.md +109 -0
  588. package/src/start-relay-server.ts +69 -0
  589. package/src/styles-examples.ts +84 -0
  590. package/src/styles.ts +343 -0
  591. package/src/tabwright-agent-skill.test.ts +61 -0
  592. package/src/tabwright-agent-skill.ts +105 -0
  593. package/src/test-declarations.ts +13 -0
  594. package/src/test-utils.test.ts +70 -0
  595. package/src/test-utils.ts +566 -0
  596. package/src/utils.ts +78 -0
  597. package/src/wait-for-page-load.ts +198 -0
  598. package/src/workflow-capability.ts +417 -0
  599. package/src/workflow-script-flow.test.ts +388 -0
@@ -0,0 +1,677 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { getTabwrightUserDataDir } from './product-paths.js';
4
+ import { getSavedRrwebRecordingWithEvents } from './rrweb-recording-relay.js';
5
+ const MAX_AI_ACTIONS = 200;
6
+ const MAX_INTERACTIVE_ELEMENTS = 120;
7
+ const MAX_PAGE_TEXTS = 160;
8
+ function getReplayAiIndexesDir() {
9
+ return path.join(getTabwrightUserDataDir(), 'replay-ai-indexes');
10
+ }
11
+ function getReplayAiIndexesIndexPath() {
12
+ return path.join(getReplayAiIndexesDir(), 'index.json');
13
+ }
14
+ function getReplayAiIndexPath(replayId) {
15
+ return path.join(getReplayAiIndexesDir(), `${replayId}.json`);
16
+ }
17
+ function isRecord(value) {
18
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
19
+ }
20
+ function optionalString(value) {
21
+ return typeof value === 'string' && value.trim() ? value : undefined;
22
+ }
23
+ function numberValue(value) {
24
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
25
+ }
26
+ function stringArrayValue(value) {
27
+ if (!Array.isArray(value)) {
28
+ return [];
29
+ }
30
+ return value.filter((item) => {
31
+ return typeof item === 'string' && item.length > 0;
32
+ });
33
+ }
34
+ function normalizeText(value) {
35
+ return (value || '').replace(/\s+/g, ' ').trim();
36
+ }
37
+ function uniqueStrings(values) {
38
+ return Array.from(new Set(values.filter((value) => {
39
+ return value.length > 0;
40
+ })));
41
+ }
42
+ function recordToStringMap(value) {
43
+ if (!isRecord(value)) {
44
+ return {};
45
+ }
46
+ return Object.fromEntries(Object.entries(value)
47
+ .map(([key, item]) => {
48
+ if (typeof item === 'string') {
49
+ return [key, item];
50
+ }
51
+ if (typeof item === 'number' || typeof item === 'boolean') {
52
+ return [key, String(item)];
53
+ }
54
+ if (isRecord(item)) {
55
+ return [key, JSON.stringify(item)];
56
+ }
57
+ return null;
58
+ })
59
+ .filter((entry) => {
60
+ return Boolean(entry);
61
+ }));
62
+ }
63
+ function getEventType(event) {
64
+ return numberValue(event.type);
65
+ }
66
+ function getEventTimestamp(event) {
67
+ return numberValue(event.timestamp);
68
+ }
69
+ function getEventData(event) {
70
+ return isRecord(event.data) ? event.data : {};
71
+ }
72
+ function getNodeId(value) {
73
+ return numberValue(isRecord(value) ? value.id : undefined);
74
+ }
75
+ function readReplayNode(rawNode, parentId) {
76
+ if (!isRecord(rawNode)) {
77
+ return null;
78
+ }
79
+ const id = numberValue(rawNode.id);
80
+ const rawType = numberValue(rawNode.type);
81
+ if (!id || rawType === undefined || ![0, 1, 2, 3, 4, 5].includes(rawType)) {
82
+ return null;
83
+ }
84
+ const type = rawType;
85
+ const childNodes = Array.isArray(rawNode.childNodes) ? rawNode.childNodes : [];
86
+ return {
87
+ id,
88
+ type,
89
+ tagName: optionalString(rawNode.tagName)?.toLowerCase(),
90
+ textContent: optionalString(rawNode.textContent),
91
+ attributes: recordToStringMap(rawNode.attributes),
92
+ childIds: childNodes
93
+ .map((child) => {
94
+ return getNodeId(child);
95
+ })
96
+ .filter((nodeId) => {
97
+ return nodeId !== undefined;
98
+ }),
99
+ parentId,
100
+ };
101
+ }
102
+ function addReplayNode(state, rawNode, parentId) {
103
+ const node = readReplayNode(rawNode, parentId);
104
+ const childNodes = isRecord(rawNode) && Array.isArray(rawNode.childNodes) ? rawNode.childNodes : [];
105
+ if (!node && childNodes.length === 0) {
106
+ return;
107
+ }
108
+ if (!node) {
109
+ childNodes.forEach((child) => {
110
+ addReplayNode(state, child, parentId);
111
+ });
112
+ return;
113
+ }
114
+ state.nodes.set(node.id, node);
115
+ childNodes.forEach((child) => {
116
+ addReplayNode(state, child, node.id);
117
+ });
118
+ }
119
+ function removeReplayNode(state, nodeId) {
120
+ const node = state.nodes.get(nodeId);
121
+ if (!node) {
122
+ return;
123
+ }
124
+ node.childIds.forEach((childId) => {
125
+ removeReplayNode(state, childId);
126
+ });
127
+ state.nodes.delete(nodeId);
128
+ }
129
+ function applyMutationEvent(state, data) {
130
+ const removes = Array.isArray(data.removes) ? data.removes : [];
131
+ removes
132
+ .map((remove) => {
133
+ return isRecord(remove) ? numberValue(remove.id) : undefined;
134
+ })
135
+ .filter((nodeId) => {
136
+ return nodeId !== undefined;
137
+ })
138
+ .forEach((nodeId) => {
139
+ removeReplayNode(state, nodeId);
140
+ });
141
+ const adds = Array.isArray(data.adds) ? data.adds : [];
142
+ adds.forEach((add) => {
143
+ if (!isRecord(add)) {
144
+ return;
145
+ }
146
+ addReplayNode(state, add.node, numberValue(add.parentId));
147
+ });
148
+ const texts = Array.isArray(data.texts) ? data.texts : [];
149
+ texts.forEach((text) => {
150
+ if (!isRecord(text)) {
151
+ return;
152
+ }
153
+ const nodeId = numberValue(text.id);
154
+ const node = nodeId === undefined ? undefined : state.nodes.get(nodeId);
155
+ if (!node) {
156
+ return;
157
+ }
158
+ node.textContent = optionalString(text.value) || '';
159
+ });
160
+ const attributes = Array.isArray(data.attributes) ? data.attributes : [];
161
+ attributes.forEach((attribute) => {
162
+ if (!isRecord(attribute)) {
163
+ return;
164
+ }
165
+ const nodeId = numberValue(attribute.id);
166
+ const node = nodeId === undefined ? undefined : state.nodes.get(nodeId);
167
+ if (!node) {
168
+ return;
169
+ }
170
+ node.attributes = {
171
+ ...node.attributes,
172
+ ...recordToStringMap(attribute.attributes),
173
+ };
174
+ });
175
+ }
176
+ function isNoisyText(value) {
177
+ return /to pick up a draggable item/i.test(value) || value === 'SCRIPT_PLACEHOLDER';
178
+ }
179
+ function nodeText(state, nodeId, depth = 0) {
180
+ const node = state.nodes.get(nodeId);
181
+ if (!node || depth > 20) {
182
+ return '';
183
+ }
184
+ const childText = node.childIds
185
+ .map((childId) => {
186
+ return nodeText(state, childId, depth + 1);
187
+ })
188
+ .filter((text) => {
189
+ return text.length > 0;
190
+ })
191
+ .join(' ');
192
+ return normalizeText([node.textContent, childText].filter(Boolean).join(' '));
193
+ }
194
+ function nodeAndAncestors(state, nodeId, maxDepth) {
195
+ const current = state.nodes.get(nodeId);
196
+ if (!current) {
197
+ return [];
198
+ }
199
+ const ancestors = [current];
200
+ let next = current.parentId === undefined ? undefined : state.nodes.get(current.parentId);
201
+ let depth = 1;
202
+ while (next && depth < maxDepth) {
203
+ ancestors.push(next);
204
+ next = next.parentId === undefined ? undefined : state.nodes.get(next.parentId);
205
+ depth += 1;
206
+ }
207
+ return ancestors;
208
+ }
209
+ function actionLabelFromText(value) {
210
+ const text = normalizeText(value);
211
+ if (!text || text.length > 120 || isNoisyText(text)) {
212
+ return undefined;
213
+ }
214
+ const matchers = [
215
+ { label: '重新编辑', pattern: /重新编辑/ },
216
+ { label: '继续编辑', pattern: /继续编辑/ },
217
+ { label: 'Add entry', pattern: /add entry/i },
218
+ { label: '新增', pattern: /新增|添加/ },
219
+ { label: '提交', pattern: /提交|submit/i },
220
+ { label: 'OK', pattern: /\bOK\b|确定/ },
221
+ { label: 'Cancel', pattern: /cancel|取消/i },
222
+ { label: '编辑', pattern: /编辑/ },
223
+ ];
224
+ return matchers.find((matcher) => {
225
+ return matcher.pattern.test(text);
226
+ })?.label;
227
+ }
228
+ function nodeLabelFromStructure(state, nodeId) {
229
+ const ancestors = nodeAndAncestors(state, nodeId, 8);
230
+ const classText = ancestors
231
+ .map((node) => {
232
+ return node.attributes.class || '';
233
+ })
234
+ .join(' ');
235
+ const inModal = classText.includes('designer-modal');
236
+ if (classText.includes('designer-formily-array-base-addition')) {
237
+ return 'Add entry';
238
+ }
239
+ if (inModal && classText.includes('designer-btn-dangerous')) {
240
+ return '重新编辑';
241
+ }
242
+ if (inModal && classText.includes('designer-btn-primary')) {
243
+ return 'OK';
244
+ }
245
+ return undefined;
246
+ }
247
+ function nodeLabelFromAttributes(node) {
248
+ return (optionalString(node.attributes['aria-label']) ||
249
+ optionalString(node.attributes.title) ||
250
+ optionalString(node.attributes.placeholder) ||
251
+ optionalString(node.attributes.name));
252
+ }
253
+ function nodeLabel(state, nodeId) {
254
+ const structuredLabel = nodeLabelFromStructure(state, nodeId);
255
+ if (structuredLabel) {
256
+ return structuredLabel;
257
+ }
258
+ const current = state.nodes.get(nodeId);
259
+ const currentAttributeLabel = current ? nodeLabelFromAttributes(current) : undefined;
260
+ if (currentAttributeLabel) {
261
+ return currentAttributeLabel;
262
+ }
263
+ const candidates = nodeAndAncestors(state, nodeId, 8)
264
+ .flatMap((node) => {
265
+ return [nodeLabelFromAttributes(node), nodeText(state, node.id)];
266
+ })
267
+ .filter((text) => {
268
+ return Boolean(text);
269
+ });
270
+ const actionLabel = candidates
271
+ .map((text) => {
272
+ return actionLabelFromText(text);
273
+ })
274
+ .find((label) => {
275
+ return Boolean(label);
276
+ });
277
+ if (actionLabel) {
278
+ return actionLabel;
279
+ }
280
+ return candidates.find((text) => {
281
+ return text.length <= 120 && !isNoisyText(text);
282
+ });
283
+ }
284
+ function attrSelector(name, value) {
285
+ return `[${name}=${JSON.stringify(value)}]`;
286
+ }
287
+ function selectorHints(node) {
288
+ const tagName = node.tagName || '';
289
+ const className = node.attributes.class || '';
290
+ const classHints = className
291
+ .split(/\s+/)
292
+ .filter((classPart) => {
293
+ return classPart === 'designer-formily-array-base-addition' || classPart === 'designer-input';
294
+ })
295
+ .map((classPart) => {
296
+ return tagName ? `${tagName}.${classPart}` : `.${classPart}`;
297
+ });
298
+ return uniqueStrings([
299
+ node.attributes.id ? `#${node.attributes.id}` : '',
300
+ node.attributes['data-testid'] ? attrSelector('data-testid', node.attributes['data-testid']) : '',
301
+ node.attributes['data-test'] ? attrSelector('data-test', node.attributes['data-test']) : '',
302
+ node.attributes.name && tagName ? `${tagName}${attrSelector('name', node.attributes.name)}` : '',
303
+ node.attributes.placeholder && tagName ? `${tagName}${attrSelector('placeholder', node.attributes.placeholder)}` : '',
304
+ node.attributes['aria-label'] && tagName ? `${tagName}${attrSelector('aria-label', node.attributes['aria-label'])}` : '',
305
+ ...classHints,
306
+ ]);
307
+ }
308
+ function nodeTypeName(type) {
309
+ if (type === 0) {
310
+ return 'document';
311
+ }
312
+ if (type === 1) {
313
+ return 'doctype';
314
+ }
315
+ if (type === 2) {
316
+ return 'element';
317
+ }
318
+ if (type === 3) {
319
+ return 'text';
320
+ }
321
+ if (type === 4) {
322
+ return 'cdata';
323
+ }
324
+ return 'comment';
325
+ }
326
+ function summarizeNode(state, nodeId) {
327
+ const node = state.nodes.get(nodeId);
328
+ if (!node) {
329
+ return undefined;
330
+ }
331
+ const text = nodeText(state, nodeId);
332
+ const ancestors = nodeAndAncestors(state, nodeId, 8).slice(1);
333
+ return {
334
+ id: node.id,
335
+ type: nodeTypeName(node.type),
336
+ tagName: node.tagName,
337
+ text: text && text.length <= 240 && !isNoisyText(text) ? text : undefined,
338
+ label: nodeLabel(state, nodeId),
339
+ role: optionalString(node.attributes.role),
340
+ name: optionalString(node.attributes.name),
341
+ placeholder: optionalString(node.attributes.placeholder),
342
+ className: optionalString(node.attributes.class),
343
+ selectorHints: selectorHints(node),
344
+ ancestorText: uniqueStrings(ancestors
345
+ .map((ancestor) => {
346
+ return nodeText(state, ancestor.id);
347
+ })
348
+ .filter((ancestorText) => {
349
+ return ancestorText.length > 0 && ancestorText.length <= 160 && !isNoisyText(ancestorText);
350
+ })).slice(0, 6),
351
+ };
352
+ }
353
+ function isInteractiveNode(node) {
354
+ const tagName = node.tagName || '';
355
+ const role = node.attributes.role || '';
356
+ const className = node.attributes.class || '';
357
+ return (['button', 'a', 'input', 'textarea', 'select', 'option'].includes(tagName) ||
358
+ ['button', 'textbox', 'checkbox', 'combobox', 'menuitem', 'tab'].includes(role) ||
359
+ className.includes('designer-formily-array-base-addition'));
360
+ }
361
+ function getFirstTimestamp(events) {
362
+ return events
363
+ .map((event) => {
364
+ return getEventTimestamp(event);
365
+ })
366
+ .find((timestamp) => {
367
+ return timestamp !== undefined;
368
+ });
369
+ }
370
+ function buildFields(actions) {
371
+ return Object.values(actions
372
+ .filter((action) => {
373
+ return action.kind === 'input';
374
+ })
375
+ .reduce((fields, action) => {
376
+ const key = action.nodeId === undefined ? action.label : `rrweb:${action.nodeId}`;
377
+ const existing = fields[key];
378
+ return {
379
+ ...fields,
380
+ [key]: {
381
+ key,
382
+ label: action.node?.label || action.label,
383
+ nodeId: action.nodeId,
384
+ selectorHints: uniqueStrings([...(existing?.selectorHints || []), ...(action.node?.selectorHints || [])]),
385
+ value: action.value ?? existing?.value,
386
+ checked: action.checked ?? existing?.checked,
387
+ actionCount: (existing?.actionCount || 0) + 1,
388
+ updatedAt: action.timestamp,
389
+ },
390
+ };
391
+ }, {})).sort((a, b) => {
392
+ return a.updatedAt - b.updatedAt;
393
+ });
394
+ }
395
+ function extractUrlFromEvent(event) {
396
+ const data = getEventData(event);
397
+ return optionalString(data.href) || optionalString(data.url);
398
+ }
399
+ function readAnnotationRect(value) {
400
+ if (!isRecord(value)) {
401
+ return undefined;
402
+ }
403
+ const x = numberValue(value.x);
404
+ const y = numberValue(value.y);
405
+ const width = numberValue(value.width);
406
+ const height = numberValue(value.height);
407
+ if (x === undefined || y === undefined || width === undefined || height === undefined) {
408
+ return undefined;
409
+ }
410
+ return { x, y, width, height };
411
+ }
412
+ function readAnnotationTarget(value) {
413
+ if (!isRecord(value)) {
414
+ return undefined;
415
+ }
416
+ const selectorHints = stringArrayValue(value.selectorHints);
417
+ const target = {
418
+ tagName: optionalString(value.tagName),
419
+ label: optionalString(value.label),
420
+ text: optionalString(value.text),
421
+ role: optionalString(value.role),
422
+ name: optionalString(value.name),
423
+ placeholder: optionalString(value.placeholder),
424
+ selectorHints,
425
+ rect: readAnnotationRect(value.rect),
426
+ };
427
+ if (!target.tagName &&
428
+ !target.label &&
429
+ !target.text &&
430
+ !target.role &&
431
+ !target.name &&
432
+ !target.placeholder &&
433
+ target.selectorHints.length === 0 &&
434
+ !target.rect) {
435
+ return undefined;
436
+ }
437
+ return target;
438
+ }
439
+ function readAnnotationEvent(options) {
440
+ if (optionalString(options.data.tag) !== 'playwriter.annotation') {
441
+ return undefined;
442
+ }
443
+ const payload = isRecord(options.data.payload) ? options.data.payload : {};
444
+ const id = optionalString(payload.id);
445
+ const text = normalizeText(optionalString(payload.text));
446
+ if (!id || !text) {
447
+ return undefined;
448
+ }
449
+ return {
450
+ id,
451
+ text,
452
+ timestamp: numberValue(payload.timestamp) || options.timestamp,
453
+ relativeTime: options.relativeTime,
454
+ url: optionalString(payload.url),
455
+ target: readAnnotationTarget(payload.target),
456
+ };
457
+ }
458
+ function readAnnotationDeleteEvent(options) {
459
+ if (optionalString(options.data.tag) !== 'playwriter.annotation.delete') {
460
+ return undefined;
461
+ }
462
+ const payload = isRecord(options.data.payload) ? options.data.payload : {};
463
+ return optionalString(payload.id);
464
+ }
465
+ export function buildReplayAiIndex(options) {
466
+ const state = { nodes: new Map() };
467
+ const firstTimestamp = getFirstTimestamp(options.events);
468
+ const stats = {
469
+ eventCount: options.events.length,
470
+ fullSnapshotCount: 0,
471
+ mutationEventCount: 0,
472
+ clickEventCount: 0,
473
+ inputEventCount: 0,
474
+ annotationCount: 0,
475
+ };
476
+ const warnings = [];
477
+ const actions = [];
478
+ const annotationsById = new Map();
479
+ let url = options.url;
480
+ options.events.forEach((event) => {
481
+ const eventType = getEventType(event);
482
+ const data = getEventData(event);
483
+ if (!url) {
484
+ url = extractUrlFromEvent(event);
485
+ }
486
+ if (eventType === 2) {
487
+ stats.fullSnapshotCount += 1;
488
+ addReplayNode(state, data.node);
489
+ return;
490
+ }
491
+ const timestamp = getEventTimestamp(event);
492
+ const relativeTime = firstTimestamp === undefined || timestamp === undefined ? undefined : timestamp - firstTimestamp;
493
+ if (eventType === 5) {
494
+ if (timestamp === undefined) {
495
+ warnings.push('Ignored rrweb custom event without timestamp.');
496
+ return;
497
+ }
498
+ const deletedAnnotationId = readAnnotationDeleteEvent({ data });
499
+ if (deletedAnnotationId) {
500
+ annotationsById.delete(deletedAnnotationId);
501
+ stats.annotationCount = annotationsById.size;
502
+ return;
503
+ }
504
+ const annotation = readAnnotationEvent({ data, timestamp, relativeTime });
505
+ if (annotation) {
506
+ annotationsById.set(annotation.id, annotation);
507
+ stats.annotationCount = annotationsById.size;
508
+ }
509
+ return;
510
+ }
511
+ if (eventType !== 3) {
512
+ return;
513
+ }
514
+ const source = numberValue(data.source);
515
+ if (source === 0) {
516
+ stats.mutationEventCount += 1;
517
+ applyMutationEvent(state, data);
518
+ return;
519
+ }
520
+ if (timestamp === undefined) {
521
+ warnings.push('Ignored rrweb event without timestamp.');
522
+ return;
523
+ }
524
+ if (source === 5) {
525
+ stats.inputEventCount += 1;
526
+ const nodeId = numberValue(data.id);
527
+ const value = optionalString(data.text) || optionalString(data.value) || '';
528
+ const checked = typeof data.isChecked === 'boolean' ? data.isChecked : undefined;
529
+ const node = nodeId === undefined ? undefined : state.nodes.get(nodeId);
530
+ if (node) {
531
+ node.attributes = {
532
+ ...node.attributes,
533
+ value,
534
+ };
535
+ }
536
+ const summary = nodeId === undefined ? undefined : summarizeNode(state, nodeId);
537
+ actions.push({
538
+ kind: 'input',
539
+ timestamp,
540
+ relativeTime,
541
+ nodeId,
542
+ label: summary?.label ||
543
+ summary?.placeholder ||
544
+ summary?.name ||
545
+ summary?.selectorHints[0] ||
546
+ (nodeId === undefined ? 'input' : `DOM node #${nodeId}`),
547
+ value,
548
+ checked,
549
+ node: summary,
550
+ });
551
+ return;
552
+ }
553
+ if (source === 2 && data.type === 2) {
554
+ stats.clickEventCount += 1;
555
+ const nodeId = numberValue(data.id);
556
+ const summary = nodeId === undefined ? undefined : summarizeNode(state, nodeId);
557
+ actions.push({
558
+ kind: 'click',
559
+ timestamp,
560
+ relativeTime,
561
+ nodeId,
562
+ label: summary?.label ||
563
+ summary?.text ||
564
+ summary?.selectorHints[0] ||
565
+ (nodeId === undefined ? 'click' : `DOM node #${nodeId}`),
566
+ node: summary,
567
+ });
568
+ }
569
+ });
570
+ const interactiveElements = Array.from(state.nodes.values())
571
+ .filter(isInteractiveNode)
572
+ .map((node) => {
573
+ return summarizeNode(state, node.id);
574
+ })
575
+ .filter((summary) => {
576
+ return Boolean(summary);
577
+ })
578
+ .filter((summary) => {
579
+ return Boolean(summary.label || summary.text || summary.selectorHints.length > 0);
580
+ })
581
+ .slice(0, MAX_INTERACTIVE_ELEMENTS);
582
+ const pageText = uniqueStrings(Array.from(state.nodes.values())
583
+ .map((node) => {
584
+ return nodeText(state, node.id);
585
+ })
586
+ .filter((text) => {
587
+ return text.length > 0 && text.length <= 160 && !isNoisyText(text);
588
+ })).slice(0, MAX_PAGE_TEXTS);
589
+ return {
590
+ schemaVersion: 1,
591
+ replayId: options.replayId,
592
+ url,
593
+ generatedAt: Date.now(),
594
+ stats,
595
+ actions: actions.slice(0, MAX_AI_ACTIONS),
596
+ fields: buildFields(actions),
597
+ annotations: Array.from(annotationsById.values()),
598
+ interactiveElements,
599
+ pageText,
600
+ warnings: uniqueStrings(warnings),
601
+ };
602
+ }
603
+ export function createReplayAiIndexFromRecording(replayId) {
604
+ const replay = getSavedRrwebRecordingWithEvents(replayId);
605
+ if (!replay) {
606
+ throw new Error(`Replay recording not found: ${replayId}`);
607
+ }
608
+ return buildReplayAiIndex({
609
+ replayId,
610
+ url: replay.recording.url,
611
+ events: replay.events,
612
+ });
613
+ }
614
+ function isSavedReplayAiIndex(value) {
615
+ if (!isRecord(value)) {
616
+ return false;
617
+ }
618
+ return (typeof value.id === 'string' &&
619
+ typeof value.replayId === 'string' &&
620
+ typeof value.path === 'string' &&
621
+ typeof value.generatedAt === 'number' &&
622
+ typeof value.size === 'number' &&
623
+ typeof value.actionCount === 'number' &&
624
+ typeof value.fieldCount === 'number' &&
625
+ (value.url === undefined || typeof value.url === 'string'));
626
+ }
627
+ function readSavedReplayAiIndexes() {
628
+ const indexPath = getReplayAiIndexesIndexPath();
629
+ if (!fs.existsSync(indexPath)) {
630
+ return [];
631
+ }
632
+ try {
633
+ const parsed = JSON.parse(fs.readFileSync(indexPath, 'utf-8'));
634
+ if (!Array.isArray(parsed)) {
635
+ return [];
636
+ }
637
+ return parsed.filter(isSavedReplayAiIndex);
638
+ }
639
+ catch {
640
+ return [];
641
+ }
642
+ }
643
+ function writeSavedReplayAiIndexes(indexes) {
644
+ const dir = getReplayAiIndexesDir();
645
+ if (!fs.existsSync(dir)) {
646
+ fs.mkdirSync(dir, { recursive: true });
647
+ }
648
+ fs.writeFileSync(getReplayAiIndexesIndexPath(), `${JSON.stringify(indexes, null, 2)}\n`);
649
+ }
650
+ export function saveReplayAiIndex(index) {
651
+ const outputPath = getReplayAiIndexPath(index.replayId);
652
+ const dir = path.dirname(outputPath);
653
+ if (!fs.existsSync(dir)) {
654
+ fs.mkdirSync(dir, { recursive: true });
655
+ }
656
+ const payload = `${JSON.stringify(index, null, 2)}\n`;
657
+ fs.writeFileSync(outputPath, payload);
658
+ const saved = {
659
+ id: index.replayId,
660
+ replayId: index.replayId,
661
+ path: outputPath,
662
+ generatedAt: index.generatedAt,
663
+ size: Buffer.byteLength(payload),
664
+ actionCount: index.actions.length,
665
+ fieldCount: index.fields.length,
666
+ url: index.url,
667
+ };
668
+ const nextIndexes = [
669
+ saved,
670
+ ...readSavedReplayAiIndexes().filter((existing) => {
671
+ return existing.id !== saved.id;
672
+ }),
673
+ ];
674
+ writeSavedReplayAiIndexes(nextIndexes.slice(0, 500));
675
+ return saved;
676
+ }
677
+ //# sourceMappingURL=replay-ai-index.js.map