@e2edev/e2e 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/README.md +7 -7
  2. package/dist/agent/act.d.ts +43 -9
  3. package/dist/agent/act.d.ts.map +1 -1
  4. package/dist/agent/act.js +126 -734
  5. package/dist/agent/act.js.map +1 -1
  6. package/dist/agent/action-dispatcher.d.ts +98 -0
  7. package/dist/agent/action-dispatcher.d.ts.map +1 -0
  8. package/dist/agent/action-dispatcher.js +319 -0
  9. package/dist/agent/action-dispatcher.js.map +1 -0
  10. package/dist/agent/actions.d.ts +16 -1
  11. package/dist/agent/actions.d.ts.map +1 -1
  12. package/dist/agent/actions.js +5 -1
  13. package/dist/agent/actions.js.map +1 -1
  14. package/dist/agent/default-agent.d.ts +17 -8
  15. package/dist/agent/default-agent.d.ts.map +1 -1
  16. package/dist/agent/default-agent.js +65 -43
  17. package/dist/agent/default-agent.js.map +1 -1
  18. package/dist/agent/executor.d.ts +30 -2
  19. package/dist/agent/executor.d.ts.map +1 -1
  20. package/dist/agent/executor.js.map +1 -1
  21. package/dist/agent/index.js +1 -1
  22. package/dist/agent/index.js.map +1 -1
  23. package/dist/agent/interactive-step.d.ts +38 -0
  24. package/dist/agent/interactive-step.d.ts.map +1 -0
  25. package/dist/agent/interactive-step.js +131 -0
  26. package/dist/agent/interactive-step.js.map +1 -0
  27. package/dist/agent/invocation.d.ts +4 -9
  28. package/dist/agent/invocation.d.ts.map +1 -1
  29. package/dist/agent/invocation.js +1 -6
  30. package/dist/agent/invocation.js.map +1 -1
  31. package/dist/agent/model/sdk.d.ts +1 -1
  32. package/dist/agent/model/sdk.js +1 -1
  33. package/dist/agent/model/tool-choice.d.ts +21 -0
  34. package/dist/agent/model/tool-choice.d.ts.map +1 -0
  35. package/dist/agent/model/tool-choice.js +49 -0
  36. package/dist/agent/model/tool-choice.js.map +1 -0
  37. package/dist/agent/observation-feed.d.ts +123 -0
  38. package/dist/agent/observation-feed.d.ts.map +1 -0
  39. package/dist/agent/observation-feed.js +281 -0
  40. package/dist/agent/observation-feed.js.map +1 -0
  41. package/dist/agent/observation.d.ts +14 -1
  42. package/dist/agent/observation.d.ts.map +1 -1
  43. package/dist/agent/observation.js +58 -2
  44. package/dist/agent/observation.js.map +1 -1
  45. package/dist/agent/operation-queue.d.ts +21 -0
  46. package/dist/agent/operation-queue.d.ts.map +1 -0
  47. package/dist/agent/operation-queue.js +27 -0
  48. package/dist/agent/operation-queue.js.map +1 -0
  49. package/dist/agent/pixels.d.ts +21 -0
  50. package/dist/agent/pixels.d.ts.map +1 -0
  51. package/dist/agent/pixels.js +85 -0
  52. package/dist/agent/pixels.js.map +1 -0
  53. package/dist/agent/point-tap.d.ts +52 -0
  54. package/dist/agent/point-tap.d.ts.map +1 -0
  55. package/dist/agent/point-tap.js +88 -0
  56. package/dist/agent/point-tap.js.map +1 -0
  57. package/dist/agent/primitives.d.ts +7 -1
  58. package/dist/agent/primitives.d.ts.map +1 -1
  59. package/dist/agent/primitives.js +96 -25
  60. package/dist/agent/primitives.js.map +1 -1
  61. package/dist/agent/replay.d.ts +8 -3
  62. package/dist/agent/replay.d.ts.map +1 -1
  63. package/dist/agent/replay.js +44 -15
  64. package/dist/agent/replay.js.map +1 -1
  65. package/dist/agent/screen-update.d.ts +50 -18
  66. package/dist/agent/screen-update.d.ts.map +1 -1
  67. package/dist/agent/screen-update.js +76 -94
  68. package/dist/agent/screen-update.js.map +1 -1
  69. package/dist/agent/step-accounting.d.ts +95 -0
  70. package/dist/agent/step-accounting.d.ts.map +1 -0
  71. package/dist/agent/step-accounting.js +201 -0
  72. package/dist/agent/step-accounting.js.map +1 -0
  73. package/dist/agent/step-cache.d.ts.map +1 -1
  74. package/dist/agent/step-cache.js +2 -2
  75. package/dist/agent/step-cache.js.map +1 -1
  76. package/dist/agent/tool-loop.d.ts +4 -4
  77. package/dist/agent/tool-loop.d.ts.map +1 -1
  78. package/dist/agent/tool-loop.js +109 -25
  79. package/dist/agent/tool-loop.js.map +1 -1
  80. package/dist/agent/transcript-compaction.d.ts +38 -0
  81. package/dist/agent/transcript-compaction.d.ts.map +1 -0
  82. package/dist/agent/transcript-compaction.js +165 -0
  83. package/dist/agent/transcript-compaction.js.map +1 -0
  84. package/dist/cache/recorder.d.ts.map +1 -1
  85. package/dist/cache/recorder.js +20 -0
  86. package/dist/cache/recorder.js.map +1 -1
  87. package/dist/cache/trace.d.ts +28 -1
  88. package/dist/cache/trace.d.ts.map +1 -1
  89. package/dist/cache/trace.js +44 -0
  90. package/dist/cache/trace.js.map +1 -1
  91. package/dist/cli/docs-url.d.ts +1 -1
  92. package/dist/cli/docs-url.d.ts.map +1 -1
  93. package/dist/cli/docs-url.js +1 -1
  94. package/dist/cli/docs-url.js.map +1 -1
  95. package/dist/cli/index.d.ts.map +1 -1
  96. package/dist/cli/index.js +71 -26
  97. package/dist/cli/index.js.map +1 -1
  98. package/dist/cli/init/engine-versions.json +1 -1
  99. package/dist/cli/init/engines.d.ts +26 -16
  100. package/dist/cli/init/engines.d.ts.map +1 -1
  101. package/dist/cli/init/engines.js +33 -24
  102. package/dist/cli/init/engines.js.map +1 -1
  103. package/dist/cli/init/gateways.js +3 -3
  104. package/dist/cli/init/mcp-config.d.ts +31 -0
  105. package/dist/cli/init/mcp-config.d.ts.map +1 -0
  106. package/dist/cli/init/mcp-config.js +72 -0
  107. package/dist/cli/init/mcp-config.js.map +1 -0
  108. package/dist/cli/init/scaffold.d.ts +1 -1
  109. package/dist/cli/init/scaffold.js +2 -2
  110. package/dist/cli/init/scaffold.js.map +1 -1
  111. package/dist/cli/init.d.ts.map +1 -1
  112. package/dist/cli/init.js +65 -29
  113. package/dist/cli/init.js.map +1 -1
  114. package/dist/cli/mcp.d.ts +15 -0
  115. package/dist/cli/mcp.d.ts.map +1 -0
  116. package/dist/cli/mcp.js +63 -0
  117. package/dist/cli/mcp.js.map +1 -0
  118. package/dist/collect/collect.d.ts +8 -3
  119. package/dist/collect/collect.d.ts.map +1 -1
  120. package/dist/collect/collect.js +29 -5
  121. package/dist/collect/collect.js.map +1 -1
  122. package/dist/collect/registry.d.ts +20 -5
  123. package/dist/collect/registry.d.ts.map +1 -1
  124. package/dist/collect/registry.js +162 -56
  125. package/dist/collect/registry.js.map +1 -1
  126. package/dist/collect/select.d.ts +9 -2
  127. package/dist/collect/select.d.ts.map +1 -1
  128. package/dist/collect/select.js +60 -12
  129. package/dist/collect/select.js.map +1 -1
  130. package/dist/config/agent.d.ts +1 -7
  131. package/dist/config/agent.d.ts.map +1 -1
  132. package/dist/config/agent.js +5 -8
  133. package/dist/config/agent.js.map +1 -1
  134. package/dist/config/app.d.ts +24 -2
  135. package/dist/config/app.d.ts.map +1 -1
  136. package/dist/config/app.js +82 -15
  137. package/dist/config/app.js.map +1 -1
  138. package/dist/config/resolve.d.ts +23 -6
  139. package/dist/config/resolve.d.ts.map +1 -1
  140. package/dist/config/resolve.js +34 -14
  141. package/dist/config/resolve.js.map +1 -1
  142. package/dist/credentials.d.ts +6 -0
  143. package/dist/credentials.d.ts.map +1 -1
  144. package/dist/credentials.js +9 -0
  145. package/dist/credentials.js.map +1 -1
  146. package/dist/engine/contract.d.ts +9 -2
  147. package/dist/engine/contract.d.ts.map +1 -1
  148. package/dist/engine/contract.js.map +1 -1
  149. package/dist/engine/index.d.ts +18 -4
  150. package/dist/engine/index.d.ts.map +1 -1
  151. package/dist/engine/index.js +8 -0
  152. package/dist/engine/index.js.map +1 -1
  153. package/dist/engine/session.d.ts.map +1 -1
  154. package/dist/engine/session.js +3 -0
  155. package/dist/engine/session.js.map +1 -1
  156. package/dist/engine/surface.d.ts +6 -2
  157. package/dist/engine/surface.d.ts.map +1 -1
  158. package/dist/engine/surface.js.map +1 -1
  159. package/dist/expect/attempt.d.ts +15 -0
  160. package/dist/expect/attempt.d.ts.map +1 -0
  161. package/dist/expect/attempt.js +33 -0
  162. package/dist/expect/attempt.js.map +1 -0
  163. package/dist/expect/index.d.ts +7 -5
  164. package/dist/expect/index.d.ts.map +1 -1
  165. package/dist/expect/index.js +8 -1
  166. package/dist/expect/index.js.map +1 -1
  167. package/dist/expect/poll.d.ts +5 -0
  168. package/dist/expect/poll.d.ts.map +1 -0
  169. package/dist/expect/poll.js +118 -0
  170. package/dist/expect/poll.js.map +1 -0
  171. package/dist/expect/values.d.ts.map +1 -1
  172. package/dist/expect/values.js +6 -1
  173. package/dist/expect/values.js.map +1 -1
  174. package/dist/explore/body.d.ts.map +1 -1
  175. package/dist/explore/body.js +2 -0
  176. package/dist/explore/body.js.map +1 -1
  177. package/dist/explore/executor.js +16 -11
  178. package/dist/explore/executor.js.map +1 -1
  179. package/dist/explore/index.d.ts +3 -2
  180. package/dist/explore/index.d.ts.map +1 -1
  181. package/dist/explore/index.js +11 -9
  182. package/dist/explore/index.js.map +1 -1
  183. package/dist/explore/plan.d.ts.map +1 -1
  184. package/dist/explore/plan.js +16 -5
  185. package/dist/explore/plan.js.map +1 -1
  186. package/dist/explore/progress.d.ts +43 -0
  187. package/dist/explore/progress.d.ts.map +1 -0
  188. package/dist/explore/progress.js +9 -0
  189. package/dist/explore/progress.js.map +1 -0
  190. package/dist/explore/state.d.ts +13 -12
  191. package/dist/explore/state.d.ts.map +1 -1
  192. package/dist/explore/state.js +28 -11
  193. package/dist/explore/state.js.map +1 -1
  194. package/dist/internal/ai-trace.d.ts +2 -0
  195. package/dist/internal/ai-trace.d.ts.map +1 -1
  196. package/dist/internal/ai-trace.js +3 -0
  197. package/dist/internal/ai-trace.js.map +1 -1
  198. package/dist/internal/brands.d.ts +2 -0
  199. package/dist/internal/brands.d.ts.map +1 -1
  200. package/dist/internal/brands.js +2 -0
  201. package/dist/internal/brands.js.map +1 -1
  202. package/dist/internal/geometry.d.ts +13 -0
  203. package/dist/internal/geometry.d.ts.map +1 -0
  204. package/dist/internal/geometry.js +16 -0
  205. package/dist/internal/geometry.js.map +1 -0
  206. package/dist/internal/ids.d.ts +2 -2
  207. package/dist/internal/ids.d.ts.map +1 -1
  208. package/dist/internal/ids.js +3 -3
  209. package/dist/internal/ids.js.map +1 -1
  210. package/dist/internal/package-manager.d.ts +4 -0
  211. package/dist/internal/package-manager.d.ts.map +1 -1
  212. package/dist/internal/package-manager.js +26 -0
  213. package/dist/internal/package-manager.js.map +1 -1
  214. package/dist/internal/urls.d.ts +6 -0
  215. package/dist/internal/urls.d.ts.map +1 -1
  216. package/dist/internal/urls.js +28 -0
  217. package/dist/internal/urls.js.map +1 -1
  218. package/dist/mcp/catalog.d.ts +51 -0
  219. package/dist/mcp/catalog.d.ts.map +1 -0
  220. package/dist/mcp/catalog.js +141 -0
  221. package/dist/mcp/catalog.js.map +1 -0
  222. package/dist/mcp/config.d.ts +11 -0
  223. package/dist/mcp/config.d.ts.map +1 -0
  224. package/dist/mcp/config.js +16 -0
  225. package/dist/mcp/config.js.map +1 -0
  226. package/dist/mcp/server.d.ts +29 -0
  227. package/dist/mcp/server.d.ts.map +1 -0
  228. package/dist/mcp/server.js +86 -0
  229. package/dist/mcp/server.js.map +1 -0
  230. package/dist/mcp/session.d.ts +68 -0
  231. package/dist/mcp/session.d.ts.map +1 -0
  232. package/dist/mcp/session.js +319 -0
  233. package/dist/mcp/session.js.map +1 -0
  234. package/dist/mcp/tools.d.ts +77 -0
  235. package/dist/mcp/tools.d.ts.map +1 -0
  236. package/dist/mcp/tools.js +179 -0
  237. package/dist/mcp/tools.js.map +1 -0
  238. package/dist/report/build.d.ts +8 -0
  239. package/dist/report/build.d.ts.map +1 -1
  240. package/dist/report/build.js +3 -1
  241. package/dist/report/build.js.map +1 -1
  242. package/dist/report/format.d.ts +19 -0
  243. package/dist/report/format.d.ts.map +1 -1
  244. package/dist/report/format.js +42 -0
  245. package/dist/report/format.js.map +1 -1
  246. package/dist/report/junit.d.ts.map +1 -1
  247. package/dist/report/junit.js +4 -1
  248. package/dist/report/junit.js.map +1 -1
  249. package/dist/report/list-explore.d.ts +109 -0
  250. package/dist/report/list-explore.d.ts.map +1 -0
  251. package/dist/report/list-explore.js +388 -0
  252. package/dist/report/list-explore.js.map +1 -0
  253. package/dist/report/list.d.ts +31 -1
  254. package/dist/report/list.d.ts.map +1 -1
  255. package/dist/report/list.js +114 -16
  256. package/dist/report/list.js.map +1 -1
  257. package/dist/report/running-tree.d.ts +7 -7
  258. package/dist/report/running-tree.d.ts.map +1 -1
  259. package/dist/report/running-tree.js +12 -13
  260. package/dist/report/running-tree.js.map +1 -1
  261. package/dist/run/app-ports.d.ts +17 -0
  262. package/dist/run/app-ports.d.ts.map +1 -0
  263. package/dist/run/app-ports.js +74 -0
  264. package/dist/run/app-ports.js.map +1 -0
  265. package/dist/run/events.d.ts +21 -7
  266. package/dist/run/events.d.ts.map +1 -1
  267. package/dist/run/events.js.map +1 -1
  268. package/dist/run/execute.d.ts +2 -2
  269. package/dist/run/execute.d.ts.map +1 -1
  270. package/dist/run/execute.js +42 -20
  271. package/dist/run/execute.js.map +1 -1
  272. package/dist/run/extended-fixtures.d.ts +33 -0
  273. package/dist/run/extended-fixtures.d.ts.map +1 -0
  274. package/dist/run/extended-fixtures.js +91 -0
  275. package/dist/run/extended-fixtures.js.map +1 -0
  276. package/dist/run/fixtures.d.ts +10 -4
  277. package/dist/run/fixtures.d.ts.map +1 -1
  278. package/dist/run/fixtures.js +40 -27
  279. package/dist/run/fixtures.js.map +1 -1
  280. package/dist/run/in-process.d.ts.map +1 -1
  281. package/dist/run/in-process.js +4 -3
  282. package/dist/run/in-process.js.map +1 -1
  283. package/dist/run/managed-process.d.ts +18 -0
  284. package/dist/run/managed-process.d.ts.map +1 -1
  285. package/dist/run/managed-process.js +101 -6
  286. package/dist/run/managed-process.js.map +1 -1
  287. package/dist/run/provision.d.ts +51 -0
  288. package/dist/run/provision.d.ts.map +1 -0
  289. package/dist/run/provision.js +94 -0
  290. package/dist/run/provision.js.map +1 -0
  291. package/dist/run/realm.d.ts +5 -4
  292. package/dist/run/realm.d.ts.map +1 -1
  293. package/dist/run/realm.js +8 -7
  294. package/dist/run/realm.js.map +1 -1
  295. package/dist/run/records.d.ts +4 -0
  296. package/dist/run/records.d.ts.map +1 -1
  297. package/dist/run/runner.d.ts +14 -5
  298. package/dist/run/runner.d.ts.map +1 -1
  299. package/dist/run/runner.js +28 -71
  300. package/dist/run/runner.js.map +1 -1
  301. package/dist/run/scheduler.d.ts +5 -2
  302. package/dist/run/scheduler.d.ts.map +1 -1
  303. package/dist/run/scheduler.js +13 -10
  304. package/dist/run/scheduler.js.map +1 -1
  305. package/dist/run/serial.d.ts +1 -1
  306. package/dist/run/serial.d.ts.map +1 -1
  307. package/dist/run/serial.js +7 -2
  308. package/dist/run/serial.js.map +1 -1
  309. package/dist/run/standalone.d.ts +63 -0
  310. package/dist/run/standalone.d.ts.map +1 -0
  311. package/dist/run/standalone.js +152 -0
  312. package/dist/run/standalone.js.map +1 -0
  313. package/dist/run/units.d.ts +6 -3
  314. package/dist/run/units.d.ts.map +1 -1
  315. package/dist/run/units.js +0 -0
  316. package/dist/run/units.js.map +1 -1
  317. package/dist/run/worker/entry.js +4 -3
  318. package/dist/run/worker/entry.js.map +1 -1
  319. package/dist/run/worker/protocol.d.ts +12 -1
  320. package/dist/run/worker/protocol.d.ts.map +1 -1
  321. package/dist/run/worker/protocol.js.map +1 -1
  322. package/dist/run/worker/session.d.ts +3 -4
  323. package/dist/run/worker/session.d.ts.map +1 -1
  324. package/dist/run/worker/session.js +5 -4
  325. package/dist/run/worker/session.js.map +1 -1
  326. package/dist/types.d.ts +77 -17
  327. package/dist/types.d.ts.map +1 -1
  328. package/package.json +11 -7
  329. package/skills/e2e/SKILL.md +9 -7
  330. package/skills/e2e/references/agent.md +27 -12
  331. package/skills/e2e/references/debugging.md +5 -5
  332. package/skills/e2e/references/explore.md +15 -9
  333. package/skills/e2e/references/mcp.md +88 -0
  334. package/skills/e2e/references/running.md +23 -18
  335. package/skills/e2e/references/setup.md +32 -18
  336. package/skills/e2e/references/writing-tests.md +12 -5
  337. package/dist/agent/model/router.d.ts +0 -36
  338. package/dist/agent/model/router.d.ts.map +0 -1
  339. package/dist/agent/model/router.js +0 -45
  340. package/dist/agent/model/router.js.map +0 -1
  341. package/dist/explore/reporter.d.ts +0 -11
  342. package/dist/explore/reporter.d.ts.map +0 -1
  343. package/dist/explore/reporter.js +0 -54
  344. package/dist/explore/reporter.js.map +0 -1
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The catalog of a live session: every tool `call` can run, as AI SDK tools.
3
+ * `observe` shows the whole screen, the grammar is what the target's engine
4
+ * honors — `screenshot` and `tap_at` among it while pixels may leave the
5
+ * runner — `locate` tries a semantic locator the way a test would, and the
6
+ * project's own tools follow. Built-in
7
+ * names win: a project tool named like one is neither listed nor reachable,
8
+ * the precedence the testing agent's toolset applies.
9
+ */
10
+ import type { ToolSet } from 'ai';
11
+ import type { StepExecutor, StepExecutorContext } from '../agent/executor.ts';
12
+ import type { ScreenPresenter } from '../agent/screen-update.ts';
13
+ import type { LocatorExpression, SemanticNode, TargetSession } from '../engine/surface.ts';
14
+ import type { LocatorEngine } from '../locator/engine.ts';
15
+ /** True for a grammar tool name, whether or not this session's engine declares the verb: a missing one is not a typo. */
16
+ export declare function isGrammarVerb(name: string): boolean;
17
+ export interface SessionCatalog {
18
+ /** Every tool `call` can run, in the order `tools` lists them. */
19
+ readonly tools: ToolSet;
20
+ /** The tools that change nothing on the app. */
21
+ readonly readOnly: ReadonlySet<string>;
22
+ }
23
+ export interface CatalogOptions {
24
+ readonly context: StepExecutorContext;
25
+ readonly screen: ScreenPresenter;
26
+ readonly locator: LocatorEngine;
27
+ readonly session: TargetSession;
28
+ /** The configured executor, whose project tools are served when it came from `createAgent`. */
29
+ readonly executor: StepExecutor | undefined;
30
+ readonly warn: (message: string) => void;
31
+ }
32
+ /** Builds the session's catalog from the step context and the target. */
33
+ export declare function createSessionCatalog(options: CatalogOptions): SessionCatalog;
34
+ export interface LocateArgs {
35
+ readonly role?: string | undefined;
36
+ readonly name?: string | undefined;
37
+ readonly text?: string | undefined;
38
+ readonly label?: string | undefined;
39
+ readonly placeholder?: string | undefined;
40
+ readonly testId?: string | undefined;
41
+ readonly exact?: boolean | undefined;
42
+ }
43
+ export interface LocateQuery {
44
+ readonly expression: LocatorExpression;
45
+ readonly code: string;
46
+ }
47
+ /** Builds the expression and the matching `screen.*` call from the tool arguments. */
48
+ export declare function locateQuery(args: LocateArgs): LocateQuery;
49
+ /** Renders a locate result: the count, the verdict a test would get, and the nodes. */
50
+ export declare function describeLocate(query: LocateQuery, count: number, nodes: readonly SemanticNode[]): string;
51
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/mcp/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAGlC,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK1D,yHAAyH;AACzH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED,yEAAyE;AACzE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAsB5E;AA2CD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,CAqBzD;AAED,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAQxG"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * The catalog of a live session: every tool `call` can run, as AI SDK tools.
3
+ * `observe` shows the whole screen, the grammar is what the target's engine
4
+ * honors — `screenshot` and `tap_at` among it while pixels may leave the
5
+ * runner — `locate` tries a semantic locator the way a test would, and the
6
+ * project's own tools follow. Built-in
7
+ * names win: a project tool named like one is neither listed nor reachable,
8
+ * the precedence the testing agent's toolset applies.
9
+ */
10
+ import { z } from 'zod';
11
+ import { isDefaultAgent, projectTools } from '../agent/default-agent.js';
12
+ import { createGrammarTools, GRAMMAR_TOOL_NAMES } from '../agent/primitives.js';
13
+ import { ConfigurationError } from '../internal/errors.js';
14
+ import { describeExpression, roleQuery, testIdQuery, textQuery } from '../locator/expression.js';
15
+ /** How many matching nodes `locate` describes. */
16
+ const MAX_LOCATE_NODES = 10;
17
+ /** True for a grammar tool name, whether or not this session's engine declares the verb: a missing one is not a typo. */
18
+ export function isGrammarVerb(name) {
19
+ return GRAMMAR_TOOL_NAMES.has(name);
20
+ }
21
+ /** Builds the session's catalog from the step context and the target. */
22
+ export function createSessionCatalog(options) {
23
+ const { context, screen } = options;
24
+ // The grammar's own observe reports a diff for the model loop; the
25
+ // session's shows the whole screen, so it replaces the grammar's.
26
+ const { observe: _diffObserve, ...verbs } = createGrammarTools(context, { screen });
27
+ const builtIn = {
28
+ observe: fullObserveTool(context, screen),
29
+ ...verbs,
30
+ locate: locateTool(options.locator, options.session),
31
+ };
32
+ const defined = isDefaultAgent(options.executor) ? options.executor.tools : {};
33
+ const readOnly = new Set(['observe', 'locate', 'screenshot']);
34
+ const project = {};
35
+ for (const [name, tool] of Object.entries(projectTools(context, defined))) {
36
+ if (name in builtIn) {
37
+ options.warn(`project tool "${name}" is not served over MCP: the name belongs to a built-in session tool`);
38
+ continue;
39
+ }
40
+ project[name] = tool;
41
+ if (defined[name]?.annotations.mutates === false)
42
+ readOnly.add(name);
43
+ }
44
+ return { tools: { ...builtIn, ...project }, readOnly };
45
+ }
46
+ /**
47
+ * The session's `observe`: the whole screen, every time. Action results
48
+ * report what changed since the screen the agent last received, as they do
49
+ * for the testing agent; a coding agent that asks to look wants everything,
50
+ * and the presenter takes that screen as the new baseline for later changes.
51
+ */
52
+ function fullObserveTool(context, screen) {
53
+ return {
54
+ description: 'Look at the whole current screen: every node with its id, role, name, and state. Action results report only what changed since the screen you last received; call this to see everything again or after waiting for something in progress.',
55
+ inputSchema: z.object({}),
56
+ execute: async () => screen.initial(await context.observe()),
57
+ };
58
+ }
59
+ /** The session's `locate`: a semantic locator tried against the live screen, with the verdict a test would get. */
60
+ function locateTool(locator, session) {
61
+ return {
62
+ description: 'Try a semantic locator against the live screen before writing it into a test: screen.getByRole(role, { name }), getByText, getByLabel, getByPlaceholder, or getByTestId. Returns how many nodes match and which, plus the test code to use. Exactly one of role, text, label, placeholder, or testId; name narrows a role query. Matching is exact unless exact is false.',
63
+ inputSchema: z.object({
64
+ role: z.string().min(1).optional().describe('ARIA role, e.g. "button", "textbox", "link"'),
65
+ name: z.string().min(1).optional().describe('Accessible name, with role'),
66
+ text: z.string().min(1).optional(),
67
+ label: z.string().min(1).optional(),
68
+ placeholder: z.string().min(1).optional(),
69
+ testId: z.string().min(1).optional(),
70
+ exact: z.boolean().optional().describe('false for substring, case-insensitive matching'),
71
+ }),
72
+ execute: async (args) => {
73
+ const query = locateQuery(args);
74
+ const refs = await locator.resolveAll(query.expression);
75
+ const read = [];
76
+ for (const ref of refs.slice(0, MAX_LOCATE_NODES)) {
77
+ read.push(await session.read(ref, locator.operation()));
78
+ }
79
+ return describeLocate(query, refs.length, read);
80
+ },
81
+ };
82
+ }
83
+ /** Builds the expression and the matching `screen.*` call from the tool arguments. */
84
+ export function locateQuery(args) {
85
+ const exact = args.exact !== false;
86
+ const exactOption = exact ? '' : ', exact: false';
87
+ const { role, name, text, label, placeholder, testId } = args;
88
+ const given = [role, text, label, placeholder, testId].filter((value) => value !== undefined).length;
89
+ if (given !== 1) {
90
+ throw new ConfigurationError('INVALID_ARGUMENT', 'locate needs exactly one of role, text, label, placeholder, or testId');
91
+ }
92
+ if (role !== undefined) {
93
+ const options = name === undefined ? '' : `, { name: ${JSON.stringify(name)}${exactOption} }`;
94
+ return {
95
+ expression: roleQuery(role, name === undefined ? undefined : { name, exact }, undefined),
96
+ code: `screen.getByRole(${JSON.stringify(role)}${options})`,
97
+ };
98
+ }
99
+ if (name !== undefined)
100
+ throw new ConfigurationError('INVALID_ARGUMENT', 'name only narrows a role query');
101
+ if (testId !== undefined)
102
+ return { expression: testIdQuery(testId, undefined, undefined), code: `screen.getByTestId(${JSON.stringify(testId)})` };
103
+ const options = exact ? '' : `, { exact: false }`;
104
+ if (text !== undefined)
105
+ return { expression: textQuery('text', text, { exact }, undefined), code: `screen.getByText(${JSON.stringify(text)}${options})` };
106
+ if (label !== undefined)
107
+ return { expression: textQuery('label', label, { exact }, undefined), code: `screen.getByLabel(${JSON.stringify(label)}${options})` };
108
+ return { expression: textQuery('placeholder', placeholder, { exact }, undefined), code: `screen.getByPlaceholder(${JSON.stringify(placeholder)}${options})` };
109
+ }
110
+ /** Renders a locate result: the count, the verdict a test would get, and the nodes. */
111
+ export function describeLocate(query, count, nodes) {
112
+ const lines = [`${count === 1 ? '1 node matches' : `${count} nodes match`} ${describeExpression(query.expression)}.`];
113
+ if (count === 1)
114
+ lines.push(`Use: ${query.code}`);
115
+ else if (count === 0)
116
+ lines.push('A test using this locator would fail with LOCATOR_NOT_FOUND. Check the accessible name in the observation (observe), or loosen the match with exact: false.');
117
+ else
118
+ lines.push(`A test action on ${query.code} would fail with LOCATOR_AMBIGUOUS. Narrow it with { name }, .filter({ hasText }), .first(), or .nth(i), or scope it under a container.`);
119
+ for (const node of nodes)
120
+ lines.push(`- ${describeNode(node)}`);
121
+ if (count > nodes.length)
122
+ lines.push(`- and ${count - nodes.length} more`);
123
+ return lines.join('\n');
124
+ }
125
+ /** A located node by what names it; located refs are not observation ids, so none is shown. */
126
+ function describeNode(node) {
127
+ const parts = [node.role ?? 'node'];
128
+ if (node.name !== undefined && node.name !== '')
129
+ parts.push(JSON.stringify(node.name));
130
+ if (node.text !== undefined && node.text !== '' && node.text !== node.name)
131
+ parts.push(`text ${JSON.stringify(node.text)}`);
132
+ if (node.value !== undefined && node.states?.secure !== true)
133
+ parts.push(`value ${JSON.stringify(node.value)}`);
134
+ const states = Object.entries(node.states ?? {})
135
+ .filter(([, value]) => value === true)
136
+ .map(([key]) => key);
137
+ if (states.length > 0)
138
+ parts.push(`[${states.join(', ')}]`);
139
+ return parts.join(' ');
140
+ }
141
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/mcp/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAIjG,kDAAkD;AAClD,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,yHAAyH;AACzH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC;AAmBD,yEAAyE;AACzE,MAAM,UAAU,oBAAoB,CAAC,OAAuB;IAC1D,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACpC,mEAAmE;IACnE,kEAAkE;IAClE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,GAAG,kBAAkB,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACpF,MAAM,OAAO,GAAY;QACvB,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC;QACzC,GAAG,KAAK;QACR,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,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AI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAChH,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;SAC7C,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;SACrC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACvB,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /** A project the server serves: its config, loaded fresh on every use. */
2
+ import { type ResolvedConfig } from '../config/resolve.ts';
3
+ export interface ProjectOptions {
4
+ readonly cwd: string;
5
+ /** An explicit config file, relative to `cwd`; otherwise the nearest `e2e.config.ts` from `cwd` upward. */
6
+ readonly configPath?: string | undefined;
7
+ readonly env: NodeJS.ProcessEnv;
8
+ }
9
+ /** Loads a project's config fresh: an agent edits the config, or opens another project, while the server runs. */
10
+ export declare function loadProjectConfig(options: ProjectOptions): Promise<ResolvedConfig>;
11
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/mcp/config.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAG1E,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE1E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2GAA2G;IAC3G,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACjC;AAED,kHAAkH;AAClH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CASxF"}
@@ -0,0 +1,16 @@
1
+ /** A project the server serves: its config, loaded fresh on every use. */
2
+ import { discoverConfig, loadConfigModule, missingConfigError } from '../config/load.js';
3
+ import { resolveConfig } from '../config/resolve.js';
4
+ /** Loads a project's config fresh: an agent edits the config, or opens another project, while the server runs. */
5
+ export async function loadProjectConfig(options) {
6
+ const discovered = discoverConfig(options.cwd, options.configPath);
7
+ if (discovered.configPath === undefined)
8
+ throw missingConfigError(options.cwd);
9
+ const raw = await loadConfigModule(discovered.configPath);
10
+ return resolveConfig(raw, {
11
+ projectRoot: discovered.projectRoot,
12
+ configPath: discovered.configPath,
13
+ env: options.env,
14
+ });
15
+ }
16
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/mcp/config.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,aAAa,EAAuB,MAAM,sBAAsB,CAAC;AAS1E,kHAAkH;AAClH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAuB;IAC7D,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACnE,IAAI,UAAU,CAAC,UAAU,KAAK,SAAS;QAAE,MAAM,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/E,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC1D,OAAO,aAAa,CAAC,GAAG,EAAE;QACxB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The `e2e mcp` server: a live session on the app for a coding agent, with
3
+ * the skill as resources, served over one stdio transport. The tool list is
4
+ * four tools and never changes: the session's own vocabulary is a catalog
5
+ * behind `call`, so it follows the config the agent opens rather than the
6
+ * config the server started next to. Streams are injected, so the CLI hands
7
+ * it the process's and a test hands it pipes.
8
+ */
9
+ import type { Readable, Writable } from 'node:stream';
10
+ export interface ServeOptions {
11
+ readonly cwd: string;
12
+ /** The config every session loads unless `open_session` names one. */
13
+ readonly configPath?: string | undefined;
14
+ /** The target every session opens on; otherwise a call names one, or the only one is used. */
15
+ readonly target?: string | undefined;
16
+ readonly headed: boolean;
17
+ readonly env: NodeJS.ProcessEnv;
18
+ readonly version: string;
19
+ readonly stdin: Readable;
20
+ /** The protocol stream: nothing else may write to it. */
21
+ readonly stdout: Writable;
22
+ /** Diagnostics for the operator, normally stderr. */
23
+ readonly log: (line: string) => void;
24
+ /** Ends the server from outside: a process signal. */
25
+ readonly signal?: AbortSignal | undefined;
26
+ }
27
+ /** Serves until the client disconnects or `signal` aborts; resolves with the exit code. */
28
+ export declare function serveMcp(options: ServeOptions): Promise<number>;
29
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAStD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,8FAA8F;IAC9F,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,qDAAqD;IACrD,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,sDAAsD;IACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAC3C;AAQD,2FAA2F;AAC3F,wBAAsB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAwDrE"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The `e2e mcp` server: a live session on the app for a coding agent, with
3
+ * the skill as resources, served over one stdio transport. The tool list is
4
+ * four tools and never changes: the session's own vocabulary is a catalog
5
+ * behind `call`, so it follows the config the agent opens rather than the
6
+ * config the server started next to. Streams are injected, so the CLI hands
7
+ * it the process's and a test hands it pipes.
8
+ */
9
+ import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
10
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
11
+ import { readGuide, skillTopics } from '../cli/skill.js';
12
+ import { ConfigurationError, errorMessage } from '../internal/errors.js';
13
+ import { loadProjectConfig } from './config.js';
14
+ import { SessionHost } from './session.js';
15
+ import { errorResult } from './tools.js';
16
+ const INSTRUCTIONS = `e2e is a local-first end-to-end test runner; this server drives an e2e project's app (its e2e.config.ts) live.
17
+ Call open_session (optionally with a target and a config path) to get a session, its tool catalog, and the first observation. Then call {tool, args} runs any catalog tool: observe, tap, type, press, select, scroll, navigate, type_secret, locate, screenshot, and the project's own tools; tools lists them, tools {tool} shows one tool's arguments. close_session when done.
18
+ Write deterministic tests (tests/*.e2e.ts) from what you saw and run them with the CLI: npx e2e run <file>. Resources e2e://guide and e2e://guide/{topic} hold the writing guide.`;
19
+ /** Serves until the client disconnects or `signal` aborts; resolves with the exit code. */
20
+ export async function serveMcp(options) {
21
+ const server = new McpServer({ name: 'e2e', title: 'e2e', version: options.version }, { capabilities: { logging: {}, tools: {}, resources: {} }, instructions: INSTRUCTIONS });
22
+ const log = (level, message) => {
23
+ options.log(`[${level}] ${message}`);
24
+ if (server.isConnected())
25
+ void server.sendLoggingMessage({ level, logger: 'e2e', data: message }).catch(() => undefined);
26
+ };
27
+ const host = new SessionHost({
28
+ loadConfig: (configPath) => loadProjectConfig({ cwd: options.cwd, configPath: configPath ?? options.configPath, env: options.env }),
29
+ env: options.env,
30
+ headed: options.headed,
31
+ defaultTarget: options.target,
32
+ log,
33
+ });
34
+ for (const spec of host.toolSpecs()) {
35
+ server.registerTool(spec.name, {
36
+ description: spec.description,
37
+ inputSchema: spec.inputSchema,
38
+ annotations: { readOnlyHint: spec.readOnly, openWorldHint: false },
39
+ }, async (args, extra) => {
40
+ // A failure is a result the agent can react to, never a protocol error.
41
+ try {
42
+ return await spec.call(args, { signal: extra.signal });
43
+ }
44
+ catch (cause) {
45
+ return errorResult(cause);
46
+ }
47
+ });
48
+ }
49
+ registerGuide(server);
50
+ const transport = new StdioServerTransport(options.stdin, options.stdout);
51
+ const closed = new Promise((resolve) => {
52
+ // The SDK's Server exposes a plain callback property, not an event target.
53
+ // oxlint-disable-next-line unicorn/prefer-add-event-listener
54
+ server.server.onclose = () => resolve();
55
+ options.signal?.addEventListener('abort', () => resolve(), { once: true });
56
+ });
57
+ await server.connect(transport);
58
+ log('info', `e2e mcp ${options.version} serving ${options.cwd}`);
59
+ await closed;
60
+ try {
61
+ const summary = await host.close('server shutdown');
62
+ if (summary !== 'No session is open.')
63
+ options.log(summary);
64
+ }
65
+ catch (cause) {
66
+ options.log(`session teardown failed: ${errorMessage(cause)}`);
67
+ }
68
+ await server.close().catch((cause) => options.log(`server close failed: ${errorMessage(cause)}`));
69
+ return 0;
70
+ }
71
+ /** The skill as resources, for clients that read context without a tool call. */
72
+ function registerGuide(server) {
73
+ server.registerResource('guide', 'e2e://guide', { title: 'e2e guide', description: 'How to set up e2e, write tests, use agent steps, run the CLI, and read a failing run', mimeType: 'text/markdown' }, async (uri) => ({ contents: [{ uri: uri.href, mimeType: 'text/markdown', text: readGuide(undefined) ?? 'The skill is not part of this installation.' }] }));
74
+ server.registerResource('guide-topic', new ResourceTemplate('e2e://guide/{topic}', {
75
+ list: async () => ({
76
+ resources: skillTopics().map((topic) => ({ uri: `e2e://guide/${topic}`, name: topic, mimeType: 'text/markdown' })),
77
+ }),
78
+ }), { title: 'e2e guide topic', description: `One topic of the guide: ${skillTopics().join(', ')}`, mimeType: 'text/markdown' }, async (uri, variables) => {
79
+ const topic = String(variables['topic']);
80
+ const text = readGuide(topic);
81
+ if (text === undefined)
82
+ throw new ConfigurationError('UNKNOWN_TOPIC', `unknown topic "${topic}"; topics: ${skillTopics().join(', ')}`);
83
+ return { contents: [{ uri: uri.href, mimeType: 'text/markdown', text }] };
84
+ });
85
+ }
86
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAoBzC,MAAM,YAAY,GAAG;;kLAE6J,C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Q,EAAE,eAAe,EAAE,EAC3H,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,IAAI,KAAK,SAAS;YAAE,MAAM,IAAI,kBAAkB,CAAC,eAAe,EAAE,kBAAkB,KAAK,cAAc,WAAW,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvI,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC5E,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The live session behind `e2e mcp`: one standalone attempt on one target
3
+ * with one interactive agent step open on it, driven by a coding agent
4
+ * through a fixed, four-tool surface. `open_session` loads the project's
5
+ * config and opens the attempt and the step; `tools` renders the session's
6
+ * catalog; `call` runs one catalog tool by name inside the step;
7
+ * `close_session` ends the step and tears the attempt down. The catalog is
8
+ * data, not registrations, so it follows the config and the target without a
9
+ * restart and the client's tool list never changes.
10
+ */
11
+ import type { ResolvedConfig } from '../config/resolve.ts';
12
+ import { type McpToolCallExtra, type McpToolResult, type McpToolSpec } from './tools.ts';
13
+ export interface OpenSessionOptions {
14
+ /** The target to open; otherwise the server's `--target`, else the config's only target. */
15
+ readonly target?: string | undefined;
16
+ /** A config file to load instead of the server's default, relative to the server's directory. */
17
+ readonly config?: string | undefined;
18
+ }
19
+ export interface SessionHostOptions {
20
+ /** Loads a config fresh for each session, so an edited config applies without a restart; `configPath` overrides the server's default. */
21
+ readonly loadConfig: (configPath: string | undefined) => Promise<ResolvedConfig>;
22
+ readonly env: NodeJS.ProcessEnv;
23
+ readonly headed: boolean;
24
+ /** The target every session opens on, from `--target`; a call may still name one. */
25
+ readonly defaultTarget?: string | undefined;
26
+ readonly log: (level: 'info' | 'warning' | 'error', message: string) => void;
27
+ readonly idleMs?: number | undefined;
28
+ readonly ttlMs?: number | undefined;
29
+ }
30
+ /** Owns at most one live session and the fixed MCP tools that drive it. */
31
+ export declare class SessionHost {
32
+ private readonly options;
33
+ private live;
34
+ private opening;
35
+ /** Why the previous session ended, for the error a call on a closed session gets. */
36
+ private lastEnd;
37
+ constructor(options: SessionHostOptions);
38
+ get isOpen(): boolean;
39
+ /** The server's tools: the same four whatever the project, the config, or the target. */
40
+ toolSpecs(): readonly McpToolSpec[];
41
+ /** Opens a session and returns its opening text: the summary, the catalog, and the first screen. */
42
+ open(options: OpenSessionOptions): Promise<string>;
43
+ /** Closes the live session, if any, and returns what happened. */
44
+ close(reason: string, session?: string): Promise<string>;
45
+ /** The session's catalog, or one tool's full contract. */
46
+ catalog(session: string | undefined, tool: string | undefined): string;
47
+ /** Runs one catalog tool inside the live session's step. */
48
+ call(session: string | undefined, name: string, args: Record<string, unknown>, extra: McpToolCallExtra): Promise<McpToolResult>;
49
+ private openSession;
50
+ /** Opens the app when the engine can navigate, then observes. */
51
+ private firstScreen;
52
+ private openingText;
53
+ private catalogLines;
54
+ private resolveTarget;
55
+ /** Every configured credential's password as a step secret, so `type_secret` can fill it. */
56
+ private secretParams;
57
+ private requireLive;
58
+ private wrongSession;
59
+ private unknownTool;
60
+ private touch;
61
+ /** Runs one tool body inside the live session's step. */
62
+ private run;
63
+ private openSpec;
64
+ private catalogSpec;
65
+ private callSpec;
66
+ private closeSpec;
67
+ }
68
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,sBAAsB,CAAC;AAS3E,OAAO,EAA0E,KAAK,gBAAgB,EAAE,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