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.
Files changed (55) hide show
  1. package/.github/workflows/docs.yml +54 -0
  2. package/AGENTS.md +133 -0
  3. package/README.md +1 -1
  4. package/dist/{chunk-6A7FFDIB.js → chunk-6VA7GBAO.js} +29 -4
  5. package/dist/chunk-6VA7GBAO.js.map +1 -0
  6. package/dist/{chunk-ANMR5WBH.js → chunk-G2Y3CXCY.js} +2 -2
  7. package/dist/{chunk-BSKNG4V7.js → chunk-ILRYKMME.js} +30 -1
  8. package/dist/chunk-ILRYKMME.js.map +1 -0
  9. package/dist/{chunk-X7C5CHBO.js → chunk-SKCMT2DE.js} +637 -76
  10. package/dist/chunk-SKCMT2DE.js.map +1 -0
  11. package/dist/{chunk-ZLNGOOH2.js → chunk-SPCIROIU.js} +65 -3
  12. package/dist/chunk-SPCIROIU.js.map +1 -0
  13. package/dist/cli/index.js +115 -2
  14. package/dist/cli/index.js.map +1 -1
  15. package/dist/client/index.cjs +637 -75
  16. package/dist/client/index.d.ts +16 -2
  17. package/dist/client/index.js +2 -2
  18. package/dist/client.iife.js +393 -72
  19. package/dist/core/index.d.ts +12 -4
  20. package/dist/core/index.js +9 -3
  21. package/dist/daemon/index.d.ts +1 -1
  22. package/dist/daemon/index.js +3 -3
  23. package/dist/{engine-DKloFjvs.d.ts → engine-CeT9URuN.d.ts} +4 -0
  24. package/dist/index.d.ts +4 -3
  25. package/dist/index.js +13 -7
  26. package/dist/mcp/index.d.ts +2 -2
  27. package/dist/mcp/index.js +2 -2
  28. package/dist/{server-CN-se8td.d.ts → server-Dd8NX2Mk.d.ts} +1 -1
  29. package/docboot.config.js +16 -0
  30. package/docs/cli.md +51 -0
  31. package/docs/closed-loop-verification.md +57 -0
  32. package/docs/getting-started.md +122 -0
  33. package/docs/incidents-diagnostics.md +61 -0
  34. package/docs/index.md +46 -0
  35. package/docs/mcp-reference.md +128 -0
  36. package/docs/security-privacy.md +32 -0
  37. package/docs/visual-notes.md +67 -0
  38. package/package.json +6 -2
  39. package/packages/client/package.json +2 -2
  40. package/packages/client/src/notes/inspector.ts +689 -79
  41. package/packages/client/src/transport/websocket.ts +15 -0
  42. package/packages/core/package.json +3 -0
  43. package/packages/core/src/redaction.ts +40 -5
  44. package/packages/daemon/src/server/ws.ts +72 -1
  45. package/packages/daemon/src/session/manager.ts +21 -0
  46. package/packages/daemon/src/storage/db.ts +10 -1
  47. package/test/client/interceptors.test.ts +61 -0
  48. package/test/core/redaction.test.ts +12 -0
  49. package/dist/chunk-6A7FFDIB.js.map +0 -1
  50. package/dist/chunk-BSKNG4V7.js.map +0 -1
  51. package/dist/chunk-X7C5CHBO.js.map +0 -1
  52. package/dist/chunk-ZLNGOOH2.js.map +0 -1
  53. package/packages/core/dist/index.d.ts +0 -317
  54. package/packages/core/dist/index.js +0 -221
  55. /package/dist/{chunk-ANMR5WBH.js.map → chunk-G2Y3CXCY.js.map} +0 -0
@@ -0,0 +1,128 @@
1
+ ---
2
+ title: MCP Tool Reference
3
+ description: Complete reference for all 16 Model Context Protocol (MCP) tools exposed to AI coding agents
4
+ order: 6
5
+ ---
6
+
7
+ # MCP Tool Reference 🛠️
8
+
9
+ BrowserTrack exposes 16 specialized Model Context Protocol (MCP) tools for AI agents.
10
+
11
+ ---
12
+
13
+ ## 📋 Incidents & Error Diagnostics
14
+
15
+ ### `list_incidents`
16
+ Lists recorded browser runtime errors, unhandled rejections, and console errors grouped into incidents.
17
+ - **Arguments**:
18
+ - `status` (`string`): Filter by `OPEN`, `FIX_ATTEMPTED`, `VERIFYING`, `VERIFIED`, `FAILED`, `INCONCLUSIVE`.
19
+ - `severity` (`string`): Filter by `error`, `warn`, `fatal`.
20
+ - `projectId` (`string`): Filter by project ID or name.
21
+ - `limit` (`number`): Max number of incidents (default: 20).
22
+
23
+ ### `get_incident`
24
+ Retrieves compact, high-signal debugging context for an error incident.
25
+ - **Arguments**:
26
+ - `incidentId` (`string`, *required*): The unique ID of the incident (e.g. `inc_19a31a28`).
27
+ - **Returns**: Stack trace, normalized error message, breadcrumbs timeline, failed network calls, last interacted element, error screenshot.
28
+
29
+ ### `get_console`
30
+ Fetches recent console logs, warnings, and errors from a browser session.
31
+ - **Arguments**:
32
+ - `sessionId` (`string`): Browser session ID (optional, defaults to active session).
33
+ - `limit` (`number`): Number of logs to retrieve (default: 30).
34
+
35
+ ### `get_network_failures`
36
+ Retrieves recent failed HTTP requests (4xx, 5xx, timeouts, aborts).
37
+ - **Arguments**:
38
+ - `sessionId` (`string`): Browser session ID (optional).
39
+ - `limit` (`number`): Maximum number of failed requests (default: 20).
40
+
41
+ ### `get_breadcrumbs`
42
+ Retrieves the chronological user interaction timeline leading up to an error.
43
+ - **Arguments**:
44
+ - `incidentId` (`string`): Associated incident ID.
45
+ - `sessionId` (`string`): Browser session ID.
46
+ - `limit` (`number`): Max breadcrumbs (default: 50).
47
+
48
+ ### `get_page_state`
49
+ Queries live DOM and URL state from the connected browser tab.
50
+ - **Arguments**:
51
+ - `sessionId` (`string`): Target session ID (optional).
52
+
53
+ ### `capture_element`
54
+ Captures an on-demand screenshot of a specific DOM element or the entire visible page.
55
+ - **Arguments**:
56
+ - `selector` (`string`): CSS selector of the target element.
57
+ - `sessionId` (`string`): Browser session ID (optional).
58
+
59
+ ---
60
+
61
+ ## 📝 Visual Notes & Layout Tools
62
+
63
+ ### `list_notes`
64
+ Lists visual annotations left on elements, regions, or pages during development.
65
+ - **Arguments**:
66
+ - `status` (`string`): `OPEN`, `IN_PROGRESS`, `VERIFYING`, `RESOLVED`, `FAILED`, `INCONCLUSIVE` (default: `OPEN`).
67
+ - `projectId` (`string`): Filter by project ID or name.
68
+ - `limit` (`number`): Max notes (default: 20).
69
+
70
+ ### `get_note`
71
+ Retrieves full debugging context for a visual note.
72
+ - **Arguments**:
73
+ - `noteId` (`string`, *required*): The unique ID of the visual note (e.g. `note_30a89599`).
74
+ - **Returns**: Note message, route, viewport dimensions, target element selector, DOM context, screenshot file path.
75
+
76
+ ### `capture_note_context`
77
+ Inspects live DOM context, bounding box, overflow, and computed styles for a target element.
78
+ - **Arguments**:
79
+ - `selector` (`string`, *required*): CSS selector of target element.
80
+ - `sessionId` (`string`): Browser session ID (optional).
81
+
82
+ ### `verify_note`
83
+ Runs closed-loop layout verification (visibility, viewport overflow, geometry delta, after-screenshot).
84
+ - **Arguments**:
85
+ - `noteId` (`string`, *required*): The ID of the visual note to verify.
86
+ - `observationWindowMs` (`number`): Observation window in ms (default: 1000).
87
+
88
+ ### `get_note_verification`
89
+ Retrieves latest layout verification verdict, screenshots, and geometry diff.
90
+ - **Arguments**:
91
+ - `noteId` (`string`, *required*): The ID of the visual note.
92
+
93
+ ### `resolve_note`
94
+ Marks a visual note as `RESOLVED`.
95
+ - **Arguments**:
96
+ - `noteId` (`string`, *required*): The ID of the visual note.
97
+
98
+ ### `reopen_note`
99
+ Reopens a previously resolved visual note.
100
+ - **Arguments**:
101
+ - `noteId` (`string`, *required*): The ID of the visual note.
102
+
103
+ ---
104
+
105
+ ## 🎛️ Session & Project Management
106
+
107
+ ### `list_projects`
108
+ Lists all registered development projects and mapped filesystem paths.
109
+
110
+ ### `list_sessions`
111
+ Lists active and recent browser tabs connected to the local development daemon.
112
+ - **Arguments**:
113
+ - `projectId` (`string`): Filter sessions by project ID or name.
114
+ - `activeOnly` (`boolean`): Show only active WebSocket sessions (default: `true`).
115
+
116
+ ### `verify_incident`
117
+ Triggers closed-loop bug fix verification (reloads browser, evaluates probes, captures after-screenshot).
118
+ - **Arguments**:
119
+ - `incidentId` (`string`, *required*): The ID of the incident.
120
+ - `route` (`string`): Optional route to navigate to.
121
+ - `targetSelector` (`string`): Optional element selector to inspect.
122
+ - `expect` (`array`): Optional verification probes (`no_incident`, `element_exists`, `element_visible`, `text_contains`, `route_is`).
123
+ - `observationWindowMs` (`number`): Observation window in ms (default: 2000).
124
+
125
+ ### `get_verification`
126
+ Retrieves latest verification result and before/after screenshots for an incident.
127
+ - **Arguments**:
128
+ - `incidentId` (`string`, *required*): The ID of the incident.
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: Security & Privacy
3
+ description: Security architecture, localhost binding, form value exclusion, and @visulima/redact sensitive data sanitization
4
+ order: 7
5
+ ---
6
+
7
+ # Security & Privacy 🛡️
8
+
9
+ BrowserTrack is built with privacy-by-design principles to ensure sensitive developer tokens, credentials, and user data never leak to AI models or external servers.
10
+
11
+ ---
12
+
13
+ ## 🔒 Core Security Principles
14
+
15
+ ### 1. Strictly Localhost Bound
16
+ - The daemon binds exclusively to `127.0.0.1`.
17
+ - It cannot be reached from the public internet or external local network devices.
18
+
19
+ ### 2. Comprehensive Sensitive Data Masking (@visulima/redact)
20
+ BrowserTrack integrates `@visulima/redact` to automatically scan and sanitize payloads before saving to SQLite or returning to MCP:
21
+ - **Authentication & Headers**: `Authorization` (Bearer tokens, Basic auth), `Cookie`, `Set-Cookie`.
22
+ - **API Keys & Credentials**: AWS Access Keys (`AKIA...`), Slack tokens (`xoxb-...`), JWTs (`eyJ...`), `private_key`, `secret`.
23
+ - **Financial & Personal Data**: Credit card numbers, CVV/CVD, SSN / Social Security Numbers.
24
+ - **Sensitive URL Parameters**: Query strings containing `token`, `key`, `apiKey`, `auth`, `secret`, `password`, `signature` are converted to `[REDACTED]`.
25
+
26
+ ### 3. No Form Input Recording
27
+ - Values inside `<input>` and `<textarea>` fields are never read or stored.
28
+ - Password inputs (`<input type="password">`) in DOM snapshot clones are explicitly sanitized to `value="[REDACTED]"`.
29
+
30
+ ### 4. Zero Request/Response Payloads
31
+ - Network event interceptors capture only URL endpoints, HTTP methods, status codes, and latency.
32
+ - Request and response body payloads are disabled by default.
@@ -0,0 +1,67 @@
1
+ ---
2
+ title: Visual Notes & Annotations
3
+ description: Visual annotations, element hover notes, drag-and-drop region notes, and persistent on-screen pins
4
+ order: 3
5
+ ---
6
+
7
+ # Visual Notes & Screen Annotations 📝
8
+
9
+ BrowserTrack enables developers and designers to leave visual feedback directly on DOM elements, custom screen regions, or full pages without leaving the browser.
10
+
11
+ ---
12
+
13
+ ## 🎯 Annotation Modes
14
+
15
+ ### 1. Element Notes (Alt + Click)
16
+ - **How to use**: Hold <kbd>Alt</kbd> and hover over any element on the page. The element will highlight with its semantic CSS selector and dimensions. Click to open the note editor.
17
+ - Alternatively, click the **🎯 Element** button in the floating toolbar.
18
+ - **Context captured**:
19
+ - Semantic CSS selector (e.g. `[data-testid="stats-banner"]` or `#user-card`)
20
+ - Element dimensions and bounding rectangle (`x`, `y`, `width`, `height`)
21
+ - Sanitized outerHTML and DOM hierarchy
22
+ - Viewport dimensions and scroll offsets
23
+ - Element screenshot snapshot
24
+
25
+ ### 2. Region / Area Notes (Drag & Drop)
26
+ - **How to use**: Click the **📐 Region** button in the floating toolbar.
27
+ - Drag a bounding rectangle over any area on the screen.
28
+ - A top banner will appear with a **✕ Cancel (Esc)** button.
29
+ - Releasing the mouse opens the note modal with the cropped region screenshot and coordinates.
30
+
31
+ ### 3. Full-Page Notes
32
+ - **How to use**: Click the **📄 Page** button in the toolbar.
33
+ - Captures the entire page viewport state, URL route, and document context.
34
+
35
+ ---
36
+
37
+ ## 📌 Persistent On-Screen Markers
38
+
39
+ When your application loads or syncs with the daemon:
40
+ - BrowserTrack automatically fetches all open notes for the project.
41
+ - **Element Pins (`📝 #1`)**: Placed at the top-left of each annotated element. Hovering highlights the element.
42
+ - **Region Outlines (`📐 #2`)**: Renders a clean dashed boundary box around the selected area.
43
+ - **Page Notes (`📄`)**: Pinned at the top right of the viewport.
44
+ - **Responsive Tracking**: Markers dynamically stay anchored to elements as the page scrolls or resizes.
45
+
46
+ ---
47
+
48
+ ## 🔍 Interactive Popover Details Card
49
+
50
+ Clicking on any note marker opens the Note Details Card:
51
+
52
+ - **Full Message**: Displays the complete text/instruction.
53
+ - **Target Metadata**: Viewport dimensions, target selector, and creation timestamp.
54
+ - **Action Buttons**:
55
+ - **`✅ Resolve Note`**: Marks the note as `RESOLVED` in real time.
56
+ - **`🗑️ Delete Note`**: Removes the note permanently from the database.
57
+ - **`✕ Close`**: Closes the popover.
58
+
59
+ ---
60
+
61
+ ## 🛠️ Toolbar Controls
62
+
63
+ The bottom-right floating toolbar gives quick access:
64
+ - **`🎯 Element`**: Toggle element inspection mode.
65
+ - **`📐 Region`**: Activate rectangle drag mode.
66
+ - **`📄 Page`**: Open full-page note modal.
67
+ - **`📌 Notes (N)`**: Toggle visibility of all note markers on screen.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browsertrack",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Local browser diagnostics + MCP bridge for coding agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -37,10 +37,14 @@
37
37
  "dev": "tsup --watch",
38
38
  "test": "vitest run",
39
39
  "test:watch": "vitest",
40
- "clean": "rm -rf dist"
40
+ "clean": "rm -rf dist dist-docs",
41
+ "docs:dev": "docboot dev",
42
+ "docs:build": "docboot build",
43
+ "docs:serve": "docboot serve dist-docs"
41
44
  },
42
45
  "dependencies": {
43
46
  "@modelcontextprotocol/sdk": "^1.6.1",
47
+ "@visulima/redact": "^2.0.5",
44
48
  "@zumer/snapdom": "^2.24.15",
45
49
  "better-sqlite3": "^11.8.1",
46
50
  "commander": "^13.1.0",
@@ -8,9 +8,9 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
+ "types": "./dist/index.d.ts",
11
12
  "import": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
- "types": "./dist/index.d.ts"
13
+ "require": "./dist/index.cjs"
14
14
  }
15
15
  },
16
16
  "scripts": {