@testdriverai/mcp 7.10.0-canary.0 → 7.10.1-test

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 (196) hide show
  1. package/.claude-plugin/marketplace.json +17 -0
  2. package/agent/index.js +116 -71
  3. package/agent/interface.js +13 -1
  4. package/agent/lib/commands.js +35 -15
  5. package/agent/lib/provision-commands.js +92 -11
  6. package/agent/lib/sandbox.js +263 -30
  7. package/agent/lib/sdk.js +16 -12
  8. package/agent/lib/system.js +107 -31
  9. package/ai/.claude-plugin/plugin.json +89 -4
  10. package/ai/agents/testdriver.md +4 -8
  11. package/ai/skills/testdriver-assert/SKILL.md +0 -1
  12. package/ai/skills/testdriver-aws-setup/SKILL.md +1 -1
  13. package/ai/skills/testdriver-caching/SKILL.md +13 -6
  14. package/ai/skills/testdriver-ci-cd/SKILL.md +57 -14
  15. package/ai/skills/testdriver-client/SKILL.md +10 -6
  16. package/ai/skills/testdriver-customizing-devices/SKILL.md +7 -5
  17. package/ai/skills/testdriver-dashcam/SKILL.md +36 -3
  18. package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +28 -4
  19. package/ai/skills/testdriver-device-config/SKILL.md +5 -5
  20. package/ai/skills/testdriver-find/SKILL.md +50 -11
  21. package/ai/skills/testdriver-generating-tests/SKILL.md +163 -8
  22. package/ai/skills/testdriver-hosted/SKILL.md +1 -1
  23. package/ai/skills/testdriver-machine-setup/SKILL.md +331 -0
  24. package/ai/skills/testdriver-making-assertions/SKILL.md +78 -2
  25. package/ai/skills/testdriver-mcp-workflow/SKILL.md +2 -2
  26. package/ai/skills/testdriver-parse/SKILL.md +1 -1
  27. package/ai/skills/testdriver-performing-actions/SKILL.md +97 -3
  28. package/ai/skills/testdriver-provision/SKILL.md +0 -20
  29. package/ai/skills/testdriver-quickstart/SKILL.md +299 -21
  30. package/ai/skills/testdriver-reusable-code/SKILL.md +3 -3
  31. package/ai/skills/testdriver-running-tests/SKILL.md +1 -1
  32. package/ai/skills/testdriver-screenshot/SKILL.md +5 -5
  33. package/ai/skills/testdriver-scroll/SKILL.md +30 -160
  34. package/ai/skills/testdriver-test-writer/SKILL.md +3 -5
  35. package/ai/skills/testdriver-testdriver/SKILL.md +3 -7
  36. package/ai/skills/testdriver-wait/SKILL.md +1 -1
  37. package/{docs/v7/ai.mdx → ai/skills/testdriver:ai/SKILL.md} +3 -4
  38. package/ai/skills/testdriver:assert/SKILL.md +315 -0
  39. package/ai/skills/testdriver:aws-setup/SKILL.md +448 -0
  40. package/ai/skills/testdriver:cache/SKILL.md +221 -0
  41. package/ai/skills/testdriver:caching/SKILL.md +124 -0
  42. package/ai/skills/testdriver:captcha/SKILL.md +158 -0
  43. package/ai/skills/testdriver:ci-cd/SKILL.md +659 -0
  44. package/ai/skills/testdriver:click/SKILL.md +286 -0
  45. package/ai/skills/testdriver:client/SKILL.md +477 -0
  46. package/ai/skills/testdriver:customizing-devices/SKILL.md +319 -0
  47. package/ai/skills/testdriver:dashcam/SKILL.md +451 -0
  48. package/ai/skills/testdriver:debugging-with-screenshots/SKILL.md +415 -0
  49. package/{docs/v7/device-config.mdx → ai/skills/testdriver:device-config/SKILL.md} +8 -8
  50. package/ai/skills/testdriver:double-click/SKILL.md +102 -0
  51. package/ai/skills/testdriver:elements/SKILL.md +605 -0
  52. package/ai/skills/testdriver:enterprise/SKILL.md +7 -0
  53. package/ai/skills/testdriver:errors/SKILL.md +246 -0
  54. package/ai/skills/testdriver:events/SKILL.md +356 -0
  55. package/ai/skills/testdriver:exec/SKILL.md +317 -0
  56. package/ai/skills/testdriver:find/SKILL.md +860 -0
  57. package/ai/skills/testdriver:focus-application/SKILL.md +293 -0
  58. package/ai/skills/testdriver:generating-tests/SKILL.md +25 -0
  59. package/ai/skills/testdriver:hosted/SKILL.md +156 -0
  60. package/ai/skills/testdriver:hover/SKILL.md +278 -0
  61. package/{docs/v7/locating-elements.mdx → ai/skills/testdriver:locating-elements/SKILL.md} +3 -3
  62. package/ai/skills/testdriver:making-assertions/SKILL.md +32 -0
  63. package/ai/skills/testdriver:mcp/SKILL.md +7 -0
  64. package/ai/skills/testdriver:mouse-down/SKILL.md +161 -0
  65. package/ai/skills/testdriver:mouse-up/SKILL.md +164 -0
  66. package/ai/skills/testdriver:parse/SKILL.md +236 -0
  67. package/ai/skills/testdriver:performing-actions/SKILL.md +53 -0
  68. package/ai/skills/testdriver:press-keys/SKILL.md +348 -0
  69. package/ai/skills/testdriver:provision/SKILL.md +331 -0
  70. package/ai/skills/testdriver:quickstart/SKILL.md +172 -0
  71. package/ai/skills/testdriver:redraw/SKILL.md +214 -0
  72. package/ai/skills/testdriver:reusable-code/SKILL.md +249 -0
  73. package/ai/skills/testdriver:right-click/SKILL.md +123 -0
  74. package/{docs/v7/running-tests.mdx → ai/skills/testdriver:running-tests/SKILL.md} +4 -4
  75. package/ai/skills/testdriver:screenshot/SKILL.md +248 -0
  76. package/ai/skills/testdriver:screenshots/SKILL.md +184 -0
  77. package/ai/skills/testdriver:scroll/SKILL.md +205 -0
  78. package/ai/skills/testdriver:secrets/SKILL.md +115 -0
  79. package/ai/skills/testdriver:self-hosted/SKILL.md +147 -0
  80. package/ai/skills/testdriver:test-results-json/SKILL.md +257 -0
  81. package/ai/skills/testdriver:testdriver/SKILL.md +624 -0
  82. package/ai/skills/testdriver:type/SKILL.md +357 -0
  83. package/ai/skills/testdriver:variables/SKILL.md +111 -0
  84. package/ai/skills/testdriver:wait/SKILL.md +50 -0
  85. package/{docs/v7/waiting-for-elements.mdx → ai/skills/testdriver:waiting-for-elements/SKILL.md} +3 -3
  86. package/ai/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
  87. package/debugger/index.html +12 -0
  88. package/docs/_data/examples-manifest.json +54 -46
  89. package/docs/_data/examples-manifest.schema.json +12 -2
  90. package/docs/_scripts/extract-example-urls.js +21 -3
  91. package/docs/_scripts/generate-examples.js +64 -16
  92. package/docs/changelog.mdx +29 -2
  93. package/docs/claude-mcp-plugin.mdx +65 -18
  94. package/docs/docs.json +16 -33
  95. package/docs/snippets/tests/scroll-yaml.mdx +2 -2
  96. package/docs/v6/commands/scroll-until-image.mdx +1 -1
  97. package/docs/v6/commands/scroll-until-text.mdx +2 -2
  98. package/docs/v6/commands/scroll.mdx +2 -2
  99. package/docs/v7/_drafts/agents.mdx +0 -4
  100. package/docs/v7/_drafts/best-practices.mdx +0 -12
  101. package/docs/v7/_drafts/commands/scroll-until-image.mdx +1 -1
  102. package/docs/v7/_drafts/commands/scroll-until-text.mdx +2 -2
  103. package/docs/v7/_drafts/commands/scroll.mdx +1 -1
  104. package/docs/v7/_drafts/configuration.mdx +0 -12
  105. package/docs/v7/_drafts/faq.mdx +2 -10
  106. package/docs/v7/_drafts/readme.mdx +0 -1
  107. package/docs/v7/_drafts/troubleshooting.mdx +1 -4
  108. package/docs/v7/assert.mdx +0 -1
  109. package/docs/v7/aws-setup.mdx +1 -1
  110. package/docs/v7/caching.mdx +14 -10
  111. package/docs/v7/ci-cd.mdx +98 -14
  112. package/docs/v7/client.mdx +10 -6
  113. package/docs/v7/copilot/auto-healing.mdx +167 -18
  114. package/docs/v7/copilot/running-tests.mdx +915 -54
  115. package/docs/v7/customizing-devices.mdx +7 -5
  116. package/docs/v7/dashcam.mdx +36 -3
  117. package/docs/v7/debugging-with-screenshots.mdx +31 -7
  118. package/docs/v7/examples/ai.mdx +13 -8
  119. package/docs/v7/examples/assert.mdx +1 -1
  120. package/docs/v7/examples/chrome-extension.mdx +30 -13
  121. package/docs/v7/examples/element-not-found.mdx +1 -1
  122. package/docs/v7/examples/findall-coffee-icons.mdx +3 -2
  123. package/docs/v7/examples/formatted-logging.mdx +74 -0
  124. package/docs/v7/examples/hover-image.mdx +1 -1
  125. package/docs/v7/examples/hover-text-with-description.mdx +2 -2
  126. package/docs/v7/examples/hover-text.mdx +1 -1
  127. package/docs/v7/examples/installer.mdx +1 -1
  128. package/docs/v7/examples/launch-vscode-linux.mdx +27 -27
  129. package/docs/v7/examples/match-image.mdx +1 -1
  130. package/docs/v7/examples/parse.mdx +3 -2
  131. package/docs/v7/examples/press-keys.mdx +2 -2
  132. package/docs/v7/examples/scroll-keyboard.mdx +2 -2
  133. package/docs/v7/examples/scroll-until-text.mdx +1 -1
  134. package/docs/v7/examples/scroll.mdx +1 -1
  135. package/docs/v7/examples/type.mdx +1 -1
  136. package/docs/v7/find.mdx +50 -11
  137. package/docs/v7/generating-tests.mdx +166 -10
  138. package/docs/v7/hosted.mdx +1 -1
  139. package/docs/v7/making-assertions.mdx +81 -4
  140. package/docs/v7/parse.mdx +1 -1
  141. package/docs/v7/performing-actions.mdx +100 -5
  142. package/docs/v7/provision.mdx +0 -20
  143. package/docs/v7/quickstart.mdx +299 -21
  144. package/docs/v7/reusable-code.mdx +3 -3
  145. package/docs/v7/screenshot.mdx +5 -5
  146. package/docs/v7/scroll.mdx +30 -160
  147. package/docs/v7/wait.mdx +1 -1
  148. package/examples/chrome-extension.test.mjs +29 -12
  149. package/examples/config.mjs +1 -1
  150. package/examples/launch-vscode-linux.test.mjs +25 -25
  151. package/interfaces/cli/commands/init.js +84 -2
  152. package/interfaces/vitest-plugin.mjs +51 -61
  153. package/lib/core/Dashcam.js +43 -2
  154. package/lib/core/index.d.ts +13 -1
  155. package/lib/github-comment.mjs +11 -5
  156. package/lib/init-project.js +98 -44
  157. package/lib/install-clients.js +470 -0
  158. package/lib/provision.js +749 -0
  159. package/lib/resolve-channel.js +2 -2
  160. package/lib/sentry.js +15 -2
  161. package/lib/vitest/hooks.mjs +44 -34
  162. package/mcp-server/README.md +32 -0
  163. package/mcp-server/dist/core/actions.d.ts +176 -0
  164. package/mcp-server/dist/core/actions.js +753 -0
  165. package/mcp-server/dist/env-utils.d.ts +45 -0
  166. package/mcp-server/dist/env-utils.js +63 -0
  167. package/mcp-server/dist/provision-types.d.ts +6 -2
  168. package/mcp-server/dist/provision-types.js +3 -1
  169. package/mcp-server/dist/server.mjs +449 -751
  170. package/mcp-server/package-lock.json +384 -1
  171. package/mcp-server/package.json +5 -2
  172. package/mcp-server/src/core/actions.ts +912 -0
  173. package/mcp-server/src/env-utils.test.ts +82 -0
  174. package/mcp-server/src/env-utils.ts +77 -0
  175. package/mcp-server/src/provision-types.ts +4 -1
  176. package/mcp-server/src/server.ts +533 -954
  177. package/mcp-server/tsconfig.json +1 -1
  178. package/mcp-server/vitest.config.ts +7 -0
  179. package/package.json +15 -3
  180. package/sdk.d.ts +11 -9
  181. package/sdk.js +116 -746
  182. package/setup/aws/spawn-runner.sh +24 -3
  183. package/docs/v7/_drafts/caching-ai.mdx +0 -215
  184. package/docs/v7/_drafts/caching.mdx +0 -366
  185. package/docs/v7/_drafts/prompt-cache.mdx +0 -200
  186. package/docs/v7/copilot/creating-tests.mdx +0 -156
  187. package/docs/v7/copilot/github.mdx +0 -143
  188. package/docs/v7/copilot/setup.mdx +0 -143
  189. package/docs/v7/examples/exec-output.mdx +0 -84
  190. package/docs/v7/examples/exec-pwsh.mdx +0 -82
  191. package/docs/v7/examples/focus-window.mdx +0 -61
  192. package/docs/v7/examples/scroll-until-image.mdx +0 -82
  193. package/docs/v7/examples/windows-installer.mdx +0 -95
  194. package/examples/formatted-logging.test.mjs +0 -27
  195. package/examples/match-image.test.mjs +0 -55
  196. package/manual/exec-stream-logs.test.mjs +0 -25
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Unit tests for env-utils.ts
3
+ *
4
+ * Verifies that the OS and E2B template ID resolution helpers apply the
5
+ * correct priority order:
6
+ * explicit param > environment variable > built-in default
7
+ */
8
+
9
+ import { describe, it, expect } from "vitest";
10
+ import { resolveOs, resolveE2bTemplateId } from "./env-utils.js";
11
+
12
+ // ---------------------------------------------------------------------------
13
+ // resolveOs
14
+ // ---------------------------------------------------------------------------
15
+
16
+ describe("resolveOs", () => {
17
+ it("returns the explicit param when provided", () => {
18
+ const { os } = resolveOs("windows", { TD_OS: "linux" });
19
+ expect(os).toBe("windows");
20
+ });
21
+
22
+ it("falls back to TD_OS env var when no explicit param is given", () => {
23
+ const { os } = resolveOs(undefined, { TD_OS: "windows" });
24
+ expect(os).toBe("windows");
25
+ });
26
+
27
+ it("defaults to linux when neither param nor TD_OS is set", () => {
28
+ const { os } = resolveOs(undefined, {});
29
+ expect(os).toBe("linux");
30
+ });
31
+
32
+ it("returns linux and a warning when TD_OS has an unsupported value", () => {
33
+ const { os, warning } = resolveOs(undefined, { TD_OS: "mac" });
34
+ expect(os).toBe("linux");
35
+ expect(warning).toMatch(/unsupported/i);
36
+ expect(warning).toContain("mac");
37
+ });
38
+
39
+ it("returns linux and a warning when TD_OS is 'Linux' (wrong case)", () => {
40
+ const { os, warning } = resolveOs(undefined, { TD_OS: "Linux" });
41
+ expect(os).toBe("linux");
42
+ expect(warning).toBeDefined();
43
+ });
44
+
45
+ it("explicit param takes priority over TD_OS env var", () => {
46
+ const { os, warning } = resolveOs("linux", { TD_OS: "windows" });
47
+ expect(os).toBe("linux");
48
+ expect(warning).toBeUndefined();
49
+ });
50
+
51
+ it("returns no warning when TD_OS is valid", () => {
52
+ const { os, warning } = resolveOs(undefined, { TD_OS: "windows" });
53
+ expect(os).toBe("windows");
54
+ expect(warning).toBeUndefined();
55
+ });
56
+ });
57
+
58
+ // ---------------------------------------------------------------------------
59
+ // resolveE2bTemplateId
60
+ // ---------------------------------------------------------------------------
61
+
62
+ describe("resolveE2bTemplateId", () => {
63
+ it("returns the explicit param when provided", () => {
64
+ const id = resolveE2bTemplateId("explicit-id", { TD_E2B_TEMPLATE_ID: "env-id" });
65
+ expect(id).toBe("explicit-id");
66
+ });
67
+
68
+ it("falls back to TD_E2B_TEMPLATE_ID env var when no explicit param is given", () => {
69
+ const id = resolveE2bTemplateId(undefined, { TD_E2B_TEMPLATE_ID: "env-id" });
70
+ expect(id).toBe("env-id");
71
+ });
72
+
73
+ it("returns undefined when neither param nor TD_E2B_TEMPLATE_ID is set", () => {
74
+ const id = resolveE2bTemplateId(undefined, {});
75
+ expect(id).toBeUndefined();
76
+ });
77
+
78
+ it("explicit param takes priority over TD_E2B_TEMPLATE_ID env var", () => {
79
+ const id = resolveE2bTemplateId("my-template", { TD_E2B_TEMPLATE_ID: "other-template" });
80
+ expect(id).toBe("my-template");
81
+ });
82
+ });
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Utilities for resolving TestDriver environment variables.
3
+ *
4
+ * These helpers centralise the "param > env var > default" fallback logic
5
+ * so the server handler stays clean and the logic can be unit-tested
6
+ * independently.
7
+ */
8
+
9
+ // ============================================================
10
+ // OS resolution
11
+ // ============================================================
12
+
13
+ const VALID_OS_VALUES = ["linux", "windows"] as const;
14
+ export type SandboxOs = (typeof VALID_OS_VALUES)[number];
15
+
16
+ /**
17
+ * Resolve the sandbox OS with the following priority:
18
+ * 1. Explicit `os` parameter passed to session_start
19
+ * 2. `TD_OS` environment variable (validated against supported values)
20
+ * 3. `"linux"` default
21
+ *
22
+ * Mirrors the behaviour in `hooks.mjs` so the MCP server and the
23
+ * Vitest integration are consistent.
24
+ *
25
+ * @param explicitOs - The value passed explicitly by the caller (may be undefined)
26
+ * @param env - The environment variables map (defaults to `process.env`)
27
+ * @returns - The resolved OS and a warning message if TD_OS was invalid
28
+ */
29
+ export function resolveOs(
30
+ explicitOs: SandboxOs | undefined,
31
+ env: NodeJS.ProcessEnv = process.env,
32
+ ): { os: SandboxOs; warning?: string } {
33
+ if (explicitOs) {
34
+ return { os: explicitOs };
35
+ }
36
+
37
+ const envOs = env.TD_OS;
38
+ if (envOs) {
39
+ if ((VALID_OS_VALUES as readonly string[]).includes(envOs)) {
40
+ return { os: envOs as SandboxOs };
41
+ }
42
+ return {
43
+ os: "linux",
44
+ warning: `TD_OS has unsupported value "${envOs}" (supported: ${VALID_OS_VALUES.join(", ")}), ignoring`,
45
+ };
46
+ }
47
+
48
+ return { os: "linux" };
49
+ }
50
+
51
+ // ============================================================
52
+ // E2B template ID resolution
53
+ // ============================================================
54
+
55
+ /**
56
+ * Resolve the E2B template ID with the following priority:
57
+ * 1. Explicit `e2bTemplateId` parameter passed to session_start
58
+ * 2. `TD_E2B_TEMPLATE_ID` environment variable
59
+ * 3. `undefined` (let the SDK use its own default)
60
+ *
61
+ * Mirrors the behaviour in `hooks.mjs`:
62
+ * ```js
63
+ * if (!config.e2bTemplateId && process.env.TD_E2B_TEMPLATE_ID) {
64
+ * config.e2bTemplateId = process.env.TD_E2B_TEMPLATE_ID;
65
+ * }
66
+ * ```
67
+ *
68
+ * @param explicitId - The value passed explicitly by the caller (may be undefined)
69
+ * @param env - The environment variables map (defaults to `process.env`)
70
+ * @returns - The resolved template ID, or undefined if none is set
71
+ */
72
+ export function resolveE2bTemplateId(
73
+ explicitId: string | undefined,
74
+ env: NodeJS.ProcessEnv = process.env,
75
+ ): string | undefined {
76
+ return explicitId || env.TD_E2B_TEMPLATE_ID;
77
+ }
@@ -143,7 +143,7 @@ export const SessionStartInputSchema = z.object({
143
143
 
144
144
  // Common session options
145
145
  /** Operating system for the sandbox */
146
- os: z.enum(["linux", "windows"]).default("linux").describe("Sandbox OS"),
146
+ os: z.enum(["linux", "windows"]).optional().describe("Sandbox OS (default: 'linux', or TD_OS environment variable if set)"),
147
147
  /** Keep sandbox alive duration in ms (default: 5 minutes) */
148
148
  keepAlive: z.number().default(300000).describe("Keep sandbox alive for this many ms"),
149
149
  /** Path to test file - when provided, you MUST append generated code to this file after each action */
@@ -157,6 +157,9 @@ export const SessionStartInputSchema = z.object({
157
157
  /** Direct IP address of self-hosted instance (bypasses cloud provisioning) */
158
158
  ip: z.string().optional().describe("Direct IP address of self-hosted Windows instance (e.g., from AWS). When provided, connects directly to this IP instead of using cloud provisioning."),
159
159
 
160
+ /** E2B sandbox template ID (overrides TD_E2B_TEMPLATE_ID env var) */
161
+ e2bTemplateId: z.string().optional().describe("E2B sandbox template ID. Overrides the TD_E2B_TEMPLATE_ID environment variable when provided."),
162
+
160
163
  // Debug mode - connect to existing sandbox
161
164
  /** Sandbox ID to connect to (for debug-on-failure mode). When provided, connects to an existing sandbox instead of creating a new one. Skip provisioning. */
162
165
  sandboxId: z.string().optional().describe("Existing sandbox ID to connect to (from debug-on-failure mode). Skips provisioning."),