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
@@ -0,0 +1,207 @@
1
+ import { loadTemplate, interpolate } from "./loader.js";
2
+ // Load templates once at module initialization
3
+ const webtestStartTemplate = loadTemplate("mcp", "webtest-start");
4
+ const webtestCrawlTemplate = loadTemplate("mcp", "webtest-crawl");
5
+ const webtestDiscoverTemplate = loadTemplate("mcp", "webtest-discover");
6
+ const webtestDiscoverFlowsTemplate = loadTemplate("mcp", "webtest-discover-flows");
7
+ const webtestGenerateTestsTemplate = loadTemplate("mcp", "webtest-generate-tests");
8
+ const webtestRunTestTemplate = loadTemplate("mcp", "webtest-run-test");
9
+ const webtestFullWorkflowTemplate = loadTemplate("mcp", "webtest-full-workflow");
10
+ export function createWebtestPrompts(getContext) {
11
+ return [
12
+ {
13
+ name: "webtest-start",
14
+ description: "Start a new web testing analysis. Guides you through setting up a workspace for testing a web application.",
15
+ arguments: [
16
+ {
17
+ name: "url",
18
+ description: "The URL of the web application to test",
19
+ required: true,
20
+ },
21
+ {
22
+ name: "focus",
23
+ description: "Optional focus area (e.g., 'checkout flow', 'user registration')",
24
+ required: false,
25
+ },
26
+ ],
27
+ async getMessages(args) {
28
+ const url = args.url || "[URL]";
29
+ const focus = args.focus ? `\nFocus area: ${args.focus}` : "";
30
+ return [
31
+ {
32
+ role: "user",
33
+ content: {
34
+ type: "text",
35
+ text: interpolate(webtestStartTemplate, { url, focus }),
36
+ },
37
+ },
38
+ ];
39
+ },
40
+ },
41
+ {
42
+ name: "webtest-crawl",
43
+ description: "Crawl a web application to discover pages and functionality. Requires an existing analysis workspace.",
44
+ arguments: [
45
+ {
46
+ name: "analysisId",
47
+ description: "The ID of the analysis workspace",
48
+ required: true,
49
+ },
50
+ {
51
+ name: "goal",
52
+ description: "What you want to discover or explore",
53
+ required: true,
54
+ },
55
+ {
56
+ name: "strategy",
57
+ description: "Crawling strategy: breadth_first, depth_first, or goal_directed",
58
+ required: false,
59
+ },
60
+ ],
61
+ async getMessages(args) {
62
+ const analysisId = args.analysisId || "[analysisId]";
63
+ const goal = args.goal || "explore the main functionality";
64
+ const strategy = args.strategy || "goal_directed";
65
+ return [
66
+ {
67
+ role: "user",
68
+ content: {
69
+ type: "text",
70
+ text: interpolate(webtestCrawlTemplate, { analysisId, goal, strategy }),
71
+ },
72
+ },
73
+ ];
74
+ },
75
+ },
76
+ {
77
+ name: "webtest-discover",
78
+ description: "Discover features and flows in a web application based on crawl data.",
79
+ arguments: [
80
+ {
81
+ name: "analysisId",
82
+ description: "The ID of the analysis workspace",
83
+ required: true,
84
+ },
85
+ {
86
+ name: "featureSlug",
87
+ description: "Optional: discover flows only for this specific feature",
88
+ required: false,
89
+ },
90
+ ],
91
+ async getMessages(args) {
92
+ const analysisId = args.analysisId || "[analysisId]";
93
+ const featureSlug = args.featureSlug;
94
+ if (featureSlug) {
95
+ // Single feature mode - discover flows for specific feature
96
+ return [
97
+ {
98
+ role: "user",
99
+ content: {
100
+ type: "text",
101
+ text: interpolate(webtestDiscoverFlowsTemplate, { analysisId, featureSlug }),
102
+ },
103
+ },
104
+ ];
105
+ }
106
+ // Full discovery mode
107
+ return [
108
+ {
109
+ role: "user",
110
+ content: {
111
+ type: "text",
112
+ text: interpolate(webtestDiscoverTemplate, { analysisId }),
113
+ },
114
+ },
115
+ ];
116
+ },
117
+ },
118
+ {
119
+ name: "webtest-generate-tests",
120
+ description: "Generate test cases from the application analysis.",
121
+ arguments: [
122
+ {
123
+ name: "analysisId",
124
+ description: "The ID of the analysis workspace",
125
+ required: true,
126
+ },
127
+ {
128
+ name: "strategy",
129
+ description: "Test strategy: comprehensive, happy_path, edge_cases, or critical_paths",
130
+ required: false,
131
+ },
132
+ ],
133
+ async getMessages(args) {
134
+ const analysisId = args.analysisId || "[analysisId]";
135
+ const strategy = args.strategy || "comprehensive";
136
+ return [
137
+ {
138
+ role: "user",
139
+ content: {
140
+ type: "text",
141
+ text: interpolate(webtestGenerateTestsTemplate, { analysisId, strategy }),
142
+ },
143
+ },
144
+ ];
145
+ },
146
+ },
147
+ {
148
+ name: "webtest-run-test",
149
+ description: "Run a specific test case against the web application.",
150
+ arguments: [
151
+ {
152
+ name: "analysisId",
153
+ description: "The ID of the analysis workspace",
154
+ required: true,
155
+ },
156
+ {
157
+ name: "testCaseId",
158
+ description: "The ID of the test case to run",
159
+ required: true,
160
+ },
161
+ ],
162
+ async getMessages(args) {
163
+ const analysisId = args.analysisId || "[analysisId]";
164
+ const testCaseId = args.testCaseId || "[testCaseId]";
165
+ return [
166
+ {
167
+ role: "user",
168
+ content: {
169
+ type: "text",
170
+ text: interpolate(webtestRunTestTemplate, { analysisId, testCaseId }),
171
+ },
172
+ },
173
+ ];
174
+ },
175
+ },
176
+ {
177
+ name: "webtest-full-workflow",
178
+ description: "Run the complete web testing workflow: start, crawl, analyze, generate tests, and run tests.",
179
+ arguments: [
180
+ {
181
+ name: "url",
182
+ description: "The URL of the web application to test",
183
+ required: true,
184
+ },
185
+ {
186
+ name: "focus",
187
+ description: "Focus area for testing",
188
+ required: false,
189
+ },
190
+ ],
191
+ async getMessages(args) {
192
+ const url = args.url || "[URL]";
193
+ const focus = args.focus || "main functionality";
194
+ return [
195
+ {
196
+ role: "user",
197
+ content: {
198
+ type: "text",
199
+ text: interpolate(webtestFullWorkflowTemplate, { url, focus }),
200
+ },
201
+ },
202
+ ];
203
+ },
204
+ },
205
+ ];
206
+ }
207
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,+CAA+C;AAC/C,MAAM,oBAAoB,GAAG,YAAY,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AAClE,MAAM,oBAAoB,GAAG,YAAY,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AAClE,MAAM,uBAAuB,GAAG,YAAY,CAAC,KAAK,EAAE,kBAAkB,CAAC,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C;gBACrD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,cAAc,CAAC;gBAErD,OAAO;oBACL;wBACE,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE;4BACP,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,WAAW,CAAC,sBAAsB,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;yBACtE;qBACF;iBACF,CAAC;YACJ,CAAC;SACF;QAED;YACE,IAAI,EAAE,uBAAuB;YAC7B,WAAW,EACT,8FAA8F;YAChG,SAAS,EAAE;gBACT;oBACE,IAAI,EAAE,KAAK;oBACX,WAAW,EAAE,wCAAwC;oBACrD,QAAQ,EAAE,IAAI;iBACf;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,wBAAwB;oBACrC,QAAQ,EAAE,KAAK;iBAChB;aACF;YACD,KAAK,CAAC,WAAW,CAAC,IAAI;gBACpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC;gBAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,oBAAoB,CAAC;gBAEjD,OAAO;oBACL;wBACE,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE;4BACP,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,WAAW,CAAC,2BAA2B,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;yBAC/D;qBACF;iBACF,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Load a template file from the templates directory.
3
+ * Templates are cached after first load.
4
+ */
5
+ export declare function loadTemplate(category: "sampling" | "mcp", name: string): string;
6
+ /**
7
+ * Interpolate variables in a template string.
8
+ * Replaces ${varName} patterns with values from the vars object.
9
+ * Unmatched placeholders are left unchanged.
10
+ */
11
+ export declare function interpolate(template: string, vars: Record<string, string | number | boolean | undefined>): string;
12
+ /**
13
+ * Load a template and interpolate variables in one step.
14
+ */
15
+ export declare function renderTemplate(category: "sampling" | "mcp", name: string, vars?: Record<string, string | number | boolean | undefined>): string;
16
+ /**
17
+ * Clear the template cache (useful for testing).
18
+ */
19
+ export declare function clearTemplateCache(): void;
20
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/prompts/loader.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,UAAU,GAAG,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAY/E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GAAG,MAAM,CAQjH;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,UAAU,GAAG,KAAK,EAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAM,GAC/D,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -0,0 +1,47 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { resolve, dirname } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ const __dirname = dirname(fileURLToPath(import.meta.url));
5
+ const templateCache = new Map();
6
+ /**
7
+ * Load a template file from the templates directory.
8
+ * Templates are cached after first load.
9
+ */
10
+ export function loadTemplate(category, name) {
11
+ const cacheKey = `${category}/${name}`;
12
+ if (templateCache.has(cacheKey)) {
13
+ return templateCache.get(cacheKey);
14
+ }
15
+ const templatePath = resolve(__dirname, "templates", category, `${name}.md`);
16
+ const content = readFileSync(templatePath, "utf-8");
17
+ templateCache.set(cacheKey, content);
18
+ return content;
19
+ }
20
+ /**
21
+ * Interpolate variables in a template string.
22
+ * Replaces ${varName} patterns with values from the vars object.
23
+ * Unmatched placeholders are left unchanged.
24
+ */
25
+ export function interpolate(template, vars) {
26
+ return template.replace(/\$\{(\w+)\}/g, (match, varName) => {
27
+ const value = vars[varName];
28
+ if (value === undefined) {
29
+ return match; // Keep placeholder if var not provided
30
+ }
31
+ return String(value);
32
+ });
33
+ }
34
+ /**
35
+ * Load a template and interpolate variables in one step.
36
+ */
37
+ export function renderTemplate(category, name, vars = {}) {
38
+ const template = loadTemplate(category, name);
39
+ return interpolate(template, vars);
40
+ }
41
+ /**
42
+ * Clear the template cache (useful for testing).
43
+ */
44
+ export function clearTemplateCache() {
45
+ templateCache.clear();
46
+ }
47
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/prompts/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,QAA4B,EAAE,IAAY;IACrE,MAAM,QAAQ,GAAG,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;IAEvC,IAAI,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;IACtC,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACpD,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAErC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,IAA2D;IACvG,OAAO,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACzD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC,CAAC,uCAAuC;QACvD,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,QAA4B,EAC5B,IAAY,EACZ,OAA8D,EAAE;IAEhE,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC9C,OAAO,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,aAAa,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Logger } from "../logger.js";
2
+ import type { Config } from "../schemas/config.js";
3
+ import type { ClientCapabilities } from "../types/capabilities.js";
4
+ import type { WorkspaceManager } from "../workspace/index.js";
5
+ import { createResourceSubscriptions, type ResourceSubscriptions } from "./subscriptions.js";
6
+ export { createResourceSubscriptions, type ResourceSubscriptions };
7
+ export interface Resource {
8
+ uri: string;
9
+ name: string;
10
+ description?: string;
11
+ mimeType?: string;
12
+ }
13
+ export interface ResourceContent {
14
+ uri: string;
15
+ mimeType: string;
16
+ text?: string;
17
+ blob?: string;
18
+ }
19
+ export interface ResourceManager {
20
+ listResources(analysisId?: string): Promise<Resource[]>;
21
+ readResource(uri: string): Promise<ResourceContent>;
22
+ notifyListChanged(): Promise<void>;
23
+ notifyResourceUpdated(uri: string): Promise<void>;
24
+ subscriptions: ResourceSubscriptions;
25
+ }
26
+ export declare function createResourceManager(config: Config, workspaceManager: WorkspaceManager, sendNotification: (method: string, params: unknown) => Promise<void>, capabilities: ClientCapabilities, logger: Logger): ResourceManager;
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,EAAE,2BAA2B,EAAE,KAAK,qBAAqB,EAAE,CAAC;AAEnE,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxD,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACpD,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,aAAa,EAAE,qBAAqB,CAAC;CACtC;AAWD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,EACpE,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,MAAM,GACb,eAAe,CA0MjB"}
@@ -0,0 +1,186 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { join, extname } from "node:path";
3
+ import { createResourceSubscriptions } from "./subscriptions.js";
4
+ export { createResourceSubscriptions };
5
+ const MIME_TYPES = {
6
+ ".json": "application/json",
7
+ ".md": "text/markdown",
8
+ ".html": "text/html",
9
+ ".png": "image/png",
10
+ ".jpg": "image/jpeg",
11
+ ".jpeg": "image/jpeg",
12
+ };
13
+ export function createResourceManager(config, workspaceManager, sendNotification, capabilities, logger) {
14
+ const subscriptions = createResourceSubscriptions(logger);
15
+ const hasListChanged = capabilities.resourcesListChanged;
16
+ const hasSubscribe = capabilities.resourcesSubscribe;
17
+ function parseWebtestUri(uri) {
18
+ if (!uri.startsWith("webtest://")) {
19
+ return null;
20
+ }
21
+ const withoutScheme = uri.slice("webtest://".length);
22
+ const slashIndex = withoutScheme.indexOf("/");
23
+ if (slashIndex === -1) {
24
+ return { analysisId: withoutScheme, path: "" };
25
+ }
26
+ return {
27
+ analysisId: withoutScheme.slice(0, slashIndex),
28
+ path: withoutScheme.slice(slashIndex + 1),
29
+ };
30
+ }
31
+ function getMimeType(path) {
32
+ const ext = extname(path).toLowerCase();
33
+ return MIME_TYPES[ext] || "application/octet-stream";
34
+ }
35
+ return {
36
+ subscriptions,
37
+ async listResources(analysisId) {
38
+ const resources = [];
39
+ const workspaces = analysisId
40
+ ? [analysisId]
41
+ : await workspaceManager.listWorkspaces();
42
+ for (const wsId of workspaces) {
43
+ if (!(await workspaceManager.workspaceExists(wsId))) {
44
+ continue;
45
+ }
46
+ const index = await workspaceManager.readWorkspaceIndex(wsId);
47
+ // Add workspace index (now markdown)
48
+ resources.push({
49
+ uri: `webtest://${wsId}/index.md`,
50
+ name: `Analysis: ${index.url}`,
51
+ description: `Analysis workspace for ${index.domain}`,
52
+ mimeType: "text/markdown",
53
+ });
54
+ // Add crawl resources
55
+ for (const crawl of index.crawls) {
56
+ resources.push({
57
+ uri: `webtest://${wsId}/crawls/${crawl.crawlId}/index.md`,
58
+ name: `Crawl: ${crawl.goal.slice(0, 50)}`,
59
+ description: `Crawl ${crawl.status} - ${crawl.pagesVisited} pages`,
60
+ mimeType: "text/markdown",
61
+ });
62
+ // Read crawl index to get page resources
63
+ try {
64
+ const crawlIndex = await workspaceManager.readCrawlIndex(wsId, crawl.crawlId);
65
+ for (const page of crawlIndex.pages) {
66
+ resources.push({
67
+ uri: page.screenshotUri,
68
+ name: `Screenshot: ${page.title || page.url}`,
69
+ mimeType: "image/png",
70
+ });
71
+ resources.push({
72
+ uri: page.snapshotUri,
73
+ name: `Snapshot: ${page.title || page.url}`,
74
+ mimeType: "text/markdown",
75
+ });
76
+ }
77
+ }
78
+ catch {
79
+ // Crawl index might not exist yet
80
+ }
81
+ }
82
+ // Add features resources (new structure)
83
+ if (index.features) {
84
+ resources.push({
85
+ uri: index.features.featuresUri,
86
+ name: `Features (${index.features.featureCount})`,
87
+ description: "Discovered application features",
88
+ mimeType: "text/markdown",
89
+ });
90
+ }
91
+ // Add feature flows resources
92
+ if (index.featureFlows) {
93
+ for (const flow of index.featureFlows) {
94
+ resources.push({
95
+ uri: flow.flowsUri,
96
+ name: `Flows: ${flow.featureSlug}`,
97
+ description: `${flow.flowCount} flows for ${flow.featureSlug} feature`,
98
+ mimeType: "text/markdown",
99
+ });
100
+ }
101
+ }
102
+ // Add test resources
103
+ if (index.tests) {
104
+ resources.push({
105
+ uri: index.tests.testsUri,
106
+ name: `Tests (${index.tests.testCount} cases)`,
107
+ description: "Generated test cases",
108
+ mimeType: "text/markdown",
109
+ });
110
+ }
111
+ // Add test run resources
112
+ for (const run of index.runs) {
113
+ resources.push({
114
+ uri: `webtest://${wsId}/runs/${run.runId}/report.md`,
115
+ name: `Test Run: ${run.testCaseId}`,
116
+ description: `Test run ${run.status}`,
117
+ mimeType: "text/markdown",
118
+ });
119
+ }
120
+ }
121
+ return resources;
122
+ },
123
+ async readResource(uri) {
124
+ const parsed = parseWebtestUri(uri);
125
+ if (!parsed) {
126
+ throw new Error(`Invalid resource URI: ${uri}`);
127
+ }
128
+ const { analysisId, path } = parsed;
129
+ const workspacePath = workspaceManager.getWorkspacePath(analysisId);
130
+ const filePath = join(workspacePath, path);
131
+ const mimeType = getMimeType(path);
132
+ try {
133
+ if (mimeType.startsWith("image/")) {
134
+ const data = await readFile(filePath);
135
+ return {
136
+ uri,
137
+ mimeType,
138
+ blob: data.toString("base64"),
139
+ };
140
+ }
141
+ else {
142
+ const text = await readFile(filePath, "utf-8");
143
+ return {
144
+ uri,
145
+ mimeType,
146
+ text,
147
+ };
148
+ }
149
+ }
150
+ catch (error) {
151
+ throw new Error(`Resource not found: ${uri} (${error instanceof Error ? error.message : "Unknown error"})`);
152
+ }
153
+ },
154
+ async notifyListChanged() {
155
+ if (!hasListChanged) {
156
+ logger.debug("listChanged notification skipped (not supported)");
157
+ return;
158
+ }
159
+ logger.debug("Emitting resources/list_changed notification");
160
+ try {
161
+ await sendNotification("notifications/resources/list_changed", {});
162
+ }
163
+ catch (error) {
164
+ logger.warn("Failed to emit list_changed notification", {
165
+ error: error instanceof Error ? error.message : "Unknown error",
166
+ });
167
+ }
168
+ },
169
+ async notifyResourceUpdated(uri) {
170
+ if (!hasSubscribe || !subscriptions.isSubscribed(uri)) {
171
+ return;
172
+ }
173
+ logger.debug("Emitting resources/updated notification", { uri });
174
+ try {
175
+ await sendNotification("notifications/resources/updated", { uri });
176
+ }
177
+ catch (error) {
178
+ logger.warn("Failed to emit resource updated notification", {
179
+ uri,
180
+ error: error instanceof Error ? error.message : "Unknown error",
181
+ });
182
+ }
183
+ },
184
+ };
185
+ }
186
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAK1C,OAAO,EAAE,2BAA2B,EAA8B,MAAM,oBAAoB,CAAC;AAE7F,OAAO,EAAE,2BAA2B,EAA8B,CAAC;AAwBnE,MAAM,UAAU,GAA2B;IACzC,OAAO,EAAE,kBAAkB;IAC3B,KAAK,EAAE,eAAe;IACtB,OAAO,EAAE,WAAW;IACpB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,MAAM,UAAU,qBAAqB,CACnC,MAAc,EACd,gBAAkC,EAClC,gBAAoE,EACpE,YAAgC,EAChC,MAAc;IAEd,MAAM,aAAa,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,cAAc,GAAG,YAAY,CAAC,oBAAoB,CAAC;IACzD,MAAM,YAAY,GAAG,YAAY,CAAC,kBAAkB,CAAC;IAErD,SAAS,eAAe,CAAC,GAAW;QAClC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACrD,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAE9C,IAAI,UAAU,KA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MAAM,CAAC,IAAI,CAAC,0CAA0C,EAAE;oBACtD,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;iBAChE,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,KAAK,CAAC,qBAAqB,CAAC,GAAW;YACrC,IAAI,CAAC,YAAY,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtD,OAAO;YACT,CAAC;YAED,MAAM,CAAC,KAAK,CAAC,yCAAyC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YAEjE,IAAI,CAAC;gBACH,MAAM,gBAAgB,CAAC,iCAAiC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,CAAC,8CAA8C,EAAE;oBAC1D,GAAG;oBACH,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;iBAChE,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Logger } from "../logger.js";
2
+ export interface ResourceSubscriptions {
3
+ subscribe(uri: string): void;
4
+ unsubscribe(uri: string): void;
5
+ isSubscribed(uri: string): boolean;
6
+ getSubscribers(): string[];
7
+ clear(): void;
8
+ }
9
+ export declare function createResourceSubscriptions(logger: Logger): ResourceSubscriptions;
10
+ //# sourceMappingURL=subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,cAAc,IAAI,MAAM,EAAE,CAAC;IAC3B,KAAK,IAAI,IAAI,CAAC;CACf;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,CA0BjF"}
@@ -0,0 +1,23 @@
1
+ export function createResourceSubscriptions(logger) {
2
+ const subscriptions = new Set();
3
+ return {
4
+ subscribe(uri) {
5
+ subscriptions.add(uri);
6
+ logger.debug("Resource subscribed", { uri });
7
+ },
8
+ unsubscribe(uri) {
9
+ subscriptions.delete(uri);
10
+ logger.debug("Resource unsubscribed", { uri });
11
+ },
12
+ isSubscribed(uri) {
13
+ return subscriptions.has(uri);
14
+ },
15
+ getSubscribers() {
16
+ return Array.from(subscriptions);
17
+ },
18
+ clear() {
19
+ subscriptions.clear();
20
+ },
21
+ };
22
+ }
23
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,2BAA2B,CAAC,MAAc;IACxD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAExC,OAAO;QACL,SAAS,CAAC,GAAW;YACnB,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/C,CAAC;QAED,WAAW,CAAC,GAAW;YACrB,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1B,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACjD,CAAC;QAED,YAAY,CAAC,GAAW;YACtB,OAAO,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;QAED,cAAc;YACZ,OAAO,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;QAED,KAAK;YACH,aAAa,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Logger } from "../logger.js";
2
+ import type { ClientCapabilities } from "../types/capabilities.js";
3
+ import { type SamplingRequest, type SamplingResponse, type SamplingResult, type SamplingOptions } from "./types.js";
4
+ export * from "./types.js";
5
+ export * from "./prompts.js";
6
+ export interface SamplingClient {
7
+ createMessage<T>(options: SamplingOptions<T>): Promise<SamplingResult<T>>;
8
+ hasSampling(): boolean;
9
+ }
10
+ export declare function createSamplingClient(requestSampling: (request: SamplingRequest) => Promise<SamplingResponse>, capabilities: ClientCapabilities, logger: Logger): SamplingClient;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sampling/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,EAErB,MAAM,YAAY,CAAC;AAGpB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAE7B,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,WAAW,IAAI,OAAO,CAAC;CACxB;AAED,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,EACxE,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,MAAM,GACb,cAAc,CAqKhB"}