@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,45 @@
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
+ declare const VALID_OS_VALUES: readonly ["linux", "windows"];
9
+ export type SandboxOs = (typeof VALID_OS_VALUES)[number];
10
+ /**
11
+ * Resolve the sandbox OS with the following priority:
12
+ * 1. Explicit `os` parameter passed to session_start
13
+ * 2. `TD_OS` environment variable (validated against supported values)
14
+ * 3. `"linux"` default
15
+ *
16
+ * Mirrors the behaviour in `hooks.mjs` so the MCP server and the
17
+ * Vitest integration are consistent.
18
+ *
19
+ * @param explicitOs - The value passed explicitly by the caller (may be undefined)
20
+ * @param env - The environment variables map (defaults to `process.env`)
21
+ * @returns - The resolved OS and a warning message if TD_OS was invalid
22
+ */
23
+ export declare function resolveOs(explicitOs: SandboxOs | undefined, env?: NodeJS.ProcessEnv): {
24
+ os: SandboxOs;
25
+ warning?: string;
26
+ };
27
+ /**
28
+ * Resolve the E2B template ID with the following priority:
29
+ * 1. Explicit `e2bTemplateId` parameter passed to session_start
30
+ * 2. `TD_E2B_TEMPLATE_ID` environment variable
31
+ * 3. `undefined` (let the SDK use its own default)
32
+ *
33
+ * Mirrors the behaviour in `hooks.mjs`:
34
+ * ```js
35
+ * if (!config.e2bTemplateId && process.env.TD_E2B_TEMPLATE_ID) {
36
+ * config.e2bTemplateId = process.env.TD_E2B_TEMPLATE_ID;
37
+ * }
38
+ * ```
39
+ *
40
+ * @param explicitId - The value passed explicitly by the caller (may be undefined)
41
+ * @param env - The environment variables map (defaults to `process.env`)
42
+ * @returns - The resolved template ID, or undefined if none is set
43
+ */
44
+ export declare function resolveE2bTemplateId(explicitId: string | undefined, env?: NodeJS.ProcessEnv): string | undefined;
45
+ export {};
@@ -0,0 +1,63 @@
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
+ // OS resolution
10
+ // ============================================================
11
+ const VALID_OS_VALUES = ["linux", "windows"];
12
+ /**
13
+ * Resolve the sandbox OS with the following priority:
14
+ * 1. Explicit `os` parameter passed to session_start
15
+ * 2. `TD_OS` environment variable (validated against supported values)
16
+ * 3. `"linux"` default
17
+ *
18
+ * Mirrors the behaviour in `hooks.mjs` so the MCP server and the
19
+ * Vitest integration are consistent.
20
+ *
21
+ * @param explicitOs - The value passed explicitly by the caller (may be undefined)
22
+ * @param env - The environment variables map (defaults to `process.env`)
23
+ * @returns - The resolved OS and a warning message if TD_OS was invalid
24
+ */
25
+ export function resolveOs(explicitOs, env = process.env) {
26
+ if (explicitOs) {
27
+ return { os: explicitOs };
28
+ }
29
+ const envOs = env.TD_OS;
30
+ if (envOs) {
31
+ if (VALID_OS_VALUES.includes(envOs)) {
32
+ return { os: envOs };
33
+ }
34
+ return {
35
+ os: "linux",
36
+ warning: `TD_OS has unsupported value "${envOs}" (supported: ${VALID_OS_VALUES.join(", ")}), ignoring`,
37
+ };
38
+ }
39
+ return { os: "linux" };
40
+ }
41
+ // ============================================================
42
+ // E2B template ID resolution
43
+ // ============================================================
44
+ /**
45
+ * Resolve the E2B template ID with the following priority:
46
+ * 1. Explicit `e2bTemplateId` parameter passed to session_start
47
+ * 2. `TD_E2B_TEMPLATE_ID` environment variable
48
+ * 3. `undefined` (let the SDK use its own default)
49
+ *
50
+ * Mirrors the behaviour in `hooks.mjs`:
51
+ * ```js
52
+ * if (!config.e2bTemplateId && process.env.TD_E2B_TEMPLATE_ID) {
53
+ * config.e2bTemplateId = process.env.TD_E2B_TEMPLATE_ID;
54
+ * }
55
+ * ```
56
+ *
57
+ * @param explicitId - The value passed explicitly by the caller (may be undefined)
58
+ * @param env - The environment variables map (defaults to `process.env`)
59
+ * @returns - The resolved template ID, or undefined if none is set
60
+ */
61
+ export function resolveE2bTemplateId(explicitId, env = process.env) {
62
+ return explicitId || env.TD_E2B_TEMPLATE_ID;
63
+ }
@@ -147,7 +147,7 @@ export declare const SessionStartInputSchema: z.ZodObject<{
147
147
  /** Electron args (for electron) */
148
148
  electronArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
149
149
  /** Operating system for the sandbox */
150
- os: z.ZodDefault<z.ZodEnum<["linux", "windows"]>>;
150
+ os: z.ZodOptional<z.ZodEnum<["linux", "windows"]>>;
151
151
  /** Keep sandbox alive duration in ms (default: 5 minutes) */
152
152
  keepAlive: z.ZodDefault<z.ZodNumber>;
153
153
  /** Path to test file - when provided, you MUST append generated code to this file after each action */
@@ -158,11 +158,12 @@ export declare const SessionStartInputSchema: z.ZodObject<{
158
158
  apiRoot: z.ZodOptional<z.ZodString>;
159
159
  /** Direct IP address of self-hosted instance (bypasses cloud provisioning) */
160
160
  ip: z.ZodOptional<z.ZodString>;
161
+ /** E2B sandbox template ID (overrides TD_E2B_TEMPLATE_ID env var) */
162
+ e2bTemplateId: z.ZodOptional<z.ZodString>;
161
163
  /** 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
164
  sandboxId: z.ZodOptional<z.ZodString>;
163
165
  }, "strip", z.ZodTypeAny, {
164
166
  type: "chrome" | "chromeExtension" | "vscode" | "installer" | "electron";
165
- os: "linux" | "windows";
166
167
  keepAlive: number;
167
168
  reconnect: boolean;
168
169
  url?: string | undefined;
@@ -178,9 +179,11 @@ export declare const SessionStartInputSchema: z.ZodObject<{
178
179
  installerUrl?: string | undefined;
179
180
  installerFilename?: string | undefined;
180
181
  electronArgs?: string[] | undefined;
182
+ os?: "linux" | "windows" | undefined;
181
183
  testFile?: string | undefined;
182
184
  apiRoot?: string | undefined;
183
185
  ip?: string | undefined;
186
+ e2bTemplateId?: string | undefined;
184
187
  sandboxId?: string | undefined;
185
188
  }, {
186
189
  url?: string | undefined;
@@ -203,6 +206,7 @@ export declare const SessionStartInputSchema: z.ZodObject<{
203
206
  reconnect?: boolean | undefined;
204
207
  apiRoot?: string | undefined;
205
208
  ip?: string | undefined;
209
+ e2bTemplateId?: string | undefined;
206
210
  sandboxId?: string | undefined;
207
211
  }>;
208
212
  export type SessionStartInput = z.infer<typeof SessionStartInputSchema>;
@@ -118,7 +118,7 @@ export const SessionStartInputSchema = z.object({
118
118
  electronArgs: z.array(z.string()).optional().describe("Additional Electron arguments"),
119
119
  // Common session options
120
120
  /** Operating system for the sandbox */
121
- os: z.enum(["linux", "windows"]).default("linux").describe("Sandbox OS"),
121
+ os: z.enum(["linux", "windows"]).optional().describe("Sandbox OS (default: 'linux', or TD_OS environment variable if set)"),
122
122
  /** Keep sandbox alive duration in ms (default: 5 minutes) */
123
123
  keepAlive: z.number().default(300000).describe("Keep sandbox alive for this many ms"),
124
124
  /** Path to test file - when provided, you MUST append generated code to this file after each action */
@@ -130,6 +130,8 @@ export const SessionStartInputSchema = z.object({
130
130
  // Self-hosted connection options
131
131
  /** Direct IP address of self-hosted instance (bypasses cloud provisioning) */
132
132
  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."),
133
+ /** E2B sandbox template ID (overrides TD_E2B_TEMPLATE_ID env var) */
134
+ e2bTemplateId: z.string().optional().describe("E2B sandbox template ID. Overrides the TD_E2B_TEMPLATE_ID environment variable when provided."),
133
135
  // Debug mode - connect to existing sandbox
134
136
  /** 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. */
135
137
  sandboxId: z.string().optional().describe("Existing sandbox ID to connect to (from debug-on-failure mode). Skips provisioning."),