browsertrack 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/docs.yml +54 -0
- package/AGENTS.md +133 -0
- package/README.md +1 -1
- package/dist/{chunk-6A7FFDIB.js → chunk-6VA7GBAO.js} +29 -4
- package/dist/chunk-6VA7GBAO.js.map +1 -0
- package/dist/{chunk-ANMR5WBH.js → chunk-G2Y3CXCY.js} +2 -2
- package/dist/{chunk-BSKNG4V7.js → chunk-ILRYKMME.js} +30 -1
- package/dist/chunk-ILRYKMME.js.map +1 -0
- package/dist/{chunk-X7C5CHBO.js → chunk-SKCMT2DE.js} +637 -76
- package/dist/chunk-SKCMT2DE.js.map +1 -0
- package/dist/{chunk-ZLNGOOH2.js → chunk-SPCIROIU.js} +65 -3
- package/dist/chunk-SPCIROIU.js.map +1 -0
- package/dist/cli/index.js +115 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/client/index.cjs +637 -75
- package/dist/client/index.d.ts +16 -2
- package/dist/client/index.js +2 -2
- package/dist/client.iife.js +393 -72
- package/dist/core/index.d.ts +12 -4
- package/dist/core/index.js +9 -3
- package/dist/daemon/index.d.ts +1 -1
- package/dist/daemon/index.js +3 -3
- package/dist/{engine-DKloFjvs.d.ts → engine-CeT9URuN.d.ts} +4 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +13 -7
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +2 -2
- package/dist/{server-CN-se8td.d.ts → server-Dd8NX2Mk.d.ts} +1 -1
- package/docboot.config.js +16 -0
- package/docs/cli.md +51 -0
- package/docs/closed-loop-verification.md +57 -0
- package/docs/getting-started.md +122 -0
- package/docs/incidents-diagnostics.md +61 -0
- package/docs/index.md +46 -0
- package/docs/mcp-reference.md +128 -0
- package/docs/security-privacy.md +32 -0
- package/docs/visual-notes.md +67 -0
- package/package.json +6 -2
- package/packages/client/package.json +2 -2
- package/packages/client/src/notes/inspector.ts +689 -79
- package/packages/client/src/transport/websocket.ts +15 -0
- package/packages/core/package.json +3 -0
- package/packages/core/src/redaction.ts +40 -5
- package/packages/daemon/src/server/ws.ts +72 -1
- package/packages/daemon/src/session/manager.ts +21 -0
- package/packages/daemon/src/storage/db.ts +10 -1
- package/test/client/interceptors.test.ts +61 -0
- package/test/core/redaction.test.ts +12 -0
- package/dist/chunk-6A7FFDIB.js.map +0 -1
- package/dist/chunk-BSKNG4V7.js.map +0 -1
- package/dist/chunk-X7C5CHBO.js.map +0 -1
- package/dist/chunk-ZLNGOOH2.js.map +0 -1
- package/packages/core/dist/index.d.ts +0 -317
- package/packages/core/dist/index.js +0 -221
- /package/dist/{chunk-ANMR5WBH.js.map → chunk-G2Y3CXCY.js.map} +0 -0
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { B as Breadcrumb, C as CaptureElementParams, a as CaptureElementResult, b as ClientCommand, c as ClientEventMessage, d as CommandResponse, e as CommandType, f as ConsoleEvent, g as ConsoleLevel, D as DOMRectJson, E as ElementContext, h as ElementStyleResult, i as ElementSummary, j as EventType, H as HelloMessage, N as NavigateParams, k as NavigationEvent, l as NetworkEvent, m as NoteStatus, n as NoteTarget, o as NoteType, p as NoteVerificationResult, O as OverflowCheckResult, P as PageStateResult, Q as QueryElementParams, q as QueryElementResult, R as RegionContext, r as ReloadParams, s as RuntimeErrorEvent, S as ScrollContext, V as ViewportContext, t as VisualNote } from '../notes-CBvN91Wf.js';
|
|
2
2
|
export { I as Incident, a as IncidentOccurrence, b as IncidentSeverity, c as IncidentSource, d as IncidentStatus, P as ProbeResult, e as ProbeType, f as Project, S as Session, V as VerificationProbe, g as VerificationRecipe, h as VerificationResult } from '../projects-CY8ungMt.js';
|
|
3
|
+
import { Rules } from '@visulima/redact';
|
|
4
|
+
export { Rules, standardRules, redact as visulimaRedact } from '@visulima/redact';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Error fingerprinting and normalization utilities
|
|
@@ -35,11 +37,16 @@ declare function extractSourceFromStack(stack?: string): {
|
|
|
35
37
|
declare function computeFingerprint(input: FingerprintInput): string;
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
|
-
* Security and Redaction Utilities
|
|
40
|
+
* Security and Redaction Utilities powered by @visulima/redact
|
|
39
41
|
*/
|
|
42
|
+
declare const REDACTED_PLACEHOLDER = "[REDACTED]";
|
|
40
43
|
declare const SENSITIVE_KEY_PATTERNS: RegExp[];
|
|
41
44
|
declare const SENSITIVE_QUERY_PARAMS: string[];
|
|
42
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Developer security rules for @visulima/redact
|
|
47
|
+
*/
|
|
48
|
+
declare const BROWSER_SECURITY_RULES: Rules;
|
|
49
|
+
|
|
43
50
|
/**
|
|
44
51
|
* Checks if a property name matches any sensitive pattern
|
|
45
52
|
*/
|
|
@@ -53,7 +60,8 @@ declare function redactUrl(rawUrl: string): string;
|
|
|
53
60
|
*/
|
|
54
61
|
declare function redactHeaders(headers: Record<string, string>): Record<string, string>;
|
|
55
62
|
/**
|
|
56
|
-
* Deeply redacts sensitive keys from an object or array
|
|
63
|
+
* Deeply redacts sensitive keys and payload data from an object or array,
|
|
64
|
+
* leveraging @visulima/redact rules combined with BrowserTrack URL/header sanitizers.
|
|
57
65
|
*/
|
|
58
66
|
declare function redactSensitiveData<T = any>(data: T, maxDepth?: number, currentDepth?: number): T;
|
|
59
67
|
|
|
@@ -75,4 +83,4 @@ declare function getSemanticSelector(element: HTMLElement | Element, options?: S
|
|
|
75
83
|
*/
|
|
76
84
|
declare function truncate(str: string | undefined | null, maxLength?: number): string;
|
|
77
85
|
|
|
78
|
-
export { type FingerprintInput, REDACTED_PLACEHOLDER, SENSITIVE_KEY_PATTERNS, SENSITIVE_QUERY_PARAMS, type SelectorOptions, computeFingerprint, extractSourceFromStack, getSemanticSelector, isSensitiveKey, normalizeErrorMessage, normalizeSourceFile, redactHeaders, redactSensitiveData, redactUrl, truncate };
|
|
86
|
+
export { BROWSER_SECURITY_RULES, type FingerprintInput, REDACTED_PLACEHOLDER, SENSITIVE_KEY_PATTERNS, SENSITIVE_QUERY_PARAMS, type SelectorOptions, computeFingerprint, extractSourceFromStack, getSemanticSelector, isSensitiveKey, normalizeErrorMessage, normalizeSourceFile, redactHeaders, redactSensitiveData, redactUrl, truncate };
|
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BROWSER_SECURITY_RULES,
|
|
2
3
|
REDACTED_PLACEHOLDER,
|
|
3
4
|
SENSITIVE_KEY_PATTERNS,
|
|
4
5
|
SENSITIVE_QUERY_PARAMS,
|
|
@@ -11,9 +12,12 @@ import {
|
|
|
11
12
|
redactHeaders,
|
|
12
13
|
redactSensitiveData,
|
|
13
14
|
redactUrl,
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
standardRules,
|
|
16
|
+
truncate,
|
|
17
|
+
visulimaRedact
|
|
18
|
+
} from "../chunk-6VA7GBAO.js";
|
|
16
19
|
export {
|
|
20
|
+
BROWSER_SECURITY_RULES,
|
|
17
21
|
REDACTED_PLACEHOLDER,
|
|
18
22
|
SENSITIVE_KEY_PATTERNS,
|
|
19
23
|
SENSITIVE_QUERY_PARAMS,
|
|
@@ -26,6 +30,8 @@ export {
|
|
|
26
30
|
redactHeaders,
|
|
27
31
|
redactSensitiveData,
|
|
28
32
|
redactUrl,
|
|
29
|
-
|
|
33
|
+
standardRules,
|
|
34
|
+
truncate,
|
|
35
|
+
visulimaRedact
|
|
30
36
|
};
|
|
31
37
|
//# sourceMappingURL=index.js.map
|
package/dist/daemon/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as StorageDB, b as ScreenshotStore, a as SessionManager, c as NotesEngine, V as VerificationEngine, N as NoteVerificationEngine } from '../engine-
|
|
1
|
+
import { S as StorageDB, b as ScreenshotStore, a as SessionManager, c as NotesEngine, V as VerificationEngine, N as NoteVerificationEngine } from '../engine-CeT9URuN.js';
|
|
2
2
|
import { c as ClientEventMessage } from '../notes-CBvN91Wf.js';
|
|
3
3
|
import { I as Incident } from '../projects-CY8ungMt.js';
|
|
4
4
|
import http from 'node:http';
|
package/dist/daemon/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
createDaemon,
|
|
5
5
|
createHttpHandler,
|
|
6
6
|
setupWebSocketServer
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-SPCIROIU.js";
|
|
8
|
+
import "../chunk-6VA7GBAO.js";
|
|
9
9
|
import {
|
|
10
10
|
NoteVerificationEngine,
|
|
11
11
|
NotesEngine,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
StorageDB,
|
|
15
15
|
VerificationEngine,
|
|
16
16
|
getDaemonConfig
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-ILRYKMME.js";
|
|
18
18
|
export {
|
|
19
19
|
BrowserTrackDaemon,
|
|
20
20
|
IncidentEngine,
|
|
@@ -70,8 +70,10 @@ declare class StorageDB {
|
|
|
70
70
|
listNotes(options?: {
|
|
71
71
|
projectId?: string;
|
|
72
72
|
status?: NoteStatus;
|
|
73
|
+
route?: string;
|
|
73
74
|
limit?: number;
|
|
74
75
|
}): VisualNote[];
|
|
76
|
+
deleteNote(id: string): void;
|
|
75
77
|
updateNoteStatus(id: string, status: NoteStatus): void;
|
|
76
78
|
updateNote(id: string, updates: Partial<VisualNote>): void;
|
|
77
79
|
insertNoteVerification(v: NoteVerificationResult): void;
|
|
@@ -103,6 +105,8 @@ declare class SessionManager {
|
|
|
103
105
|
getActiveSessionForProject(projectId: string): Session | null;
|
|
104
106
|
getAnyActiveSession(): Session | null;
|
|
105
107
|
getActiveCount(): number;
|
|
108
|
+
broadcastToProject(projectId: string, message: any): void;
|
|
109
|
+
sendToSession(sessionId: string, message: any): void;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
declare class NotesEngine {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { B as Breadcrumb, C as CaptureElementParams, a as CaptureElementResult, b as ClientCommand, c as ClientEventMessage, d as CommandResponse, e as CommandType, f as ConsoleEvent, g as ConsoleLevel, D as DOMRectJson, E as ElementContext, h as ElementStyleResult, i as ElementSummary, j as EventType, H as HelloMessage, N as NavigateParams, k as NavigationEvent, l as NetworkEvent, m as NoteStatus, n as NoteTarget, o as NoteType, p as NoteVerificationResult, O as OverflowCheckResult, P as PageStateResult, Q as QueryElementParams, q as QueryElementResult, R as RegionContext, r as ReloadParams, s as RuntimeErrorEvent, S as ScrollContext, V as ViewportContext, t as VisualNote } from './notes-CBvN91Wf.js';
|
|
2
2
|
export { I as Incident, a as IncidentOccurrence, b as IncidentSeverity, c as IncidentSource, d as IncidentStatus, P as ProbeResult, e as ProbeType, f as Project, S as Session, V as VerificationProbe, g as VerificationRecipe, h as VerificationResult } from './projects-CY8ungMt.js';
|
|
3
|
-
export { FingerprintInput, REDACTED_PLACEHOLDER, SENSITIVE_KEY_PATTERNS, SENSITIVE_QUERY_PARAMS, SelectorOptions, computeFingerprint, extractSourceFromStack, getSemanticSelector, isSensitiveKey, normalizeErrorMessage, normalizeSourceFile, redactHeaders, redactSensitiveData, redactUrl, truncate } from './core/index.js';
|
|
3
|
+
export { BROWSER_SECURITY_RULES, FingerprintInput, REDACTED_PLACEHOLDER, SENSITIVE_KEY_PATTERNS, SENSITIVE_QUERY_PARAMS, SelectorOptions, computeFingerprint, extractSourceFromStack, getSemanticSelector, isSensitiveKey, normalizeErrorMessage, normalizeSourceFile, redactHeaders, redactSensitiveData, redactUrl, truncate } from './core/index.js';
|
|
4
4
|
export { BrowserTrackClient, getClient, init as initClient } from './client/index.js';
|
|
5
5
|
export { BrowserTrackDaemon, createDaemon } from './daemon/index.js';
|
|
6
|
-
export { c as createMcpServer } from './server-
|
|
7
|
-
|
|
6
|
+
export { c as createMcpServer } from './server-Dd8NX2Mk.js';
|
|
7
|
+
export { Rules, standardRules, redact as visulimaRedact } from '@visulima/redact';
|
|
8
|
+
import './engine-CeT9URuN.js';
|
|
8
9
|
import 'ws';
|
|
9
10
|
import 'node:http';
|
|
10
11
|
import '@modelcontextprotocol/sdk/server/index.js';
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,13 @@ import {
|
|
|
2
2
|
BrowserTrackClient,
|
|
3
3
|
getClient,
|
|
4
4
|
init
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SKCMT2DE.js";
|
|
6
6
|
import {
|
|
7
7
|
BrowserTrackDaemon,
|
|
8
8
|
createDaemon
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SPCIROIU.js";
|
|
10
10
|
import {
|
|
11
|
+
BROWSER_SECURITY_RULES,
|
|
11
12
|
REDACTED_PLACEHOLDER,
|
|
12
13
|
SENSITIVE_KEY_PATTERNS,
|
|
13
14
|
SENSITIVE_QUERY_PARAMS,
|
|
@@ -20,13 +21,16 @@ import {
|
|
|
20
21
|
redactHeaders,
|
|
21
22
|
redactSensitiveData,
|
|
22
23
|
redactUrl,
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
standardRules,
|
|
25
|
+
truncate,
|
|
26
|
+
visulimaRedact
|
|
27
|
+
} from "./chunk-6VA7GBAO.js";
|
|
25
28
|
import {
|
|
26
29
|
createMcpServer
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
30
|
+
} from "./chunk-G2Y3CXCY.js";
|
|
31
|
+
import "./chunk-ILRYKMME.js";
|
|
29
32
|
export {
|
|
33
|
+
BROWSER_SECURITY_RULES,
|
|
30
34
|
BrowserTrackClient,
|
|
31
35
|
BrowserTrackDaemon,
|
|
32
36
|
REDACTED_PLACEHOLDER,
|
|
@@ -45,6 +49,8 @@ export {
|
|
|
45
49
|
redactHeaders,
|
|
46
50
|
redactSensitiveData,
|
|
47
51
|
redactUrl,
|
|
48
|
-
|
|
52
|
+
standardRules,
|
|
53
|
+
truncate,
|
|
54
|
+
visulimaRedact
|
|
49
55
|
};
|
|
50
56
|
//# sourceMappingURL=index.js.map
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
export { M as McpContext, a as McpServerOptions, c as createMcpServer, h as handleToolCall } from '../server-
|
|
2
|
+
export { M as McpContext, a as McpServerOptions, c as createMcpServer, h as handleToolCall } from '../server-Dd8NX2Mk.js';
|
|
3
3
|
import '@modelcontextprotocol/sdk/server/index.js';
|
|
4
|
-
import '../engine-
|
|
4
|
+
import '../engine-CeT9URuN.js';
|
|
5
5
|
import '../notes-CBvN91Wf.js';
|
|
6
6
|
import '../projects-CY8ungMt.js';
|
|
7
7
|
import 'ws';
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
-
import { S as StorageDB, a as SessionManager, V as VerificationEngine, N as NoteVerificationEngine } from './engine-
|
|
2
|
+
import { S as StorageDB, a as SessionManager, V as VerificationEngine, N as NoteVerificationEngine } from './engine-CeT9URuN.js';
|
|
3
3
|
|
|
4
4
|
interface McpContext {
|
|
5
5
|
db: StorageDB;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @type {import('docboot').DocbootConfig} */
|
|
2
|
+
export default {
|
|
3
|
+
title: "BrowserTrack",
|
|
4
|
+
description: "Local browser diagnostics shared with coding agents through MCP",
|
|
5
|
+
docs: "./docs",
|
|
6
|
+
out: "./dist-docs",
|
|
7
|
+
theme: {
|
|
8
|
+
preset: "zinc",
|
|
9
|
+
defaultMode: "dark"
|
|
10
|
+
},
|
|
11
|
+
search: {
|
|
12
|
+
fuzzy: 0.2,
|
|
13
|
+
prefix: true,
|
|
14
|
+
maxResults: 10
|
|
15
|
+
}
|
|
16
|
+
};
|
package/docs/cli.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CLI Reference
|
|
3
|
+
description: Command-line interface commands for daemon control, project tracking, error logs, and documentation
|
|
4
|
+
order: 8
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CLI Reference 💻
|
|
8
|
+
|
|
9
|
+
BrowserTrack provides a complete command-line interface for managing the daemon, tracked projects, and runtime errors.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ⚡ Commands
|
|
14
|
+
|
|
15
|
+
### Daemon Management
|
|
16
|
+
```bash
|
|
17
|
+
browsertrack start # Start local daemon on http://127.0.0.1:7331
|
|
18
|
+
browsertrack start --verbose # Start with verbose message logging
|
|
19
|
+
browsertrack stop # Stop running daemon process
|
|
20
|
+
browsertrack status # Check status and connected browser sessions
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Project Registry
|
|
24
|
+
```bash
|
|
25
|
+
browsertrack projects # List all tracked projects
|
|
26
|
+
browsertrack project add <name> --origin <url> --path <path>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Incident & Log Inspection
|
|
30
|
+
```bash
|
|
31
|
+
browsertrack errors # List open runtime error incidents
|
|
32
|
+
browsertrack errors --project <name>
|
|
33
|
+
browsertrack clear # Wipe stored logs, screenshots, and incidents
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### MCP Integration
|
|
37
|
+
```bash
|
|
38
|
+
browsertrack mcp # Start Model Context Protocol server over stdio
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 📖 Documentation Commands (Docboot)
|
|
44
|
+
|
|
45
|
+
To preview or build this documentation locally using [Docboot](https://github.com/litepacks/docboot):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm run docs:dev # Start live documentation server on http://localhost:3000
|
|
49
|
+
npm run docs:build # Build static production documentation to dist-docs/
|
|
50
|
+
npm run docs:serve # Preview production build locally
|
|
51
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Closed-Loop Verification
|
|
3
|
+
description: Automated bug-fix verification, visual layout probes, before/after screenshot comparisons, and resolution verdicts
|
|
4
|
+
order: 5
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Closed-Loop Verification 🔄
|
|
8
|
+
|
|
9
|
+
BrowserTrack features an automated closed-loop verification engine for both runtime bug fixes and visual layout fixes.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🐞 Bug Fix Verification (`verify_incident`)
|
|
14
|
+
|
|
15
|
+
When an agent fixes a code bug, it triggers `verify_incident`:
|
|
16
|
+
|
|
17
|
+
1. **Browser Reload**: Reloads the active browser tab (or navigates to the incident route).
|
|
18
|
+
2. **Error Monitoring**: Watches for the incident fingerprint during an observation window (e.g. 2000ms).
|
|
19
|
+
3. **Probe Evaluation**: Evaluates custom verification probes:
|
|
20
|
+
- `no_incident`: Confirms zero runtime errors occurred.
|
|
21
|
+
- `element_exists`: Checks if a specific selector exists in the DOM.
|
|
22
|
+
- `element_visible`: Confirms the target is rendered and visible.
|
|
23
|
+
- `text_contains`: Asserts expected text content.
|
|
24
|
+
- `route_is`: Verifies current SPA route.
|
|
25
|
+
4. **After Screenshot**: Automatically captures an after-fix screenshot.
|
|
26
|
+
5. **Verdict**: Returns `VERIFIED`, `FAILED`, or `INCONCLUSIVE`.
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// Example MCP call
|
|
30
|
+
await client.callTool("verify_incident", {
|
|
31
|
+
incidentId: "inc_19a31a28",
|
|
32
|
+
expect: [
|
|
33
|
+
{ type: "no_incident" },
|
|
34
|
+
{ type: "element_visible", selector: "#user-card" }
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 📐 Layout & Visual Note Verification (`verify_note`)
|
|
42
|
+
|
|
43
|
+
When an agent modifies CSS or HTML to resolve visual feedback, it triggers `verify_note`:
|
|
44
|
+
|
|
45
|
+
1. **Target Element Inspection**: Queries element visibility, bounding rect, and computed styles.
|
|
46
|
+
2. **Viewport Overflow Probe**: Checks if `rect.right > viewportWidth` or if container has unintended horizontal scroll.
|
|
47
|
+
3. **Geometry Diff**: Calculates before vs after dimensional delta (`widthDiff`, `heightDiff`, `overflowFixed`).
|
|
48
|
+
4. **After Screenshot**: Captures an updated visual snapshot.
|
|
49
|
+
5. **Verdict & Auto-Resolution**: If all checks pass and overflow is eliminated, returns `VERIFIED`.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
// Example MCP call
|
|
53
|
+
await client.callTool("verify_note", {
|
|
54
|
+
noteId: "note_30a89599",
|
|
55
|
+
observationWindowMs: 1000
|
|
56
|
+
});
|
|
57
|
+
```
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Getting Started
|
|
3
|
+
description: Installation, daemon setup, and browser client integration guide for BrowserTrack
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Getting Started 🚀
|
|
8
|
+
|
|
9
|
+
Follow this guide to get BrowserTrack up and running in under 2 minutes.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Install & Start Daemon
|
|
14
|
+
|
|
15
|
+
Install BrowserTrack globally via npm:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g browsertrack
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Start the background diagnostics server:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
browsertrack start
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This will initialize the local server at `http://127.0.0.1:7331` (WebSocket bridge on `ws://127.0.0.1:7331`) and SQLite database at `~/.browsertrack/browsertrack.db`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 2. Connect Your Web Application
|
|
32
|
+
|
|
33
|
+
Choose the integration method that best suits your tech stack:
|
|
34
|
+
|
|
35
|
+
### Option A: Zero-Install Script Tag (Plain HTML / Vite / Next.js / Astro)
|
|
36
|
+
|
|
37
|
+
Add the script tag to your root HTML or document layout:
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<script src="http://127.0.0.1:7331/client.js"></script>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> **Tip (Next.js / SSR)**: You can conditionally load this script tag only in development environments (`process.env.NODE_ENV !== 'production'`).
|
|
44
|
+
|
|
45
|
+
### Option B: NPM Package (React / Vue / Svelte / Angular)
|
|
46
|
+
|
|
47
|
+
Install the client package:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install -D browsertrack
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Import the client in your main application entry point (e.g. `main.ts` or `src/index.tsx`):
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import 'browsertrack/client';
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or configure custom options programmatically:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { BrowserTrackClient } from 'browsertrack/client';
|
|
63
|
+
|
|
64
|
+
const client = new BrowserTrackClient({
|
|
65
|
+
daemonUrl: 'ws://127.0.0.1:7331',
|
|
66
|
+
captureErrors: true,
|
|
67
|
+
captureConsole: true,
|
|
68
|
+
captureNetwork: true,
|
|
69
|
+
captureInteractions: true,
|
|
70
|
+
notes: {
|
|
71
|
+
enabled: true,
|
|
72
|
+
shortcut: 'Alt+Click',
|
|
73
|
+
},
|
|
74
|
+
}).init();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 3. Configure Your IDE for MCP
|
|
80
|
+
|
|
81
|
+
Add BrowserTrack MCP server to your AI editor configuration:
|
|
82
|
+
|
|
83
|
+
### Antigravity (`~/.gemini/antigravity-ide/mcp_config.json`)
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"browsertrack": {
|
|
88
|
+
"command": "browsertrack",
|
|
89
|
+
"args": ["mcp"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Cursor (`~/.cursor/mcp.json`) & Claude Code
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"browsertrack": {
|
|
100
|
+
"command": "npx",
|
|
101
|
+
"args": ["browsertrack", "mcp"]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 4. Add Project Agent Guidelines
|
|
110
|
+
|
|
111
|
+
Place an `AGENTS.md` file in the root of your project to instruct AI agents on how and when to use BrowserTrack tools:
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
# AGENTS.md
|
|
115
|
+
This project is integrated with BrowserTrack MCP. Always check `list_incidents` and `list_notes` when debugging runtime errors or fixing layout feedback. Use `verify_incident` and `verify_note` after making code changes.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 5. Verify the Connection
|
|
121
|
+
|
|
122
|
+
Open your web application in any browser. You will see the floating BrowserTrack dock in the bottom-right corner with **Element**, **Region**, **Page**, and **Notes** controls!
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Incidents & Diagnostics
|
|
3
|
+
description: Automatic error grouping, runtime crash diagnostics, network tracking, and interaction breadcrumbs
|
|
4
|
+
order: 4
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Incidents & Diagnostics ⚠️
|
|
8
|
+
|
|
9
|
+
BrowserTrack continuously captures runtime errors, unhandled promise rejections, console warnings/errors, failed network calls, and user interaction breadcrumbs.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ⚡ Automatic Error Grouping (Incidents)
|
|
14
|
+
|
|
15
|
+
Instead of overwhelming AI agents with duplicate errors, BrowserTrack uses intelligent fingerprinting:
|
|
16
|
+
- Grouped by `errorType`, normalized message, and source file line/column.
|
|
17
|
+
- Tracks `occurrences`, `firstSeen`, and `lastSeen` timestamps.
|
|
18
|
+
- Captures stack traces, route, and surrounding DOM state.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🍞 User Interaction Breadcrumbs
|
|
23
|
+
|
|
24
|
+
BrowserTrack maintains a bounded chronological timeline of events leading up to an error:
|
|
25
|
+
- **User Clicks**: Target selector, tag, text, and timestamp.
|
|
26
|
+
- **Form Focus/Blur**: Inputs engaged prior to crash (values are never recorded).
|
|
27
|
+
- **SPA & Browser Navigation**: `history.pushState` and URL route changes.
|
|
28
|
+
- **Console Logs**: `console.log`, `console.warn`, `console.error`.
|
|
29
|
+
- **Network Requests**: Method, URL, status code, and duration.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🌐 Network Failure Tracking
|
|
34
|
+
|
|
35
|
+
Failed HTTP requests (`4xx`, `5xx`, timeouts, and aborts) are captured with:
|
|
36
|
+
- Request method and sanitized URL (sensitive query parameters redacted by `@visulima/redact`).
|
|
37
|
+
- HTTP status code and response duration in ms.
|
|
38
|
+
- Error status and aborted flags.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 🤖 Diagnostics Workflow for Coding Agents
|
|
43
|
+
|
|
44
|
+
```mermaid
|
|
45
|
+
sequenceDiagram
|
|
46
|
+
participant Agent as AI Coding Agent
|
|
47
|
+
participant MCP as BrowserTrack MCP
|
|
48
|
+
participant Daemon as Local Daemon
|
|
49
|
+
participant Browser as Browser Client
|
|
50
|
+
|
|
51
|
+
Agent->>MCP: list_incidents({ status: "OPEN" })
|
|
52
|
+
MCP->>Daemon: Query incidents from SQLite
|
|
53
|
+
Daemon-->>Agent: Returns grouped incidents
|
|
54
|
+
Agent->>MCP: get_incident({ incidentId: "inc_xxx" })
|
|
55
|
+
MCP-->>Agent: Stack trace, source line, breadcrumbs, screenshot
|
|
56
|
+
Agent->>Agent: Modifies code to fix bug
|
|
57
|
+
Agent->>MCP: verify_incident({ incidentId: "inc_xxx" })
|
|
58
|
+
MCP->>Browser: Dispatches reload & executes probes
|
|
59
|
+
Browser-->>Daemon: Reports runtime status & captures screenshot
|
|
60
|
+
Daemon-->>Agent: Verdict (VERIFIED / FAILED)
|
|
61
|
+
```
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Introduction
|
|
3
|
+
description: Overview of BrowserTrack - local browser diagnostics bridge for AI coding agents via MCP
|
|
4
|
+
order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# BrowserTrack 🔍
|
|
8
|
+
|
|
9
|
+
> **Local browser diagnostics shared with AI coding agents through Model Context Protocol (MCP).**
|
|
10
|
+
|
|
11
|
+
BrowserTrack is a lightweight, framework-agnostic local development daemon and MCP bridge. It continuously captures browser runtime errors, unhandled promise rejections, console logs, network failures (4xx/5xx), user interaction breadcrumbs, live DOM snapshots, and visual design annotations—making them instantly accessible to AI coding assistants (Antigravity, Cursor, Claude Code, Windsurf) for autonomous debugging and closed-loop verification.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ⚡ Why BrowserTrack?
|
|
16
|
+
|
|
17
|
+
Traditional browser debugging with AI coding agents relies on manual copy-pasting of truncated error messages or sending cropped screenshots. BrowserTrack removes the human in the middle:
|
|
18
|
+
|
|
19
|
+
- 🚀 **Real-time Diagnostics Pipeline**: Your browser communicates with the local daemon via WebSockets.
|
|
20
|
+
- 🎯 **Visual Annotations & Notes**: Hold <kbd>Alt</kbd> and click any element (or drag a region) to leave notes with DOM context and screenshots directly for coding agents.
|
|
21
|
+
- 📌 **Persistent On-Screen Markers**: Visual note pins appear directly on your web pages and can be inspected or resolved with a single click.
|
|
22
|
+
- 🤖 **Closed-Loop Verification**: After an agent edits your code, it automatically reloads the browser, executes verification probes, checks for regressions, and captures before/after screenshots.
|
|
23
|
+
- 🛡️ **Zero-Leak Security**: Integrated with `@visulima/redact` to automatically sanitize passwords, auth tokens, cookies, credit cards, and secret query parameters.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 🏗️ Architecture Overview
|
|
28
|
+
|
|
29
|
+
```mermaid
|
|
30
|
+
graph TD
|
|
31
|
+
A[Browser Client<br>Vanilla / React / Vue / Vite] <-->|WebSocket ws://127.0.0.1:7331| B[Local Daemon<br>SQLite Storage + Verification Engine]
|
|
32
|
+
B <-->|Model Context Protocol / stdio| C[AI Coding Agents<br>Antigravity / Cursor / Claude Code]
|
|
33
|
+
B -->|Static Docs & Web UI| D[Local Dashboard / Dev Server]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 🚀 Quick Navigation
|
|
39
|
+
|
|
40
|
+
- [Getting Started](./getting-started.md) — Quick installation and setup in under 2 minutes.
|
|
41
|
+
- [Visual Notes & Annotations](./visual-notes.md) — Screen notes, region selection, and persistent markers.
|
|
42
|
+
- [Incidents & Error Diagnostics](./incidents-diagnostics.md) — Ingest runtime errors, stack traces, and breadcrumbs.
|
|
43
|
+
- [Closed-Loop Verification](./closed-loop-verification.md) — Automated bug-fix and layout verification.
|
|
44
|
+
- [MCP Tool Reference](./mcp-reference.md) — Complete guide to all 16 MCP tools.
|
|
45
|
+
- [Security & Redaction](./security-privacy.md) — Privacy architecture and `@visulima/redact` integration.
|
|
46
|
+
- [CLI Reference](./cli.md) — Command-line interface usage.
|