@noego/wood 0.4.9 → 0.5.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 (493) hide show
  1. package/README.md +118 -42
  2. package/bin/axe.js +313 -98
  3. package/dist/{loader/__fixtures__/layouts/app.load.cjs → automation/actions.cjs} +3 -13
  4. package/dist/automation/actions.cjs.map +1 -0
  5. package/dist/automation/actions.d.cts +57 -0
  6. package/dist/automation/actions.d.ts +57 -0
  7. package/dist/automation/actions.js +1 -0
  8. package/dist/automation/actions.js.map +1 -0
  9. package/dist/automation/actions_executor.cjs +101 -0
  10. package/dist/automation/actions_executor.cjs.map +1 -0
  11. package/dist/automation/actions_executor.d.cts +16 -0
  12. package/dist/automation/actions_executor.d.ts +16 -0
  13. package/dist/automation/actions_executor.js +76 -0
  14. package/dist/automation/actions_executor.js.map +1 -0
  15. package/dist/automation/connection.cjs +86 -0
  16. package/dist/automation/connection.cjs.map +1 -0
  17. package/dist/automation/connection.d.cts +18 -0
  18. package/dist/automation/connection.d.ts +18 -0
  19. package/dist/automation/connection.js +51 -0
  20. package/dist/automation/connection.js.map +1 -0
  21. package/dist/{middleware/__fixtures__/middleware/sequence.cjs → automation/errors.cjs} +25 -22
  22. package/dist/automation/errors.cjs.map +1 -0
  23. package/dist/automation/errors.d.cts +31 -0
  24. package/dist/automation/errors.d.ts +31 -0
  25. package/dist/automation/errors.js +24 -0
  26. package/dist/automation/errors.js.map +1 -0
  27. package/dist/automation/index.cjs +49 -0
  28. package/dist/automation/index.cjs.map +1 -0
  29. package/dist/automation/index.d.cts +16 -0
  30. package/dist/automation/index.d.ts +16 -0
  31. package/dist/automation/index.js +15 -0
  32. package/dist/automation/index.js.map +1 -0
  33. package/dist/automation/introspection_reader.cjs +75 -0
  34. package/dist/automation/introspection_reader.cjs.map +1 -0
  35. package/dist/automation/introspection_reader.d.cts +20 -0
  36. package/dist/automation/introspection_reader.d.ts +20 -0
  37. package/dist/automation/introspection_reader.js +48 -0
  38. package/dist/automation/introspection_reader.js.map +1 -0
  39. package/dist/automation/locator.cjs +102 -0
  40. package/dist/automation/locator.cjs.map +1 -0
  41. package/dist/automation/locator.d.cts +51 -0
  42. package/dist/automation/locator.d.ts +51 -0
  43. package/dist/automation/locator.js +75 -0
  44. package/dist/automation/locator.js.map +1 -0
  45. package/dist/{loader/__fixtures__/views/test/page.load.cjs → automation/observation.cjs} +3 -13
  46. package/dist/automation/observation.cjs.map +1 -0
  47. package/dist/automation/observation.d.cts +44 -0
  48. package/dist/automation/observation.d.ts +44 -0
  49. package/dist/automation/observation.js +1 -0
  50. package/dist/automation/observation.js.map +1 -0
  51. package/dist/{controller/__fixtures__/controllers/test.cjs → automation/receipts.cjs} +3 -15
  52. package/dist/automation/receipts.cjs.map +1 -0
  53. package/dist/automation/receipts.d.cts +27 -0
  54. package/dist/automation/receipts.d.ts +27 -0
  55. package/dist/automation/receipts.js +1 -0
  56. package/dist/automation/receipts.js.map +1 -0
  57. package/dist/automation/scenario.cjs +696 -0
  58. package/dist/automation/scenario.cjs.map +1 -0
  59. package/dist/automation/scenario.d.cts +89 -0
  60. package/dist/automation/scenario.d.ts +89 -0
  61. package/dist/automation/scenario.js +660 -0
  62. package/dist/automation/scenario.js.map +1 -0
  63. package/dist/automation/scrolling.cjs +17 -0
  64. package/dist/automation/scrolling.cjs.map +1 -0
  65. package/dist/automation/scrolling.d.cts +51 -0
  66. package/dist/automation/scrolling.d.ts +51 -0
  67. package/dist/automation/scrolling.js +1 -0
  68. package/dist/automation/scrolling.js.map +1 -0
  69. package/dist/automation/scrolling_executor.cjs +109 -0
  70. package/dist/automation/scrolling_executor.cjs.map +1 -0
  71. package/dist/automation/scrolling_executor.d.cts +13 -0
  72. package/dist/automation/scrolling_executor.d.ts +13 -0
  73. package/dist/automation/scrolling_executor.js +84 -0
  74. package/dist/automation/scrolling_executor.js.map +1 -0
  75. package/dist/automation/target_identity.cjs +17 -0
  76. package/dist/automation/target_identity.cjs.map +1 -0
  77. package/dist/automation/target_identity.d.cts +28 -0
  78. package/dist/automation/target_identity.d.ts +28 -0
  79. package/dist/automation/target_identity.js +1 -0
  80. package/dist/automation/target_identity.js.map +1 -0
  81. package/dist/automation/target_registry.cjs +148 -0
  82. package/dist/automation/target_registry.cjs.map +1 -0
  83. package/dist/automation/target_registry.d.cts +32 -0
  84. package/dist/automation/target_registry.d.ts +32 -0
  85. package/dist/automation/target_registry.js +122 -0
  86. package/dist/automation/target_registry.js.map +1 -0
  87. package/dist/automation/waits.cjs +17 -0
  88. package/dist/automation/waits.cjs.map +1 -0
  89. package/dist/automation/waits.d.cts +44 -0
  90. package/dist/automation/waits.d.ts +44 -0
  91. package/dist/automation/waits.js +1 -0
  92. package/dist/automation/waits.js.map +1 -0
  93. package/dist/automation/waits_executor.cjs +104 -0
  94. package/dist/automation/waits_executor.cjs.map +1 -0
  95. package/dist/automation/waits_executor.d.cts +14 -0
  96. package/dist/automation/waits_executor.d.ts +14 -0
  97. package/dist/automation/waits_executor.js +79 -0
  98. package/dist/automation/waits_executor.js.map +1 -0
  99. package/dist/bridge/backend_bridge.cjs.map +1 -1
  100. package/dist/bridge/backend_bridge.js.map +1 -1
  101. package/dist/client/index.cjs +78 -21
  102. package/dist/client/index.cjs.map +1 -1
  103. package/dist/client/index.d.cts +19 -3
  104. package/dist/client/index.d.ts +19 -3
  105. package/dist/client/index.js +80 -22
  106. package/dist/client/index.js.map +1 -1
  107. package/dist/client/renderer_log_transport.cjs +151 -0
  108. package/dist/client/renderer_log_transport.cjs.map +1 -0
  109. package/dist/client/renderer_log_transport.d.cts +54 -0
  110. package/dist/client/renderer_log_transport.d.ts +54 -0
  111. package/dist/client/renderer_log_transport.js +123 -0
  112. package/dist/client/renderer_log_transport.js.map +1 -0
  113. package/dist/codegen/controller_registration_generator.cjs +13 -2
  114. package/dist/codegen/controller_registration_generator.cjs.map +1 -1
  115. package/dist/codegen/controller_registration_generator.d.cts +12 -1
  116. package/dist/codegen/controller_registration_generator.d.ts +12 -1
  117. package/dist/codegen/controller_registration_generator.js +10 -1
  118. package/dist/codegen/controller_registration_generator.js.map +1 -1
  119. package/dist/codegen/index.d.cts +1 -0
  120. package/dist/codegen/index.d.ts +1 -0
  121. package/dist/codegen/preload_generator.cjs +13 -6
  122. package/dist/codegen/preload_generator.cjs.map +1 -1
  123. package/dist/codegen/preload_generator.d.cts +11 -2
  124. package/dist/codegen/preload_generator.d.ts +11 -2
  125. package/dist/codegen/preload_generator.js +13 -6
  126. package/dist/codegen/preload_generator.js.map +1 -1
  127. package/dist/codegen/renderer_app_generator.cjs +95 -44
  128. package/dist/codegen/renderer_app_generator.cjs.map +1 -1
  129. package/dist/codegen/renderer_app_generator.js +95 -44
  130. package/dist/codegen/renderer_app_generator.js.map +1 -1
  131. package/dist/codegen/type_generator.cjs +1 -0
  132. package/dist/codegen/type_generator.cjs.map +1 -1
  133. package/dist/codegen/type_generator.js +1 -0
  134. package/dist/codegen/type_generator.js.map +1 -1
  135. package/dist/config/config_parser.cjs +95 -4
  136. package/dist/config/config_parser.cjs.map +1 -1
  137. package/dist/config/config_parser.d.cts +10 -2
  138. package/dist/config/config_parser.d.ts +10 -2
  139. package/dist/config/config_parser.js +92 -3
  140. package/dist/config/config_parser.js.map +1 -1
  141. package/dist/config/index.cjs +6 -2
  142. package/dist/config/index.cjs.map +1 -1
  143. package/dist/config/index.d.cts +2 -2
  144. package/dist/config/index.d.ts +2 -2
  145. package/dist/config/index.js +8 -2
  146. package/dist/config/index.js.map +1 -1
  147. package/dist/controller/controller_resolver.cjs +51 -3
  148. package/dist/controller/controller_resolver.cjs.map +1 -1
  149. package/dist/controller/controller_resolver.d.cts +27 -4
  150. package/dist/controller/controller_resolver.d.ts +27 -4
  151. package/dist/controller/controller_resolver.js +48 -2
  152. package/dist/controller/controller_resolver.js.map +1 -1
  153. package/dist/controller/index.cjs +6 -2
  154. package/dist/controller/index.cjs.map +1 -1
  155. package/dist/controller/index.d.cts +1 -1
  156. package/dist/controller/index.d.ts +1 -1
  157. package/dist/controller/index.js +4 -2
  158. package/dist/controller/index.js.map +1 -1
  159. package/dist/dev/wood_dev_server.cjs +4 -1
  160. package/dist/dev/wood_dev_server.cjs.map +1 -1
  161. package/dist/dev/wood_dev_server.js +5 -2
  162. package/dist/dev/wood_dev_server.js.map +1 -1
  163. package/dist/dev/yaml_watcher.cjs +1 -1
  164. package/dist/dev/yaml_watcher.cjs.map +1 -1
  165. package/dist/dev/yaml_watcher.d.cts +4 -0
  166. package/dist/dev/yaml_watcher.d.ts +4 -0
  167. package/dist/dev/yaml_watcher.js +1 -1
  168. package/dist/dev/yaml_watcher.js.map +1 -1
  169. package/dist/frontend/frontend_lifecycle.cjs +74 -0
  170. package/dist/frontend/frontend_lifecycle.cjs.map +1 -0
  171. package/dist/frontend/frontend_lifecycle.d.cts +50 -0
  172. package/dist/frontend/frontend_lifecycle.d.ts +50 -0
  173. package/dist/frontend/frontend_lifecycle.js +50 -0
  174. package/dist/frontend/frontend_lifecycle.js.map +1 -0
  175. package/dist/frontend/frontend_page.cjs +122 -0
  176. package/dist/frontend/frontend_page.cjs.map +1 -0
  177. package/dist/frontend/frontend_page.d.cts +62 -0
  178. package/dist/frontend/frontend_page.d.ts +62 -0
  179. package/dist/frontend/frontend_page.js +98 -0
  180. package/dist/frontend/frontend_page.js.map +1 -0
  181. package/dist/frontend/frontend_surface.cjs +249 -0
  182. package/dist/frontend/frontend_surface.cjs.map +1 -0
  183. package/dist/frontend/frontend_surface.d.cts +64 -0
  184. package/dist/frontend/frontend_surface.d.ts +64 -0
  185. package/dist/frontend/frontend_surface.js +224 -0
  186. package/dist/frontend/frontend_surface.js.map +1 -0
  187. package/dist/frontend/index.cjs +52 -0
  188. package/dist/frontend/index.cjs.map +1 -0
  189. package/dist/frontend/index.d.cts +10 -0
  190. package/dist/frontend/index.d.ts +10 -0
  191. package/dist/frontend/index.js +19 -0
  192. package/dist/frontend/index.js.map +1 -0
  193. package/dist/frontend/page_catalog.cjs +135 -0
  194. package/dist/frontend/page_catalog.cjs.map +1 -0
  195. package/dist/frontend/page_catalog.d.cts +56 -0
  196. package/dist/frontend/page_catalog.d.ts +56 -0
  197. package/dist/frontend/page_catalog.js +108 -0
  198. package/dist/frontend/page_catalog.js.map +1 -0
  199. package/dist/frontend/tracked_transport.cjs +55 -0
  200. package/dist/frontend/tracked_transport.cjs.map +1 -0
  201. package/dist/frontend/tracked_transport.d.cts +36 -0
  202. package/dist/frontend/tracked_transport.d.ts +36 -0
  203. package/dist/frontend/tracked_transport.js +31 -0
  204. package/dist/frontend/tracked_transport.js.map +1 -0
  205. package/dist/frontend/work_registry.cjs +153 -0
  206. package/dist/frontend/work_registry.cjs.map +1 -0
  207. package/dist/frontend/work_registry.d.cts +70 -0
  208. package/dist/frontend/work_registry.d.ts +70 -0
  209. package/dist/frontend/work_registry.js +128 -0
  210. package/dist/frontend/work_registry.js.map +1 -0
  211. package/dist/index.cjs +24 -0
  212. package/dist/index.cjs.map +1 -1
  213. package/dist/index.d.cts +11 -7
  214. package/dist/index.d.ts +11 -7
  215. package/dist/index.js +27 -4
  216. package/dist/index.js.map +1 -1
  217. package/dist/main/index.cjs +10 -0
  218. package/dist/main/index.cjs.map +1 -1
  219. package/dist/main/index.d.cts +14 -2
  220. package/dist/main/index.d.ts +14 -2
  221. package/dist/main/index.js +16 -0
  222. package/dist/main/index.js.map +1 -1
  223. package/dist/middleware/middleware_resolver.cjs +22 -1
  224. package/dist/middleware/middleware_resolver.cjs.map +1 -1
  225. package/dist/middleware/middleware_resolver.d.cts +13 -1
  226. package/dist/middleware/middleware_resolver.d.ts +13 -1
  227. package/dist/middleware/middleware_resolver.js +22 -1
  228. package/dist/middleware/middleware_resolver.js.map +1 -1
  229. package/dist/navigation/automation_introspection.cjs +110 -0
  230. package/dist/navigation/automation_introspection.cjs.map +1 -0
  231. package/dist/navigation/automation_introspection.d.cts +60 -0
  232. package/dist/navigation/automation_introspection.d.ts +60 -0
  233. package/dist/navigation/automation_introspection.js +85 -0
  234. package/dist/navigation/automation_introspection.js.map +1 -0
  235. package/dist/navigation/index.cjs +10 -2
  236. package/dist/navigation/index.cjs.map +1 -1
  237. package/dist/navigation/index.d.cts +27 -1
  238. package/dist/navigation/index.d.ts +27 -1
  239. package/dist/navigation/index.js +6 -1
  240. package/dist/navigation/index.js.map +1 -1
  241. package/dist/{middleware/__fixtures__/middleware/auth.cjs → navigation/layout_preservation.cjs} +18 -20
  242. package/dist/navigation/layout_preservation.cjs.map +1 -0
  243. package/dist/navigation/layout_preservation.d.cts +2 -0
  244. package/dist/navigation/layout_preservation.d.ts +2 -0
  245. package/dist/navigation/layout_preservation.js +18 -0
  246. package/dist/navigation/layout_preservation.js.map +1 -0
  247. package/dist/parser/index.cjs +2 -0
  248. package/dist/parser/index.cjs.map +1 -1
  249. package/dist/parser/index.d.cts +1 -1
  250. package/dist/parser/index.d.ts +1 -1
  251. package/dist/parser/index.js +2 -1
  252. package/dist/parser/index.js.map +1 -1
  253. package/dist/parser/operations_parser.cjs +6 -0
  254. package/dist/parser/operations_parser.cjs.map +1 -1
  255. package/dist/parser/operations_parser.d.cts +9 -2
  256. package/dist/parser/operations_parser.d.ts +9 -2
  257. package/dist/parser/operations_parser.js +5 -0
  258. package/dist/parser/operations_parser.js.map +1 -1
  259. package/dist/parser/views_parser.cjs.map +1 -1
  260. package/dist/parser/views_parser.js.map +1 -1
  261. package/dist/router/index.d.cts +1 -0
  262. package/dist/router/index.d.ts +1 -0
  263. package/dist/router/wood_router.cjs +35 -3
  264. package/dist/router/wood_router.cjs.map +1 -1
  265. package/dist/router/wood_router.d.cts +15 -0
  266. package/dist/router/wood_router.d.ts +15 -0
  267. package/dist/router/wood_router.js +36 -4
  268. package/dist/router/wood_router.js.map +1 -1
  269. package/dist/runtime/get_container.cjs +9 -34
  270. package/dist/runtime/get_container.cjs.map +1 -1
  271. package/dist/runtime/get_container.d.cts +24 -4
  272. package/dist/runtime/get_container.d.ts +24 -4
  273. package/dist/runtime/get_container.js +8 -23
  274. package/dist/runtime/get_container.js.map +1 -1
  275. package/dist/runtime/index.cjs +9 -0
  276. package/dist/runtime/index.cjs.map +1 -1
  277. package/dist/runtime/index.d.cts +5 -2
  278. package/dist/runtime/index.d.ts +5 -2
  279. package/dist/runtime/index.js +10 -1
  280. package/dist/runtime/index.js.map +1 -1
  281. package/dist/runtime/renderer_config_extension.cjs +50 -0
  282. package/dist/runtime/renderer_config_extension.cjs.map +1 -0
  283. package/dist/runtime/renderer_config_extension.d.cts +19 -0
  284. package/dist/runtime/renderer_config_extension.d.ts +19 -0
  285. package/dist/runtime/renderer_config_extension.js +24 -0
  286. package/dist/runtime/renderer_config_extension.js.map +1 -0
  287. package/dist/runtime/renderer_log_batch_receiver.cjs +73 -0
  288. package/dist/runtime/renderer_log_batch_receiver.cjs.map +1 -0
  289. package/dist/runtime/renderer_log_batch_receiver.d.cts +29 -0
  290. package/dist/runtime/renderer_log_batch_receiver.d.ts +29 -0
  291. package/dist/runtime/renderer_log_batch_receiver.js +48 -0
  292. package/dist/runtime/renderer_log_batch_receiver.js.map +1 -0
  293. package/dist/runtime/renderer_trace_batch_receiver_registry.d.cts +1 -1
  294. package/dist/runtime/renderer_trace_batch_receiver_registry.d.ts +1 -1
  295. package/dist/runtime/runtime.cjs +14 -0
  296. package/dist/runtime/runtime.cjs.map +1 -1
  297. package/dist/runtime/runtime.d.cts +2 -1
  298. package/dist/runtime/runtime.d.ts +2 -1
  299. package/dist/runtime/runtime.js +14 -0
  300. package/dist/runtime/runtime.js.map +1 -1
  301. package/dist/stick/index.cjs.map +1 -1
  302. package/dist/stick/index.js.map +1 -1
  303. package/dist/testing/automation_assertions.cjs +417 -0
  304. package/dist/testing/automation_assertions.cjs.map +1 -0
  305. package/dist/testing/automation_assertions.d.cts +44 -0
  306. package/dist/testing/automation_assertions.d.ts +44 -0
  307. package/dist/testing/automation_assertions.js +385 -0
  308. package/dist/testing/automation_assertions.js.map +1 -0
  309. package/dist/testing/browser.cjs +130 -57
  310. package/dist/testing/browser.cjs.map +1 -1
  311. package/dist/testing/browser.d.cts +10 -4
  312. package/dist/testing/browser.d.ts +10 -4
  313. package/dist/testing/browser.js +132 -53
  314. package/dist/testing/browser.js.map +1 -1
  315. package/dist/testing/create_controller_harness.cjs +28 -8
  316. package/dist/testing/create_controller_harness.cjs.map +1 -1
  317. package/dist/testing/create_controller_harness.d.cts +18 -2
  318. package/dist/testing/create_controller_harness.d.ts +18 -2
  319. package/dist/testing/create_controller_harness.js +28 -8
  320. package/dist/testing/create_controller_harness.js.map +1 -1
  321. package/dist/testing/create_router_bridge.d.cts +1 -0
  322. package/dist/testing/create_router_bridge.d.ts +1 -0
  323. package/dist/testing/create_test_router.d.cts +1 -0
  324. package/dist/testing/create_test_router.d.ts +1 -0
  325. package/dist/testing/geometry.cjs +109 -0
  326. package/dist/testing/geometry.cjs.map +1 -0
  327. package/dist/testing/geometry.d.cts +45 -0
  328. package/dist/testing/geometry.d.ts +45 -0
  329. package/dist/testing/geometry.js +79 -0
  330. package/dist/testing/geometry.js.map +1 -0
  331. package/dist/testing/index.cjs +62 -2
  332. package/dist/testing/index.cjs.map +1 -1
  333. package/dist/testing/index.d.cts +23 -4
  334. package/dist/testing/index.d.ts +23 -4
  335. package/dist/testing/index.js +50 -2
  336. package/dist/testing/index.js.map +1 -1
  337. package/dist/{controller/__fixtures__/controllers/not_a_class.cjs → testing/test_wood.cjs} +15 -7
  338. package/dist/testing/test_wood.cjs.map +1 -0
  339. package/dist/testing/test_wood.d.cts +16 -0
  340. package/dist/testing/test_wood.d.ts +16 -0
  341. package/dist/testing/test_wood.js +12 -0
  342. package/dist/testing/test_wood.js.map +1 -0
  343. package/dist/testing/test_wood_config.cjs +272 -0
  344. package/dist/testing/test_wood_config.cjs.map +1 -0
  345. package/dist/testing/test_wood_config.d.cts +111 -0
  346. package/dist/testing/test_wood_config.d.ts +111 -0
  347. package/dist/testing/test_wood_config.js +247 -0
  348. package/dist/testing/test_wood_config.js.map +1 -0
  349. package/dist/testing/wood_config_source.cjs +146 -0
  350. package/dist/testing/wood_config_source.cjs.map +1 -0
  351. package/dist/testing/wood_config_source.d.cts +36 -0
  352. package/dist/testing/wood_config_source.d.ts +36 -0
  353. package/dist/testing/wood_config_source.js +112 -0
  354. package/dist/testing/wood_config_source.js.map +1 -0
  355. package/dist/testing/wood_env_renderer.cjs +210 -0
  356. package/dist/testing/wood_env_renderer.cjs.map +1 -0
  357. package/dist/testing/wood_env_renderer.d.cts +74 -0
  358. package/dist/testing/wood_env_renderer.d.ts +74 -0
  359. package/dist/testing/wood_env_renderer.js +188 -0
  360. package/dist/testing/wood_env_renderer.js.map +1 -0
  361. package/dist/testing/wood_test_selection.cjs +94 -0
  362. package/dist/testing/wood_test_selection.cjs.map +1 -0
  363. package/dist/testing/wood_test_selection.d.cts +39 -0
  364. package/dist/testing/wood_test_selection.d.ts +39 -0
  365. package/dist/testing/wood_test_selection.js +68 -0
  366. package/dist/testing/wood_test_selection.js.map +1 -0
  367. package/dist/trace-testing/index.d.cts +1 -2
  368. package/dist/trace-testing/index.d.ts +1 -2
  369. package/dist/trace-testing/trace_recorder.cjs +1 -1
  370. package/dist/trace-testing/trace_recorder.cjs.map +1 -1
  371. package/dist/trace-testing/trace_recorder.d.cts +1 -2
  372. package/dist/trace-testing/trace_recorder.d.ts +1 -2
  373. package/dist/trace-testing/trace_recorder.js +1 -1
  374. package/dist/trace-testing/trace_recorder.js.map +1 -1
  375. package/dist/trace-transport/index.d.cts +1 -1
  376. package/dist/trace-transport/index.d.ts +1 -1
  377. package/dist/{trace_hub-Cob54qRx.d.cts → trace_hub-Cpo_nVze.d.cts} +21 -1
  378. package/dist/{trace_hub-Cob54qRx.d.ts → trace_hub-Cpo_nVze.d.ts} +21 -1
  379. package/dist/tracing/index.cjs +9 -2
  380. package/dist/tracing/index.cjs.map +1 -1
  381. package/dist/tracing/index.d.cts +3 -2
  382. package/dist/tracing/index.d.ts +3 -2
  383. package/dist/tracing/index.js +7 -1
  384. package/dist/tracing/index.js.map +1 -1
  385. package/dist/tracing/renderer_trace_batch_host.d.cts +1 -1
  386. package/dist/tracing/renderer_trace_batch_host.d.ts +1 -1
  387. package/dist/tracing/renderer_trace_batch_transport.cjs +48 -6
  388. package/dist/tracing/renderer_trace_batch_transport.cjs.map +1 -1
  389. package/dist/tracing/renderer_trace_batch_transport.d.cts +17 -1
  390. package/dist/tracing/renderer_trace_batch_transport.d.ts +17 -1
  391. package/dist/tracing/renderer_trace_batch_transport.js +48 -6
  392. package/dist/tracing/renderer_trace_batch_transport.js.map +1 -1
  393. package/dist/tracing/trace_batch_adapter.cjs +110 -0
  394. package/dist/tracing/trace_batch_adapter.cjs.map +1 -0
  395. package/dist/tracing/trace_batch_adapter.d.cts +36 -0
  396. package/dist/tracing/trace_batch_adapter.d.ts +36 -0
  397. package/dist/tracing/trace_batch_adapter.js +86 -0
  398. package/dist/tracing/trace_batch_adapter.js.map +1 -0
  399. package/dist/tracing/trace_commit_writer.d.cts +1 -1
  400. package/dist/tracing/trace_commit_writer.d.ts +1 -1
  401. package/dist/tracing/trace_hub.cjs +87 -20
  402. package/dist/tracing/trace_hub.cjs.map +1 -1
  403. package/dist/tracing/trace_hub.d.cts +1 -1
  404. package/dist/tracing/trace_hub.d.ts +1 -1
  405. package/dist/tracing/trace_hub.js +85 -20
  406. package/dist/tracing/trace_hub.js.map +1 -1
  407. package/dist/tracing/trace_provider.cjs +21 -6
  408. package/dist/tracing/trace_provider.cjs.map +1 -1
  409. package/dist/tracing/trace_provider.d.cts +13 -4
  410. package/dist/tracing/trace_provider.d.ts +13 -4
  411. package/dist/tracing/trace_provider.js +22 -7
  412. package/dist/tracing/trace_provider.js.map +1 -1
  413. package/dist/tracing/types/wood_trace_batch.types.cjs.map +1 -1
  414. package/dist/tracing/types/wood_trace_batch.types.d.cts +15 -1
  415. package/dist/tracing/types/wood_trace_batch.types.d.ts +15 -1
  416. package/dist/tracing/types/wood_trace_sink.types.d.cts +1 -1
  417. package/dist/tracing/types/wood_trace_sink.types.d.ts +1 -1
  418. package/dist/tracing/wood_trace_batch_contract.cjs +2 -0
  419. package/dist/tracing/wood_trace_batch_contract.cjs.map +1 -1
  420. package/dist/tracing/wood_trace_batch_contract.d.cts +1 -1
  421. package/dist/tracing/wood_trace_batch_contract.d.ts +1 -1
  422. package/dist/tracing/wood_trace_batch_contract.js +2 -0
  423. package/dist/tracing/wood_trace_batch_contract.js.map +1 -1
  424. package/dist/transport/build_transport_bridge.cjs +4 -2
  425. package/dist/transport/build_transport_bridge.cjs.map +1 -1
  426. package/dist/transport/build_transport_bridge.d.cts +7 -1
  427. package/dist/transport/build_transport_bridge.d.ts +7 -1
  428. package/dist/transport/build_transport_bridge.js +2 -1
  429. package/dist/transport/build_transport_bridge.js.map +1 -1
  430. package/dist/transport/in_process_router_transport.d.cts +1 -0
  431. package/dist/transport/in_process_router_transport.d.ts +1 -0
  432. package/dist/transport/index.d.cts +1 -0
  433. package/dist/transport/index.d.ts +1 -0
  434. package/dist/types/config.cjs.map +1 -1
  435. package/dist/types/config.d.cts +47 -1
  436. package/dist/types/config.d.ts +47 -1
  437. package/dist/types/context.cjs +12 -0
  438. package/dist/types/context.cjs.map +1 -1
  439. package/dist/types/context.d.cts +27 -1
  440. package/dist/types/context.d.ts +27 -1
  441. package/dist/types/context.js +4 -0
  442. package/dist/types/context.js.map +1 -1
  443. package/dist/types/index.d.cts +2 -2
  444. package/dist/types/index.d.ts +2 -2
  445. package/dist/types/operations.cjs.map +1 -1
  446. package/dist/types/operations.d.cts +2 -0
  447. package/dist/types/operations.d.ts +2 -0
  448. package/docs/axe.md +706 -0
  449. package/package.json +19 -5
  450. package/src/components/NavigationShell.scopes.browser.test.ts +363 -0
  451. package/src/components/NavigationShell.svelte +126 -49
  452. package/dist/controller/__fixtures__/controllers/chat.cjs +0 -32
  453. package/dist/controller/__fixtures__/controllers/chat.cjs.map +0 -1
  454. package/dist/controller/__fixtures__/controllers/chat.d.cts +0 -11
  455. package/dist/controller/__fixtures__/controllers/chat.d.ts +0 -11
  456. package/dist/controller/__fixtures__/controllers/chat.js +0 -12
  457. package/dist/controller/__fixtures__/controllers/chat.js.map +0 -1
  458. package/dist/controller/__fixtures__/controllers/not_a_class.cjs.map +0 -1
  459. package/dist/controller/__fixtures__/controllers/not_a_class.d.cts +0 -3
  460. package/dist/controller/__fixtures__/controllers/not_a_class.d.ts +0 -3
  461. package/dist/controller/__fixtures__/controllers/not_a_class.js +0 -5
  462. package/dist/controller/__fixtures__/controllers/not_a_class.js.map +0 -1
  463. package/dist/controller/__fixtures__/controllers/settings.controller.cjs +0 -32
  464. package/dist/controller/__fixtures__/controllers/settings.controller.cjs.map +0 -1
  465. package/dist/controller/__fixtures__/controllers/settings.controller.d.cts +0 -12
  466. package/dist/controller/__fixtures__/controllers/settings.controller.d.ts +0 -12
  467. package/dist/controller/__fixtures__/controllers/settings.controller.js +0 -12
  468. package/dist/controller/__fixtures__/controllers/settings.controller.js.map +0 -1
  469. package/dist/controller/__fixtures__/controllers/test.cjs.map +0 -1
  470. package/dist/controller/__fixtures__/controllers/test.d.cts +0 -7
  471. package/dist/controller/__fixtures__/controllers/test.d.ts +0 -7
  472. package/dist/controller/__fixtures__/controllers/test.js +0 -9
  473. package/dist/controller/__fixtures__/controllers/test.js.map +0 -1
  474. package/dist/loader/__fixtures__/layouts/app.load.cjs.map +0 -1
  475. package/dist/loader/__fixtures__/layouts/app.load.d.cts +0 -5
  476. package/dist/loader/__fixtures__/layouts/app.load.d.ts +0 -5
  477. package/dist/loader/__fixtures__/layouts/app.load.js +0 -7
  478. package/dist/loader/__fixtures__/layouts/app.load.js.map +0 -1
  479. package/dist/loader/__fixtures__/views/test/page.load.cjs.map +0 -1
  480. package/dist/loader/__fixtures__/views/test/page.load.d.cts +0 -6
  481. package/dist/loader/__fixtures__/views/test/page.load.d.ts +0 -6
  482. package/dist/loader/__fixtures__/views/test/page.load.js +0 -7
  483. package/dist/loader/__fixtures__/views/test/page.load.js.map +0 -1
  484. package/dist/middleware/__fixtures__/middleware/auth.cjs.map +0 -1
  485. package/dist/middleware/__fixtures__/middleware/auth.d.cts +0 -6
  486. package/dist/middleware/__fixtures__/middleware/auth.d.ts +0 -6
  487. package/dist/middleware/__fixtures__/middleware/auth.js +0 -19
  488. package/dist/middleware/__fixtures__/middleware/auth.js.map +0 -1
  489. package/dist/middleware/__fixtures__/middleware/sequence.cjs.map +0 -1
  490. package/dist/middleware/__fixtures__/middleware/sequence.d.cts +0 -7
  491. package/dist/middleware/__fixtures__/middleware/sequence.d.ts +0 -7
  492. package/dist/middleware/__fixtures__/middleware/sequence.js +0 -21
  493. package/dist/middleware/__fixtures__/middleware/sequence.js.map +0 -1
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var actions_executor_exports = {};
20
+ __export(actions_executor_exports, {
21
+ deriveReceiptChanges: () => deriveReceiptChanges,
22
+ executeAction: () => executeAction
23
+ });
24
+ module.exports = __toCommonJS(actions_executor_exports);
25
+ var import_errors = require("./errors.cjs");
26
+ var import_introspection_reader = require("./introspection_reader.cjs");
27
+ var import_locator = require("./locator.cjs");
28
+ var import_scrolling_executor = require("./scrolling_executor.cjs");
29
+ var import_waits_executor = require("./waits_executor.cjs");
30
+ let nextActionId = 1;
31
+ async function readTarget(page, previous) {
32
+ const snapshot = await (0, import_introspection_reader.readAutomationSnapshot)(page);
33
+ const url = page.url();
34
+ const title = await page.title();
35
+ const currentRoute = (0, import_introspection_reader.formatRoute)(snapshot?.currentRoute ?? null);
36
+ return { targetId: previous?.targetId ?? "page", windowId: snapshot?.windowId ?? previous?.windowId ?? null, pageGeneration: previous?.pageGeneration ?? 0, url, title, ...currentRoute ? { currentRoute } : {}, woodBridgePresent: snapshot !== null, eligible: true };
37
+ }
38
+ function deriveReceiptChanges(before, after) {
39
+ return { changedDocument: before.url !== after.url || before.title !== after.title, changedTarget: before.targetId !== after.targetId || before.windowId !== after.windowId || before.pageGeneration !== after.pageGeneration, changedRoute: before.currentRoute !== after.currentRoute };
40
+ }
41
+ async function actionable(page, target) {
42
+ const locator = (0, import_locator.toPlaywrightLocator)(page, target);
43
+ const count = await locator.count();
44
+ if (count !== 1) {
45
+ const visibility = await Promise.all(Array.from({ length: count }, (_, index) => locator.nth(index).isVisible().catch(() => false)));
46
+ return (0, import_errors.automationError)("LOCATOR_INVALID", `Expected exactly one actionable match for ${(0, import_locator.describeLocator)(target)}, found ${count}.`, { details: { matchCount: count, candidateVisibility: visibility } });
47
+ }
48
+ return (0, import_errors.automationOk)(locator);
49
+ }
50
+ function actionTarget(action) {
51
+ return "target" in action ? action.target : void 0;
52
+ }
53
+ async function executeAction(page, action, options) {
54
+ const startedAt = /* @__PURE__ */ new Date();
55
+ const before = await readTarget(page);
56
+ const diagnostics = [];
57
+ const eventLike = options?.wait && (options.wait.kind === "route" || options.wait.kind === "url" || options.wait.kind === "target" || options.wait.kind === "trace");
58
+ const armedWait = eventLike && options?.wait ? (0, import_waits_executor.awaitCondition)(page, options.wait, { timeoutMs: options.timeoutMs }) : void 0;
59
+ try {
60
+ const target = actionTarget(action);
61
+ let locator;
62
+ if (target) {
63
+ const result = await actionable(page, target);
64
+ if (!result.ok) return result;
65
+ locator = result.value;
66
+ }
67
+ if (action.kind === "click") await locator.click({ button: action.button });
68
+ else if (action.kind === "double_click") await locator.dblclick();
69
+ else if (action.kind === "fill") await locator.fill(action.value);
70
+ else if (action.kind === "type") await locator.pressSequentially(action.value, { delay: action.delayMs });
71
+ else if (action.kind === "press") {
72
+ for (const keys of action.keys) action.target ? await locator.press(keys) : await page.keyboard.press(keys);
73
+ } else if (action.kind === "select") await locator.selectOption(action.option);
74
+ else if (action.kind === "toggle") await locator.setChecked(action.checked);
75
+ else if (action.kind === "scroll") {
76
+ const result = await (0, import_scrolling_executor.executeScroll)(page, action.command);
77
+ if (!result.ok) return result;
78
+ diagnostics.push(`scroll steps=${result.value.steps}`);
79
+ } else if (action.kind === "back") await page.goBack({ timeout: options?.timeoutMs });
80
+ else if (action.kind === "forward") await page.goForward({ timeout: options?.timeoutMs });
81
+ else if (action.kind === "reload") await page.reload({ timeout: options?.timeoutMs });
82
+ else {
83
+ const result = await (0, import_waits_executor.awaitCondition)(page, action.condition, { timeoutMs: options?.timeoutMs });
84
+ if (!result.ok) return result;
85
+ diagnostics.push(`waitedMs=${result.value.waitedMs}`);
86
+ }
87
+ const postcondition = armedWait ? await armedWait : options?.wait ? await (0, import_waits_executor.awaitCondition)(page, options.wait, { timeoutMs: options.timeoutMs }) : void 0;
88
+ if (postcondition && !postcondition.ok) return (0, import_errors.automationError)(postcondition.error.code, postcondition.error.message, { requiredAction: postcondition.error.requiredAction, details: postcondition.error.details });
89
+ const after = await readTarget(page, before);
90
+ const changes = deriveReceiptChanges(before, after);
91
+ return (0, import_errors.automationOk)({ actionId: `action-${nextActionId++}`, targetBefore: before, targetAfter: after, routeBefore: before.currentRoute, routeAfter: after.currentRoute, startedAt: startedAt.toISOString(), durationMs: Date.now() - startedAt.getTime(), actionability: target ? "passed" : "bypassed", ...changes, diagnostics });
92
+ } catch (error) {
93
+ return (0, import_errors.automationError)("ACTION_FAILED", `Action ${action.kind} failed.`, { details: { cause: error instanceof Error ? error.message : String(error), diagnostics } });
94
+ }
95
+ }
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ deriveReceiptChanges,
99
+ executeAction
100
+ });
101
+ //# sourceMappingURL=actions_executor.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/automation/actions_executor.ts"],"sourcesContent":["import type { Page } from 'playwright';\nimport type { WoodAutomationAction } from './actions.cjs';\nimport { automationError, automationOk, type WoodAutomationResult } from './errors.cjs';\nimport { formatRoute, readAutomationSnapshot } from './introspection_reader.cjs';\nimport { describeLocator, toPlaywrightLocator, type WoodLocator } from './locator.cjs';\nimport type { WoodActionReceipt } from './receipts.cjs';\nimport { executeScroll } from './scrolling_executor.cjs';\nimport type { WoodLiveTarget } from './target_identity.cjs';\nimport { awaitCondition } from './waits_executor.cjs';\nimport type { WoodWaitCondition } from './waits.cjs';\n\nlet nextActionId = 1;\nasync function readTarget(page: Page, previous?: WoodLiveTarget): Promise<WoodLiveTarget> {\n const snapshot = await readAutomationSnapshot(page);\n const url = page.url();\n const title = await page.title();\n const currentRoute = formatRoute(snapshot?.currentRoute ?? null);\n return { targetId: previous?.targetId ?? 'page', windowId: snapshot?.windowId ?? previous?.windowId ?? null, pageGeneration: previous?.pageGeneration ?? 0, url, title, ...(currentRoute ? { currentRoute } : {}), woodBridgePresent: snapshot !== null, eligible: true };\n}\nexport function deriveReceiptChanges(before: WoodLiveTarget, after: WoodLiveTarget): Pick<WoodActionReceipt, 'changedDocument' | 'changedTarget' | 'changedRoute'> {\n return { changedDocument: before.url !== after.url || before.title !== after.title, changedTarget: before.targetId !== after.targetId || before.windowId !== after.windowId || before.pageGeneration !== after.pageGeneration, changedRoute: before.currentRoute !== after.currentRoute };\n}\nasync function actionable(page: Page, target: WoodLocator): Promise<WoodAutomationResult<ReturnType<typeof toPlaywrightLocator>>> {\n const locator = toPlaywrightLocator(page, target);\n const count = await locator.count();\n if (count !== 1) {\n const visibility = await Promise.all(Array.from({ length: count }, (_, index) => locator.nth(index).isVisible().catch(() => false)));\n return automationError('LOCATOR_INVALID', `Expected exactly one actionable match for ${describeLocator(target)}, found ${count}.`, { details: { matchCount: count, candidateVisibility: visibility } });\n }\n return automationOk(locator);\n}\nfunction actionTarget(action: WoodAutomationAction): WoodLocator | undefined {\n return 'target' in action ? action.target : undefined;\n}\nexport async function executeAction(page: Page, action: WoodAutomationAction, options?: { wait?: WoodWaitCondition; timeoutMs?: number }): Promise<WoodAutomationResult<WoodActionReceipt>> {\n const startedAt = new Date();\n const before = await readTarget(page);\n const diagnostics: string[] = [];\n const eventLike = options?.wait && (options.wait.kind === 'route' || options.wait.kind === 'url' || options.wait.kind === 'target' || options.wait.kind === 'trace');\n const armedWait = eventLike && options?.wait ? awaitCondition(page, options.wait, { timeoutMs: options.timeoutMs }) : undefined;\n try {\n const target = actionTarget(action);\n let locator;\n if (target) {\n const result = await actionable(page, target);\n if (!result.ok) return result;\n locator = result.value;\n }\n if (action.kind === 'click') await locator!.click({ button: action.button });\n else if (action.kind === 'double_click') await locator!.dblclick();\n else if (action.kind === 'fill') await locator!.fill(action.value);\n else if (action.kind === 'type') await locator!.pressSequentially(action.value, { delay: action.delayMs });\n else if (action.kind === 'press') {\n for (const keys of action.keys) action.target ? await locator!.press(keys) : await page.keyboard.press(keys);\n } else if (action.kind === 'select') await locator!.selectOption(action.option);\n else if (action.kind === 'toggle') await locator!.setChecked(action.checked);\n else if (action.kind === 'scroll') {\n const result = await executeScroll(page, action.command);\n if (!result.ok) return result;\n diagnostics.push(`scroll steps=${result.value.steps}`);\n } else if (action.kind === 'back') await page.goBack({ timeout: options?.timeoutMs });\n else if (action.kind === 'forward') await page.goForward({ timeout: options?.timeoutMs });\n else if (action.kind === 'reload') await page.reload({ timeout: options?.timeoutMs });\n else {\n const result = await awaitCondition(page, action.condition, { timeoutMs: options?.timeoutMs });\n if (!result.ok) return result;\n diagnostics.push(`waitedMs=${result.value.waitedMs}`);\n }\n const postcondition = armedWait ? await armedWait : (options?.wait ? await awaitCondition(page, options.wait, { timeoutMs: options.timeoutMs }) : undefined);\n if (postcondition && !postcondition.ok) return automationError(postcondition.error.code, postcondition.error.message, { requiredAction: postcondition.error.requiredAction, details: postcondition.error.details });\n const after = await readTarget(page, before);\n const changes = deriveReceiptChanges(before, after);\n return automationOk({ actionId: `action-${nextActionId++}`, targetBefore: before, targetAfter: after, routeBefore: before.currentRoute, routeAfter: after.currentRoute, startedAt: startedAt.toISOString(), durationMs: Date.now() - startedAt.getTime(), actionability: target ? 'passed' : 'bypassed', ...changes, diagnostics });\n } catch (error) {\n return automationError('ACTION_FAILED', `Action ${action.kind} failed.`, { details: { cause: error instanceof Error ? error.message : String(error), diagnostics } });\n }\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,16 @@
1
+ import { Page } from 'playwright';
2
+ import { WoodAutomationAction } from './actions.cjs';
3
+ import { WoodAutomationResult } from './errors.cjs';
4
+ import { WoodActionReceipt } from './receipts.cjs';
5
+ import { WoodLiveTarget } from './target_identity.cjs';
6
+ import { WoodWaitCondition } from './waits.cjs';
7
+ import './locator.cjs';
8
+ import './scrolling.cjs';
9
+
10
+ declare function deriveReceiptChanges(before: WoodLiveTarget, after: WoodLiveTarget): Pick<WoodActionReceipt, 'changedDocument' | 'changedTarget' | 'changedRoute'>;
11
+ declare function executeAction(page: Page, action: WoodAutomationAction, options?: {
12
+ wait?: WoodWaitCondition;
13
+ timeoutMs?: number;
14
+ }): Promise<WoodAutomationResult<WoodActionReceipt>>;
15
+
16
+ export { deriveReceiptChanges, executeAction };
@@ -0,0 +1,16 @@
1
+ import { Page } from 'playwright';
2
+ import { WoodAutomationAction } from './actions.js';
3
+ import { WoodAutomationResult } from './errors.js';
4
+ import { WoodActionReceipt } from './receipts.js';
5
+ import { WoodLiveTarget } from './target_identity.js';
6
+ import { WoodWaitCondition } from './waits.js';
7
+ import './locator.js';
8
+ import './scrolling.js';
9
+
10
+ declare function deriveReceiptChanges(before: WoodLiveTarget, after: WoodLiveTarget): Pick<WoodActionReceipt, 'changedDocument' | 'changedTarget' | 'changedRoute'>;
11
+ declare function executeAction(page: Page, action: WoodAutomationAction, options?: {
12
+ wait?: WoodWaitCondition;
13
+ timeoutMs?: number;
14
+ }): Promise<WoodAutomationResult<WoodActionReceipt>>;
15
+
16
+ export { deriveReceiptChanges, executeAction };
@@ -0,0 +1,76 @@
1
+ import { automationError, automationOk } from "./errors.js";
2
+ import { formatRoute, readAutomationSnapshot } from "./introspection_reader.js";
3
+ import { describeLocator, toPlaywrightLocator } from "./locator.js";
4
+ import { executeScroll } from "./scrolling_executor.js";
5
+ import { awaitCondition } from "./waits_executor.js";
6
+ let nextActionId = 1;
7
+ async function readTarget(page, previous) {
8
+ const snapshot = await readAutomationSnapshot(page);
9
+ const url = page.url();
10
+ const title = await page.title();
11
+ const currentRoute = formatRoute(snapshot?.currentRoute ?? null);
12
+ return { targetId: previous?.targetId ?? "page", windowId: snapshot?.windowId ?? previous?.windowId ?? null, pageGeneration: previous?.pageGeneration ?? 0, url, title, ...currentRoute ? { currentRoute } : {}, woodBridgePresent: snapshot !== null, eligible: true };
13
+ }
14
+ function deriveReceiptChanges(before, after) {
15
+ return { changedDocument: before.url !== after.url || before.title !== after.title, changedTarget: before.targetId !== after.targetId || before.windowId !== after.windowId || before.pageGeneration !== after.pageGeneration, changedRoute: before.currentRoute !== after.currentRoute };
16
+ }
17
+ async function actionable(page, target) {
18
+ const locator = toPlaywrightLocator(page, target);
19
+ const count = await locator.count();
20
+ if (count !== 1) {
21
+ const visibility = await Promise.all(Array.from({ length: count }, (_, index) => locator.nth(index).isVisible().catch(() => false)));
22
+ return automationError("LOCATOR_INVALID", `Expected exactly one actionable match for ${describeLocator(target)}, found ${count}.`, { details: { matchCount: count, candidateVisibility: visibility } });
23
+ }
24
+ return automationOk(locator);
25
+ }
26
+ function actionTarget(action) {
27
+ return "target" in action ? action.target : void 0;
28
+ }
29
+ async function executeAction(page, action, options) {
30
+ const startedAt = /* @__PURE__ */ new Date();
31
+ const before = await readTarget(page);
32
+ const diagnostics = [];
33
+ const eventLike = options?.wait && (options.wait.kind === "route" || options.wait.kind === "url" || options.wait.kind === "target" || options.wait.kind === "trace");
34
+ const armedWait = eventLike && options?.wait ? awaitCondition(page, options.wait, { timeoutMs: options.timeoutMs }) : void 0;
35
+ try {
36
+ const target = actionTarget(action);
37
+ let locator;
38
+ if (target) {
39
+ const result = await actionable(page, target);
40
+ if (!result.ok) return result;
41
+ locator = result.value;
42
+ }
43
+ if (action.kind === "click") await locator.click({ button: action.button });
44
+ else if (action.kind === "double_click") await locator.dblclick();
45
+ else if (action.kind === "fill") await locator.fill(action.value);
46
+ else if (action.kind === "type") await locator.pressSequentially(action.value, { delay: action.delayMs });
47
+ else if (action.kind === "press") {
48
+ for (const keys of action.keys) action.target ? await locator.press(keys) : await page.keyboard.press(keys);
49
+ } else if (action.kind === "select") await locator.selectOption(action.option);
50
+ else if (action.kind === "toggle") await locator.setChecked(action.checked);
51
+ else if (action.kind === "scroll") {
52
+ const result = await executeScroll(page, action.command);
53
+ if (!result.ok) return result;
54
+ diagnostics.push(`scroll steps=${result.value.steps}`);
55
+ } else if (action.kind === "back") await page.goBack({ timeout: options?.timeoutMs });
56
+ else if (action.kind === "forward") await page.goForward({ timeout: options?.timeoutMs });
57
+ else if (action.kind === "reload") await page.reload({ timeout: options?.timeoutMs });
58
+ else {
59
+ const result = await awaitCondition(page, action.condition, { timeoutMs: options?.timeoutMs });
60
+ if (!result.ok) return result;
61
+ diagnostics.push(`waitedMs=${result.value.waitedMs}`);
62
+ }
63
+ const postcondition = armedWait ? await armedWait : options?.wait ? await awaitCondition(page, options.wait, { timeoutMs: options.timeoutMs }) : void 0;
64
+ if (postcondition && !postcondition.ok) return automationError(postcondition.error.code, postcondition.error.message, { requiredAction: postcondition.error.requiredAction, details: postcondition.error.details });
65
+ const after = await readTarget(page, before);
66
+ const changes = deriveReceiptChanges(before, after);
67
+ return automationOk({ actionId: `action-${nextActionId++}`, targetBefore: before, targetAfter: after, routeBefore: before.currentRoute, routeAfter: after.currentRoute, startedAt: startedAt.toISOString(), durationMs: Date.now() - startedAt.getTime(), actionability: target ? "passed" : "bypassed", ...changes, diagnostics });
68
+ } catch (error) {
69
+ return automationError("ACTION_FAILED", `Action ${action.kind} failed.`, { details: { cause: error instanceof Error ? error.message : String(error), diagnostics } });
70
+ }
71
+ }
72
+ export {
73
+ deriveReceiptChanges,
74
+ executeAction
75
+ };
76
+ //# sourceMappingURL=actions_executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/automation/actions_executor.ts"],"sourcesContent":["import type { Page } from 'playwright';\nimport type { WoodAutomationAction } from './actions.js';\nimport { automationError, automationOk, type WoodAutomationResult } from './errors.js';\nimport { formatRoute, readAutomationSnapshot } from './introspection_reader.js';\nimport { describeLocator, toPlaywrightLocator, type WoodLocator } from './locator.js';\nimport type { WoodActionReceipt } from './receipts.js';\nimport { executeScroll } from './scrolling_executor.js';\nimport type { WoodLiveTarget } from './target_identity.js';\nimport { awaitCondition } from './waits_executor.js';\nimport type { WoodWaitCondition } from './waits.js';\n\nlet nextActionId = 1;\nasync function readTarget(page: Page, previous?: WoodLiveTarget): Promise<WoodLiveTarget> {\n const snapshot = await readAutomationSnapshot(page);\n const url = page.url();\n const title = await page.title();\n const currentRoute = formatRoute(snapshot?.currentRoute ?? null);\n return { targetId: previous?.targetId ?? 'page', windowId: snapshot?.windowId ?? previous?.windowId ?? null, pageGeneration: previous?.pageGeneration ?? 0, url, title, ...(currentRoute ? { currentRoute } : {}), woodBridgePresent: snapshot !== null, eligible: true };\n}\nexport function deriveReceiptChanges(before: WoodLiveTarget, after: WoodLiveTarget): Pick<WoodActionReceipt, 'changedDocument' | 'changedTarget' | 'changedRoute'> {\n return { changedDocument: before.url !== after.url || before.title !== after.title, changedTarget: before.targetId !== after.targetId || before.windowId !== after.windowId || before.pageGeneration !== after.pageGeneration, changedRoute: before.currentRoute !== after.currentRoute };\n}\nasync function actionable(page: Page, target: WoodLocator): Promise<WoodAutomationResult<ReturnType<typeof toPlaywrightLocator>>> {\n const locator = toPlaywrightLocator(page, target);\n const count = await locator.count();\n if (count !== 1) {\n const visibility = await Promise.all(Array.from({ length: count }, (_, index) => locator.nth(index).isVisible().catch(() => false)));\n return automationError('LOCATOR_INVALID', `Expected exactly one actionable match for ${describeLocator(target)}, found ${count}.`, { details: { matchCount: count, candidateVisibility: visibility } });\n }\n return automationOk(locator);\n}\nfunction actionTarget(action: WoodAutomationAction): WoodLocator | undefined {\n return 'target' in action ? action.target : undefined;\n}\nexport async function executeAction(page: Page, action: WoodAutomationAction, options?: { wait?: WoodWaitCondition; timeoutMs?: number }): Promise<WoodAutomationResult<WoodActionReceipt>> {\n const startedAt = new Date();\n const before = await readTarget(page);\n const diagnostics: string[] = [];\n const eventLike = options?.wait && (options.wait.kind === 'route' || options.wait.kind === 'url' || options.wait.kind === 'target' || options.wait.kind === 'trace');\n const armedWait = eventLike && options?.wait ? awaitCondition(page, options.wait, { timeoutMs: options.timeoutMs }) : undefined;\n try {\n const target = actionTarget(action);\n let locator;\n if (target) {\n const result = await actionable(page, target);\n if (!result.ok) return result;\n locator = result.value;\n }\n if (action.kind === 'click') await locator!.click({ button: action.button });\n else if (action.kind === 'double_click') await locator!.dblclick();\n else if (action.kind === 'fill') await locator!.fill(action.value);\n else if (action.kind === 'type') await locator!.pressSequentially(action.value, { delay: action.delayMs });\n else if (action.kind === 'press') {\n for (const keys of action.keys) action.target ? await locator!.press(keys) : await page.keyboard.press(keys);\n } else if (action.kind === 'select') await locator!.selectOption(action.option);\n else if (action.kind === 'toggle') await locator!.setChecked(action.checked);\n else if (action.kind === 'scroll') {\n const result = await executeScroll(page, action.command);\n if (!result.ok) return result;\n diagnostics.push(`scroll steps=${result.value.steps}`);\n } else if (action.kind === 'back') await page.goBack({ timeout: options?.timeoutMs });\n else if (action.kind === 'forward') await page.goForward({ timeout: options?.timeoutMs });\n else if (action.kind === 'reload') await page.reload({ timeout: options?.timeoutMs });\n else {\n const result = await awaitCondition(page, action.condition, { timeoutMs: options?.timeoutMs });\n if (!result.ok) return result;\n diagnostics.push(`waitedMs=${result.value.waitedMs}`);\n }\n const postcondition = armedWait ? await armedWait : (options?.wait ? await awaitCondition(page, options.wait, { timeoutMs: options.timeoutMs }) : undefined);\n if (postcondition && !postcondition.ok) return automationError(postcondition.error.code, postcondition.error.message, { requiredAction: postcondition.error.requiredAction, details: postcondition.error.details });\n const after = await readTarget(page, before);\n const changes = deriveReceiptChanges(before, after);\n return automationOk({ actionId: `action-${nextActionId++}`, targetBefore: before, targetAfter: after, routeBefore: before.currentRoute, routeAfter: after.currentRoute, startedAt: startedAt.toISOString(), durationMs: Date.now() - startedAt.getTime(), actionability: target ? 'passed' : 'bypassed', ...changes, diagnostics });\n } catch (error) {\n return automationError('ACTION_FAILED', `Action ${action.kind} failed.`, { details: { cause: error instanceof Error ? error.message : String(error), diagnostics } });\n }\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var connection_exports = {};
30
+ __export(connection_exports, {
31
+ connectToWoodApp: () => connectToWoodApp,
32
+ readDevMetadata: () => readDevMetadata
33
+ });
34
+ module.exports = __toCommonJS(connection_exports);
35
+ var import_dev_metadata = require("../dev/dev_metadata.cjs");
36
+ var import_errors = require("./errors.cjs");
37
+ async function loadPlaywright() {
38
+ try {
39
+ return (0, import_errors.automationOk)(await import("playwright"));
40
+ } catch (error) {
41
+ const message = error instanceof Error ? error.message : String(error);
42
+ return (0, import_errors.automationError)("PLAYWRIGHT_UNAVAILABLE", `Playwright is not installed in this environment. ${message}`, {
43
+ requiredAction: "Install playwright as a dev dependency of the app project."
44
+ });
45
+ }
46
+ }
47
+ function readDevMetadata(projectRoot) {
48
+ try {
49
+ return (0, import_errors.automationOk)((0, import_dev_metadata.readWoodDevMetadata)(projectRoot));
50
+ } catch (error) {
51
+ const message = error instanceof Error ? error.message : String(error);
52
+ const requiredAction = message.includes("wood dev") ? void 0 : 'Start the app with "wood dev" first.';
53
+ return (0, import_errors.automationError)("DEV_METADATA_MISSING", message, requiredAction ? { requiredAction } : void 0);
54
+ }
55
+ }
56
+ async function connectToWoodApp(projectRoot = process.cwd()) {
57
+ const metadata = readDevMetadata(projectRoot);
58
+ if (!metadata.ok) {
59
+ return metadata;
60
+ }
61
+ const playwright = await loadPlaywright();
62
+ if (!playwright.ok) {
63
+ return playwright;
64
+ }
65
+ try {
66
+ const browser = await playwright.value.chromium.connectOverCDP(metadata.value.browserUrl);
67
+ return (0, import_errors.automationOk)({
68
+ browser,
69
+ metadata: metadata.value,
70
+ close: async () => {
71
+ await browser.close();
72
+ }
73
+ });
74
+ } catch (error) {
75
+ const message = error instanceof Error ? error.message : String(error);
76
+ return (0, import_errors.automationError)("CONNECT_FAILED", `Could not connect to ${metadata.value.browserUrl}. ${message}`, {
77
+ requiredAction: "Verify the wood dev app is still running and the debug port matches .wood/dev.json."
78
+ });
79
+ }
80
+ }
81
+ // Annotate the CommonJS export names for ESM import in node:
82
+ 0 && (module.exports = {
83
+ connectToWoodApp,
84
+ readDevMetadata
85
+ });
86
+ //# sourceMappingURL=connection.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/automation/connection.ts"],"sourcesContent":["/**\n * Connection to a running `wood dev` Electron app over CDP.\n * Extracted from bin/axe.js (AXE-WP-01); the CLI is now a thin adapter.\n */\n\nimport type { Browser } from 'playwright';\nimport { readWoodDevMetadata, type WoodDevMetadata } from '../dev/dev_metadata.cjs';\nimport { automationError, automationOk, type WoodAutomationResult } from './errors.cjs';\n\nexport interface WoodAutomationConnection {\n browser: Browser;\n metadata: WoodDevMetadata;\n close: () => Promise<void>;\n}\n\nasync function loadPlaywright(): Promise<WoodAutomationResult<typeof import('playwright')>> {\n try {\n return automationOk(await import('playwright'));\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return automationError('PLAYWRIGHT_UNAVAILABLE', `Playwright is not installed in this environment. ${message}`, {\n requiredAction: 'Install playwright as a dev dependency of the app project.',\n });\n }\n}\n\nexport function readDevMetadata(projectRoot: string): WoodAutomationResult<WoodDevMetadata> {\n try {\n return automationOk(readWoodDevMetadata(projectRoot));\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n // readWoodDevMetadata's own message already tells the user to run \"wood dev\".\n const requiredAction = message.includes('wood dev') ? undefined : 'Start the app with \"wood dev\" first.';\n return automationError('DEV_METADATA_MISSING', message, requiredAction ? { requiredAction } : undefined);\n }\n}\n\nexport async function connectToWoodApp(\n projectRoot: string = process.cwd(),\n): Promise<WoodAutomationResult<WoodAutomationConnection>> {\n const metadata = readDevMetadata(projectRoot);\n if (!metadata.ok) {\n return metadata;\n }\n\n const playwright = await loadPlaywright();\n if (!playwright.ok) {\n return playwright;\n }\n\n try {\n const browser = await playwright.value.chromium.connectOverCDP(metadata.value.browserUrl);\n return automationOk({\n browser,\n metadata: metadata.value,\n close: async () => {\n await browser.close();\n },\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return automationError('CONNECT_FAILED', `Could not connect to ${metadata.value.browserUrl}. ${message}`, {\n requiredAction: 'Verify the wood dev app is still running and the debug port matches .wood/dev.json.',\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,0BAA0D;AAC1D,oBAAyE;AAQzE,eAAe,iBAA6E;AAC1F,MAAI;AACF,eAAO,4BAAa,MAAM,OAAO,YAAY,CAAC;AAAA,EAChD,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,eAAO,+BAAgB,0BAA0B,oDAAoD,OAAO,IAAI;AAAA,MAC9G,gBAAgB;AAAA,IAClB,CAAC;AAAA,EACH;AACF;AAEO,SAAS,gBAAgB,aAA4D;AAC1F,MAAI;AACF,eAAO,gCAAa,yCAAoB,WAAW,CAAC;AAAA,EACtD,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAErE,UAAM,iBAAiB,QAAQ,SAAS,UAAU,IAAI,SAAY;AAClE,eAAO,+BAAgB,wBAAwB,SAAS,iBAAiB,EAAE,eAAe,IAAI,MAAS;AAAA,EACzG;AACF;AAEA,eAAsB,iBACpB,cAAsB,QAAQ,IAAI,GACuB;AACzD,QAAM,WAAW,gBAAgB,WAAW;AAC5C,MAAI,CAAC,SAAS,IAAI;AAChB,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,MAAM,eAAe;AACxC,MAAI,CAAC,WAAW,IAAI;AAClB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,UAAU,MAAM,WAAW,MAAM,SAAS,eAAe,SAAS,MAAM,UAAU;AACxF,eAAO,4BAAa;AAAA,MAClB;AAAA,MACA,UAAU,SAAS;AAAA,MACnB,OAAO,YAAY;AACjB,cAAM,QAAQ,MAAM;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,eAAO,+BAAgB,kBAAkB,wBAAwB,SAAS,MAAM,UAAU,KAAK,OAAO,IAAI;AAAA,MACxG,gBAAgB;AAAA,IAClB,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -0,0 +1,18 @@
1
+ import { Browser } from 'playwright';
2
+ import { WoodDevMetadata } from '../dev/dev_metadata.cjs';
3
+ import { WoodAutomationResult } from './errors.cjs';
4
+
5
+ /**
6
+ * Connection to a running `wood dev` Electron app over CDP.
7
+ * Extracted from bin/axe.js (AXE-WP-01); the CLI is now a thin adapter.
8
+ */
9
+
10
+ interface WoodAutomationConnection {
11
+ browser: Browser;
12
+ metadata: WoodDevMetadata;
13
+ close: () => Promise<void>;
14
+ }
15
+ declare function readDevMetadata(projectRoot: string): WoodAutomationResult<WoodDevMetadata>;
16
+ declare function connectToWoodApp(projectRoot?: string): Promise<WoodAutomationResult<WoodAutomationConnection>>;
17
+
18
+ export { type WoodAutomationConnection, connectToWoodApp, readDevMetadata };
@@ -0,0 +1,18 @@
1
+ import { Browser } from 'playwright';
2
+ import { WoodDevMetadata } from '../dev/dev_metadata.js';
3
+ import { WoodAutomationResult } from './errors.js';
4
+
5
+ /**
6
+ * Connection to a running `wood dev` Electron app over CDP.
7
+ * Extracted from bin/axe.js (AXE-WP-01); the CLI is now a thin adapter.
8
+ */
9
+
10
+ interface WoodAutomationConnection {
11
+ browser: Browser;
12
+ metadata: WoodDevMetadata;
13
+ close: () => Promise<void>;
14
+ }
15
+ declare function readDevMetadata(projectRoot: string): WoodAutomationResult<WoodDevMetadata>;
16
+ declare function connectToWoodApp(projectRoot?: string): Promise<WoodAutomationResult<WoodAutomationConnection>>;
17
+
18
+ export { type WoodAutomationConnection, connectToWoodApp, readDevMetadata };
@@ -0,0 +1,51 @@
1
+ import { readWoodDevMetadata } from "../dev/dev_metadata.js";
2
+ import { automationError, automationOk } from "./errors.js";
3
+ async function loadPlaywright() {
4
+ try {
5
+ return automationOk(await import("playwright"));
6
+ } catch (error) {
7
+ const message = error instanceof Error ? error.message : String(error);
8
+ return automationError("PLAYWRIGHT_UNAVAILABLE", `Playwright is not installed in this environment. ${message}`, {
9
+ requiredAction: "Install playwright as a dev dependency of the app project."
10
+ });
11
+ }
12
+ }
13
+ function readDevMetadata(projectRoot) {
14
+ try {
15
+ return automationOk(readWoodDevMetadata(projectRoot));
16
+ } catch (error) {
17
+ const message = error instanceof Error ? error.message : String(error);
18
+ const requiredAction = message.includes("wood dev") ? void 0 : 'Start the app with "wood dev" first.';
19
+ return automationError("DEV_METADATA_MISSING", message, requiredAction ? { requiredAction } : void 0);
20
+ }
21
+ }
22
+ async function connectToWoodApp(projectRoot = process.cwd()) {
23
+ const metadata = readDevMetadata(projectRoot);
24
+ if (!metadata.ok) {
25
+ return metadata;
26
+ }
27
+ const playwright = await loadPlaywright();
28
+ if (!playwright.ok) {
29
+ return playwright;
30
+ }
31
+ try {
32
+ const browser = await playwright.value.chromium.connectOverCDP(metadata.value.browserUrl);
33
+ return automationOk({
34
+ browser,
35
+ metadata: metadata.value,
36
+ close: async () => {
37
+ await browser.close();
38
+ }
39
+ });
40
+ } catch (error) {
41
+ const message = error instanceof Error ? error.message : String(error);
42
+ return automationError("CONNECT_FAILED", `Could not connect to ${metadata.value.browserUrl}. ${message}`, {
43
+ requiredAction: "Verify the wood dev app is still running and the debug port matches .wood/dev.json."
44
+ });
45
+ }
46
+ }
47
+ export {
48
+ connectToWoodApp,
49
+ readDevMetadata
50
+ };
51
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/automation/connection.ts"],"sourcesContent":["/**\n * Connection to a running `wood dev` Electron app over CDP.\n * Extracted from bin/axe.js (AXE-WP-01); the CLI is now a thin adapter.\n */\n\nimport type { Browser } from 'playwright';\nimport { readWoodDevMetadata, type WoodDevMetadata } from '../dev/dev_metadata.js';\nimport { automationError, automationOk, type WoodAutomationResult } from './errors.js';\n\nexport interface WoodAutomationConnection {\n browser: Browser;\n metadata: WoodDevMetadata;\n close: () => Promise<void>;\n}\n\nasync function loadPlaywright(): Promise<WoodAutomationResult<typeof import('playwright')>> {\n try {\n return automationOk(await import('playwright'));\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return automationError('PLAYWRIGHT_UNAVAILABLE', `Playwright is not installed in this environment. ${message}`, {\n requiredAction: 'Install playwright as a dev dependency of the app project.',\n });\n }\n}\n\nexport function readDevMetadata(projectRoot: string): WoodAutomationResult<WoodDevMetadata> {\n try {\n return automationOk(readWoodDevMetadata(projectRoot));\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n // readWoodDevMetadata's own message already tells the user to run \"wood dev\".\n const requiredAction = message.includes('wood dev') ? undefined : 'Start the app with \"wood dev\" first.';\n return automationError('DEV_METADATA_MISSING', message, requiredAction ? { requiredAction } : undefined);\n }\n}\n\nexport async function connectToWoodApp(\n projectRoot: string = process.cwd(),\n): Promise<WoodAutomationResult<WoodAutomationConnection>> {\n const metadata = readDevMetadata(projectRoot);\n if (!metadata.ok) {\n return metadata;\n }\n\n const playwright = await loadPlaywright();\n if (!playwright.ok) {\n return playwright;\n }\n\n try {\n const browser = await playwright.value.chromium.connectOverCDP(metadata.value.browserUrl);\n return automationOk({\n browser,\n metadata: metadata.value,\n close: async () => {\n await browser.close();\n },\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return automationError('CONNECT_FAILED', `Could not connect to ${metadata.value.browserUrl}. ${message}`, {\n requiredAction: 'Verify the wood dev app is still running and the debug port matches .wood/dev.json.',\n });\n }\n}\n"],"mappings":"AAMA,SAAS,2BAAiD;AAC1D,SAAS,iBAAiB,oBAA+C;AAQzE,eAAe,iBAA6E;AAC1F,MAAI;AACF,WAAO,aAAa,MAAM,OAAO,YAAY,CAAC;AAAA,EAChD,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,WAAO,gBAAgB,0BAA0B,oDAAoD,OAAO,IAAI;AAAA,MAC9G,gBAAgB;AAAA,IAClB,CAAC;AAAA,EACH;AACF;AAEO,SAAS,gBAAgB,aAA4D;AAC1F,MAAI;AACF,WAAO,aAAa,oBAAoB,WAAW,CAAC;AAAA,EACtD,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAErE,UAAM,iBAAiB,QAAQ,SAAS,UAAU,IAAI,SAAY;AAClE,WAAO,gBAAgB,wBAAwB,SAAS,iBAAiB,EAAE,eAAe,IAAI,MAAS;AAAA,EACzG;AACF;AAEA,eAAsB,iBACpB,cAAsB,QAAQ,IAAI,GACuB;AACzD,QAAM,WAAW,gBAAgB,WAAW;AAC5C,MAAI,CAAC,SAAS,IAAI;AAChB,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,MAAM,eAAe;AACxC,MAAI,CAAC,WAAW,IAAI;AAClB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,UAAU,MAAM,WAAW,MAAM,SAAS,eAAe,SAAS,MAAM,UAAU;AACxF,WAAO,aAAa;AAAA,MAClB;AAAA,MACA,UAAU,SAAS;AAAA,MACnB,OAAO,YAAY;AACjB,cAAM,QAAQ,MAAM;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,WAAO,gBAAgB,kBAAkB,wBAAwB,SAAS,MAAM,UAAU,KAAK,OAAO,IAAI;AAAA,MACxG,gBAAgB;AAAA,IAClB,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -16,32 +16,35 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var sequence_exports = {};
20
- __export(sequence_exports, {
21
- step1: () => step1,
22
- step2: () => step2,
23
- step3: () => step3
19
+ var errors_exports = {};
20
+ __export(errors_exports, {
21
+ automationError: () => automationError,
22
+ automationOk: () => automationOk,
23
+ describeAutomationError: () => describeAutomationError
24
24
  });
25
- module.exports = __toCommonJS(sequence_exports);
26
- function step1(ctx) {
27
- const order = ctx.get("order") ?? [];
28
- order.push("step1");
29
- ctx.set("order", order);
25
+ module.exports = __toCommonJS(errors_exports);
26
+ function automationOk(value) {
27
+ return { ok: true, value };
30
28
  }
31
- function step2(ctx) {
32
- const order = ctx.get("order") ?? [];
33
- order.push("step2");
34
- ctx.set("order", order);
29
+ function automationError(code, message, extra) {
30
+ return {
31
+ ok: false,
32
+ error: {
33
+ code,
34
+ message,
35
+ ...extra?.requiredAction ? { requiredAction: extra.requiredAction } : {},
36
+ ...extra?.details ? { details: extra.details } : {}
37
+ }
38
+ };
35
39
  }
36
- function step3(ctx) {
37
- const order = ctx.get("order") ?? [];
38
- order.push("step3");
39
- ctx.set("order", order);
40
+ function describeAutomationError(error) {
41
+ const action = error.requiredAction ? ` ${error.requiredAction}` : "";
42
+ return `[${error.code}] ${error.message}${action}`;
40
43
  }
41
44
  // Annotate the CommonJS export names for ESM import in node:
42
45
  0 && (module.exports = {
43
- step1,
44
- step2,
45
- step3
46
+ automationError,
47
+ automationOk,
48
+ describeAutomationError
46
49
  });
47
- //# sourceMappingURL=sequence.cjs.map
50
+ //# sourceMappingURL=errors.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/automation/errors.ts"],"sourcesContent":["/**\n * Classified error model for the Wood automation core (Axe).\n *\n * Every failure is a structured, classified value rather than a bare thrown\n * string, so the CLI, test adapters, and future scenario runner can render\n * and branch on the same shape.\n */\n\nexport type WoodAutomationErrorCode =\n | 'DEV_METADATA_MISSING'\n | 'PLAYWRIGHT_UNAVAILABLE'\n | 'CONNECT_FAILED'\n | 'NO_ELIGIBLE_TARGETS'\n | 'TARGET_NOT_FOUND'\n | 'TARGET_AMBIGUOUS'\n | 'LOCATOR_INVALID'\n | 'ACTION_FAILED'\n | 'UNSUPPORTED';\n\nexport interface WoodAutomationError {\n code: WoodAutomationErrorCode;\n message: string;\n /** What the caller should do to recover, when known. */\n requiredAction?: string;\n /** Bounded structured context (candidate windowIds, selector, etc.). */\n details?: Record<string, unknown>;\n}\n\nexport type WoodAutomationResult<T> =\n | { ok: true; value: T }\n | { ok: false; error: WoodAutomationError };\n\nexport function automationOk<T>(value: T): WoodAutomationResult<T> {\n return { ok: true, value };\n}\n\nexport function automationError<T = never>(\n code: WoodAutomationErrorCode,\n message: string,\n extra?: { requiredAction?: string; details?: Record<string, unknown> },\n): WoodAutomationResult<T> {\n return {\n ok: false,\n error: {\n code,\n message,\n ...(extra?.requiredAction ? { requiredAction: extra.requiredAction } : {}),\n ...(extra?.details ? { details: extra.details } : {}),\n },\n };\n}\n\nexport function describeAutomationError(error: WoodAutomationError): string {\n const action = error.requiredAction ? ` ${error.requiredAction}` : '';\n return `[${error.code}] ${error.message}${action}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCO,SAAS,aAAgB,OAAmC;AACjE,SAAO,EAAE,IAAI,MAAM,MAAM;AAC3B;AAEO,SAAS,gBACd,MACA,SACA,OACyB;AACzB,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,GAAI,OAAO,iBAAiB,EAAE,gBAAgB,MAAM,eAAe,IAAI,CAAC;AAAA,MACxE,GAAI,OAAO,UAAU,EAAE,SAAS,MAAM,QAAQ,IAAI,CAAC;AAAA,IACrD;AAAA,EACF;AACF;AAEO,SAAS,wBAAwB,OAAoC;AAC1E,QAAM,SAAS,MAAM,iBAAiB,IAAI,MAAM,cAAc,KAAK;AACnE,SAAO,IAAI,MAAM,IAAI,KAAK,MAAM,OAAO,GAAG,MAAM;AAClD;","names":[]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Classified error model for the Wood automation core (Axe).
3
+ *
4
+ * Every failure is a structured, classified value rather than a bare thrown
5
+ * string, so the CLI, test adapters, and future scenario runner can render
6
+ * and branch on the same shape.
7
+ */
8
+ type WoodAutomationErrorCode = 'DEV_METADATA_MISSING' | 'PLAYWRIGHT_UNAVAILABLE' | 'CONNECT_FAILED' | 'NO_ELIGIBLE_TARGETS' | 'TARGET_NOT_FOUND' | 'TARGET_AMBIGUOUS' | 'LOCATOR_INVALID' | 'ACTION_FAILED' | 'UNSUPPORTED';
9
+ interface WoodAutomationError {
10
+ code: WoodAutomationErrorCode;
11
+ message: string;
12
+ /** What the caller should do to recover, when known. */
13
+ requiredAction?: string;
14
+ /** Bounded structured context (candidate windowIds, selector, etc.). */
15
+ details?: Record<string, unknown>;
16
+ }
17
+ type WoodAutomationResult<T> = {
18
+ ok: true;
19
+ value: T;
20
+ } | {
21
+ ok: false;
22
+ error: WoodAutomationError;
23
+ };
24
+ declare function automationOk<T>(value: T): WoodAutomationResult<T>;
25
+ declare function automationError<T = never>(code: WoodAutomationErrorCode, message: string, extra?: {
26
+ requiredAction?: string;
27
+ details?: Record<string, unknown>;
28
+ }): WoodAutomationResult<T>;
29
+ declare function describeAutomationError(error: WoodAutomationError): string;
30
+
31
+ export { type WoodAutomationError, type WoodAutomationErrorCode, type WoodAutomationResult, automationError, automationOk, describeAutomationError };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Classified error model for the Wood automation core (Axe).
3
+ *
4
+ * Every failure is a structured, classified value rather than a bare thrown
5
+ * string, so the CLI, test adapters, and future scenario runner can render
6
+ * and branch on the same shape.
7
+ */
8
+ type WoodAutomationErrorCode = 'DEV_METADATA_MISSING' | 'PLAYWRIGHT_UNAVAILABLE' | 'CONNECT_FAILED' | 'NO_ELIGIBLE_TARGETS' | 'TARGET_NOT_FOUND' | 'TARGET_AMBIGUOUS' | 'LOCATOR_INVALID' | 'ACTION_FAILED' | 'UNSUPPORTED';
9
+ interface WoodAutomationError {
10
+ code: WoodAutomationErrorCode;
11
+ message: string;
12
+ /** What the caller should do to recover, when known. */
13
+ requiredAction?: string;
14
+ /** Bounded structured context (candidate windowIds, selector, etc.). */
15
+ details?: Record<string, unknown>;
16
+ }
17
+ type WoodAutomationResult<T> = {
18
+ ok: true;
19
+ value: T;
20
+ } | {
21
+ ok: false;
22
+ error: WoodAutomationError;
23
+ };
24
+ declare function automationOk<T>(value: T): WoodAutomationResult<T>;
25
+ declare function automationError<T = never>(code: WoodAutomationErrorCode, message: string, extra?: {
26
+ requiredAction?: string;
27
+ details?: Record<string, unknown>;
28
+ }): WoodAutomationResult<T>;
29
+ declare function describeAutomationError(error: WoodAutomationError): string;
30
+
31
+ export { type WoodAutomationError, type WoodAutomationErrorCode, type WoodAutomationResult, automationError, automationOk, describeAutomationError };
@@ -0,0 +1,24 @@
1
+ function automationOk(value) {
2
+ return { ok: true, value };
3
+ }
4
+ function automationError(code, message, extra) {
5
+ return {
6
+ ok: false,
7
+ error: {
8
+ code,
9
+ message,
10
+ ...extra?.requiredAction ? { requiredAction: extra.requiredAction } : {},
11
+ ...extra?.details ? { details: extra.details } : {}
12
+ }
13
+ };
14
+ }
15
+ function describeAutomationError(error) {
16
+ const action = error.requiredAction ? ` ${error.requiredAction}` : "";
17
+ return `[${error.code}] ${error.message}${action}`;
18
+ }
19
+ export {
20
+ automationError,
21
+ automationOk,
22
+ describeAutomationError
23
+ };
24
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/automation/errors.ts"],"sourcesContent":["/**\n * Classified error model for the Wood automation core (Axe).\n *\n * Every failure is a structured, classified value rather than a bare thrown\n * string, so the CLI, test adapters, and future scenario runner can render\n * and branch on the same shape.\n */\n\nexport type WoodAutomationErrorCode =\n | 'DEV_METADATA_MISSING'\n | 'PLAYWRIGHT_UNAVAILABLE'\n | 'CONNECT_FAILED'\n | 'NO_ELIGIBLE_TARGETS'\n | 'TARGET_NOT_FOUND'\n | 'TARGET_AMBIGUOUS'\n | 'LOCATOR_INVALID'\n | 'ACTION_FAILED'\n | 'UNSUPPORTED';\n\nexport interface WoodAutomationError {\n code: WoodAutomationErrorCode;\n message: string;\n /** What the caller should do to recover, when known. */\n requiredAction?: string;\n /** Bounded structured context (candidate windowIds, selector, etc.). */\n details?: Record<string, unknown>;\n}\n\nexport type WoodAutomationResult<T> =\n | { ok: true; value: T }\n | { ok: false; error: WoodAutomationError };\n\nexport function automationOk<T>(value: T): WoodAutomationResult<T> {\n return { ok: true, value };\n}\n\nexport function automationError<T = never>(\n code: WoodAutomationErrorCode,\n message: string,\n extra?: { requiredAction?: string; details?: Record<string, unknown> },\n): WoodAutomationResult<T> {\n return {\n ok: false,\n error: {\n code,\n message,\n ...(extra?.requiredAction ? { requiredAction: extra.requiredAction } : {}),\n ...(extra?.details ? { details: extra.details } : {}),\n },\n };\n}\n\nexport function describeAutomationError(error: WoodAutomationError): string {\n const action = error.requiredAction ? ` ${error.requiredAction}` : '';\n return `[${error.code}] ${error.message}${action}`;\n}\n"],"mappings":"AAgCO,SAAS,aAAgB,OAAmC;AACjE,SAAO,EAAE,IAAI,MAAM,MAAM;AAC3B;AAEO,SAAS,gBACd,MACA,SACA,OACyB;AACzB,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,GAAI,OAAO,iBAAiB,EAAE,gBAAgB,MAAM,eAAe,IAAI,CAAC;AAAA,MACxE,GAAI,OAAO,UAAU,EAAE,SAAS,MAAM,QAAQ,IAAI,CAAC;AAAA,IACrD;AAAA,EACF;AACF;AAEO,SAAS,wBAAwB,OAAoC;AAC1E,QAAM,SAAS,MAAM,iBAAiB,IAAI,MAAM,cAAc,KAAK;AACnE,SAAO,IAAI,MAAM,IAAI,KAAK,MAAM,OAAO,GAAG,MAAM;AAClD;","names":[]}