@hover-dev/core 0.15.0 → 0.17.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 (169) hide show
  1. package/README.md +26 -55
  2. package/dist/agentDirectives.d.ts +55 -0
  3. package/dist/agentDirectives.d.ts.map +1 -0
  4. package/dist/agentDirectives.js +276 -0
  5. package/dist/agents/claude.d.ts.map +1 -1
  6. package/dist/agents/claude.js +28 -3
  7. package/dist/agents/codex.d.ts.map +1 -1
  8. package/dist/agents/codex.js +38 -18
  9. package/dist/agents/gemini.d.ts.map +1 -1
  10. package/dist/agents/gemini.js +3 -14
  11. package/dist/agents/invoke.d.ts.map +1 -1
  12. package/dist/agents/invoke.js +3 -6
  13. package/dist/agents/qwen.d.ts.map +1 -1
  14. package/dist/agents/qwen.js +3 -14
  15. package/dist/agents/registry.d.ts.map +1 -1
  16. package/dist/agents/registry.js +0 -4
  17. package/dist/agents/shared.d.ts +28 -0
  18. package/dist/agents/shared.d.ts.map +1 -0
  19. package/dist/agents/shared.js +35 -0
  20. package/dist/agents/types.d.ts +19 -11
  21. package/dist/agents/types.d.ts.map +1 -1
  22. package/dist/engine.d.ts +53 -0
  23. package/dist/engine.d.ts.map +1 -0
  24. package/dist/engine.js +78 -0
  25. package/dist/mcp/actuateServer.d.ts +3 -0
  26. package/dist/mcp/actuateServer.d.ts.map +1 -0
  27. package/dist/mcp/actuateServer.js +594 -0
  28. package/dist/mcp/sourceFence.d.ts +23 -0
  29. package/dist/mcp/sourceFence.d.ts.map +1 -0
  30. package/dist/mcp/sourceFence.js +79 -0
  31. package/dist/mcp/sourceServer.d.ts +3 -0
  32. package/dist/mcp/sourceServer.d.ts.map +1 -0
  33. package/dist/mcp/sourceServer.js +191 -0
  34. package/dist/memory/businessMemory.d.ts +29 -0
  35. package/dist/memory/businessMemory.d.ts.map +1 -0
  36. package/dist/memory/businessMemory.js +125 -0
  37. package/dist/modes.d.ts +39 -0
  38. package/dist/modes.d.ts.map +1 -0
  39. package/dist/modes.js +34 -0
  40. package/dist/playwright/cdpStatus.d.ts +0 -15
  41. package/dist/playwright/cdpStatus.d.ts.map +1 -1
  42. package/dist/playwright/cdpStatus.js +0 -67
  43. package/dist/playwright/launchChrome.d.ts +18 -0
  44. package/dist/playwright/launchChrome.d.ts.map +1 -1
  45. package/dist/playwright/launchChrome.js +46 -3
  46. package/dist/playwright/preflight.d.ts.map +1 -1
  47. package/dist/playwright/preflight.js +6 -1
  48. package/dist/playwright/resolveMcpConfig.d.ts +12 -0
  49. package/dist/playwright/resolveMcpConfig.d.ts.map +1 -1
  50. package/dist/playwright/resolveMcpConfig.js +36 -5
  51. package/dist/plugin-api.d.ts +35 -26
  52. package/dist/plugin-api.d.ts.map +1 -1
  53. package/dist/plugin-api.js +2 -2
  54. package/dist/qa/candidates.d.ts +32 -0
  55. package/dist/qa/candidates.d.ts.map +1 -0
  56. package/dist/qa/candidates.js +20 -0
  57. package/dist/qa/classify.d.ts +38 -0
  58. package/dist/qa/classify.d.ts.map +1 -0
  59. package/dist/qa/classify.js +138 -0
  60. package/dist/qa/intensity.d.ts +33 -0
  61. package/dist/qa/intensity.d.ts.map +1 -0
  62. package/dist/qa/intensity.js +25 -0
  63. package/dist/qa/qaReport.d.ts +19 -0
  64. package/dist/qa/qaReport.d.ts.map +1 -0
  65. package/dist/qa/qaReport.js +50 -0
  66. package/dist/runSession.d.ts +14 -3
  67. package/dist/runSession.d.ts.map +1 -1
  68. package/dist/runSession.js +31 -11
  69. package/dist/service/cdpHandlers.d.ts +3 -27
  70. package/dist/service/cdpHandlers.d.ts.map +1 -1
  71. package/dist/service/cdpHandlers.js +6 -53
  72. package/dist/service/cdpHint.d.ts +21 -28
  73. package/dist/service/cdpHint.d.ts.map +1 -1
  74. package/dist/service/cdpHint.js +106 -164
  75. package/dist/service/relayHandlers.d.ts +28 -0
  76. package/dist/service/relayHandlers.d.ts.map +1 -0
  77. package/dist/service/relayHandlers.js +105 -0
  78. package/dist/service/saveHandlers.d.ts +1 -3
  79. package/dist/service/saveHandlers.d.ts.map +1 -1
  80. package/dist/service/saveHandlers.js +17 -15
  81. package/dist/service/types.d.ts +108 -8
  82. package/dist/service/types.d.ts.map +1 -1
  83. package/dist/service.d.ts +13 -3
  84. package/dist/service.d.ts.map +1 -1
  85. package/dist/service.js +1022 -236
  86. package/dist/sessions/sessions.d.ts +125 -0
  87. package/dist/sessions/sessions.d.ts.map +1 -0
  88. package/dist/sessions/sessions.js +175 -0
  89. package/dist/specs/authFixture.d.ts +30 -0
  90. package/dist/specs/authFixture.d.ts.map +1 -0
  91. package/dist/specs/authFixture.js +145 -0
  92. package/dist/specs/businessMap.d.ts +29 -0
  93. package/dist/specs/businessMap.d.ts.map +1 -0
  94. package/dist/specs/businessMap.js +95 -0
  95. package/dist/specs/detectSharedFlows.d.ts +1 -1
  96. package/dist/specs/detectSharedFlows.d.ts.map +1 -1
  97. package/dist/specs/detectSharedFlows.js +20 -21
  98. package/dist/specs/generatePageObject.d.ts +1 -1
  99. package/dist/specs/generatePageObject.d.ts.map +1 -1
  100. package/dist/specs/healPrompt.d.ts +19 -0
  101. package/dist/specs/healPrompt.d.ts.map +1 -0
  102. package/dist/specs/healPrompt.js +48 -0
  103. package/dist/specs/humanSteps.d.ts +4 -8
  104. package/dist/specs/humanSteps.d.ts.map +1 -1
  105. package/dist/specs/humanSteps.js +6 -1
  106. package/dist/specs/optimizeSpec.d.ts +15 -8
  107. package/dist/specs/optimizeSpec.d.ts.map +1 -1
  108. package/dist/specs/optimizeSpec.js +98 -46
  109. package/dist/specs/optimizeSpecWithAgent.d.ts +0 -2
  110. package/dist/specs/optimizeSpecWithAgent.d.ts.map +1 -1
  111. package/dist/specs/optimizeSpecWithAgent.js +0 -1
  112. package/dist/specs/pageObjectManifest.d.ts +3 -1
  113. package/dist/specs/pageObjectManifest.d.ts.map +1 -1
  114. package/dist/specs/pageObjectManifest.js +13 -9
  115. package/dist/specs/replayGrounded.d.ts +45 -0
  116. package/dist/specs/replayGrounded.d.ts.map +1 -0
  117. package/dist/specs/replayGrounded.js +155 -0
  118. package/dist/specs/runFailures.d.ts +34 -0
  119. package/dist/specs/runFailures.d.ts.map +1 -0
  120. package/dist/specs/runFailures.js +93 -0
  121. package/dist/specs/seeds.d.ts +16 -15
  122. package/dist/specs/seeds.d.ts.map +1 -1
  123. package/dist/specs/seeds.js +86 -54
  124. package/dist/specs/sidecar.d.ts +34 -6
  125. package/dist/specs/sidecar.d.ts.map +1 -1
  126. package/dist/specs/sidecar.js +79 -9
  127. package/dist/specs/softBatch.d.ts +14 -0
  128. package/dist/specs/softBatch.d.ts.map +1 -0
  129. package/dist/specs/softBatch.js +177 -0
  130. package/dist/specs/specStep.d.ts +21 -0
  131. package/dist/specs/specStep.d.ts.map +1 -0
  132. package/dist/specs/specStep.js +1 -0
  133. package/dist/specs/text.d.ts +19 -0
  134. package/dist/specs/text.d.ts.map +1 -0
  135. package/dist/specs/text.js +27 -0
  136. package/dist/specs/writeSpec.d.ts +62 -1
  137. package/dist/specs/writeSpec.d.ts.map +1 -1
  138. package/dist/specs/writeSpec.js +598 -30
  139. package/package.json +10 -10
  140. package/dist/agents/aider.d.ts +0 -16
  141. package/dist/agents/aider.d.ts.map +0 -1
  142. package/dist/agents/aider.js +0 -169
  143. package/dist/agents/cursor.d.ts +0 -18
  144. package/dist/agents/cursor.d.ts.map +0 -1
  145. package/dist/agents/cursor.js +0 -229
  146. package/dist/playwright/raiseWindow.d.ts +0 -10
  147. package/dist/playwright/raiseWindow.d.ts.map +0 -1
  148. package/dist/playwright/raiseWindow.js +0 -139
  149. package/dist/scripts/bench-multi-tab.d.ts +0 -2
  150. package/dist/scripts/bench-multi-tab.d.ts.map +0 -1
  151. package/dist/scripts/bench-multi-tab.js +0 -192
  152. package/dist/scripts/bench-ttfb.d.ts +0 -2
  153. package/dist/scripts/bench-ttfb.d.ts.map +0 -1
  154. package/dist/scripts/bench-ttfb.js +0 -127
  155. package/dist/scripts/start-chrome.d.ts +0 -3
  156. package/dist/scripts/start-chrome.d.ts.map +0 -1
  157. package/dist/scripts/start-chrome.js +0 -23
  158. package/dist/skills/writeSkill.d.ts +0 -27
  159. package/dist/skills/writeSkill.d.ts.map +0 -1
  160. package/dist/skills/writeSkill.js +0 -13
  161. package/dist/specs/listSpecs.d.ts +0 -52
  162. package/dist/specs/listSpecs.d.ts.map +0 -1
  163. package/dist/specs/listSpecs.js +0 -139
  164. package/dist/specs/optimizationSuggestion.d.ts +0 -26
  165. package/dist/specs/optimizationSuggestion.d.ts.map +0 -1
  166. package/dist/specs/optimizationSuggestion.js +0 -28
  167. package/dist/specs/writeCaseCsv.d.ts +0 -28
  168. package/dist/specs/writeCaseCsv.d.ts.map +0 -1
  169. package/dist/specs/writeCaseCsv.js +0 -140
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The path fence for the opt-in `read_source` capability (codeContext).
3
+ *
4
+ * Giving the agent the ability to read source is the ONE place Hover relaxes
5
+ * its "the agent only touches the browser" rule, so the fence is the whole
6
+ * security story. It must guarantee, on every call, that a caller-supplied path:
7
+ * 1. resolves to a location INSIDE the project root (no `..` / absolute-path
8
+ * escape — symlink escape is caught by the server's realpath re-check), and
9
+ * 2. is not a credential / secret / VCS / dependency file.
10
+ * Pure + lexical so it's exhaustively unit-testable; the server layers a
11
+ * realpath check + a size/binary guard on top.
12
+ */
13
+ import { resolve, relative, isAbsolute, sep } from 'node:path';
14
+ /** Files we refuse to read even inside the root — credentials, keys, VCS,
15
+ * dependency trees, build caches. Matched against the POSIX-style relative
16
+ * path (so `\` on Windows is normalised first). */
17
+ const SECRET_PATTERNS = [
18
+ /(^|\/)\.env(\.[^/]*)?$/i, // .env, .env.local, .env.production
19
+ /\.env$/i, // any *.env dotenv file (prod.env, local.env)
20
+ /(^|\/)\.envrc$/i, // direnv (holds exported env / secrets)
21
+ /\.tfvars(\.json)?$/i, // terraform variable files (often secrets)
22
+ /(^|\/)\.htpasswd$/i, // http basic-auth credentials
23
+ /(^|\/)\.git(\/|$)/, // the git dir
24
+ /(^|\/)node_modules(\/|$)/, // dependency tree
25
+ /(^|\/)\.(next|nuxt|svelte-kit|astro|turbo|cache|output|vercel)(\/|$)/, // build caches
26
+ /(^|\/)(dist|build|coverage)(\/|$)/, // build output
27
+ /\.(pem|key|p12|pfx|crt|cer|der|keystore|jks)$/i, // key / cert material
28
+ /(^|\/)id_(rsa|dsa|ecdsa|ed25519)(\.[^/]*)?$/i, // ssh keys
29
+ /(^|\/)\.(npmrc|netrc|pgpass)$/i, // token-bearing rc files
30
+ /(^|\/)\.(ssh|aws|gnupg|gcloud|kube|docker)(\/|$)/i, // credential dirs
31
+ /(^|\/)secrets?(\/|\.[^/]*$|$)/i, // a secrets dir, or a secret(s).<ext> file
32
+ /(^|\/)credentials?(\/|\.[^/]*$|$)/i, // a credentials dir, or credential(s).<ext>
33
+ /\.(secret|secrets)$/i,
34
+ ];
35
+ /** A path containing a NUL or C0 control char is never a legitimate source file. */
36
+ function hasControlChar(s) {
37
+ for (let i = 0; i < s.length; i++) {
38
+ if (s.charCodeAt(i) < 0x20)
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+ /**
44
+ * Resolve `input` against `root`, refusing anything outside the root or matching
45
+ * a secret pattern. `input` is treated as relative to the root; an absolute
46
+ * input is resolved too but will fail the containment check unless it happens to
47
+ * live under the root (the agent should pass repo-relative paths).
48
+ */
49
+ export function resolveSourcePath(root, input) {
50
+ if (typeof input !== 'string' || !input.trim()) {
51
+ return { ok: false, reason: 'path is required' };
52
+ }
53
+ if (hasControlChar(input)) {
54
+ return { ok: false, reason: 'path contains control characters' };
55
+ }
56
+ const rootAbs = resolve(root);
57
+ const abs = resolve(rootAbs, input);
58
+ const rel = relative(rootAbs, abs);
59
+ // Outside the root: relative() returns '' for the root itself, a '..'-prefixed
60
+ // path for an ancestor/sibling, or an absolute path when on a different drive.
61
+ if (rel === '' || rel === '..' || rel.startsWith('..' + sep) || rel.startsWith('../') || isAbsolute(rel)) {
62
+ return { ok: false, reason: 'path escapes the project root' };
63
+ }
64
+ const relPosix = rel.split(sep).join('/');
65
+ for (const pat of SECRET_PATTERNS) {
66
+ if (pat.test(relPosix)) {
67
+ return { ok: false, reason: `refused: "${relPosix}" matches an excluded (secret / build / VCS) pattern` };
68
+ }
69
+ }
70
+ return { ok: true, abs, rel: relPosix };
71
+ }
72
+ /** True if a resolved-and-realpathed absolute path is still inside the root.
73
+ * The server calls this AFTER realpath to defeat symlink escape (a symlink
74
+ * whose lexical path passed resolveSourcePath but points outside the root). */
75
+ export function isWithinRoot(root, realAbs) {
76
+ const rootAbs = resolve(root);
77
+ const rel = relative(rootAbs, realAbs);
78
+ return rel !== '' && rel !== '..' && !rel.startsWith('..' + sep) && !rel.startsWith('../') && !isAbsolute(rel);
79
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=sourceServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceServer.d.ts","sourceRoot":"","sources":["../../src/mcp/sourceServer.ts"],"names":[],"mappings":""}
@@ -0,0 +1,191 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Hover source-reader MCP server — the runtime behind the opt-in `codeContext`
4
+ * switch. Spawned by the agent (Claude Code / Codex) as a stdio subprocess when
5
+ * codeContext is enabled, in addition to Playwright MCP. It gives the agent
6
+ * READ-ONLY, fenced access to the project's source so it can author smarter
7
+ * tests and do white-box security/pentest work (read the actual query / authz
8
+ * check, not just the rendered DOM).
9
+ *
10
+ * This is the ONE place Hover relaxes "the agent only touches the browser", so
11
+ * the safety is all in the fence (src/mcp/sourceFence.ts) + the guards here:
12
+ * - every path is resolved INSIDE the project root (no `..` / absolute escape)
13
+ * - a realpath re-check defeats symlink escape
14
+ * - secret / VCS / dependency / build files are refused (.env, keys, .git, …)
15
+ * - read-only: there is no write / exec / delete tool here
16
+ * - a size cap + a binary guard keep it to actual source
17
+ *
18
+ * The project root comes in via env:
19
+ * HOVER_PROJECT_ROOT absolute path to the dev project root (devRoot)
20
+ *
21
+ * Tools exposed:
22
+ * read_source({ path }) → the file's text (fenced, ≤256 KB, text-only)
23
+ * list_source({ subdir? }) → a shallow dir listing (secrets filtered out)
24
+ */
25
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
26
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
27
+ import { z } from 'zod';
28
+ import { readFileSync, realpathSync, statSync, readdirSync } from 'node:fs';
29
+ import { WebSocket } from 'ws';
30
+ import { resolveSourcePath, isWithinRoot } from './sourceFence.js';
31
+ const root = process.env.HOVER_PROJECT_ROOT;
32
+ if (!root) {
33
+ process.stderr.write('[hover-source-mcp] HOVER_PROJECT_ROOT must be set by the host.\n');
34
+ process.exit(1);
35
+ }
36
+ const ROOT = root;
37
+ const MAX_BYTES = 256 * 1024;
38
+ function md(text) {
39
+ return { content: [{ type: 'text', text }] };
40
+ }
41
+ // ── Read-approval gate ──────────────────────────────────────────────────────
42
+ // When the host runs us with HOVER_SOURCE_GATE=ask, every read/list first asks
43
+ // the editor (over the Hover service WS at HOVER_APPROVAL_PORT) for the user's
44
+ // one-click approval. The reader is fenced + read-only, so the gate is consent
45
+ // UX, not a security boundary: if the editor can't be reached or doesn't answer
46
+ // within 30s we FAIL OPEN (allow) rather than stall the agent's run.
47
+ const GATE = process.env.HOVER_SOURCE_GATE;
48
+ const APPROVAL_PORT = process.env.HOVER_APPROVAL_PORT;
49
+ let approvalWs = null;
50
+ let approvalSeq = 0;
51
+ const pendingApprovals = new Map();
52
+ function ensureApprovalWs() {
53
+ if (GATE !== 'ask' || !APPROVAL_PORT)
54
+ return null;
55
+ if (approvalWs && (approvalWs.readyState === WebSocket.OPEN || approvalWs.readyState === WebSocket.CONNECTING))
56
+ return approvalWs;
57
+ try {
58
+ const sock = new WebSocket(`ws://127.0.0.1:${APPROVAL_PORT}`);
59
+ sock.on('message', (data) => {
60
+ try {
61
+ const m = JSON.parse(data.toString());
62
+ if (m?.type === 'source-approval-response' && m.payload?.approvalId) {
63
+ const settle = pendingApprovals.get(m.payload.approvalId);
64
+ if (settle)
65
+ settle(m.payload.allow === true);
66
+ }
67
+ }
68
+ catch { /* ignore malformed */ }
69
+ });
70
+ // Channel lost → fail OPEN for every waiting read (the reader is fenced +
71
+ // read-only; the gate is consent UX, not a security boundary, so never hang
72
+ // a run on a dead channel). The user taking their time is NOT a loss — only
73
+ // a closed/errored socket settles here.
74
+ const drain = () => { for (const s of [...pendingApprovals.values()])
75
+ s(true); };
76
+ sock.on('error', () => { drain(); });
77
+ sock.on('close', () => { if (approvalWs === sock)
78
+ approvalWs = null; drain(); });
79
+ approvalWs = sock;
80
+ }
81
+ catch {
82
+ approvalWs = null;
83
+ }
84
+ return approvalWs;
85
+ }
86
+ async function approve(path, kind) {
87
+ if (GATE !== 'ask' || !APPROVAL_PORT)
88
+ return true; // not gated → allow
89
+ const sock = ensureApprovalWs();
90
+ if (!sock)
91
+ return true; // no channel → fail open
92
+ const id = `a${++approvalSeq}`;
93
+ return new Promise((resolve) => {
94
+ // NO timeout: the consent prompt waits for the user (they may not see it for
95
+ // a while — that must never auto-allow). It settles only on their answer, or
96
+ // when the channel drops (drain() above → fail open), or run cancel.
97
+ const settle = (allow) => {
98
+ if (!pendingApprovals.has(id))
99
+ return;
100
+ pendingApprovals.delete(id);
101
+ resolve(allow);
102
+ };
103
+ pendingApprovals.set(id, settle);
104
+ const req = () => sock.send(JSON.stringify({ type: 'source-approval-request', payload: { approvalId: id, sourcePath: path, sourceKind: kind } }));
105
+ if (sock.readyState === WebSocket.OPEN)
106
+ req();
107
+ else
108
+ sock.once('open', req);
109
+ });
110
+ }
111
+ const server = new McpServer({ name: 'hover-source', version: '0.0.0' });
112
+ server.registerTool('read_source', {
113
+ description: "Read a source file from THIS project (read-only). Pass a repo-relative path (e.g. the one in an element's data-hover-source, `src/app/login.tsx:42` → path `src/app/login.tsx`). Fenced to the project root: paths that escape it, or that name secrets / keys / .env / .git / node_modules / build output, are refused. Use this to write tests against the real selectors & routes, or — in security/pentest mode — to confirm a finding against the actual server code (the SQL query, the authz check). You cannot write, run, or delete anything.",
114
+ inputSchema: {
115
+ path: z.string().describe('Repo-relative path to a source file, e.g. "src/api/orders.ts".'),
116
+ },
117
+ }, async ({ path }) => {
118
+ if (!(await approve(path, 'read')))
119
+ return md(`✗ source read declined by the user — continue from what's visible on the page.`);
120
+ const f = resolveSourcePath(ROOT, path);
121
+ if (!f.ok)
122
+ return md(`✗ ${f.reason}`);
123
+ let real;
124
+ try {
125
+ real = realpathSync(f.abs);
126
+ }
127
+ catch {
128
+ return md(`✗ not found: ${f.rel}`);
129
+ }
130
+ if (!isWithinRoot(ROOT, real))
131
+ return md(`✗ refused: "${f.rel}" resolves (via a symlink) outside the project root`);
132
+ let st;
133
+ try {
134
+ st = statSync(real);
135
+ }
136
+ catch {
137
+ return md(`✗ not found: ${f.rel}`);
138
+ }
139
+ if (st.isDirectory())
140
+ return md(`✗ "${f.rel}" is a directory — use list_source`);
141
+ if (st.size > MAX_BYTES)
142
+ return md(`✗ "${f.rel}" is ${Math.round(st.size / 1024)} KB — too large to read (cap ${MAX_BYTES / 1024} KB)`);
143
+ let buf;
144
+ try {
145
+ buf = readFileSync(real);
146
+ }
147
+ catch (e) {
148
+ return md(`✗ could not read ${f.rel}: ${e instanceof Error ? e.message : String(e)}`);
149
+ }
150
+ // Binary guard — a NUL byte in the first 8 KB means it isn't source text.
151
+ if (buf.subarray(0, 8192).includes(0))
152
+ return md(`✗ "${f.rel}" looks binary — refused`);
153
+ return md(`\`\`\`\n// ${f.rel}\n${buf.toString('utf-8')}\n\`\`\``);
154
+ });
155
+ server.registerTool('list_source', {
156
+ description: 'List the entries of a directory in THIS project (shallow, read-only). Omit `subdir` for the project root. Secret / VCS / dependency / build entries are filtered out. Use it to discover what source exists before reading a file.',
157
+ inputSchema: {
158
+ subdir: z.string().optional().describe('Repo-relative directory, e.g. "src/api". Omit for the root.'),
159
+ },
160
+ }, async ({ subdir }) => {
161
+ if (!(await approve(subdir || '.', 'list')))
162
+ return md(`✗ source listing declined by the user.`);
163
+ let dirAbs = ROOT;
164
+ let base = '';
165
+ if (subdir && subdir.trim() && subdir.trim() !== '.') {
166
+ const d = resolveSourcePath(ROOT, subdir);
167
+ if (!d.ok)
168
+ return md(`✗ ${d.reason}`);
169
+ dirAbs = d.abs;
170
+ base = d.rel;
171
+ }
172
+ let entries;
173
+ try {
174
+ entries = readdirSync(dirAbs, { withFileTypes: true });
175
+ }
176
+ catch {
177
+ return md(`✗ not a readable directory: ${base || '.'}`);
178
+ }
179
+ const rows = [];
180
+ for (const e of entries.sort((a, b) => a.name.localeCompare(b.name))) {
181
+ const rel = base ? `${base}/${e.name}` : e.name;
182
+ // Filter via the same fence so secrets/build/VCS never even show up.
183
+ if (!resolveSourcePath(ROOT, rel).ok)
184
+ continue;
185
+ rows.push(e.isDirectory() ? `${rel}/` : rel);
186
+ }
187
+ if (rows.length === 0)
188
+ return md(`(empty or fully filtered) ${base || '.'}`);
189
+ return md(`${base || '.'} —\n${rows.join('\n')}`);
190
+ });
191
+ await server.connect(new StdioServerTransport());
@@ -0,0 +1,29 @@
1
+ /** A learned business fact about the app under test. */
2
+ export interface BusinessFact {
3
+ /** kebab-case slug; also the filename stem. */
4
+ name: string;
5
+ /** One-line summary used for recall relevance + the index hook. */
6
+ description: string;
7
+ /** What kind of knowledge this is. */
8
+ type: 'business-rule' | 'expected-behavior' | 'validation' | 'access-policy';
9
+ /** The fact itself (markdown). */
10
+ body: string;
11
+ }
12
+ export declare function memoryDir(devRoot: string): string;
13
+ /** kebab-case a title into a safe filename stem. */
14
+ export declare function slugify(s: string): string;
15
+ /** Load every fact under `.hover/memory/` (excluding the MEMORY.md index).
16
+ * Pure + total: a missing dir / unreadable file just yields fewer facts. */
17
+ export declare function loadMemory(devRoot: string): Promise<BusinessFact[]>;
18
+ /** Format loaded facts as a system-prompt block, or '' when there are none (so
19
+ * the caller appends nothing). Grouped nothing-fancy: one bullet per fact. */
20
+ export declare function formatMemoryForPrompt(facts: BusinessFact[]): string;
21
+ /** Write (or overwrite) a fact file + refresh the MEMORY.md index line. NEVER
22
+ * throws — returns the path or an error string for the caller to log. Business
23
+ * RULES only; the caller must never pass secrets / PII / credentials. */
24
+ export declare function writeFact(devRoot: string, fact: BusinessFact): Promise<{
25
+ path: string;
26
+ } | {
27
+ error: string;
28
+ }>;
29
+ //# sourceMappingURL=businessMemory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"businessMemory.d.ts","sourceRoot":"","sources":["../../src/memory/businessMemory.ts"],"names":[],"mappings":"AAwBA,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,IAAI,EAAE,eAAe,GAAG,mBAAmB,GAAG,YAAY,GAAG,eAAe,CAAC;IAC7E,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,oDAAoD;AACpD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzC;AAsBD;6EAC6E;AAC7E,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAkBzE;AAED;+EAC+E;AAC/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,MAAM,CAQnE;AAED;;0EAE0E;AAC1E,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAc/C"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Business memory — the per-app knowledge QA / API modes accumulate so they stop
3
+ * re-asking the same business questions every run. Lives at `<devRoot>/.hover/
4
+ * memory/`, mirroring Claude's own memory layout (an index + one fact per file):
5
+ *
6
+ * .hover/memory/
7
+ * MEMORY.md ← index: one `- [title](file.md) — hook` line per fact
8
+ * checkout-tax.md ← frontmatter (name / description / type) + the fact body
9
+ * ...
10
+ *
11
+ * Loop: load at run start → inject as agent context ("Known business rules…");
12
+ * after the user answers a business clarification (trigger-B, a later QA stage),
13
+ * write the learned fact. The more an app is tested, the fewer popups — see the
14
+ * QA-tester-mode design + project-moat-strategy.
15
+ *
16
+ * CONTRACT: business RULES only, NEVER secrets / PII / credentials (extends the
17
+ * standing "never read env / secrets" rule). Writes are best-effort — a memory
18
+ * failure must NEVER break a run (same rule as the session ledger). Used by QA +
19
+ * API modes only; Flow / Pentest don't read or write it.
20
+ */
21
+ import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises';
22
+ import { join } from 'node:path';
23
+ import { hoverDir } from '../specs/sidecar.js';
24
+ export function memoryDir(devRoot) {
25
+ return join(hoverDir(devRoot), 'memory');
26
+ }
27
+ /** kebab-case a title into a safe filename stem. */
28
+ export function slugify(s) {
29
+ return s
30
+ .toLowerCase()
31
+ .replace(/[^a-z0-9]+/g, '-')
32
+ .replace(/^-+|-+$/g, '')
33
+ .slice(0, 60) || 'fact';
34
+ }
35
+ /** Parse a fact file's `---` frontmatter + body. Minimal + total — a malformed
36
+ * file yields nulls and is skipped by the caller. Only the three known keys are
37
+ * read; everything after the closing `---` is the body. */
38
+ function parseFact(slug, raw) {
39
+ const m = raw.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
40
+ if (!m)
41
+ return null;
42
+ const fm = m[1];
43
+ const body = m[2].trim();
44
+ const field = (k) => {
45
+ const f = fm.match(new RegExp(`^${k}\\s*:\\s*(.+)$`, 'm'));
46
+ return f ? f[1].trim().replace(/^["']|["']$/g, '') : '';
47
+ };
48
+ const description = field('description');
49
+ const rawType = field('type');
50
+ const types = ['business-rule', 'expected-behavior', 'validation', 'access-policy'];
51
+ const type = types.includes(rawType) ? rawType : 'business-rule';
52
+ if (!body)
53
+ return null;
54
+ return { name: field('name') || slug, description, type, body };
55
+ }
56
+ /** Load every fact under `.hover/memory/` (excluding the MEMORY.md index).
57
+ * Pure + total: a missing dir / unreadable file just yields fewer facts. */
58
+ export async function loadMemory(devRoot) {
59
+ try {
60
+ const dir = memoryDir(devRoot);
61
+ const entries = (await readdir(dir)).filter((e) => e.endsWith('.md') && e.toLowerCase() !== 'memory.md');
62
+ const facts = [];
63
+ for (const entry of entries.sort()) {
64
+ try {
65
+ const raw = await readFile(join(dir, entry), 'utf-8');
66
+ const fact = parseFact(entry.replace(/\.md$/, ''), raw);
67
+ if (fact)
68
+ facts.push(fact);
69
+ }
70
+ catch {
71
+ /* skip unreadable */
72
+ }
73
+ }
74
+ return facts;
75
+ }
76
+ catch {
77
+ return [];
78
+ }
79
+ }
80
+ /** Format loaded facts as a system-prompt block, or '' when there are none (so
81
+ * the caller appends nothing). Grouped nothing-fancy: one bullet per fact. */
82
+ export function formatMemoryForPrompt(facts) {
83
+ if (!facts.length)
84
+ return '';
85
+ const lines = facts.map((f) => `- ${f.description ? f.description + ' — ' : ''}${f.body.replace(/\s+/g, ' ').trim()}`);
86
+ return ('KNOWN BUSINESS KNOWLEDGE FOR THIS APP (learned from earlier runs — treat as ' +
87
+ 'ground truth; do NOT re-ask what these already answer):\n' +
88
+ lines.join('\n'));
89
+ }
90
+ /** Write (or overwrite) a fact file + refresh the MEMORY.md index line. NEVER
91
+ * throws — returns the path or an error string for the caller to log. Business
92
+ * RULES only; the caller must never pass secrets / PII / credentials. */
93
+ export async function writeFact(devRoot, fact) {
94
+ try {
95
+ const dir = memoryDir(devRoot);
96
+ await mkdir(dir, { recursive: true });
97
+ const slug = slugify(fact.name);
98
+ const file = `${slug}.md`;
99
+ const content = `---\nname: ${slug}\ndescription: ${fact.description}\ntype: ${fact.type}\n---\n\n${fact.body.trim()}\n`;
100
+ await writeFile(join(dir, file), content, 'utf-8');
101
+ await upsertIndex(dir, slug, fact);
102
+ return { path: join(dir, file) };
103
+ }
104
+ catch (err) {
105
+ return { error: err instanceof Error ? err.message : String(err) };
106
+ }
107
+ }
108
+ /** Add/replace this fact's line in MEMORY.md (`- [title](file.md) — hook`),
109
+ * keyed by the file link so re-writing a fact updates rather than duplicates. */
110
+ async function upsertIndex(dir, slug, fact) {
111
+ const indexPath = join(dir, 'MEMORY.md');
112
+ const link = `(${slug}.md)`;
113
+ const line = `- [${fact.name}](${slug}.md) — ${fact.description || fact.type}`;
114
+ let existing = '';
115
+ try {
116
+ existing = await readFile(indexPath, 'utf-8');
117
+ }
118
+ catch {
119
+ existing = '# Business memory\n\nWhat Hover has learned about this app. One fact per file.\n';
120
+ }
121
+ const kept = existing
122
+ .split('\n')
123
+ .filter((l) => !(l.startsWith('- [') && l.includes(link)));
124
+ await writeFile(indexPath, `${kept.join('\n').replace(/\n+$/, '')}\n${line}\n`, 'utf-8');
125
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Built-in (non-plugin) mode behavior. Hover's core modes — Flow (the default,
3
+ * modeId `null`) and the planned QA mode — are pure agent-behavior config: which
4
+ * actuation tools the agent uses and how a run crystallizes. (Plugin modes —
5
+ * api-test / pentest — bring runtime machinery instead: a MITM proxy, sidecars,
6
+ * Chrome proxy flags, lifecycle hooks; they resolve to PLUGIN_MODE_BEHAVIOR.)
7
+ *
8
+ * `resolveModeBehavior(modeId)` is the SINGLE place that answers "how does this
9
+ * mode drive the agent", replacing scattered `currentModeId === null` checks.
10
+ * Adding a built-in mode (e.g. QA) = one entry in BUILTIN_MODE_BEHAVIOR, not new
11
+ * conditionals threaded through the run-assembly path.
12
+ */
13
+ export interface ModeBehavior {
14
+ /** Deny Playwright's loose interaction tools (browser_click / type / fill_form
15
+ * / select_option / file_upload) AND inject the grounded-actuation directive,
16
+ * so the agent actuates via the Hover control MCP and saved selectors are
17
+ * role+name (record == replay). Flow and QA want this — they crystallize
18
+ * browser steps; plugin modes don't — they explore to capture traffic and
19
+ * keep the Playwright tools. */
20
+ groundedActuation: boolean;
21
+ }
22
+ /** Resolve the agent-behavior config for a mode id (null = Flow). Built-in modes
23
+ * are table-driven; any other (plugin) id falls back to PLUGIN_MODE_BEHAVIOR. */
24
+ export declare function resolveModeBehavior(modeId: string | null): ModeBehavior;
25
+ /** Picker metadata for built-in non-Flow modes (Flow is the implicit null
26
+ * default, not listed). core's broadcastModes merges these into the mode
27
+ * catalogue alongside plugin-contributed modes, and switchMode/set-mode accept
28
+ * them without requiring a plugin. */
29
+ export interface BuiltinMode {
30
+ id: string;
31
+ label: string;
32
+ description: string;
33
+ accent: string;
34
+ }
35
+ export declare const BUILTIN_MODES: BuiltinMode[];
36
+ /** True for a built-in non-null mode id (currently just `qa`). Lets core accept
37
+ * it in set-mode / switchMode without a contributing plugin. */
38
+ export declare function isBuiltinMode(modeId: string): boolean;
39
+ //# sourceMappingURL=modes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../src/modes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;qCAKiC;IACjC,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAmBD;kFACkF;AAClF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,CAGvE;AAED;;;uCAGuC;AACvC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,eAAO,MAAM,aAAa,EAAE,WAAW,EAOtC,CAAC;AAEF;iEACiE;AACjE,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErD"}
package/dist/modes.js ADDED
@@ -0,0 +1,34 @@
1
+ /** Flow — the default mode (modeId `null`): author a Playwright spec via grounded
2
+ * actuation. */
3
+ const FLOW_MODE_BEHAVIOR = { groundedActuation: true };
4
+ /** Built-in modes other than Flow, keyed by modeId.
5
+ * QA = comprehensive testing umbrella; its Functional capability reuses Flow's
6
+ * grounded actuation (record == replay for promoted candidate flows). (Its API
7
+ * capability — when enabled — delegates to the api-test plugin's MITM runtime;
8
+ * that orchestration is a later QA stage, not a ModeBehavior field.) */
9
+ const BUILTIN_MODE_BEHAVIOR = {
10
+ qa: { groundedActuation: true },
11
+ };
12
+ /** Plugin-contributed modes (api-test / pentest): full Playwright tool access —
13
+ * they explore to capture traffic, not to crystallize browser steps. */
14
+ const PLUGIN_MODE_BEHAVIOR = { groundedActuation: false };
15
+ /** Resolve the agent-behavior config for a mode id (null = Flow). Built-in modes
16
+ * are table-driven; any other (plugin) id falls back to PLUGIN_MODE_BEHAVIOR. */
17
+ export function resolveModeBehavior(modeId) {
18
+ if (modeId === null)
19
+ return FLOW_MODE_BEHAVIOR;
20
+ return BUILTIN_MODE_BEHAVIOR[modeId] ?? PLUGIN_MODE_BEHAVIOR;
21
+ }
22
+ export const BUILTIN_MODES = [
23
+ {
24
+ id: 'qa',
25
+ label: 'QA Testing',
26
+ description: 'explore the whole app → findings report + promotable specs',
27
+ accent: '#22c55e',
28
+ },
29
+ ];
30
+ /** True for a built-in non-null mode id (currently just `qa`). Lets core accept
31
+ * it in set-mode / switchMode without a contributing plugin. */
32
+ export function isBuiltinMode(modeId) {
33
+ return modeId in BUILTIN_MODE_BEHAVIOR;
34
+ }
@@ -11,19 +11,4 @@ export interface CdpStatusResult {
11
11
  reason?: string;
12
12
  }
13
13
  export declare function checkCdpStatus(cdpUrl: string, pageUrl: string): Promise<CdpStatusResult>;
14
- /**
15
- * Bring the debug-Chrome tab matching `pageUrl`'s origin to the front. If no
16
- * matching tab exists, open a new tab on the origin. Returns the URL of the
17
- * tab that was focused (or opened) for logging.
18
- *
19
- * Uses a short-lived playwright-core connection — opens it, does the work,
20
- * closes it. We don't keep a long-lived browser handle.
21
- */
22
- export declare function focusDebugTab(cdpUrl: string, pageUrl: string): Promise<{
23
- ok: true;
24
- focusedUrl: string;
25
- } | {
26
- ok: false;
27
- reason: string;
28
- }>;
29
14
  //# sourceMappingURL=cdpStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cdpStatus.d.ts","sourceRoot":"","sources":["../../src/playwright/cdpStatus.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,cAAc,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,QAAQ,CAAC;IAChB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAeD,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,CAAC,CA4B1B;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA8C3E"}
1
+ {"version":3,"file":"cdpStatus.d.ts","sourceRoot":"","sources":["../../src/playwright/cdpStatus.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,cAAc,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,QAAQ,CAAC;IAChB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAeD,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,CAAC,CA4B1B"}
@@ -11,9 +11,7 @@
11
11
  * - 'no-cdp' no debug Chrome at all; the widget should let the user
12
12
  * trigger a launch.
13
13
  */
14
- import { chromium } from 'playwright-core';
15
14
  import { getPreflight } from './preflightCache.js';
16
- import { findCdpPid, raiseChromeWindow } from './raiseWindow.js';
17
15
  /**
18
16
  * Parse a page URL down to its origin (protocol + host + port). We compare
19
17
  * by origin, not full URL — the user might be on /login while the debug
@@ -52,68 +50,3 @@ export async function checkCdpStatus(cdpUrl, pageUrl) {
52
50
  browser: cdp.browser,
53
51
  };
54
52
  }
55
- /**
56
- * Bring the debug-Chrome tab matching `pageUrl`'s origin to the front. If no
57
- * matching tab exists, open a new tab on the origin. Returns the URL of the
58
- * tab that was focused (or opened) for logging.
59
- *
60
- * Uses a short-lived playwright-core connection — opens it, does the work,
61
- * closes it. We don't keep a long-lived browser handle.
62
- */
63
- export async function focusDebugTab(cdpUrl, pageUrl) {
64
- const wantOrigin = originOf(pageUrl);
65
- if (!wantOrigin) {
66
- return { ok: false, reason: `unparseable page URL: ${pageUrl}` };
67
- }
68
- let browser;
69
- try {
70
- browser = await chromium.connectOverCDP(cdpUrl);
71
- }
72
- catch (err) {
73
- const msg = err instanceof Error ? err.message : String(err);
74
- return { ok: false, reason: `couldn't connect to CDP at ${cdpUrl}: ${msg}` };
75
- }
76
- let focusedUrl;
77
- try {
78
- const pages = browser.contexts().flatMap(c => c.pages());
79
- const match = pages.find(p => originOf(p.url()) === wantOrigin);
80
- if (match) {
81
- await match.bringToFront();
82
- focusedUrl = match.url();
83
- }
84
- else {
85
- // No tab on the dev origin yet — open one so the widget appears.
86
- const context = browser.contexts()[0] ?? (await browser.newContext());
87
- const page = await context.newPage();
88
- await page.goto(pageUrl, { waitUntil: 'domcontentloaded' });
89
- await page.bringToFront();
90
- focusedUrl = page.url();
91
- }
92
- }
93
- catch (err) {
94
- await browser.close().catch(() => { });
95
- const msg = err instanceof Error ? err.message : String(err);
96
- return { ok: false, reason: `bringToFront failed: ${msg}` };
97
- }
98
- await browser.close().catch(() => { });
99
- // CDP-level bringToFront only activates the tab inside the Chrome process;
100
- // on macOS in particular the Chrome *window* stays buried if it wasn't
101
- // foreground already. Raise the OS window too. Best-effort, never fatal.
102
- const port = portFromCdpUrl(cdpUrl);
103
- if (port !== null) {
104
- const pid = await findCdpPid(port);
105
- if (pid !== null)
106
- await raiseChromeWindow(pid);
107
- }
108
- return { ok: true, focusedUrl };
109
- }
110
- function portFromCdpUrl(cdpUrl) {
111
- try {
112
- const u = new URL(cdpUrl);
113
- const port = Number.parseInt(u.port, 10);
114
- return Number.isInteger(port) && port > 0 ? port : null;
115
- }
116
- catch {
117
- return null;
118
- }
119
- }
@@ -21,6 +21,17 @@ export interface LaunchOptions {
21
21
  /** Base64 SHA-256 of the MITM CA's SubjectPublicKeyInfo. */
22
22
  spki: string;
23
23
  };
24
+ /** Launch Chrome headless (`--headless=new`) — no visible window. Still
25
+ * CDP-drivable and still uses the persistent profile, so login state set in
26
+ * a prior headed launch carries over. Used by the VSCode extension's silent
27
+ * mode. Default false (visible window). */
28
+ headless?: boolean;
29
+ /** Close any existing debug Chrome on this port FIRST, then launch fresh.
30
+ * The plain launch is idempotent (returns the running instance), so it can't
31
+ * switch headless↔visible or recover a window that's there-but-not-showing —
32
+ * `force` makes the headless/visible toggle and the "reopen browser" action
33
+ * actually relaunch. Default false. */
34
+ force?: boolean;
24
35
  }
25
36
  export type LaunchResult = {
26
37
  ok: true;
@@ -32,6 +43,13 @@ export type LaunchResult = {
32
43
  reason: string;
33
44
  };
34
45
  export declare function findChromeBinary(): string | null;
46
+ /**
47
+ * Close a debug Chrome on `port` by sending CDP `Browser.close` over its
48
+ * DevTools WebSocket (from /json/version). Works without a child-process handle
49
+ * — Hover spawns Chrome detached — so it's the only way to relaunch in a
50
+ * different mode. Resolves once closed (or the timeout lapses); never throws.
51
+ */
52
+ export declare function closeDebugChrome(port: number, timeoutMs?: number): Promise<boolean>;
35
53
  /**
36
54
  * Start (or detect) a debug Chrome listening on the given CDP port. Detaches
37
55
  * the child process so the calling script can exit cleanly while Chrome keeps