@agentrhq/webcmd 0.1.1 → 0.1.2

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 (415) hide show
  1. package/README.md +317 -24
  2. package/dist/src/adapter-shadow.d.ts +11 -0
  3. package/dist/src/adapter-shadow.js +72 -0
  4. package/dist/src/adapter-shadow.test.d.ts +1 -0
  5. package/dist/src/adapter-shadow.test.js +49 -0
  6. package/dist/src/adapter-source.d.ts +11 -0
  7. package/dist/src/adapter-source.js +24 -0
  8. package/dist/src/adapter-source.test.d.ts +1 -0
  9. package/dist/src/adapter-source.test.js +29 -0
  10. package/dist/src/brand.d.ts +9 -0
  11. package/dist/src/brand.js +9 -0
  12. package/dist/src/brand.test.d.ts +1 -0
  13. package/dist/src/brand.test.js +15 -0
  14. package/dist/src/browser/analyze.d.ts +118 -0
  15. package/dist/src/browser/analyze.js +405 -0
  16. package/dist/src/browser/analyze.test.d.ts +1 -0
  17. package/dist/src/browser/analyze.test.js +209 -0
  18. package/dist/src/browser/article-extract.d.ts +57 -0
  19. package/dist/src/browser/article-extract.e2e.test.d.ts +1 -0
  20. package/dist/src/browser/article-extract.e2e.test.js +105 -0
  21. package/dist/src/browser/article-extract.js +169 -0
  22. package/dist/src/browser/article-extract.test.d.ts +1 -0
  23. package/dist/src/browser/article-extract.test.js +94 -0
  24. package/dist/src/browser/ax-snapshot.d.ts +37 -0
  25. package/dist/src/browser/ax-snapshot.js +217 -0
  26. package/dist/src/browser/ax-snapshot.test.d.ts +1 -0
  27. package/dist/src/browser/ax-snapshot.test.js +91 -0
  28. package/dist/src/browser/base-page.d.ts +151 -0
  29. package/dist/src/browser/base-page.js +1060 -0
  30. package/dist/src/browser/base-page.test.d.ts +1 -0
  31. package/dist/src/browser/base-page.test.js +803 -0
  32. package/dist/src/browser/bridge-readiness.d.ts +14 -0
  33. package/dist/src/browser/bridge-readiness.js +24 -0
  34. package/dist/src/browser/bridge-readiness.test.d.ts +1 -0
  35. package/dist/src/browser/bridge-readiness.test.js +58 -0
  36. package/dist/src/browser/bridge.d.ts +26 -0
  37. package/dist/src/browser/bridge.js +58 -0
  38. package/dist/src/browser/cdp-click-fixture.test.d.ts +1 -0
  39. package/dist/src/browser/cdp-click-fixture.test.js +87 -0
  40. package/dist/src/browser/cdp.d.ts +46 -0
  41. package/dist/src/browser/cdp.js +536 -0
  42. package/dist/src/browser/cdp.test.d.ts +1 -0
  43. package/dist/src/browser/cdp.test.js +79 -0
  44. package/dist/src/browser/compound.d.ts +59 -0
  45. package/dist/src/browser/compound.js +112 -0
  46. package/dist/src/browser/compound.test.d.ts +1 -0
  47. package/dist/src/browser/compound.test.js +175 -0
  48. package/dist/src/browser/config.d.ts +2 -0
  49. package/dist/src/browser/config.js +14 -0
  50. package/dist/src/browser/daemon-client.d.ts +32 -0
  51. package/dist/src/browser/daemon-client.js +135 -0
  52. package/dist/src/browser/daemon-client.test.d.ts +1 -0
  53. package/dist/src/browser/daemon-client.test.js +326 -0
  54. package/dist/src/browser/daemon-lifecycle.d.ts +37 -0
  55. package/dist/src/browser/daemon-lifecycle.js +147 -0
  56. package/dist/src/browser/daemon-transport.d.ts +54 -0
  57. package/dist/src/browser/daemon-transport.js +68 -0
  58. package/dist/src/browser/daemon-version.d.ts +4 -0
  59. package/dist/src/browser/daemon-version.js +12 -0
  60. package/dist/src/browser/dom-helpers.d.ts +41 -0
  61. package/dist/src/browser/dom-helpers.js +239 -0
  62. package/dist/src/browser/dom-helpers.test.d.ts +1 -0
  63. package/dist/src/browser/dom-helpers.test.js +106 -0
  64. package/dist/src/browser/dom-snapshot.d.ts +93 -0
  65. package/dist/src/browser/dom-snapshot.js +894 -0
  66. package/dist/src/browser/dom-snapshot.test.d.ts +11 -0
  67. package/dist/src/browser/dom-snapshot.test.js +313 -0
  68. package/dist/src/browser/errors.d.ts +38 -0
  69. package/dist/src/browser/errors.js +79 -0
  70. package/dist/src/browser/errors.test.d.ts +1 -0
  71. package/dist/src/browser/errors.test.js +60 -0
  72. package/dist/src/browser/extract.d.ts +69 -0
  73. package/dist/src/browser/extract.js +132 -0
  74. package/dist/src/browser/extract.test.d.ts +1 -0
  75. package/dist/src/browser/extract.test.js +129 -0
  76. package/dist/src/browser/find.d.ts +84 -0
  77. package/dist/src/browser/find.js +398 -0
  78. package/dist/src/browser/find.test.d.ts +1 -0
  79. package/dist/src/browser/find.test.js +180 -0
  80. package/dist/src/browser/html-tree.d.ts +75 -0
  81. package/dist/src/browser/html-tree.js +112 -0
  82. package/dist/src/browser/html-tree.test.d.ts +1 -0
  83. package/dist/src/browser/html-tree.test.js +181 -0
  84. package/dist/src/browser/index.d.ts +14 -0
  85. package/dist/src/browser/index.js +12 -0
  86. package/dist/src/browser/network-cache.d.ts +49 -0
  87. package/dist/src/browser/network-cache.js +78 -0
  88. package/dist/src/browser/network-cache.test.d.ts +1 -0
  89. package/dist/src/browser/network-cache.test.js +75 -0
  90. package/dist/src/browser/network-interceptor.d.ts +11 -0
  91. package/dist/src/browser/network-interceptor.js +11 -0
  92. package/dist/src/browser/network-key.d.ts +22 -0
  93. package/dist/src/browser/network-key.js +66 -0
  94. package/dist/src/browser/network-key.test.d.ts +1 -0
  95. package/dist/src/browser/network-key.test.js +49 -0
  96. package/dist/src/browser/page.d.ts +83 -0
  97. package/dist/src/browser/page.js +453 -0
  98. package/dist/src/browser/page.test.d.ts +1 -0
  99. package/dist/src/browser/page.test.js +406 -0
  100. package/dist/src/browser/profile.d.ts +14 -0
  101. package/dist/src/browser/profile.js +86 -0
  102. package/dist/src/browser/protocol.d.ts +63 -0
  103. package/dist/src/browser/protocol.js +1 -0
  104. package/dist/src/browser/runtime/local-cloak/actions.d.ts +3 -0
  105. package/dist/src/browser/runtime/local-cloak/actions.js +240 -0
  106. package/dist/src/browser/runtime/local-cloak/downloads.d.ts +3 -0
  107. package/dist/src/browser/runtime/local-cloak/downloads.js +28 -0
  108. package/dist/src/browser/runtime/local-cloak/network.d.ts +28 -0
  109. package/dist/src/browser/runtime/local-cloak/network.js +120 -0
  110. package/dist/src/browser/runtime/local-cloak/network.test.d.ts +1 -0
  111. package/dist/src/browser/runtime/local-cloak/network.test.js +124 -0
  112. package/dist/src/browser/runtime/local-cloak/profiles.d.ts +6 -0
  113. package/dist/src/browser/runtime/local-cloak/profiles.js +17 -0
  114. package/dist/src/browser/runtime/local-cloak/profiles.test.d.ts +1 -0
  115. package/dist/src/browser/runtime/local-cloak/profiles.test.js +19 -0
  116. package/dist/src/browser/runtime/local-cloak/provider.d.ts +15 -0
  117. package/dist/src/browser/runtime/local-cloak/provider.js +27 -0
  118. package/dist/src/browser/runtime/local-cloak/provider.test.d.ts +1 -0
  119. package/dist/src/browser/runtime/local-cloak/provider.test.js +244 -0
  120. package/dist/src/browser/runtime/local-cloak/session-manager.d.ts +77 -0
  121. package/dist/src/browser/runtime/local-cloak/session-manager.js +280 -0
  122. package/dist/src/browser/runtime/local-cloak/session-manager.test.d.ts +1 -0
  123. package/dist/src/browser/runtime/local-cloak/session-manager.test.js +92 -0
  124. package/dist/src/browser/runtime/provider.d.ts +9 -0
  125. package/dist/src/browser/runtime/provider.js +1 -0
  126. package/dist/src/browser/runtime/provider.test.d.ts +2 -0
  127. package/dist/src/browser/runtime/provider.test.js +49 -0
  128. package/dist/src/browser/shape-filter.d.ts +52 -0
  129. package/dist/src/browser/shape-filter.js +101 -0
  130. package/dist/src/browser/shape-filter.test.d.ts +1 -0
  131. package/dist/src/browser/shape-filter.test.js +101 -0
  132. package/dist/src/browser/shape.d.ts +23 -0
  133. package/dist/src/browser/shape.js +95 -0
  134. package/dist/src/browser/shape.test.d.ts +1 -0
  135. package/dist/src/browser/shape.test.js +82 -0
  136. package/dist/src/browser/stealth.d.ts +11 -0
  137. package/dist/src/browser/stealth.js +359 -0
  138. package/dist/src/browser/stealth.test.d.ts +1 -0
  139. package/dist/src/browser/stealth.test.js +134 -0
  140. package/dist/src/browser/tabs.d.ts +13 -0
  141. package/dist/src/browser/tabs.js +70 -0
  142. package/dist/src/browser/target-errors.d.ts +39 -0
  143. package/dist/src/browser/target-errors.js +45 -0
  144. package/dist/src/browser/target-errors.test.d.ts +1 -0
  145. package/dist/src/browser/target-errors.test.js +94 -0
  146. package/dist/src/browser/target-resolver.d.ts +158 -0
  147. package/dist/src/browser/target-resolver.js +570 -0
  148. package/dist/src/browser/target-resolver.test.d.ts +1 -0
  149. package/dist/src/browser/target-resolver.test.js +118 -0
  150. package/dist/src/browser/utils.d.ts +20 -0
  151. package/dist/src/browser/utils.js +64 -0
  152. package/dist/src/browser/utils.test.d.ts +1 -0
  153. package/dist/src/browser/utils.test.js +29 -0
  154. package/dist/src/browser/verify-fixture.d.ts +65 -0
  155. package/dist/src/browser/verify-fixture.js +318 -0
  156. package/dist/src/browser/verify-fixture.test.d.ts +1 -0
  157. package/dist/src/browser/verify-fixture.test.js +219 -0
  158. package/dist/src/browser/visual-refs.d.ts +11 -0
  159. package/dist/src/browser/visual-refs.js +108 -0
  160. package/dist/src/browser.test.d.ts +1 -0
  161. package/dist/src/browser.test.js +297 -0
  162. package/dist/src/build-manifest.d.ts +103 -0
  163. package/dist/src/build-manifest.js +363 -0
  164. package/dist/src/build-manifest.test.d.ts +1 -0
  165. package/dist/src/build-manifest.test.js +341 -0
  166. package/dist/src/capabilityRouting.d.ts +19 -0
  167. package/dist/src/capabilityRouting.js +56 -0
  168. package/dist/src/capabilityRouting.test.d.ts +1 -0
  169. package/dist/src/capabilityRouting.test.js +63 -0
  170. package/dist/src/cli-argv-preprocess.d.ts +63 -0
  171. package/dist/src/cli-argv-preprocess.js +303 -0
  172. package/dist/src/cli-argv-preprocess.test.d.ts +1 -0
  173. package/dist/src/cli-argv-preprocess.test.js +304 -0
  174. package/dist/src/cli.d.ts +79 -0
  175. package/dist/src/cli.js +3350 -0
  176. package/dist/src/cli.test.d.ts +1 -0
  177. package/dist/src/cli.test.js +3041 -0
  178. package/dist/src/commanderAdapter.d.ts +21 -0
  179. package/dist/src/commanderAdapter.js +208 -0
  180. package/dist/src/commanderAdapter.test.d.ts +1 -0
  181. package/dist/src/commanderAdapter.test.js +352 -0
  182. package/dist/src/commands/auth.d.ts +40 -0
  183. package/dist/src/commands/auth.js +434 -0
  184. package/dist/src/commands/auth.test.d.ts +1 -0
  185. package/dist/src/commands/auth.test.js +252 -0
  186. package/dist/src/commands/daemon.d.ts +9 -0
  187. package/dist/src/commands/daemon.js +91 -0
  188. package/dist/src/commands/daemon.test.d.ts +1 -0
  189. package/dist/src/commands/daemon.test.js +293 -0
  190. package/dist/src/completion-fast.d.ts +22 -0
  191. package/dist/src/completion-fast.js +88 -0
  192. package/dist/src/completion-shared.d.ts +13 -0
  193. package/dist/src/completion-shared.js +61 -0
  194. package/dist/src/completion.d.ts +21 -0
  195. package/dist/src/completion.js +68 -0
  196. package/dist/src/completion.test.d.ts +1 -0
  197. package/dist/src/completion.test.js +24 -0
  198. package/dist/src/constants.d.ts +18 -0
  199. package/dist/src/constants.js +41 -0
  200. package/dist/src/convention-audit.d.ts +50 -0
  201. package/dist/src/convention-audit.js +553 -0
  202. package/dist/src/convention-audit.test.d.ts +1 -0
  203. package/dist/src/convention-audit.test.js +255 -0
  204. package/dist/src/daemon/server.d.ts +13 -0
  205. package/dist/src/daemon/server.js +185 -0
  206. package/dist/src/daemon/server.test.d.ts +1 -0
  207. package/dist/src/daemon/server.test.js +132 -0
  208. package/dist/src/daemon-utils.d.ts +18 -0
  209. package/dist/src/daemon-utils.js +37 -0
  210. package/dist/src/daemon.d.ts +1 -0
  211. package/dist/src/daemon.js +27 -0
  212. package/dist/src/daemon.test.d.ts +1 -0
  213. package/dist/src/daemon.test.js +60 -0
  214. package/dist/src/discovery.d.ts +46 -0
  215. package/dist/src/discovery.js +341 -0
  216. package/dist/src/doctor.d.ts +39 -0
  217. package/dist/src/doctor.js +168 -0
  218. package/dist/src/doctor.test.d.ts +1 -0
  219. package/dist/src/doctor.test.js +302 -0
  220. package/dist/src/download/article-download.d.ts +72 -0
  221. package/dist/src/download/article-download.js +305 -0
  222. package/dist/src/download/article-download.test.d.ts +1 -0
  223. package/dist/src/download/article-download.test.js +235 -0
  224. package/dist/src/download/index.d.ts +71 -0
  225. package/dist/src/download/index.js +363 -0
  226. package/dist/src/download/index.test.d.ts +1 -0
  227. package/dist/src/download/index.test.js +174 -0
  228. package/dist/src/download/media-download.d.ts +49 -0
  229. package/dist/src/download/media-download.js +127 -0
  230. package/dist/src/download/media-download.test.d.ts +1 -0
  231. package/dist/src/download/media-download.test.js +112 -0
  232. package/dist/src/download/progress.d.ts +36 -0
  233. package/dist/src/download/progress.js +120 -0
  234. package/dist/src/download/progress.test.d.ts +1 -0
  235. package/dist/src/download/progress.test.js +36 -0
  236. package/dist/src/electron-apps.d.ts +31 -0
  237. package/dist/src/electron-apps.js +91 -0
  238. package/dist/src/electron-apps.test.d.ts +1 -0
  239. package/dist/src/electron-apps.test.js +76 -0
  240. package/dist/src/engine.test.d.ts +1 -0
  241. package/dist/src/engine.test.js +312 -0
  242. package/dist/src/errors.d.ts +114 -0
  243. package/dist/src/errors.js +174 -0
  244. package/dist/src/errors.test.d.ts +1 -0
  245. package/dist/src/errors.test.js +109 -0
  246. package/dist/src/execution.d.ts +24 -0
  247. package/dist/src/execution.js +509 -0
  248. package/dist/src/execution.test.d.ts +1 -0
  249. package/dist/src/execution.test.js +645 -0
  250. package/dist/src/external.d.ts +49 -0
  251. package/dist/src/external.js +211 -0
  252. package/dist/src/external.test.d.ts +1 -0
  253. package/dist/src/external.test.js +110 -0
  254. package/dist/src/help.d.ts +88 -0
  255. package/dist/src/help.js +556 -0
  256. package/dist/src/help.test.d.ts +1 -0
  257. package/dist/src/help.test.js +58 -0
  258. package/dist/src/hooks.d.ts +46 -0
  259. package/dist/src/hooks.js +58 -0
  260. package/dist/src/hooks.test.d.ts +4 -0
  261. package/dist/src/hooks.test.js +92 -0
  262. package/dist/src/interceptor.d.ts +44 -0
  263. package/dist/src/interceptor.js +183 -0
  264. package/dist/src/interceptor.test.d.ts +4 -0
  265. package/dist/src/interceptor.test.js +81 -0
  266. package/dist/src/launcher.d.ts +41 -0
  267. package/dist/src/launcher.js +226 -0
  268. package/dist/src/launcher.test.d.ts +1 -0
  269. package/dist/src/launcher.test.js +153 -0
  270. package/dist/src/logger.d.ts +26 -0
  271. package/dist/src/logger.js +49 -0
  272. package/dist/src/main.d.ts +5 -0
  273. package/dist/src/main.js +177 -0
  274. package/dist/src/manifest-types.d.ts +43 -0
  275. package/dist/src/manifest-types.js +9 -0
  276. package/dist/src/node-network.d.ts +10 -0
  277. package/dist/src/node-network.js +174 -0
  278. package/dist/src/node-network.test.d.ts +1 -0
  279. package/dist/src/node-network.test.js +55 -0
  280. package/dist/src/observation/artifact.d.ts +16 -0
  281. package/dist/src/observation/artifact.js +260 -0
  282. package/dist/src/observation/artifact.test.d.ts +1 -0
  283. package/dist/src/observation/artifact.test.js +121 -0
  284. package/dist/src/observation/events.d.ts +89 -0
  285. package/dist/src/observation/events.js +1 -0
  286. package/dist/src/observation/index.d.ts +7 -0
  287. package/dist/src/observation/index.js +7 -0
  288. package/dist/src/observation/manager.d.ts +9 -0
  289. package/dist/src/observation/manager.js +27 -0
  290. package/dist/src/observation/manager.test.d.ts +1 -0
  291. package/dist/src/observation/manager.test.js +13 -0
  292. package/dist/src/observation/redaction.d.ts +11 -0
  293. package/dist/src/observation/redaction.js +81 -0
  294. package/dist/src/observation/redaction.test.d.ts +1 -0
  295. package/dist/src/observation/redaction.test.js +32 -0
  296. package/dist/src/observation/retention.d.ts +32 -0
  297. package/dist/src/observation/retention.js +160 -0
  298. package/dist/src/observation/retention.test.d.ts +1 -0
  299. package/dist/src/observation/retention.test.js +118 -0
  300. package/dist/src/observation/ring-buffer.d.ts +22 -0
  301. package/dist/src/observation/ring-buffer.js +45 -0
  302. package/dist/src/observation/ring-buffer.test.d.ts +1 -0
  303. package/dist/src/observation/ring-buffer.test.js +22 -0
  304. package/dist/src/observation/session.d.ts +25 -0
  305. package/dist/src/observation/session.js +50 -0
  306. package/dist/src/output.d.ts +14 -0
  307. package/dist/src/output.js +152 -0
  308. package/dist/src/output.test.d.ts +1 -0
  309. package/dist/src/output.test.js +53 -0
  310. package/dist/src/package-exports.test.d.ts +1 -0
  311. package/dist/src/package-exports.test.js +112 -0
  312. package/dist/src/package-paths.d.ts +8 -0
  313. package/dist/src/package-paths.js +41 -0
  314. package/dist/src/pipeline/executor.d.ts +11 -0
  315. package/dist/src/pipeline/executor.js +93 -0
  316. package/dist/src/pipeline/executor.test.d.ts +4 -0
  317. package/dist/src/pipeline/executor.test.js +182 -0
  318. package/dist/src/pipeline/index.d.ts +5 -0
  319. package/dist/src/pipeline/index.js +5 -0
  320. package/dist/src/pipeline/registry.d.ts +28 -0
  321. package/dist/src/pipeline/registry.js +55 -0
  322. package/dist/src/pipeline/steps/browser.d.ts +13 -0
  323. package/dist/src/pipeline/steps/browser.js +86 -0
  324. package/dist/src/pipeline/steps/download.d.ts +18 -0
  325. package/dist/src/pipeline/steps/download.js +252 -0
  326. package/dist/src/pipeline/steps/download.test.d.ts +1 -0
  327. package/dist/src/pipeline/steps/download.test.js +102 -0
  328. package/dist/src/pipeline/steps/fetch.d.ts +5 -0
  329. package/dist/src/pipeline/steps/fetch.js +122 -0
  330. package/dist/src/pipeline/steps/fetch.test.d.ts +1 -0
  331. package/dist/src/pipeline/steps/fetch.test.js +117 -0
  332. package/dist/src/pipeline/steps/intercept.d.ts +5 -0
  333. package/dist/src/pipeline/steps/intercept.js +50 -0
  334. package/dist/src/pipeline/steps/tap.d.ts +12 -0
  335. package/dist/src/pipeline/steps/tap.js +93 -0
  336. package/dist/src/pipeline/steps/transform.d.ts +9 -0
  337. package/dist/src/pipeline/steps/transform.js +70 -0
  338. package/dist/src/pipeline/template.d.ts +17 -0
  339. package/dist/src/pipeline/template.js +344 -0
  340. package/dist/src/pipeline/template.test.d.ts +4 -0
  341. package/dist/src/pipeline/template.test.js +197 -0
  342. package/dist/src/pipeline/transform.test.d.ts +4 -0
  343. package/dist/src/pipeline/transform.test.js +133 -0
  344. package/dist/src/plugin-manifest.d.ts +70 -0
  345. package/dist/src/plugin-manifest.js +160 -0
  346. package/dist/src/plugin-manifest.test.d.ts +4 -0
  347. package/dist/src/plugin-manifest.test.js +179 -0
  348. package/dist/src/plugin-scaffold.d.ts +28 -0
  349. package/dist/src/plugin-scaffold.js +143 -0
  350. package/dist/src/plugin-scaffold.test.d.ts +4 -0
  351. package/dist/src/plugin-scaffold.test.js +83 -0
  352. package/dist/src/plugin.d.ts +146 -0
  353. package/dist/src/plugin.js +1303 -0
  354. package/dist/src/plugin.test.d.ts +4 -0
  355. package/dist/src/plugin.test.js +1363 -0
  356. package/dist/src/registry-api.d.ts +13 -0
  357. package/dist/src/registry-api.js +10 -0
  358. package/dist/src/registry.d.ts +123 -0
  359. package/dist/src/registry.js +125 -0
  360. package/dist/src/registry.test.d.ts +4 -0
  361. package/dist/src/registry.test.js +209 -0
  362. package/dist/src/runtime-copy.test.d.ts +1 -0
  363. package/dist/src/runtime-copy.test.js +29 -0
  364. package/dist/src/runtime-detect.d.ts +31 -0
  365. package/dist/src/runtime-detect.js +47 -0
  366. package/dist/src/runtime-detect.test.d.ts +1 -0
  367. package/dist/src/runtime-detect.test.js +39 -0
  368. package/dist/src/runtime-identity.test.d.ts +1 -0
  369. package/dist/src/runtime-identity.test.js +18 -0
  370. package/dist/src/runtime.d.ts +47 -0
  371. package/dist/src/runtime.js +54 -0
  372. package/dist/src/scripts/framework.d.ts +7 -0
  373. package/dist/src/scripts/framework.js +25 -0
  374. package/dist/src/scripts/interact.d.ts +4 -0
  375. package/dist/src/scripts/interact.js +20 -0
  376. package/dist/src/scripts/store.d.ts +13 -0
  377. package/dist/src/scripts/store.js +48 -0
  378. package/dist/src/serialization.d.ts +42 -0
  379. package/dist/src/serialization.js +103 -0
  380. package/dist/src/serialization.test.d.ts +1 -0
  381. package/dist/src/serialization.test.js +78 -0
  382. package/dist/src/skills.d.ts +14 -0
  383. package/dist/src/skills.js +127 -0
  384. package/dist/src/skills.test.d.ts +1 -0
  385. package/dist/src/skills.test.js +71 -0
  386. package/dist/src/snapshotFormatter.d.ts +11 -0
  387. package/dist/src/snapshotFormatter.js +338 -0
  388. package/dist/src/snapshotFormatter.test.d.ts +7 -0
  389. package/dist/src/snapshotFormatter.test.js +521 -0
  390. package/dist/src/tui.d.ts +28 -0
  391. package/dist/src/tui.js +179 -0
  392. package/dist/src/tui.test.d.ts +1 -0
  393. package/dist/src/tui.test.js +19 -0
  394. package/dist/src/types.d.ts +236 -0
  395. package/dist/src/types.js +7 -0
  396. package/dist/src/update-check.d.ts +66 -0
  397. package/dist/src/update-check.js +206 -0
  398. package/dist/src/update-check.test.d.ts +1 -0
  399. package/dist/src/update-check.test.js +117 -0
  400. package/dist/src/utils.d.ts +57 -0
  401. package/dist/src/utils.js +152 -0
  402. package/dist/src/utils.test.d.ts +1 -0
  403. package/dist/src/utils.test.js +155 -0
  404. package/dist/src/validate.d.ts +21 -0
  405. package/dist/src/validate.js +130 -0
  406. package/dist/src/validate.test.d.ts +9 -0
  407. package/dist/src/validate.test.js +90 -0
  408. package/dist/src/verify.d.ts +26 -0
  409. package/dist/src/verify.js +67 -0
  410. package/dist/src/version.d.ts +4 -0
  411. package/dist/src/version.js +22 -0
  412. package/dist/src/weixin-download.test.d.ts +1 -0
  413. package/dist/src/weixin-download.test.js +45 -0
  414. package/package.json +4 -3
  415. package/scripts/check-package-bin.mjs +95 -0
@@ -0,0 +1,341 @@
1
+ import { afterEach, describe, expect, it } from 'vitest';
2
+ import * as fs from 'node:fs';
3
+ import * as os from 'node:os';
4
+ import * as path from 'node:path';
5
+ import { cli, getRegistry, Strategy } from './registry.js';
6
+ import { ManifestImportError, diffRemovedEntries, findManifestMetadataIssues, loadManifestEntries, normalizeManifestPath, parseBuildManifestArgs, scanClisDir, serializeManifest, } from './build-manifest.js';
7
+ describe('manifest helper rules', () => {
8
+ const tempDirs = [];
9
+ afterEach(() => {
10
+ for (const dir of tempDirs.splice(0)) {
11
+ fs.rmSync(dir, { recursive: true, force: true });
12
+ }
13
+ });
14
+ it('skips TS files that do not register a cli', () => {
15
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'webcmd-manifest-'));
16
+ tempDirs.push(dir);
17
+ const file = path.join(dir, 'utils.ts');
18
+ fs.writeFileSync(file, `export function helper() { return 'noop'; }`);
19
+ return expect(loadManifestEntries(file, 'demo', async () => ({}))).resolves.toEqual([]);
20
+ });
21
+ it('builds TS manifest entries from exported runtime commands', async () => {
22
+ const site = `manifest-hydrate-${Date.now()}`;
23
+ const key = `${site}/dynamic`;
24
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'webcmd-manifest-'));
25
+ tempDirs.push(dir);
26
+ const file = path.join(dir, `${site}.ts`);
27
+ fs.writeFileSync(file, `export const command = cli({ site: '${site}', name: 'dynamic', access: 'read' });`);
28
+ const entries = await loadManifestEntries(file, site, async () => ({
29
+ command: cli({
30
+ site,
31
+ name: 'dynamic',
32
+ access: 'read',
33
+ description: 'dynamic command',
34
+ strategy: Strategy.PUBLIC,
35
+ browser: false,
36
+ aliases: ['metadata'],
37
+ args: [
38
+ {
39
+ name: 'model',
40
+ required: true,
41
+ positional: true,
42
+ help: 'Choose a model',
43
+ choices: ['auto', 'thinking'],
44
+ default: '30',
45
+ },
46
+ ],
47
+ domain: 'localhost',
48
+ navigateBefore: 'https://example.com/session',
49
+ defaultFormat: 'plain',
50
+ }),
51
+ }));
52
+ expect(entries).toMatchObject([
53
+ {
54
+ site,
55
+ name: 'dynamic',
56
+ access: 'read',
57
+ description: 'dynamic command',
58
+ domain: 'localhost',
59
+ strategy: 'public',
60
+ browser: false,
61
+ aliases: ['metadata'],
62
+ args: [
63
+ expect.objectContaining({
64
+ name: 'model',
65
+ type: 'str',
66
+ required: true,
67
+ positional: true,
68
+ help: 'Choose a model',
69
+ choices: ['auto', 'thinking'],
70
+ default: '30',
71
+ }),
72
+ ],
73
+ type: 'js',
74
+ modulePath: `${site}/${site}.js`,
75
+ navigateBefore: 'https://example.com/session',
76
+ defaultFormat: 'plain',
77
+ },
78
+ ]);
79
+ // Verify sourceFile is included and stable for manifest consumers.
80
+ expect(entries[0].sourceFile).toBeDefined();
81
+ expect(entries[0].sourceFile).not.toContain('\\');
82
+ getRegistry().delete(key);
83
+ });
84
+ it('falls back to registry delta for side-effect-only cli modules', async () => {
85
+ const site = `manifest-side-effect-${Date.now()}`;
86
+ const key = `${site}/legacy`;
87
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'webcmd-manifest-'));
88
+ tempDirs.push(dir);
89
+ const file = path.join(dir, `${site}.ts`);
90
+ fs.writeFileSync(file, `cli({ site: '${site}', name: 'legacy', access: 'read' });`);
91
+ const entries = await loadManifestEntries(file, site, async () => {
92
+ cli({
93
+ site,
94
+ name: 'legacy',
95
+ access: 'read',
96
+ description: 'legacy command',
97
+ });
98
+ return {};
99
+ });
100
+ expect(entries).toMatchObject([
101
+ {
102
+ site,
103
+ name: 'legacy',
104
+ access: 'read',
105
+ description: 'legacy command',
106
+ strategy: 'cookie',
107
+ browser: true,
108
+ args: [],
109
+ type: 'js',
110
+ modulePath: `${site}/${site}.js`,
111
+ },
112
+ ]);
113
+ // Verify sourceFile is included
114
+ expect(entries[0].sourceFile).toBeDefined();
115
+ getRegistry().delete(key);
116
+ });
117
+ it('keeps every command a module exports instead of guessing by site', async () => {
118
+ const site = `manifest-multi-${Date.now()}`;
119
+ const screenKey = `${site}/screen`;
120
+ const statusKey = `${site}/status`;
121
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'webcmd-manifest-'));
122
+ tempDirs.push(dir);
123
+ const file = path.join(dir, `${site}.ts`);
124
+ fs.writeFileSync(file, `export const screen = cli({ site: '${site}', name: 'screen', access: 'read' });`);
125
+ const entries = await loadManifestEntries(file, site, async () => ({
126
+ screen: cli({
127
+ site,
128
+ name: 'screen',
129
+ access: 'read',
130
+ description: 'capture screen',
131
+ }),
132
+ status: cli({
133
+ site,
134
+ name: 'status',
135
+ access: 'read',
136
+ description: 'show status',
137
+ }),
138
+ }));
139
+ expect(entries.map(entry => entry.name)).toEqual(['screen', 'status']);
140
+ getRegistry().delete(screenKey);
141
+ getRegistry().delete(statusKey);
142
+ });
143
+ it('normalizes manifest paths to POSIX separators', () => {
144
+ expect(normalizeManifestPath('demo\\status.js')).toBe('demo/status.js');
145
+ expect(normalizeManifestPath('demo/status.js')).toBe('demo/status.js');
146
+ });
147
+ it('serializes manifest json with a trailing newline', () => {
148
+ const serialized = serializeManifest([{
149
+ site: 'demo',
150
+ name: 'status', access: 'read',
151
+ description: '',
152
+ strategy: 'public',
153
+ browser: false,
154
+ args: [],
155
+ type: 'js',
156
+ }]);
157
+ expect(serialized.endsWith('\n')).toBe(true);
158
+ expect(serialized).toContain('\n]');
159
+ });
160
+ it('throws ManifestImportError when an adapter looks like a CLI module but fails to import', async () => {
161
+ // Reproduces the "stale dist drops adapters silently" incident: the file
162
+ // matches the cli() pattern (so it's not just a helper), but the importer
163
+ // throws — we want the failure surfaced, not swallowed.
164
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'webcmd-manifest-fail-'));
165
+ tempDirs.push(dir);
166
+ const file = path.join(dir, 'broken.ts');
167
+ fs.writeFileSync(file, `export const command = cli({ site: 'demo', name: 'broken', access: 'read' });`);
168
+ const importer = async () => { throw new Error('boom: stale dist'); };
169
+ await expect(loadManifestEntries(file, 'demo', importer))
170
+ .rejects.toBeInstanceOf(ManifestImportError);
171
+ try {
172
+ await loadManifestEntries(file, 'demo', importer);
173
+ }
174
+ catch (err) {
175
+ expect(err).toBeInstanceOf(ManifestImportError);
176
+ const e = err;
177
+ expect(e.filePath).toBe(file);
178
+ expect(e.message).toContain('boom: stale dist');
179
+ }
180
+ });
181
+ it('still silently skips files that do not call cli() even if the importer would have thrown', async () => {
182
+ // The cli() pattern check happens before importing — we don't even ask
183
+ // the importer about helper modules, so a thrown import does not turn
184
+ // them into failures.
185
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'webcmd-manifest-helper-'));
186
+ tempDirs.push(dir);
187
+ const file = path.join(dir, 'helper.ts');
188
+ fs.writeFileSync(file, `export const helper = () => 42;`);
189
+ const importer = async () => { throw new Error('should never be called'); };
190
+ await expect(loadManifestEntries(file, 'demo', importer)).resolves.toEqual([]);
191
+ });
192
+ it('scanClisDir aggregates per-adapter import failures instead of silently dropping them', async () => {
193
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'webcmd-clis-'));
194
+ tempDirs.push(root);
195
+ const siteDir = path.join(root, 'demo');
196
+ fs.mkdirSync(siteDir);
197
+ fs.writeFileSync(path.join(siteDir, 'good.js'), `export const cmd = cli({ site: 'demo', name: 'good', access: 'read' });`);
198
+ fs.writeFileSync(path.join(siteDir, 'broken.js'), `export const cmd = cli({ site: 'demo', name: 'broken', access: 'read' });`);
199
+ const importer = async (href) => {
200
+ if (href.endsWith('broken.js'))
201
+ throw new Error('stale dist drops broken');
202
+ return { cmd: cli({ site: 'demo', name: 'good', access: 'read', description: 'ok' }) };
203
+ };
204
+ const result = await scanClisDir(root, importer);
205
+ expect(result.failures).toHaveLength(1);
206
+ expect(result.failures[0]).toBeInstanceOf(ManifestImportError);
207
+ expect(result.failures[0].filePath).toMatch(/broken\.js$/);
208
+ expect(result.failures[0].message).toContain('stale dist drops broken');
209
+ expect(result.entries.map(e => e.name)).toEqual(['good']);
210
+ getRegistry().delete('demo/good');
211
+ });
212
+ it('diffRemovedEntries returns site/name keys present only in prev', () => {
213
+ const prev = [
214
+ { site: 'a', name: '1', access: 'read', description: '', strategy: 'public', browser: false, args: [], type: 'js' },
215
+ { site: 'a', name: '2', access: 'read', description: '', strategy: 'public', browser: false, args: [], type: 'js' },
216
+ { site: 'b', name: '3', access: 'read', description: '', strategy: 'public', browser: false, args: [], type: 'js' },
217
+ ];
218
+ const next = [
219
+ { site: 'a', name: '1', access: 'read', description: '', strategy: 'public', browser: false, args: [], type: 'js' },
220
+ ];
221
+ expect(diffRemovedEntries(prev, next)).toEqual(['a/2', 'b/3']);
222
+ expect(diffRemovedEntries(prev, prev)).toEqual([]);
223
+ expect(diffRemovedEntries([], next)).toEqual([]);
224
+ });
225
+ it('findManifestMetadataIssues flags positionals with empty/missing help', () => {
226
+ // The build-time hard gate. A positional with `help: ''` or no `help` at
227
+ // all renders `Arguments:\n <name>` with a blank trailing column —
228
+ // unrecoverable for both humans and agents reading help. Failing closed
229
+ // here is the only way to keep help text trustworthy as adapters land.
230
+ //
231
+ // Semantic quality (e.g. what does an *optional* positional mean when
232
+ // omitted?) is intentionally NOT enforced — that belongs to the planned
233
+ // Arg metadata v2 advisory pass.
234
+ const entries = [
235
+ // Positional with usable help — clean.
236
+ {
237
+ site: 'demo',
238
+ name: 'ok',
239
+ access: 'read',
240
+ description: '',
241
+ strategy: 'public',
242
+ browser: false,
243
+ args: [
244
+ { name: 'q', positional: true, required: true, help: 'Search query' },
245
+ ],
246
+ type: 'js',
247
+ sourceFile: 'demo/ok.js',
248
+ },
249
+ // Positional with empty help string — must flag.
250
+ {
251
+ site: 'demo',
252
+ name: 'empty-help',
253
+ access: 'read',
254
+ description: '',
255
+ strategy: 'public',
256
+ browser: false,
257
+ args: [
258
+ { name: 'user', positional: true, required: false, help: '' },
259
+ ],
260
+ type: 'js',
261
+ sourceFile: 'demo/empty.js',
262
+ },
263
+ // Positional with whitespace-only help — must flag.
264
+ {
265
+ site: 'demo',
266
+ name: 'whitespace-help',
267
+ access: 'read',
268
+ description: '',
269
+ strategy: 'public',
270
+ browser: false,
271
+ args: [
272
+ { name: 'id', positional: true, required: true, help: ' ' },
273
+ ],
274
+ type: 'js',
275
+ },
276
+ // Positional with no help field at all — must flag.
277
+ {
278
+ site: 'demo',
279
+ name: 'missing-help',
280
+ access: 'read',
281
+ description: '',
282
+ strategy: 'public',
283
+ browser: false,
284
+ args: [
285
+ { name: 'name', positional: true, required: true },
286
+ ],
287
+ type: 'js',
288
+ },
289
+ // NON-positional flag with empty help — must NOT flag (gate is
290
+ // intentionally scoped to positionals; named flags carry the flag
291
+ // name itself in the help line).
292
+ {
293
+ site: 'demo',
294
+ name: 'flag-only',
295
+ access: 'read',
296
+ description: '',
297
+ strategy: 'public',
298
+ browser: false,
299
+ args: [
300
+ { name: 'limit', required: false, help: '' },
301
+ ],
302
+ type: 'js',
303
+ },
304
+ ];
305
+ const issues = findManifestMetadataIssues(entries);
306
+ expect(issues).toHaveLength(3);
307
+ expect(issues.map(i => `${i.site}/${i.command}/${i.arg}`).sort()).toEqual([
308
+ 'demo/empty-help/user',
309
+ 'demo/missing-help/name',
310
+ 'demo/whitespace-help/id',
311
+ ]);
312
+ // sourceFile flows through when present so the build error points at the
313
+ // exact file to fix.
314
+ const emptyHelp = issues.find(i => i.command === 'empty-help');
315
+ expect(emptyHelp?.sourceFile).toBe('demo/empty.js');
316
+ });
317
+ it('findManifestMetadataIssues returns [] for fully-documented entries', () => {
318
+ expect(findManifestMetadataIssues([])).toEqual([]);
319
+ expect(findManifestMetadataIssues([
320
+ {
321
+ site: 'demo',
322
+ name: 'no-args',
323
+ access: 'read',
324
+ description: '',
325
+ strategy: 'public',
326
+ browser: false,
327
+ args: [],
328
+ type: 'js',
329
+ },
330
+ ])).toEqual([]);
331
+ });
332
+ it('parseBuildManifestArgs reads --allow-removals[=N]', () => {
333
+ expect(parseBuildManifestArgs([]).allowRemovals).toBe(0);
334
+ expect(parseBuildManifestArgs(['--allow-removals=5']).allowRemovals).toBe(5);
335
+ expect(parseBuildManifestArgs(['--allow-removals=0']).allowRemovals).toBe(0);
336
+ // Bare flag is the explicit "I know what I'm doing" escape hatch.
337
+ expect(parseBuildManifestArgs(['--allow-removals']).allowRemovals).toBe(Number.POSITIVE_INFINITY);
338
+ // Unknown flags are ignored.
339
+ expect(parseBuildManifestArgs(['--something-else']).allowRemovals).toBe(0);
340
+ });
341
+ });
@@ -0,0 +1,19 @@
1
+ import type { CliCommand } from './registry.js';
2
+ /**
3
+ * Pipeline steps that require a live browser session.
4
+ *
5
+ * Note: this is the *subset* of registered pipeline steps that need a page;
6
+ * non-browser steps (fetch, select, map, filter, sort, limit, download)
7
+ * deliberately stay out. The full registered-step list lives in
8
+ * `src/pipeline/registry.ts` and is re-derived elsewhere via
9
+ * `getRegisteredStepNames()` (e.g. in `validate.ts`). When you add a new
10
+ * pipeline step, decide whether it belongs here based on whether its handler
11
+ * touches the IPage object — and `src/capabilityRouting.test.ts` verifies the
12
+ * subset relationship is intact.
13
+ */
14
+ export declare const BROWSER_ONLY_STEPS: Set<string>;
15
+ /** Internal helper: ensure BROWSER_ONLY_STEPS is a subset of registered pipeline steps. */
16
+ export declare function _validateBrowserOnlyStepsAgainstRegistry(): {
17
+ extras: string[];
18
+ };
19
+ export declare function shouldUseBrowserSession(cmd: CliCommand): boolean;
@@ -0,0 +1,56 @@
1
+ import { getRegisteredStepNames } from './pipeline/registry.js';
2
+ /**
3
+ * Pipeline steps that require a live browser session.
4
+ *
5
+ * Note: this is the *subset* of registered pipeline steps that need a page;
6
+ * non-browser steps (fetch, select, map, filter, sort, limit, download)
7
+ * deliberately stay out. The full registered-step list lives in
8
+ * `src/pipeline/registry.ts` and is re-derived elsewhere via
9
+ * `getRegisteredStepNames()` (e.g. in `validate.ts`). When you add a new
10
+ * pipeline step, decide whether it belongs here based on whether its handler
11
+ * touches the IPage object — and `src/capabilityRouting.test.ts` verifies the
12
+ * subset relationship is intact.
13
+ */
14
+ export const BROWSER_ONLY_STEPS = new Set([
15
+ 'navigate',
16
+ 'click',
17
+ 'type',
18
+ 'fill',
19
+ 'wait',
20
+ 'press',
21
+ 'snapshot',
22
+ 'evaluate',
23
+ 'intercept',
24
+ 'tap',
25
+ ]);
26
+ /** Internal helper: ensure BROWSER_ONLY_STEPS is a subset of registered pipeline steps. */
27
+ export function _validateBrowserOnlyStepsAgainstRegistry() {
28
+ const registered = new Set(getRegisteredStepNames());
29
+ const extras = [];
30
+ for (const step of BROWSER_ONLY_STEPS) {
31
+ if (!registered.has(step))
32
+ extras.push(step);
33
+ }
34
+ return { extras };
35
+ }
36
+ function pipelineNeedsBrowserSession(pipeline) {
37
+ return pipeline.some((step) => {
38
+ if (!step || typeof step !== 'object')
39
+ return false;
40
+ return Object.keys(step).some((op) => BROWSER_ONLY_STEPS.has(op));
41
+ });
42
+ }
43
+ export function shouldUseBrowserSession(cmd) {
44
+ if (!cmd.browser)
45
+ return false;
46
+ if (cmd.func)
47
+ return true;
48
+ if (!cmd.pipeline || cmd.pipeline.length === 0)
49
+ return true;
50
+ // normalizeCommand sets navigateBefore to a URL string (needs pre-nav) or
51
+ // boolean true (needs authenticated context, no specific URL). Either way
52
+ // the pipeline requires a browser session even if no step is browser-only.
53
+ if (cmd.navigateBefore)
54
+ return true;
55
+ return pipelineNeedsBrowserSession(cmd.pipeline);
56
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,63 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { Strategy } from './registry.js';
3
+ import { BROWSER_ONLY_STEPS, _validateBrowserOnlyStepsAgainstRegistry, shouldUseBrowserSession } from './capabilityRouting.js';
4
+ import { getRegisteredStepNames } from './pipeline/registry.js';
5
+ function makeCmd(partial) {
6
+ return {
7
+ site: 'test',
8
+ name: 'command', access: 'read',
9
+ description: '',
10
+ args: [],
11
+ ...partial,
12
+ };
13
+ }
14
+ describe('shouldUseBrowserSession', () => {
15
+ it('skips browser session for public fetch-only pipelines', () => {
16
+ expect(shouldUseBrowserSession(makeCmd({
17
+ browser: true,
18
+ strategy: Strategy.PUBLIC,
19
+ pipeline: [{ fetch: 'https://example.com/api' }, { select: 'items' }],
20
+ }))).toBe(false);
21
+ });
22
+ it('keeps browser session for public pipelines with browser-only steps', () => {
23
+ expect(shouldUseBrowserSession(makeCmd({
24
+ browser: true,
25
+ strategy: Strategy.PUBLIC,
26
+ pipeline: [{ navigate: 'https://example.com' }, { evaluate: '() => []' }],
27
+ }))).toBe(true);
28
+ });
29
+ it('keeps browser session for non-public strategies (via normalized navigateBefore)', () => {
30
+ // After normalizeCommand, COOKIE strategy without domain sets navigateBefore: true
31
+ // (signals "needs authenticated browser context" without a specific pre-nav URL).
32
+ expect(shouldUseBrowserSession(makeCmd({
33
+ browser: true,
34
+ strategy: Strategy.COOKIE,
35
+ navigateBefore: true,
36
+ pipeline: [{ fetch: 'https://example.com/api' }],
37
+ }))).toBe(true);
38
+ });
39
+ it('keeps browser session for function adapters', () => {
40
+ expect(shouldUseBrowserSession(makeCmd({
41
+ browser: true,
42
+ strategy: Strategy.PUBLIC,
43
+ func: async () => [],
44
+ }))).toBe(true);
45
+ });
46
+ it('routes pipelines containing the fill step into a browser session', () => {
47
+ expect(shouldUseBrowserSession(makeCmd({
48
+ browser: true,
49
+ strategy: Strategy.PUBLIC,
50
+ pipeline: [{ navigate: 'https://example.com' }, { fill: { ref: '#q', text: 'hello' } }],
51
+ }))).toBe(true);
52
+ });
53
+ });
54
+ describe('BROWSER_ONLY_STEPS / pipeline registry alignment', () => {
55
+ it('is a subset of registered pipeline step names', () => {
56
+ const { extras } = _validateBrowserOnlyStepsAgainstRegistry();
57
+ expect(extras).toEqual([]);
58
+ });
59
+ it('includes fill (DOM-touching step added in PR #1222)', () => {
60
+ expect(BROWSER_ONLY_STEPS.has('fill')).toBe(true);
61
+ expect(getRegisteredStepNames()).toContain('fill');
62
+ });
63
+ });
@@ -0,0 +1,63 @@
1
+ /**
2
+ * argv preprocessing: rewrite `webcmd browser <session> <subcommand> ...`
3
+ * into `webcmd browser --session <session> <subcommand> ...` so commander
4
+ * (which can't combine a parent positional with subcommand dispatch) can parse it.
5
+ *
6
+ * The user-facing form is positional; the internal form uses --session. Help text
7
+ * for the `browser` command is overridden to advertise the positional form.
8
+ */
9
+ /**
10
+ * Returns the set of reserved subcommand names (exposed for tests so they stay
11
+ * synced with the actual registrations in cli.ts).
12
+ */
13
+ export declare function getBrowserSubcommandNames(): ReadonlySet<string>;
14
+ /**
15
+ * Rewrite `argv` to convert the positional `<session>` after `browser`
16
+ * into the internal `--session <name>` flag form.
17
+ *
18
+ * Only acts when `browser` is the root command (i.e. the first non-flag token
19
+ * after any leading root options), so it can't mis-interpret occurrences of
20
+ * the literal word `browser` deeper in the argv (e.g. `webcmd adapter init
21
+ * browser/x`, or a URL value containing `browser`).
22
+ *
23
+ * Leaves argv unchanged when:
24
+ * - root command is not `browser`
25
+ * - the token after `browser` is a flag (e.g. `--help`)
26
+ * - the token after `browser` is a known subcommand name (session was
27
+ * omitted; commander will surface its own required-flag error)
28
+ */
29
+ export declare function rewriteBrowserArgv(argv: readonly string[]): string[];
30
+ /**
31
+ * Thrown by the preprocessor when user argv uses a retired/old form that we
32
+ * intentionally refuse to accept. main.ts catches this and exits with a
33
+ * usage error so it does not bubble up as an internal stacktrace.
34
+ */
35
+ export declare class BrowserSessionArgvError extends Error {
36
+ constructor(message: string);
37
+ }
38
+ /**
39
+ * Minimal manifest shape consumed by escapeLeadingDashPositional. Imported
40
+ * lazily by main.ts so this module stays dependency-free.
41
+ */
42
+ export interface DashPositionalManifestEntry {
43
+ site: string;
44
+ name: string;
45
+ args?: Array<{
46
+ name: string;
47
+ positional?: boolean;
48
+ required?: boolean;
49
+ valueRequired?: boolean;
50
+ default?: unknown;
51
+ }>;
52
+ browser?: boolean;
53
+ }
54
+ /**
55
+ * `webcmd boss detail -abc123def` fails because commander parses
56
+ * `-abc123def` as an unknown option rather than the required
57
+ * `<security-id>` positional. BOSS 直聘 securityId tokens are opaque
58
+ * strings that can legitimately start with `-` (issue #1160), and the
59
+ * same shape can show up in any adapter that takes an opaque-id
60
+ * positional. Insert a `--` separator so commander treats the next
61
+ * token as the positional value.
62
+ */
63
+ export declare function escapeLeadingDashPositional(argv: readonly string[], manifest: readonly DashPositionalManifestEntry[]): string[];