retestkit 1.4.1

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 (327) hide show
  1. package/.claude/commands/openspec/apply.md +23 -0
  2. package/.claude/commands/openspec/archive.md +27 -0
  3. package/.claude/commands/openspec/proposal.md +28 -0
  4. package/.gemini/commands/openspec/apply.toml +21 -0
  5. package/.gemini/commands/openspec/archive.toml +25 -0
  6. package/.gemini/commands/openspec/proposal.toml +26 -0
  7. package/.github/prompts/openspec-apply.prompt.md +22 -0
  8. package/.github/prompts/openspec-archive.prompt.md +26 -0
  9. package/.github/prompts/openspec-proposal.prompt.md +27 -0
  10. package/.github/workflows/release.yml +33 -0
  11. package/.kilocode/workflows/openspec-apply.md +17 -0
  12. package/.kilocode/workflows/openspec-archive.md +21 -0
  13. package/.kilocode/workflows/openspec-proposal.md +22 -0
  14. package/.mcp.json +23 -0
  15. package/.opencode/command/openspec-apply.md +25 -0
  16. package/.opencode/command/openspec-archive.md +28 -0
  17. package/.opencode/command/openspec-proposal.md +30 -0
  18. package/.roo/commands/openspec-apply.md +20 -0
  19. package/.roo/commands/openspec-archive.md +24 -0
  20. package/.roo/commands/openspec-proposal.md +25 -0
  21. package/.vscode/mcp.json +23 -0
  22. package/AGENTS.md +18 -0
  23. package/CLAUDE.md +18 -0
  24. package/LICENSE +65 -0
  25. package/README.md +303 -0
  26. package/dist/config.d.ts +4 -0
  27. package/dist/config.d.ts.map +1 -0
  28. package/dist/config.js +27 -0
  29. package/dist/config.js.map +1 -0
  30. package/dist/elicitation/index.d.ts +17 -0
  31. package/dist/elicitation/index.d.ts.map +1 -0
  32. package/dist/elicitation/index.js +118 -0
  33. package/dist/elicitation/index.js.map +1 -0
  34. package/dist/elicitation/types.d.ts +35 -0
  35. package/dist/elicitation/types.d.ts.map +1 -0
  36. package/dist/elicitation/types.js +39 -0
  37. package/dist/elicitation/types.js.map +1 -0
  38. package/dist/index.d.ts +3 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +76 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/lifecycle/index.d.ts +31 -0
  43. package/dist/lifecycle/index.d.ts.map +1 -0
  44. package/dist/lifecycle/index.js +61 -0
  45. package/dist/lifecycle/index.js.map +1 -0
  46. package/dist/logger.d.ts +21 -0
  47. package/dist/logger.d.ts.map +1 -0
  48. package/dist/logger.js +182 -0
  49. package/dist/logger.js.map +1 -0
  50. package/dist/playwright-client/index.d.ts +29 -0
  51. package/dist/playwright-client/index.d.ts.map +1 -0
  52. package/dist/playwright-client/index.js +288 -0
  53. package/dist/playwright-client/index.js.map +1 -0
  54. package/dist/playwright-client/types.d.ts +44 -0
  55. package/dist/playwright-client/types.d.ts.map +1 -0
  56. package/dist/playwright-client/types.js +49 -0
  57. package/dist/playwright-client/types.js.map +1 -0
  58. package/dist/progress/index.d.ts +39 -0
  59. package/dist/progress/index.d.ts.map +1 -0
  60. package/dist/progress/index.js +106 -0
  61. package/dist/progress/index.js.map +1 -0
  62. package/dist/progress/types.d.ts +24 -0
  63. package/dist/progress/types.d.ts.map +1 -0
  64. package/dist/progress/types.js +2 -0
  65. package/dist/progress/types.js.map +1 -0
  66. package/dist/prompts/index.d.ts +19 -0
  67. package/dist/prompts/index.d.ts.map +1 -0
  68. package/dist/prompts/index.js +207 -0
  69. package/dist/prompts/index.js.map +1 -0
  70. package/dist/prompts/loader.d.ts +20 -0
  71. package/dist/prompts/loader.d.ts.map +1 -0
  72. package/dist/prompts/loader.js +47 -0
  73. package/dist/prompts/loader.js.map +1 -0
  74. package/dist/resources/index.d.ts +27 -0
  75. package/dist/resources/index.d.ts.map +1 -0
  76. package/dist/resources/index.js +186 -0
  77. package/dist/resources/index.js.map +1 -0
  78. package/dist/resources/subscriptions.d.ts +10 -0
  79. package/dist/resources/subscriptions.d.ts.map +1 -0
  80. package/dist/resources/subscriptions.js +23 -0
  81. package/dist/resources/subscriptions.js.map +1 -0
  82. package/dist/sampling/index.d.ts +11 -0
  83. package/dist/sampling/index.d.ts.map +1 -0
  84. package/dist/sampling/index.js +201 -0
  85. package/dist/sampling/index.js.map +1 -0
  86. package/dist/sampling/prompts.d.ts +56 -0
  87. package/dist/sampling/prompts.d.ts.map +1 -0
  88. package/dist/sampling/prompts.js +124 -0
  89. package/dist/sampling/prompts.js.map +1 -0
  90. package/dist/sampling/types.d.ts +57 -0
  91. package/dist/sampling/types.d.ts.map +1 -0
  92. package/dist/sampling/types.js +2 -0
  93. package/dist/sampling/types.js.map +1 -0
  94. package/dist/schemas/config.d.ts +40 -0
  95. package/dist/schemas/config.d.ts.map +1 -0
  96. package/dist/schemas/config.js +30 -0
  97. package/dist/schemas/config.js.map +1 -0
  98. package/dist/security/index.d.ts +38 -0
  99. package/dist/security/index.d.ts.map +1 -0
  100. package/dist/security/index.js +281 -0
  101. package/dist/security/index.js.map +1 -0
  102. package/dist/server.d.ts +9 -0
  103. package/dist/server.d.ts.map +1 -0
  104. package/dist/server.js +142 -0
  105. package/dist/server.js.map +1 -0
  106. package/dist/test-utils/index.d.ts +6 -0
  107. package/dist/test-utils/index.d.ts.map +1 -0
  108. package/dist/test-utils/index.js +6 -0
  109. package/dist/test-utils/index.js.map +1 -0
  110. package/dist/test-utils/mock-context.d.ts +64 -0
  111. package/dist/test-utils/mock-context.d.ts.map +1 -0
  112. package/dist/test-utils/mock-context.js +347 -0
  113. package/dist/test-utils/mock-context.js.map +1 -0
  114. package/dist/test-utils/mock-playwright-client.d.ts +62 -0
  115. package/dist/test-utils/mock-playwright-client.d.ts.map +1 -0
  116. package/dist/test-utils/mock-playwright-client.js +315 -0
  117. package/dist/test-utils/mock-playwright-client.js.map +1 -0
  118. package/dist/tools/index.d.ts +4 -0
  119. package/dist/tools/index.d.ts.map +1 -0
  120. package/dist/tools/index.js +8 -0
  121. package/dist/tools/index.js.map +1 -0
  122. package/dist/tools/webtest/crawl.d.ts +46 -0
  123. package/dist/tools/webtest/crawl.d.ts.map +1 -0
  124. package/dist/tools/webtest/crawl.js +678 -0
  125. package/dist/tools/webtest/crawl.js.map +1 -0
  126. package/dist/tools/webtest/discover-features.d.ts +30 -0
  127. package/dist/tools/webtest/discover-features.d.ts.map +1 -0
  128. package/dist/tools/webtest/discover-features.js +343 -0
  129. package/dist/tools/webtest/discover-features.js.map +1 -0
  130. package/dist/tools/webtest/discover-flows.d.ts +29 -0
  131. package/dist/tools/webtest/discover-flows.d.ts.map +1 -0
  132. package/dist/tools/webtest/discover-flows.js +341 -0
  133. package/dist/tools/webtest/discover-flows.js.map +1 -0
  134. package/dist/tools/webtest/generate-tests.d.ts +54 -0
  135. package/dist/tools/webtest/generate-tests.d.ts.map +1 -0
  136. package/dist/tools/webtest/generate-tests.js +364 -0
  137. package/dist/tools/webtest/generate-tests.js.map +1 -0
  138. package/dist/tools/webtest/index.d.ts +8 -0
  139. package/dist/tools/webtest/index.d.ts.map +1 -0
  140. package/dist/tools/webtest/index.js +8 -0
  141. package/dist/tools/webtest/index.js.map +1 -0
  142. package/dist/tools/webtest/run-test-case.d.ts +28 -0
  143. package/dist/tools/webtest/run-test-case.d.ts.map +1 -0
  144. package/dist/tools/webtest/run-test-case.js +420 -0
  145. package/dist/tools/webtest/run-test-case.js.map +1 -0
  146. package/dist/tools/webtest/schemas.d.ts +175 -0
  147. package/dist/tools/webtest/schemas.d.ts.map +1 -0
  148. package/dist/tools/webtest/schemas.js +156 -0
  149. package/dist/tools/webtest/schemas.js.map +1 -0
  150. package/dist/tools/webtest/start-analysis.d.ts +16 -0
  151. package/dist/tools/webtest/start-analysis.d.ts.map +1 -0
  152. package/dist/tools/webtest/start-analysis.js +137 -0
  153. package/dist/tools/webtest/start-analysis.js.map +1 -0
  154. package/dist/transports/http.d.ts +8 -0
  155. package/dist/transports/http.d.ts.map +1 -0
  156. package/dist/transports/http.js +9 -0
  157. package/dist/transports/http.js.map +1 -0
  158. package/dist/transports/index.d.ts +14 -0
  159. package/dist/transports/index.d.ts.map +1 -0
  160. package/dist/transports/index.js +20 -0
  161. package/dist/transports/index.js.map +1 -0
  162. package/dist/transports/stdio.d.ts +4 -0
  163. package/dist/transports/stdio.d.ts.map +1 -0
  164. package/dist/transports/stdio.js +6 -0
  165. package/dist/transports/stdio.js.map +1 -0
  166. package/dist/types/capabilities.d.ts +18 -0
  167. package/dist/types/capabilities.d.ts.map +1 -0
  168. package/dist/types/capabilities.js +35 -0
  169. package/dist/types/capabilities.js.map +1 -0
  170. package/dist/types/context.d.ts +20 -0
  171. package/dist/types/context.d.ts.map +1 -0
  172. package/dist/types/context.js +2 -0
  173. package/dist/types/context.js.map +1 -0
  174. package/dist/types/tool.d.ts +10 -0
  175. package/dist/types/tool.d.ts.map +1 -0
  176. package/dist/types/tool.js +2 -0
  177. package/dist/types/tool.js.map +1 -0
  178. package/dist/workspace/index.d.ts +99 -0
  179. package/dist/workspace/index.d.ts.map +1 -0
  180. package/dist/workspace/index.js +648 -0
  181. package/dist/workspace/index.js.map +1 -0
  182. package/dist/workspace/markdown.d.ts +50 -0
  183. package/dist/workspace/markdown.d.ts.map +1 -0
  184. package/dist/workspace/markdown.js +210 -0
  185. package/dist/workspace/markdown.js.map +1 -0
  186. package/dist/workspace/types.d.ts +173 -0
  187. package/dist/workspace/types.d.ts.map +1 -0
  188. package/dist/workspace/types.js +2 -0
  189. package/dist/workspace/types.js.map +1 -0
  190. package/openspec/AGENTS.md +456 -0
  191. package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/proposal.md +33 -0
  192. package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/specs/webtest-resources/spec.md +27 -0
  193. package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/specs/webtest-tools/spec.md +304 -0
  194. package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/tasks.md +43 -0
  195. package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/design.md +209 -0
  196. package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/proposal.md +41 -0
  197. package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/specs/mcp-server-core/spec.md +183 -0
  198. package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/tasks.md +112 -0
  199. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/design.md +333 -0
  200. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/proposal.md +66 -0
  201. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/mcp-server-core/spec.md +129 -0
  202. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-lifecycle/spec.md +138 -0
  203. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-logging/spec.md +211 -0
  204. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-prompts/spec.md +157 -0
  205. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-resources/spec.md +213 -0
  206. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-sampling/spec.md +257 -0
  207. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-tools/spec.md +501 -0
  208. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/tasks.md +264 -0
  209. package/openspec/changes/archive/2025-12-18-allow-analysis-of-incomplete-crawls/proposal.md +24 -0
  210. package/openspec/changes/archive/2025-12-18-allow-analysis-of-incomplete-crawls/specs/webtest-tools/spec.md +80 -0
  211. package/openspec/changes/archive/2025-12-18-allow-analysis-of-incomplete-crawls/tasks.md +8 -0
  212. package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/design.md +90 -0
  213. package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/proposal.md +28 -0
  214. package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/specs/webtest-sampling/spec.md +90 -0
  215. package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/tasks.md +33 -0
  216. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/design.md +558 -0
  217. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/proposal.md +119 -0
  218. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/specs/webtest-resources/spec.md +109 -0
  219. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/specs/webtest-tools/spec.md +121 -0
  220. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/tasks.md +133 -0
  221. package/openspec/changes/extract-prompts-to-markdown/design.md +86 -0
  222. package/openspec/changes/extract-prompts-to-markdown/proposal.md +50 -0
  223. package/openspec/changes/extract-prompts-to-markdown/specs/webtest-prompts/spec.md +74 -0
  224. package/openspec/changes/extract-prompts-to-markdown/tasks.md +40 -0
  225. package/openspec/changes/refactor-webtest-naming/design.md +95 -0
  226. package/openspec/changes/refactor-webtest-naming/proposal.md +66 -0
  227. package/openspec/changes/refactor-webtest-naming/specs/webtest-prompts/spec.md +79 -0
  228. package/openspec/changes/refactor-webtest-naming/specs/webtest-resources/spec.md +80 -0
  229. package/openspec/changes/refactor-webtest-naming/specs/webtest-sampling/spec.md +122 -0
  230. package/openspec/changes/refactor-webtest-naming/specs/webtest-tools/spec.md +113 -0
  231. package/openspec/changes/refactor-webtest-naming/tasks.md +119 -0
  232. package/openspec/changes/rename-package-to-retest/proposal.md +52 -0
  233. package/openspec/changes/rename-package-to-retest/specs/mcp-server-core/spec.md +53 -0
  234. package/openspec/changes/rename-package-to-retest/specs/retest-lifecycle/spec.md +68 -0
  235. package/openspec/changes/rename-package-to-retest/specs/retest-logging/spec.md +35 -0
  236. package/openspec/changes/rename-package-to-retest/specs/retest-prompts/spec.md +159 -0
  237. package/openspec/changes/rename-package-to-retest/specs/retest-resources/spec.md +251 -0
  238. package/openspec/changes/rename-package-to-retest/specs/retest-sampling/spec.md +99 -0
  239. package/openspec/changes/rename-package-to-retest/specs/retest-tools/spec.md +295 -0
  240. package/openspec/changes/rename-package-to-retest/tasks.md +71 -0
  241. package/openspec/project.md +31 -0
  242. package/openspec/specs/mcp-server-core/spec.md +178 -0
  243. package/openspec/specs/webtest-lifecycle/spec.md +136 -0
  244. package/openspec/specs/webtest-logging/spec.md +209 -0
  245. package/openspec/specs/webtest-prompts/spec.md +155 -0
  246. package/openspec/specs/webtest-resources/spec.md +248 -0
  247. package/openspec/specs/webtest-sampling/spec.md +344 -0
  248. package/openspec/specs/webtest-tools/spec.md +282 -0
  249. package/package.json +54 -0
  250. package/release.config.js +9 -0
  251. package/src/config.test.ts +96 -0
  252. package/src/config.ts +32 -0
  253. package/src/elicitation/index.test.ts +399 -0
  254. package/src/elicitation/index.ts +171 -0
  255. package/src/elicitation/types.ts +68 -0
  256. package/src/index.ts +83 -0
  257. package/src/lifecycle/index.test.ts +260 -0
  258. package/src/lifecycle/index.ts +101 -0
  259. package/src/logger.redaction.test.ts +322 -0
  260. package/src/logger.test.ts +123 -0
  261. package/src/logger.ts +229 -0
  262. package/src/playwright-client/index.ts +392 -0
  263. package/src/playwright-client/types.ts +99 -0
  264. package/src/progress/index.test.ts +327 -0
  265. package/src/progress/index.ts +170 -0
  266. package/src/progress/types.ts +25 -0
  267. package/src/prompts/index.test.ts +451 -0
  268. package/src/prompts/index.ts +246 -0
  269. package/src/prompts/loader.test.ts +100 -0
  270. package/src/prompts/loader.ts +59 -0
  271. package/src/prompts/templates/mcp/webtest-crawl.md +7 -0
  272. package/src/prompts/templates/mcp/webtest-discover-flows.md +11 -0
  273. package/src/prompts/templates/mcp/webtest-discover.md +12 -0
  274. package/src/prompts/templates/mcp/webtest-full-workflow.md +12 -0
  275. package/src/prompts/templates/mcp/webtest-generate-tests.md +11 -0
  276. package/src/prompts/templates/mcp/webtest-run-test.md +11 -0
  277. package/src/prompts/templates/mcp/webtest-start.md +8 -0
  278. package/src/prompts/templates/sampling/crawl-action.md +35 -0
  279. package/src/prompts/templates/sampling/feature-discovery.md +27 -0
  280. package/src/prompts/templates/sampling/flow-discovery.md +29 -0
  281. package/src/prompts/templates/sampling/page-content-wrapper.md +5 -0
  282. package/src/prompts/templates/sampling/system-prefix.md +12 -0
  283. package/src/prompts/templates/sampling/test-evaluation.md +17 -0
  284. package/src/prompts/templates/sampling/test-generation.md +31 -0
  285. package/src/resources/index.ts +250 -0
  286. package/src/resources/subscriptions.ts +37 -0
  287. package/src/sampling/index.test.ts +414 -0
  288. package/src/sampling/index.ts +286 -0
  289. package/src/sampling/prompts.ts +194 -0
  290. package/src/sampling/types.ts +60 -0
  291. package/src/schemas/config.ts +39 -0
  292. package/src/security/index.test.ts +441 -0
  293. package/src/security/index.ts +361 -0
  294. package/src/security/security-scenarios.test.ts +468 -0
  295. package/src/server.ts +211 -0
  296. package/src/test-utils/index.ts +6 -0
  297. package/src/test-utils/mock-context.ts +426 -0
  298. package/src/test-utils/mock-playwright-client.ts +422 -0
  299. package/src/tools/index.ts +11 -0
  300. package/src/tools/webtest/crawl.test.ts +834 -0
  301. package/src/tools/webtest/crawl.ts +901 -0
  302. package/src/tools/webtest/discover-features.ts +412 -0
  303. package/src/tools/webtest/discover-flows.ts +408 -0
  304. package/src/tools/webtest/generate-tests.test.ts +532 -0
  305. package/src/tools/webtest/generate-tests.ts +425 -0
  306. package/src/tools/webtest/index.ts +7 -0
  307. package/src/tools/webtest/integration.test.ts +536 -0
  308. package/src/tools/webtest/run-test-case.test.ts +659 -0
  309. package/src/tools/webtest/run-test-case.ts +508 -0
  310. package/src/tools/webtest/schemas.ts +201 -0
  311. package/src/tools/webtest/start-analysis.test.ts +151 -0
  312. package/src/tools/webtest/start-analysis.ts +158 -0
  313. package/src/transports/http.ts +19 -0
  314. package/src/transports/index.ts +30 -0
  315. package/src/transports/stdio.ts +7 -0
  316. package/src/types/capabilities.test.ts +193 -0
  317. package/src/types/capabilities.ts +50 -0
  318. package/src/types/context.ts +21 -0
  319. package/src/types/tool.ts +11 -0
  320. package/src/workspace/index.ts +945 -0
  321. package/src/workspace/markdown.ts +272 -0
  322. package/src/workspace/types.ts +186 -0
  323. package/tests/integration/server.test.ts +89 -0
  324. package/tests/integration/tools.test.ts +99 -0
  325. package/tsconfig.json +20 -0
  326. package/vitest.config.ts +9 -0
  327. package/vitest.integration.config.ts +10 -0
package/LICENSE ADDED
@@ -0,0 +1,65 @@
1
+ ## PROPRIETARY LICENSE (v1.1 – tightened)
2
+
3
+ Copyright (c) 2025 Ing. Jan Beránek
4
+ All rights reserved.
5
+ Contact: [honza@beranku.cz](mailto:honza@beranku.cz)
6
+ (“Licensor”, “we”, “us”)
7
+
8
+ This software and associated documentation (the “Software”) is proprietary and protected by copyright and other laws. **No rights are granted** except as expressly set out in a **separate written agreement** signed by the Licensor (a “Commercial Agreement”). **If you do not have a Commercial Agreement, you have no rights to use the Software.**
9
+
10
+ ### 1. Acceptance
11
+
12
+ By installing, copying, accessing, executing, or otherwise using the Software, you agree to be bound by this license.
13
+
14
+ ### 2. No Public License Grant
15
+
16
+ No license, right, or interest in the Software is granted or transferred to you except as expressly set out in a Commercial Agreement.
17
+
18
+ ### 3. Authorized Use Only (MCP / testing)
19
+
20
+ You may use the Software **only** as explicitly permitted in a Commercial Agreement and **only for testing systems you are authorized to test**. You represent and warrant that you have all necessary rights and permissions for any target application or environment you test.
21
+
22
+ ### 4. Restrictions
23
+
24
+ Except as expressly permitted in a Commercial Agreement, you must not (and must not permit any third party to):
25
+
26
+ * copy, reproduce, publish, distribute, or disclose the Software (in whole or in part);
27
+ * sell, sublicense, rent, lease, lend, **host**, provide as a **service bureau**, timesharing, SaaS, managed service, or otherwise make the Software available to any third party;
28
+ * use the Software to provide testing services to third parties, or to build or offer a competing product/service;
29
+ * modify, translate, adapt, or create derivative works;
30
+ * reverse engineer, decompile, disassemble, or attempt to derive source code, ideas, algorithms, protocols, or structure of the Software, **except to the limited extent such restriction is prohibited by applicable law**;
31
+ * circumvent or disable authentication, access controls, usage limits, telemetry/licensing checks, or security mechanisms;
32
+ * remove, alter, or obscure proprietary notices;
33
+ * publish or disclose benchmarks, performance results, security analyses, or comparisons relating to the Software without Licensor’s prior written consent.
34
+
35
+ ### 5. Confidentiality
36
+
37
+ The Software may contain trade secrets and confidential information. You must treat the Software and any non-public information about it as confidential, use at least reasonable care to protect it, and not disclose it to any third party. These obligations survive termination.
38
+
39
+ ### 6. Ownership
40
+
41
+ The Software remains the exclusive property of the Licensor and its licensors. All rights not expressly granted are reserved.
42
+
43
+ ### 7. Termination
44
+
45
+ Any rights you may have under a Commercial Agreement terminate immediately upon breach. Upon termination you must cease all use and destroy all copies in your possession or control, unless required by law or a Commercial Agreement.
46
+
47
+ ### 8. Injunctive Relief
48
+
49
+ You acknowledge that unauthorized use or disclosure may cause irreparable harm, and the Licensor may seek injunctive or equitable relief in addition to any other remedies.
50
+
51
+ ### 9. Disclaimer of Warranty
52
+
53
+ THE SOFTWARE IS PROVIDED “AS IS” AND “AS AVAILABLE”, WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT.
54
+
55
+ ### 10. Limitation of Liability
56
+
57
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS, REVENUE, DATA, OR BUSINESS INTERRUPTION.
58
+
59
+ ### 11. Indemnity
60
+
61
+ You will defend, indemnify, and hold harmless the Licensor from any claims, damages, liabilities, penalties, and expenses arising from your (or your users’) use of the Software in violation of this license, including unauthorized testing or illegal use.
62
+
63
+ ### 12. Governing Law
64
+
65
+ This license is governed by the laws of the Czech Republic, excluding conflict-of-law rules. Any disputes shall be resolved by the competent courts in the Czech Republic.
package/README.md ADDED
@@ -0,0 +1,303 @@
1
+ # retest:kit
2
+
3
+ > **Proprietary software. No public license is granted.**
4
+ > Use, copying, modification, or distribution is permitted **only** under a separate written agreement with the Licensor.
5
+ > See: **[LICENSE](./LICENSE)**
6
+
7
+ ## Overview
8
+
9
+ This repository contains an **MCP server** for **AI-powered web application testing**. It provides tools for automated crawling, application analysis, test generation, and test execution using the Model Context Protocol (MCP).
10
+
11
+ The server integrates with:
12
+ - **MCP-compatible clients** (Claude Desktop, custom clients)
13
+ - **Playwright MCP** for browser automation
14
+ - **MCP Sampling** for AI-powered decision making
15
+ - **MCP Elicitation** for interactive user input
16
+
17
+ ## Authorized Use Only
18
+
19
+ You may use this Software **only** if:
20
+ - you have a **separate written agreement** with the Licensor, and
21
+ - you test only systems you are **authorized to test**.
22
+
23
+ Any other use is prohibited. See **[LICENSE](./LICENSE)**.
24
+
25
+ ## Features
26
+
27
+ - **Goal-directed crawling** - AI navigates web applications to achieve specified goals
28
+ - **Application analysis** - Automatic discovery of entities, user flows, and assertions
29
+ - **Test generation** - AI-generated test cases based on application analysis
30
+ - **Test execution** - Automated test running with evidence capture
31
+ - **Progress tracking** - Real-time progress notifications with budget status
32
+ - **Checkpoint & resume** - Crawl checkpointing for resumable operations
33
+ - **Security features** - Domain allowlists, injection protection, exfiltration blocking
34
+ - **Resource management** - `webtest://` URI scheme for artifact access
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ npm install
40
+ npm run build
41
+ ```
42
+
43
+ ## Configuration
44
+
45
+ Configuration is done via environment variables:
46
+
47
+ | Variable | Default | Description |
48
+ |----------|---------|-------------|
49
+ | `TRANSPORT` | `stdio` | Transport type: `stdio` or `http` |
50
+ | `PORT` | `3000` | HTTP port (when `TRANSPORT=http`) |
51
+ | `LOG_LEVEL` | `info` | Log level: `debug`, `info`, `warn`, `error` |
52
+ | `WEBTEST_WORKSPACE_DIR` | `./webtest-workspaces` | Directory for analysis workspaces |
53
+ | `PLAYWRIGHT_MCP_COMMAND` | `npx` | Command to spawn Playwright MCP |
54
+ | `PLAYWRIGHT_MCP_ARGS` | `@playwright/mcp@latest` | Comma-separated args for Playwright MCP |
55
+ | `CHECKPOINT_INTERVAL` | `5` | Steps between crawl checkpoints |
56
+ | `SCREENSHOT_FORMAT` | `png` | Screenshot format: `png` or `jpeg` |
57
+ | `SCREENSHOT_QUALITY` | `80` | JPEG quality (1-100) |
58
+ | `DEFAULT_MAX_STEPS` | `50` | Default max crawl steps |
59
+ | `DEFAULT_MAX_MINUTES` | `30` | Default max crawl duration |
60
+ | `DEFAULT_MAX_PAGES` | `20` | Default max pages to crawl |
61
+
62
+ ## Available Tools
63
+
64
+ ### `webtest_init`
65
+
66
+ Initialize a new web testing analysis workspace.
67
+
68
+ **Input:**
69
+ ```json
70
+ {
71
+ "url": "https://example.com",
72
+ "focus": "User authentication flow",
73
+ "limits": {
74
+ "maxSteps": 50,
75
+ "maxMinutes": 30,
76
+ "maxPages": 20
77
+ },
78
+ "allowedDomains": ["example.com", "*.example.com"]
79
+ }
80
+ ```
81
+
82
+ **Output:** `analysisId` (e.g., `2025-01-15_10-30`), `workspacePath`
83
+
84
+ ### `webtest_crawl_app`
85
+
86
+ Perform goal-directed crawling of a web application.
87
+
88
+ **Input:**
89
+ ```json
90
+ {
91
+ "analysisId": "2025-01-15_10-30",
92
+ "goal": "Navigate to login page and explore authentication options",
93
+ "strategy": "goal_directed",
94
+ "limits": { "maxSteps": 30 },
95
+ "artifacts": { "captureScreenshots": true, "captureSnapshots": true, "captureDom": true },
96
+ "resume": false
97
+ }
98
+ ```
99
+
100
+ **Features:**
101
+ - AI-powered navigation decisions via MCP Sampling
102
+ - Loop detection (DOM signatures, URL cycles, action repeats)
103
+ - Budget enforcement (steps, time, pages)
104
+ - Checkpointing every N steps (configurable)
105
+ - Elicitation for user decisions (cookie consent, modals, auth)
106
+ - Domain validation and security checks
107
+
108
+ **Output:** `crawlId` (e.g., `2025-01-15_10-30-45`), `crawlPath`, page artifacts
109
+
110
+ ### `webtest_analyze_app`
111
+
112
+ Analyze a crawled application to extract structure and flows.
113
+
114
+ **Input:**
115
+ ```json
116
+ {
117
+ "analysisId": "2025-01-15_10-30",
118
+ "crawlId": "2025-01-15_10-30-45"
119
+ }
120
+ ```
121
+
122
+ **Output:** `appAnalysisUri`, `appAnalysisFilePath`, `flowsUri`, `flowsFilePath` containing:
123
+ - Application purpose and type
124
+ - Discovered entities with fields
125
+ - User flows with steps
126
+ - Assertions (invariants, pre/postconditions)
127
+ - Security and accessibility observations
128
+
129
+ ### `webtest_generate_tests`
130
+
131
+ Generate test cases from application analysis.
132
+
133
+ **Input:**
134
+ ```json
135
+ {
136
+ "analysisId": "2025-01-15_10-30",
137
+ "testStrategy": "comprehensive",
138
+ "maxTests": 20,
139
+ "focusFlows": ["checkout-flow", "login-flow"]
140
+ }
141
+ ```
142
+
143
+ **Output:** `testsUri`, `testsFilePath` containing test cases with:
144
+ - ID, name, purpose, category
145
+ - Preconditions and steps
146
+ - Expected outcomes
147
+
148
+ ### `webtest_run_tests`
149
+
150
+ Execute a generated test case.
151
+
152
+ **Input:**
153
+ ```json
154
+ {
155
+ "analysisId": "2025-01-15_10-30",
156
+ "testCaseId": "TC-001",
157
+ "runOptions": {
158
+ "captureEvidence": true,
159
+ "stopOnFailure": true,
160
+ "retryFailedSteps": false
161
+ }
162
+ }
163
+ ```
164
+
165
+ **Output:** `runId`, `reportUri`, step results with:
166
+ - Pass/fail status per step
167
+ - Evidence (screenshots, DOM state)
168
+ - Failure reasoning and discrepancies
169
+
170
+ ## Resources
171
+
172
+ The server exposes resources via the `webtest://` URI scheme:
173
+
174
+ - `webtest://{analysisId}/index.md` - Workspace metadata and summary
175
+ - `webtest://{analysisId}/crawls/{crawlId}/index.md` - Crawl index with action history
176
+ - `webtest://{analysisId}/crawls/{crawlId}/checkpoint.md` - Crawl checkpoint state
177
+ - `webtest://{analysisId}/crawls/{crawlId}/pages/{pageId}/snapshot.md` - Page accessibility snapshot
178
+ - `webtest://{analysisId}/crawls/{crawlId}/pages/{pageId}/screenshot.png` - Page screenshot
179
+ - `webtest://{analysisId}/crawls/{crawlId}/pages/{pageId}/dom.html` - Page DOM
180
+ - `webtest://{analysisId}/analysis/app-analysis.md` - Application analysis report
181
+ - `webtest://{analysisId}/analysis/flows.md` - User flows with structured data
182
+ - `webtest://{analysisId}/tests/tests.md` - Generated test cases
183
+ - `webtest://{analysisId}/runs/{runId}/report.md` - Test run report
184
+ - `webtest://{analysisId}/runs/{runId}/steps/{n}/snapshot.md` - Step evidence snapshot
185
+
186
+ ### Artifact Format
187
+
188
+ All artifacts (except screenshots and DOM) use **Markdown with YAML frontmatter**:
189
+
190
+ ```markdown
191
+ ---
192
+ analysisId: "2025-01-15_10-30"
193
+ url: "https://example.com"
194
+ status: "active"
195
+ # ... structured data in YAML ...
196
+ ---
197
+
198
+ # Human-Readable Content
199
+
200
+ This section contains formatted markdown for easy browsing.
201
+ ```
202
+
203
+ **Benefits:**
204
+ - Human-readable without special tools
205
+ - Structured data accessible via frontmatter parsing
206
+ - Works with any markdown viewer or IDE
207
+ - Git-friendly diffs
208
+
209
+ **Parsing frontmatter programmatically:**
210
+ ```typescript
211
+ import matter from "gray-matter";
212
+
213
+ const { data, content } = matter(markdownContent);
214
+ // data = parsed YAML frontmatter object
215
+ // content = markdown body
216
+ ```
217
+
218
+ ### Workspace Folder Naming
219
+
220
+ Workspaces use date-time based folder names for easy identification:
221
+ - **Workspace ID**: `YYYY-MM-DD_HH-mm` (e.g., `2025-01-15_10-30`)
222
+ - **Crawl ID**: `YYYY-MM-DD_HH-mm-ss` (e.g., `2025-01-15_10-30-45`)
223
+
224
+ Legacy UUID-format IDs are still supported for backwards compatibility.
225
+
226
+ ## Prompts
227
+
228
+ The server provides prompts for guided workflows:
229
+
230
+ - **webtest-start** - Initialize a new analysis
231
+ - **webtest-crawl** - Start or continue crawling
232
+ - **webtest-analyze** - Analyze crawled application
233
+ - **webtest-generate-tests** - Generate test cases
234
+ - **webtest-run-test** - Execute a test case
235
+ - **webtest-full-workflow** - Complete end-to-end workflow
236
+
237
+ ## Example Workflow
238
+
239
+ ```
240
+ 1. Start analysis:
241
+ webtest_init({ url: "https://myapp.com", focus: "checkout flow" })
242
+ → Returns analysisId
243
+
244
+ 2. Crawl the application:
245
+ webtest_crawl_app({ analysisId, goal: "Explore product catalog and checkout" })
246
+ → Returns crawlId, artifacts
247
+
248
+ 3. Analyze the application:
249
+ webtest_analyze_app({ analysisId, crawlId })
250
+ → Returns app structure, flows, assertions
251
+
252
+ 4. Generate test cases:
253
+ webtest_generate_tests({ analysisId, appAnalysisUri })
254
+ → Returns test cases
255
+
256
+ 5. Run tests:
257
+ webtest_run_tests({ analysisId, testCaseId, testsUri })
258
+ → Returns test results with evidence
259
+ ```
260
+
261
+ ## MCP Client Requirements
262
+
263
+ For full functionality, the MCP client should support:
264
+
265
+ | Capability | Required | Used For |
266
+ |------------|----------|----------|
267
+ | `sampling` | Recommended | AI-powered crawling, analysis, test generation |
268
+ | `elicitation` | Optional | User decisions during crawl (cookie consent, auth) |
269
+ | `logging` | Optional | Structured log delivery via MCP notifications |
270
+ | `resources.listChanged` | Optional | Real-time resource update notifications |
271
+ | `resources.subscribe` | Optional | Resource subscription support |
272
+
273
+ **Fallback modes:** When sampling is unavailable, tools return prompt resources for manual execution. When elicitation is unavailable, questions are returned in tool output.
274
+
275
+ ## Security
276
+
277
+ The server implements multiple security layers:
278
+
279
+ - **Domain allowlists** - Restrict navigation to authorized domains
280
+ - **Prompt injection protection** - Untrusted content demarcation in AI prompts
281
+ - **Data exfiltration blocking** - Prevents sensitive data leakage
282
+ - **Credential elicitation blocking** - Refuses to ask for passwords
283
+ - **Audit logging** - All AI inputs/outputs logged for review
284
+ - **Sensitive data redaction** - URL params, cookies, passwords redacted in logs
285
+
286
+ ## Getting Access
287
+
288
+ To request commercial access or a license agreement, contact:
289
+ **Ing. Jan Beránek** — honza@beranku.cz
290
+
291
+ ## Security & Responsible Use
292
+
293
+ If you discover a security issue, please report it privately to the contact above.
294
+ Do not open public issues containing sensitive details.
295
+
296
+ ## Repository Status
297
+
298
+ Unless explicitly stated in a separate agreement, this repository is provided **without warranty** and **without support obligations**.
299
+
300
+ ## License
301
+
302
+ Copyright (c) 2025 Ing. Jan Beránek.
303
+ All rights reserved. See **[LICENSE](./LICENSE)**.
@@ -0,0 +1,4 @@
1
+ import { type Config } from "./schemas/config.js";
2
+ export declare function loadConfig(): Config;
3
+ export type { Config };
4
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAEhE,wBAAgB,UAAU,IAAI,MAAM,CA2BnC;AAED,YAAY,EAAE,MAAM,EAAE,CAAC"}
package/dist/config.js ADDED
@@ -0,0 +1,27 @@
1
+ import { ConfigSchema } from "./schemas/config.js";
2
+ export function loadConfig() {
3
+ const rawConfig = {
4
+ transport: process.env.TRANSPORT,
5
+ port: process.env.PORT,
6
+ logLevel: process.env.LOG_LEVEL,
7
+ // Webtest configuration
8
+ workspaceDir: process.env.WEBTEST_WORKSPACE_DIR,
9
+ playwrightMcpCommand: process.env.PLAYWRIGHT_MCP_COMMAND,
10
+ playwrightMcpArgs: process.env.PLAYWRIGHT_MCP_ARGS,
11
+ checkpointInterval: process.env.WEBTEST_CHECKPOINT_INTERVAL,
12
+ screenshotFormat: process.env.WEBTEST_SCREENSHOT_FORMAT,
13
+ screenshotQuality: process.env.WEBTEST_SCREENSHOT_QUALITY,
14
+ defaultMaxSteps: process.env.WEBTEST_DEFAULT_MAX_STEPS,
15
+ defaultMaxMinutes: process.env.WEBTEST_DEFAULT_MAX_MINUTES,
16
+ defaultMaxPages: process.env.WEBTEST_DEFAULT_MAX_PAGES,
17
+ };
18
+ const result = ConfigSchema.safeParse(rawConfig);
19
+ if (!result.success) {
20
+ const errors = result.error.issues
21
+ .map((issue) => `${issue.path.join(".")}: ${issue.message}`)
22
+ .join(", ");
23
+ throw new Error(`Invalid configuration: ${errors}`);
24
+ }
25
+ return result.data;
26
+ }
27
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,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 import type { Logger } from "../logger.js";
2
+ import type { ClientCapabilities } from "../types/capabilities.js";
3
+ import { type ElicitationRequest, type ElicitationResponse, type ElicitationResult } from "./types.js";
4
+ export * from "./types.js";
5
+ export interface ElicitationClient {
6
+ elicit(request: ElicitationRequest): Promise<ElicitationResult>;
7
+ hasElicitation(): boolean;
8
+ createCookieConsentRequest(context: string): ElicitationRequest;
9
+ createModalBlockingRequest(modalContent: string): ElicitationRequest;
10
+ createAmbiguousNavigationRequest(options: Array<{
11
+ url: string;
12
+ label: string;
13
+ }>): ElicitationRequest;
14
+ createAuthRequiredRequest(): ElicitationRequest;
15
+ }
16
+ export declare function createElicitationClient(requestElicitation: (request: ElicitationRequest) => Promise<ElicitationResponse>, capabilities: ClientCapabilities, logger: Logger): ElicitationClient;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/elicitation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAKvB,MAAM,YAAY,CAAC;AAEpB,cAAc,YAAY,CAAC;AAE3B,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChE,cAAc,IAAI,OAAO,CAAC;IAC1B,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAChE,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,CAAC;IACrE,gCAAgC,CAC9B,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAC7C,kBAAkB,CAAC;IACtB,yBAAyB,IAAI,kBAAkB,CAAC;CACjD;AAED,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,CAClB,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,mBAAmB,CAAC,EACjC,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,MAAM,GACb,iBAAiB,CA0InB"}
@@ -0,0 +1,118 @@
1
+ import { isElicitationSupported } from "../types/capabilities.js";
2
+ import { ElicitationType, COOKIE_CONSENT_OPTIONS, MODAL_BLOCKING_OPTIONS, AUTH_REQUIRED_OPTIONS, } from "./types.js";
3
+ export * from "./types.js";
4
+ export function createElicitationClient(requestElicitation, capabilities, logger) {
5
+ const hasElicitationCapability = isElicitationSupported(capabilities);
6
+ async function elicit(request) {
7
+ // Validate that we never request credentials
8
+ if (request.type === ElicitationType.AuthRequired) {
9
+ // Ensure options don't include credential entry
10
+ const hasCredentialOption = request.options.some((opt) => opt.value.includes("password") ||
11
+ opt.value.includes("credential") ||
12
+ opt.value.includes("login"));
13
+ if (hasCredentialOption) {
14
+ logger.error("Attempted to elicit credentials - blocked", {
15
+ type: request.type,
16
+ });
17
+ return {
18
+ success: false,
19
+ error: "Security policy prevents credential elicitation",
20
+ };
21
+ }
22
+ }
23
+ // If elicitation not available, return fallback
24
+ if (!hasElicitationCapability) {
25
+ logger.info("Elicitation unavailable, returning fallback questions");
26
+ return {
27
+ success: false,
28
+ error: "Elicitation not available",
29
+ fallbackQuestions: request,
30
+ };
31
+ }
32
+ logger.debug("Sending elicitation request", {
33
+ type: request.type,
34
+ title: request.title,
35
+ optionCount: request.options.length,
36
+ });
37
+ try {
38
+ const response = await requestElicitation(request);
39
+ if (response.action === "cancel") {
40
+ logger.info("User cancelled elicitation", { type: request.type });
41
+ return {
42
+ success: true,
43
+ cancelled: true,
44
+ };
45
+ }
46
+ if (response.action === "dismiss") {
47
+ logger.info("User dismissed elicitation", { type: request.type });
48
+ return {
49
+ success: true,
50
+ selectedValue: "dismiss",
51
+ };
52
+ }
53
+ // Extract selected value from content
54
+ const selectedValue = response.content?.selected || response.content?.value;
55
+ logger.info("Elicitation response received", {
56
+ type: request.type,
57
+ action: response.action,
58
+ selectedValue,
59
+ });
60
+ return {
61
+ success: true,
62
+ selectedValue,
63
+ customValue: response.content?.custom,
64
+ };
65
+ }
66
+ catch (error) {
67
+ const message = error instanceof Error ? error.message : "Unknown error";
68
+ logger.error("Elicitation request failed", { error: message });
69
+ return {
70
+ success: false,
71
+ error: message,
72
+ fallbackQuestions: request,
73
+ };
74
+ }
75
+ }
76
+ return {
77
+ elicit,
78
+ hasElicitation: () => hasElicitationCapability,
79
+ createCookieConsentRequest(context) {
80
+ return {
81
+ type: ElicitationType.CookieConsent,
82
+ title: "Cookie Consent Banner Detected",
83
+ message: `A cookie consent banner was detected on the page. How should we handle it?\n\nContext: ${context}`,
84
+ options: COOKIE_CONSENT_OPTIONS,
85
+ };
86
+ },
87
+ createModalBlockingRequest(modalContent) {
88
+ return {
89
+ type: ElicitationType.ModalBlocking,
90
+ title: "Modal Dialog Blocking Page",
91
+ message: `A modal dialog is blocking page interaction.\n\nModal content: ${modalContent.slice(0, 200)}...`,
92
+ options: MODAL_BLOCKING_OPTIONS,
93
+ };
94
+ },
95
+ createAmbiguousNavigationRequest(options) {
96
+ return {
97
+ type: ElicitationType.AmbiguousNavigation,
98
+ title: "Multiple Navigation Options",
99
+ message: "Multiple similar navigation options were found. Which path should we explore?",
100
+ options: options.slice(0, 5).map((opt, i) => ({
101
+ value: opt.url,
102
+ label: opt.label || `Option ${i + 1}`,
103
+ description: opt.url,
104
+ })),
105
+ allowCustom: true,
106
+ };
107
+ },
108
+ createAuthRequiredRequest() {
109
+ return {
110
+ type: ElicitationType.AuthRequired,
111
+ title: "Authentication Required",
112
+ message: "This page requires authentication. For security reasons, we cannot handle login automatically. How would you like to proceed?",
113
+ options: AUTH_REQUIRED_OPTIONS,
114
+ };
115
+ },
116
+ };
117
+ }
118
+ //# sourceMappingURL=index.js.map
@@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AC;QAED,yBAAyB;YACvB,OAAO;gBACL,IAAI,EAAE,eAAe,CAAC,YAAY;gBAClC,KAAK,EAAE,yBAAyB;gBAChC,OAAO,EACL,+HAA+H;gBACjI,OAAO,EAAE,qBAAqB;aAC/B,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ export declare enum ElicitationType {
2
+ CookieConsent = "cookie_consent",
3
+ ModalBlocking = "modal_blocking",
4
+ AmbiguousNavigation = "ambiguous_navigation",
5
+ AuthRequired = "auth_required",
6
+ ConfirmAction = "confirm_action"
7
+ }
8
+ export interface ElicitationOption {
9
+ value: string;
10
+ label: string;
11
+ description?: string;
12
+ }
13
+ export interface ElicitationRequest {
14
+ type: ElicitationType;
15
+ title: string;
16
+ message: string;
17
+ options: ElicitationOption[];
18
+ allowCustom?: boolean;
19
+ }
20
+ export interface ElicitationResponse {
21
+ action: "confirm" | "dismiss" | "cancel";
22
+ content?: Record<string, string>;
23
+ }
24
+ export interface ElicitationResult {
25
+ success: boolean;
26
+ selectedValue?: string;
27
+ customValue?: string;
28
+ cancelled?: boolean;
29
+ error?: string;
30
+ fallbackQuestions?: ElicitationRequest;
31
+ }
32
+ export declare const COOKIE_CONSENT_OPTIONS: ElicitationOption[];
33
+ export declare const MODAL_BLOCKING_OPTIONS: ElicitationOption[];
34
+ export declare const AUTH_REQUIRED_OPTIONS: ElicitationOption[];
35
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/elicitation/types.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,aAAa,mBAAmB;IAChC,aAAa,mBAAmB;IAChC,mBAAmB,yBAAyB;IAC5C,YAAY,kBAAkB;IAC9B,aAAa,mBAAmB;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;CACxC;AAGD,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,EAYrD,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,EAOrD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,EAOpD,CAAC"}
@@ -0,0 +1,39 @@
1
+ export var ElicitationType;
2
+ (function (ElicitationType) {
3
+ ElicitationType["CookieConsent"] = "cookie_consent";
4
+ ElicitationType["ModalBlocking"] = "modal_blocking";
5
+ ElicitationType["AmbiguousNavigation"] = "ambiguous_navigation";
6
+ ElicitationType["AuthRequired"] = "auth_required";
7
+ ElicitationType["ConfirmAction"] = "confirm_action";
8
+ })(ElicitationType || (ElicitationType = {}));
9
+ // Predefined option sets for common scenarios
10
+ export const COOKIE_CONSENT_OPTIONS = [
11
+ { value: "accept", label: "Accept All", description: "Accept all cookies" },
12
+ {
13
+ value: "reject",
14
+ label: "Reject All",
15
+ description: "Reject non-essential cookies",
16
+ },
17
+ {
18
+ value: "dismiss",
19
+ label: "Dismiss",
20
+ description: "Close the banner without choosing",
21
+ },
22
+ ];
23
+ export const MODAL_BLOCKING_OPTIONS = [
24
+ { value: "close", label: "Close Modal", description: "Close and continue" },
25
+ {
26
+ value: "interact",
27
+ label: "Interact",
28
+ description: "Interact with modal content",
29
+ },
30
+ ];
31
+ export const AUTH_REQUIRED_OPTIONS = [
32
+ { value: "stop", label: "Stop Analysis", description: "End the analysis" },
33
+ {
34
+ value: "continue",
35
+ label: "Continue Unauthenticated",
36
+ description: "Continue without logging in",
37
+ },
38
+ ];
39
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/elicitation/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,mDAAgC,CAAA;IAChC,mDAAgC,CAAA;IAChC,+DAA4C,CAAA;IAC5C,iDAA8B,CAAA;IAC9B,mDAAgC,CAAA;AAClC,CAAC,EANW,eAAe,KAAf,eAAe,QAM1B;AA8BD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,sBAAsB,GAAwB;IACzD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE;IAC3E;QACE,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,8BAA8B;KAC5C;IACD;QACE,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,mCAAmC;KACjD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAwB;IACzD,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE;IAC3E;QACE,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,6BAA6B;KAC3C;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAwB;IACxD,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE;IAC1E;QACE,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,6BAA6B;KAC3C;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}