browsertrack 0.1.2 → 0.2.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 (52) hide show
  1. package/AGENTS.md +6 -2
  2. package/dist/{chunk-ILRYKMME.js → chunk-3HOXPTM2.js} +97 -3
  3. package/dist/chunk-3HOXPTM2.js.map +1 -0
  4. package/dist/{chunk-G2Y3CXCY.js → chunk-464D4U2U.js} +86 -3
  5. package/dist/chunk-464D4U2U.js.map +1 -0
  6. package/dist/{chunk-SPCIROIU.js → chunk-7OCOQGDN.js} +24 -5
  7. package/dist/chunk-7OCOQGDN.js.map +1 -0
  8. package/dist/{chunk-SKCMT2DE.js → chunk-INXDWPJW.js} +806 -160
  9. package/dist/chunk-INXDWPJW.js.map +1 -0
  10. package/dist/cli/index.js +202 -6
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/client/index.cjs +809 -161
  13. package/dist/client/index.d.ts +62 -11
  14. package/dist/client/index.js +7 -3
  15. package/dist/client.iife.js +206 -27
  16. package/dist/{notes-CBvN91Wf.d.ts → commands-fjuqKzkm.d.ts} +125 -91
  17. package/dist/core/index.d.ts +2 -2
  18. package/dist/daemon/index.d.ts +3 -3
  19. package/dist/daemon/index.js +2 -2
  20. package/dist/{engine-CeT9URuN.d.ts → engine-CmchnMDq.d.ts} +13 -2
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +4 -4
  23. package/dist/mcp/index.d.ts +4 -4
  24. package/dist/mcp/index.js +2 -2
  25. package/dist/{projects-CY8ungMt.d.ts → projects-DB7S312i.d.ts} +1 -1
  26. package/dist/{server-Dd8NX2Mk.d.ts → server-DiVmTrIR.d.ts} +1 -1
  27. package/docs/component-resolver.md +108 -0
  28. package/docs/index.md +3 -1
  29. package/docs/mcp-reference.md +15 -2
  30. package/docs/scenarios-flows.md +86 -0
  31. package/docs/visual-notes.md +36 -0
  32. package/package.json +1 -1
  33. package/packages/client/src/client.ts +18 -1
  34. package/packages/client/src/config.ts +84 -1
  35. package/packages/client/src/index.ts +4 -1
  36. package/packages/client/src/interceptors/interaction.ts +3 -0
  37. package/packages/client/src/notes/inspector.ts +640 -166
  38. package/packages/client/src/source/resolver.ts +272 -0
  39. package/packages/core/src/types/events.ts +3 -0
  40. package/packages/core/src/types/notes.ts +36 -0
  41. package/packages/daemon/src/notes/engine.ts +6 -0
  42. package/packages/daemon/src/server/ws.ts +23 -1
  43. package/packages/daemon/src/storage/db.ts +106 -3
  44. package/packages/mcp/src/handlers.ts +59 -0
  45. package/packages/mcp/src/tools.ts +28 -0
  46. package/test/client/component-resolver.test.ts +141 -0
  47. package/test/client/interceptors.test.ts +120 -0
  48. package/test/daemon/scenario-storage.test.ts +158 -0
  49. package/dist/chunk-G2Y3CXCY.js.map +0 -1
  50. package/dist/chunk-ILRYKMME.js.map +0 -1
  51. package/dist/chunk-SKCMT2DE.js.map +0 -1
  52. package/dist/chunk-SPCIROIU.js.map +0 -1
@@ -1,3 +1,126 @@
1
+ type NoteType = 'element' | 'region' | 'page';
2
+ type NoteStatus = 'OPEN' | 'IN_PROGRESS' | 'VERIFYING' | 'READY_FOR_REVIEW' | 'VERIFIED' | 'RESOLVED' | 'FAILED' | 'INCONCLUSIVE';
3
+ interface ViewportContext {
4
+ width: number;
5
+ height: number;
6
+ devicePixelRatio: number;
7
+ }
8
+ interface ScrollContext {
9
+ scrollX: number;
10
+ scrollY: number;
11
+ }
12
+ interface DOMRectJson {
13
+ x: number;
14
+ y: number;
15
+ width: number;
16
+ height: number;
17
+ top: number;
18
+ left: number;
19
+ bottom: number;
20
+ right: number;
21
+ }
22
+ interface NoteTarget {
23
+ selector: string;
24
+ boundingRect: DOMRectJson;
25
+ visible: boolean;
26
+ confidence?: 'high' | 'medium' | 'low';
27
+ }
28
+ interface ComponentSourceInfo {
29
+ framework?: 'react' | 'vue' | 'svelte' | 'web-component' | 'vanilla';
30
+ componentName?: string;
31
+ sourceFile?: string;
32
+ sourceLine?: number;
33
+ sourceColumn?: number;
34
+ hierarchy?: string[];
35
+ props?: Record<string, any>;
36
+ }
37
+ interface ElementContext {
38
+ selector: string;
39
+ tag: string;
40
+ attributes?: Record<string, string>;
41
+ outerHTML?: string;
42
+ innerText?: string;
43
+ componentSource?: ComponentSourceInfo;
44
+ parent?: {
45
+ selector: string;
46
+ tag: string;
47
+ };
48
+ }
49
+ interface RegionContext {
50
+ x: number;
51
+ y: number;
52
+ width: number;
53
+ height: number;
54
+ }
55
+ interface VisualNote {
56
+ id: string;
57
+ projectId: string;
58
+ sessionId: string;
59
+ type: NoteType;
60
+ message: string;
61
+ route: string;
62
+ url: string;
63
+ viewport: ViewportContext;
64
+ scroll: ScrollContext;
65
+ target?: NoteTarget;
66
+ elementContext?: ElementContext;
67
+ region?: RegionContext;
68
+ status: NoteStatus;
69
+ incidentId?: string;
70
+ scenarioId?: string;
71
+ stepNumber?: number;
72
+ scenarioTitle?: string;
73
+ screenshots?: {
74
+ original?: string;
75
+ after?: string;
76
+ };
77
+ createdAt: string;
78
+ updatedAt: string;
79
+ resolvedAt?: string;
80
+ }
81
+ interface ScenarioOverview {
82
+ id: string;
83
+ projectId: string;
84
+ title: string;
85
+ stepsCount: number;
86
+ status: NoteStatus;
87
+ route: string;
88
+ firstStepAt: string;
89
+ lastStepAt: string;
90
+ }
91
+ interface ScenarioDetail {
92
+ id: string;
93
+ projectId: string;
94
+ title: string;
95
+ stepsCount: number;
96
+ status: NoteStatus;
97
+ steps: VisualNote[];
98
+ createdAt: string;
99
+ updatedAt: string;
100
+ }
101
+ interface NoteVerificationResult {
102
+ noteId: string;
103
+ status: NoteStatus;
104
+ checks: Array<{
105
+ type: string;
106
+ passed: boolean;
107
+ details?: string;
108
+ }>;
109
+ geometryDiff?: {
110
+ before?: DOMRectJson;
111
+ current?: DOMRectJson;
112
+ viewportWidth?: number;
113
+ overflowFixed?: boolean;
114
+ overflowPx?: number;
115
+ };
116
+ screenshots?: {
117
+ before?: string;
118
+ after?: string;
119
+ };
120
+ timestamp: string;
121
+ message?: string;
122
+ }
123
+
1
124
  type EventType = 'runtime_error' | 'unhandled_rejection' | 'console' | 'fetch' | 'xhr' | 'navigation' | 'interaction';
2
125
  type ConsoleLevel = 'error' | 'warn' | 'info' | 'log' | 'debug';
3
126
  interface ElementSummary {
@@ -8,6 +131,7 @@ interface ElementSummary {
8
131
  attributes?: Record<string, string>;
9
132
  outerHTML?: string;
10
133
  innerText?: string;
134
+ componentSource?: ComponentSourceInfo;
11
135
  boundingRect?: {
12
136
  x: number;
13
137
  y: number;
@@ -167,94 +291,4 @@ interface CommandResponse<T = any> {
167
291
  reason?: string;
168
292
  }
169
293
 
170
- type NoteType = 'element' | 'region' | 'page';
171
- type NoteStatus = 'OPEN' | 'IN_PROGRESS' | 'VERIFYING' | 'READY_FOR_REVIEW' | 'VERIFIED' | 'RESOLVED' | 'FAILED' | 'INCONCLUSIVE';
172
- interface ViewportContext {
173
- width: number;
174
- height: number;
175
- devicePixelRatio: number;
176
- }
177
- interface ScrollContext {
178
- scrollX: number;
179
- scrollY: number;
180
- }
181
- interface DOMRectJson {
182
- x: number;
183
- y: number;
184
- width: number;
185
- height: number;
186
- top: number;
187
- left: number;
188
- bottom: number;
189
- right: number;
190
- }
191
- interface NoteTarget {
192
- selector: string;
193
- boundingRect: DOMRectJson;
194
- visible: boolean;
195
- confidence?: 'high' | 'medium' | 'low';
196
- }
197
- interface ElementContext {
198
- selector: string;
199
- tag: string;
200
- attributes?: Record<string, string>;
201
- outerHTML?: string;
202
- innerText?: string;
203
- parent?: {
204
- selector: string;
205
- tag: string;
206
- };
207
- }
208
- interface RegionContext {
209
- x: number;
210
- y: number;
211
- width: number;
212
- height: number;
213
- }
214
- interface VisualNote {
215
- id: string;
216
- projectId: string;
217
- sessionId: string;
218
- type: NoteType;
219
- message: string;
220
- route: string;
221
- url: string;
222
- viewport: ViewportContext;
223
- scroll: ScrollContext;
224
- target?: NoteTarget;
225
- elementContext?: ElementContext;
226
- region?: RegionContext;
227
- status: NoteStatus;
228
- incidentId?: string;
229
- screenshots?: {
230
- original?: string;
231
- after?: string;
232
- };
233
- createdAt: string;
234
- updatedAt: string;
235
- resolvedAt?: string;
236
- }
237
- interface NoteVerificationResult {
238
- noteId: string;
239
- status: NoteStatus;
240
- checks: Array<{
241
- type: string;
242
- passed: boolean;
243
- details?: string;
244
- }>;
245
- geometryDiff?: {
246
- before?: DOMRectJson;
247
- current?: DOMRectJson;
248
- viewportWidth?: number;
249
- overflowFixed?: boolean;
250
- overflowPx?: number;
251
- };
252
- screenshots?: {
253
- before?: string;
254
- after?: string;
255
- };
256
- timestamp: string;
257
- message?: string;
258
- }
259
-
260
- export type { Breadcrumb as B, CaptureElementParams as C, DOMRectJson as D, ElementContext as E, HelloMessage as H, NavigateParams as N, OverflowCheckResult as O, PageStateResult as P, QueryElementParams as Q, RegionContext as R, ScrollContext as S, ViewportContext as V, CaptureElementResult as a, ClientCommand as b, ClientEventMessage as c, CommandResponse as d, CommandType as e, ConsoleEvent as f, ConsoleLevel as g, ElementStyleResult as h, ElementSummary as i, EventType as j, NavigationEvent as k, NetworkEvent as l, NoteStatus as m, NoteTarget as n, NoteType as o, NoteVerificationResult as p, QueryElementResult as q, ReloadParams as r, RuntimeErrorEvent as s, VisualNote as t };
294
+ export type { Breadcrumb as B, CaptureElementParams as C, DOMRectJson as D, ElementContext as E, HelloMessage as H, NavigateParams as N, OverflowCheckResult as O, PageStateResult as P, QueryElementParams as Q, RegionContext as R, ScenarioDetail as S, ViewportContext as V, CaptureElementResult as a, ClientCommand as b, ClientEventMessage as c, CommandResponse as d, CommandType as e, ComponentSourceInfo as f, ConsoleEvent as g, ConsoleLevel as h, ElementStyleResult as i, ElementSummary as j, EventType as k, NavigationEvent as l, NetworkEvent as m, NoteStatus as n, NoteTarget as o, NoteType as p, NoteVerificationResult as q, QueryElementResult as r, ReloadParams as s, RuntimeErrorEvent as t, ScenarioOverview as u, ScrollContext as v, VisualNote as w };
@@ -1,5 +1,5 @@
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
- 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';
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 ComponentSourceInfo, g as ConsoleEvent, h as ConsoleLevel, D as DOMRectJson, E as ElementContext, i as ElementStyleResult, j as ElementSummary, k as EventType, H as HelloMessage, N as NavigateParams, l as NavigationEvent, m as NetworkEvent, n as NoteStatus, o as NoteTarget, p as NoteType, q as NoteVerificationResult, O as OverflowCheckResult, P as PageStateResult, Q as QueryElementParams, r as QueryElementResult, R as RegionContext, s as ReloadParams, t as RuntimeErrorEvent, S as ScenarioDetail, u as ScenarioOverview, v as ScrollContext, V as ViewportContext, w as VisualNote } from '../commands-fjuqKzkm.js';
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-DB7S312i.js';
3
3
  import { Rules } from '@visulima/redact';
4
4
  export { Rules, standardRules, redact as visulimaRedact } from '@visulima/redact';
5
5
 
@@ -1,6 +1,6 @@
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
- import { c as ClientEventMessage } from '../notes-CBvN91Wf.js';
3
- import { I as Incident } from '../projects-CY8ungMt.js';
1
+ import { S as StorageDB, b as ScreenshotStore, a as SessionManager, c as NotesEngine, V as VerificationEngine, N as NoteVerificationEngine } from '../engine-CmchnMDq.js';
2
+ import { c as ClientEventMessage } from '../commands-fjuqKzkm.js';
3
+ import { I as Incident } from '../projects-DB7S312i.js';
4
4
  import http from 'node:http';
5
5
  import { WebSocketServer } from 'ws';
6
6
 
@@ -4,7 +4,7 @@ import {
4
4
  createDaemon,
5
5
  createHttpHandler,
6
6
  setupWebSocketServer
7
- } from "../chunk-SPCIROIU.js";
7
+ } from "../chunk-7OCOQGDN.js";
8
8
  import "../chunk-6VA7GBAO.js";
9
9
  import {
10
10
  NoteVerificationEngine,
@@ -14,7 +14,7 @@ import {
14
14
  StorageDB,
15
15
  VerificationEngine,
16
16
  getDaemonConfig
17
- } from "../chunk-ILRYKMME.js";
17
+ } from "../chunk-3HOXPTM2.js";
18
18
  export {
19
19
  BrowserTrackDaemon,
20
20
  IncidentEngine,
@@ -1,5 +1,5 @@
1
- import { B as Breadcrumb, i as ElementSummary, t as VisualNote, m as NoteStatus, p as NoteVerificationResult, d as CommandResponse, b as ClientCommand } from './notes-CBvN91Wf.js';
2
- import { f as Project, S as Session, I as Incident, d as IncidentStatus, b as IncidentSeverity, a as IncidentOccurrence, h as VerificationResult, g as VerificationRecipe } from './projects-CY8ungMt.js';
1
+ import { B as Breadcrumb, j as ElementSummary, w as VisualNote, n as NoteStatus, u as ScenarioOverview, S as ScenarioDetail, q as NoteVerificationResult, d as CommandResponse, b as ClientCommand } from './commands-fjuqKzkm.js';
2
+ import { f as Project, S as Session, I as Incident, d as IncidentStatus, b as IncidentSeverity, a as IncidentOccurrence, h as VerificationResult, g as VerificationRecipe } from './projects-DB7S312i.js';
3
3
  import { WebSocket } from 'ws';
4
4
 
5
5
  declare class StorageDB {
@@ -71,9 +71,17 @@ declare class StorageDB {
71
71
  projectId?: string;
72
72
  status?: NoteStatus;
73
73
  route?: string;
74
+ scenarioId?: string;
74
75
  limit?: number;
75
76
  }): VisualNote[];
76
77
  deleteNote(id: string): void;
78
+ listScenarios(options?: {
79
+ projectId?: string;
80
+ status?: NoteStatus;
81
+ limit?: number;
82
+ }): ScenarioOverview[];
83
+ getScenario(scenarioId: string): ScenarioDetail | null;
84
+ deleteScenario(scenarioId: string): void;
77
85
  updateNoteStatus(id: string, status: NoteStatus): void;
78
86
  updateNote(id: string, updates: Partial<VisualNote>): void;
79
87
  insertNoteVerification(v: NoteVerificationResult): void;
@@ -133,6 +141,9 @@ declare class NotesEngine {
133
141
  region?: any;
134
142
  screenshot?: string;
135
143
  incidentId?: string;
144
+ scenarioId?: string;
145
+ stepNumber?: number;
146
+ scenarioTitle?: string;
136
147
  }): VisualNote;
137
148
  saveNoteScreenshot(projectId: string, noteId: string, name: string, dataUrl: string): string | null;
138
149
  }
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
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
- 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';
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 ComponentSourceInfo, g as ConsoleEvent, h as ConsoleLevel, D as DOMRectJson, E as ElementContext, i as ElementStyleResult, j as ElementSummary, k as EventType, H as HelloMessage, N as NavigateParams, l as NavigationEvent, m as NetworkEvent, n as NoteStatus, o as NoteTarget, p as NoteType, q as NoteVerificationResult, O as OverflowCheckResult, P as PageStateResult, Q as QueryElementParams, r as QueryElementResult, R as RegionContext, s as ReloadParams, t as RuntimeErrorEvent, S as ScenarioDetail, u as ScenarioOverview, v as ScrollContext, V as ViewportContext, w as VisualNote } from './commands-fjuqKzkm.js';
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-DB7S312i.js';
3
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-Dd8NX2Mk.js';
6
+ export { c as createMcpServer } from './server-DiVmTrIR.js';
7
7
  export { Rules, standardRules, redact as visulimaRedact } from '@visulima/redact';
8
- import './engine-CeT9URuN.js';
8
+ import './engine-CmchnMDq.js';
9
9
  import 'ws';
10
10
  import 'node:http';
11
11
  import '@modelcontextprotocol/sdk/server/index.js';
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  BrowserTrackClient,
3
3
  getClient,
4
4
  init
5
- } from "./chunk-SKCMT2DE.js";
5
+ } from "./chunk-INXDWPJW.js";
6
6
  import {
7
7
  BrowserTrackDaemon,
8
8
  createDaemon
9
- } from "./chunk-SPCIROIU.js";
9
+ } from "./chunk-7OCOQGDN.js";
10
10
  import {
11
11
  BROWSER_SECURITY_RULES,
12
12
  REDACTED_PLACEHOLDER,
@@ -27,8 +27,8 @@ import {
27
27
  } from "./chunk-6VA7GBAO.js";
28
28
  import {
29
29
  createMcpServer
30
- } from "./chunk-G2Y3CXCY.js";
31
- import "./chunk-ILRYKMME.js";
30
+ } from "./chunk-464D4U2U.js";
31
+ import "./chunk-3HOXPTM2.js";
32
32
  export {
33
33
  BROWSER_SECURITY_RULES,
34
34
  BrowserTrackClient,
@@ -1,9 +1,9 @@
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-Dd8NX2Mk.js';
2
+ export { M as McpContext, a as McpServerOptions, c as createMcpServer, h as handleToolCall } from '../server-DiVmTrIR.js';
3
3
  import '@modelcontextprotocol/sdk/server/index.js';
4
- import '../engine-CeT9URuN.js';
5
- import '../notes-CBvN91Wf.js';
6
- import '../projects-CY8ungMt.js';
4
+ import '../engine-CmchnMDq.js';
5
+ import '../commands-fjuqKzkm.js';
6
+ import '../projects-DB7S312i.js';
7
7
  import 'ws';
8
8
 
9
9
  declare const TOOLS: Tool[];
package/dist/mcp/index.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  TOOLS,
3
3
  createMcpServer,
4
4
  handleToolCall
5
- } from "../chunk-G2Y3CXCY.js";
6
- import "../chunk-ILRYKMME.js";
5
+ } from "../chunk-464D4U2U.js";
6
+ import "../chunk-3HOXPTM2.js";
7
7
  export {
8
8
  TOOLS,
9
9
  createMcpServer,
@@ -1,4 +1,4 @@
1
- import { B as Breadcrumb, l as NetworkEvent, i as ElementSummary } from './notes-CBvN91Wf.js';
1
+ import { B as Breadcrumb, m as NetworkEvent, j as ElementSummary } from './commands-fjuqKzkm.js';
2
2
 
3
3
  type IncidentStatus = 'OPEN' | 'FIX_ATTEMPTED' | 'VERIFYING' | 'VERIFIED' | 'FAILED' | 'INCONCLUSIVE';
4
4
  type IncidentSeverity = 'error' | 'warn' | 'fatal';
@@ -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-CeT9URuN.js';
2
+ import { S as StorageDB, a as SessionManager, V as VerificationEngine, N as NoteVerificationEngine } from './engine-CmchnMDq.js';
3
3
 
4
4
  interface McpContext {
5
5
  db: StorageDB;
@@ -0,0 +1,108 @@
1
+ ---
2
+ title: Component & Source Resolver
3
+ description: Map live browser DOM elements to React Fiber, Vue VNode, Svelte metadata, and exact source file locations for AI coding agents
4
+ order: 5
5
+ ---
6
+
7
+ # Component & Source-Map Resolver 🧬
8
+
9
+ A core challenge for AI coding agents during frontend debugging is bridging the gap between what the browser renders (e.g., `<button class="sc-bdVaJa bDwzTH">`) and the actual source code file in the repository (e.g., `src/components/CheckoutButton.tsx:42`).
10
+
11
+ BrowserTrack includes an automated **Component & Source-Map Resolver** that inspects internal framework virtual DOM instances in real time and attaches exact component and source locations to visual notes, user interaction breadcrumbs, and error incidents.
12
+
13
+ ---
14
+
15
+ ## ⚡ Supported Frameworks
16
+
17
+ | Framework | Inspection Technique | Resolved Metadata |
18
+ | :--- | :--- | :--- |
19
+ | **React (v16–19)** | `__reactFiber$`, `_debugSource`, `_debugOwner` | Component Name, Source File, Line, Column, Component Hierarchy, Props |
20
+ | **Vue 3** | `__vueParentComponent`, `__vnode` | Component Name (`__name`), SFC File (`__file`), Hierarchy, Props |
21
+ | **Vue 2** | `__vue__.$options` | Component Tag, SFC File (`__file`) |
22
+ | **Svelte** | `__svelte_meta.loc` | Svelte Component Name, File Path, Line, Column |
23
+ | **Web Components** | Hyphenated custom element tags | Custom Element Tag Name |
24
+ | **Generic / Vanilla** | `data-component`, `data-source-file`, `data-source-line` | Explicit Component & File Annotation |
25
+
26
+ ---
27
+
28
+ ## 🔍 How It Works
29
+
30
+ ```mermaid
31
+ graph LR
32
+ A[Target DOM Element] --> B[BrowserTrack Resolver]
33
+ B -->|React Fiber| C[Extract _debugSource & _debugOwner]
34
+ B -->|Vue VNode| D[Extract __file & type.__name]
35
+ B -->|Svelte Meta| E[Extract loc.file & loc.line]
36
+ C & D & E --> F[ComponentSourceInfo]
37
+ F --> G[Visual Notes, Breadcrumbs & Incidents]
38
+ G --> H[AI Agent opens exact file:line via MCP]
39
+ ```
40
+
41
+ ### Development Mode Source Maps
42
+ Modern bundlers (Vite, Next.js, Create React App, Nuxt, SvelteKit) automatically populate `_debugSource` and `__file` on virtual DOM nodes during local development. BrowserTrack reads this data directly without requiring additional build plugins.
43
+
44
+ ---
45
+
46
+ ## 📦 Resolved Metadata Structure
47
+
48
+ Whenever a visual note is taken, or when user interactions precede a crash:
49
+
50
+ ```typescript
51
+ export interface ComponentSourceInfo {
52
+ framework?: 'react' | 'vue' | 'svelte' | 'web-component' | 'vanilla';
53
+ componentName?: string; // e.g. "CheckoutButton"
54
+ sourceFile?: string; // e.g. "src/components/CheckoutButton.tsx"
55
+ sourceLine?: number; // e.g. 42
56
+ sourceColumn?: number; // e.g. 8
57
+ hierarchy?: string[]; // e.g. ["App", "ShopLayout", "CartDrawer", "CheckoutButton"]
58
+ props?: Record<string, any>;// Sanitized component props
59
+ }
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 🤖 AI Agent MCP Usage
65
+
66
+ When an agent retrieves an incident or visual note:
67
+
68
+ ### In `get_incident`:
69
+ The `lastInteractedElement` provides direct source coordinates:
70
+ ```json
71
+ {
72
+ "lastInteractedElement": {
73
+ "selector": "button#checkout-btn",
74
+ "tag": "button",
75
+ "componentSource": {
76
+ "framework": "react",
77
+ "componentName": "CheckoutButton",
78
+ "sourceFile": "src/components/CheckoutButton.tsx",
79
+ "sourceLine": 42,
80
+ "hierarchy": ["App", "ShopLayout", "CheckoutButton"]
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ ### In `get_note`:
87
+ ```json
88
+ {
89
+ "elementContext": {
90
+ "selector": ".user-profile-card",
91
+ "componentSource": {
92
+ "framework": "vue",
93
+ "componentName": "UserProfileCard",
94
+ "sourceFile": "src/components/UserProfileCard.vue"
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ The AI agent can immediately edit the exact file and line without running codebase searches or guessing CSS selectors!
101
+
102
+ ---
103
+
104
+ ## 🎨 Interactive Visual Badges in Browser
105
+
106
+ When inspecting elements or viewing saved notes on screen:
107
+ - The Note Editor modal displays a purple pill: `🧬 <CheckoutButton> (src/components/CheckoutButton.tsx:42)`.
108
+ - The Note Details Card popover displays the component badge and framework tag (`REACT`, `VUE`, `SVELTE`).
package/docs/index.md CHANGED
@@ -39,8 +39,10 @@ graph TD
39
39
 
40
40
  - [Getting Started](./getting-started.md) — Quick installation and setup in under 2 minutes.
41
41
  - [Visual Notes & Annotations](./visual-notes.md) — Screen notes, region selection, and persistent markers.
42
+ - [Multi-Step Scenarios & Flows](./scenarios-flows.md) — Sequential reproduction flows, Save & Next Step, and stepper walk-throughs.
43
+ - [Component & Source Resolver](./component-resolver.md) — Map live DOM elements to React Fiber, Vue VNode, Svelte, and exact source file locations.
42
44
  - [Incidents & Error Diagnostics](./incidents-diagnostics.md) — Ingest runtime errors, stack traces, and breadcrumbs.
43
45
  - [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.
46
+ - [MCP Tool Reference](./mcp-reference.md) — Complete guide to all MCP tools.
45
47
  - [Security & Redaction](./security-privacy.md) — Privacy architecture and `@visulima/redact` integration.
46
48
  - [CLI Reference](./cli.md) — Command-line interface usage.
@@ -24,7 +24,7 @@ Lists recorded browser runtime errors, unhandled rejections, and console errors
24
24
  Retrieves compact, high-signal debugging context for an error incident.
25
25
  - **Arguments**:
26
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.
27
+ - **Returns**: Stack trace, normalized error message, breadcrumbs timeline, failed network calls, last interacted element (with `componentSource`: component name, source file, line number, hierarchy), and error screenshot.
28
28
 
29
29
  ### `get_console`
30
30
  Fetches recent console logs, warnings, and errors from a browser session.
@@ -65,13 +65,26 @@ Lists visual annotations left on elements, regions, or pages during development.
65
65
  - **Arguments**:
66
66
  - `status` (`string`): `OPEN`, `IN_PROGRESS`, `VERIFYING`, `RESOLVED`, `FAILED`, `INCONCLUSIVE` (default: `OPEN`).
67
67
  - `projectId` (`string`): Filter by project ID or name.
68
+ - `scenarioId` (`string`): Filter notes by scenario / flow ID.
68
69
  - `limit` (`number`): Max notes (default: 20).
69
70
 
71
+ ### `list_scenarios`
72
+ Lists multi-step user reproduction scenarios and sequential interaction flows.
73
+ - **Arguments**:
74
+ - `projectId` (`string`): Filter scenarios by project ID or name.
75
+ - `status` (`string`): Filter by `OPEN` or `RESOLVED`.
76
+ - `limit` (`number`): Max scenarios (default: 20).
77
+
78
+ ### `get_scenario`
79
+ Retrieves full chronological step-by-step reproduction flow with selectors, route, screenshots, and action details.
80
+ - **Arguments**:
81
+ - `scenarioId` (`string`, *required*): The unique ID of the scenario / flow (e.g. `scen_checkout_123`).
82
+
70
83
  ### `get_note`
71
84
  Retrieves full debugging context for a visual note.
72
85
  - **Arguments**:
73
86
  - `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.
87
+ - **Returns**: Note message, route, viewport dimensions, target element selector, DOM context (including `componentSource` with framework, component name, source file path, and line number), screenshot file path, scenario metadata.
75
88
 
76
89
  ### `capture_note_context`
77
90
  Inspects live DOM context, bounding box, overflow, and computed styles for a target element.
@@ -0,0 +1,86 @@
1
+ ---
2
+ title: Multi-Step Scenarios & Flows
3
+ description: Record sequential user flows, multi-step bug reproduction journeys, on-screen step pins, and MCP flow retrieval
4
+ order: 4
5
+ ---
6
+
7
+ # Multi-Step Scenarios & Flows 🎬
8
+
9
+ BrowserTrack allows developers, testers, and designers to record sequential multi-step user reproduction scenarios (e.g., *"First I clicked this, then I entered this promo code, and here is where the price overflow occurred"*).
10
+
11
+ ---
12
+
13
+ ## ⚡ Continuous Recording Workflow (Save & Next Step)
14
+
15
+ Instead of manually reopening tools for each step, BrowserTrack provides a continuous capture loop:
16
+
17
+ ```mermaid
18
+ graph LR
19
+ A[🎬 Start Flow] -->|Click Element 1| B[Step 1 Modal]
20
+ B -->|➡️ Save & Next Step| C[Hover Element 2]
21
+ C -->|Click Element 2| D[Step 2 Modal]
22
+ D -->|➡️ Save & Next Step| E[Drag Region 3]
23
+ E -->|✓ Save & Finish Flow| F[Complete Multi-Step Scenario]
24
+ ```
25
+
26
+ 1. **Start Recording**: Click **`🎬 Flow`** in the floating bottom-right dock (or click **`➡️ Save as Step 1 (Flow)`** from any note).
27
+ 2. **Step Progression**:
28
+ - Hover and click the first target element (or drag a region).
29
+ - Enter your description/action.
30
+ - Click **`➡️ Save & Next Step`** (or press <kbd>⌘+Enter</kbd> / <kbd>Ctrl+Enter</kbd>).
31
+ - The step is saved instantly, the counter increments to Step 2, and the inspector automatically reactivates element inspection mode so you can immediately click the next element without touching the toolbar!
32
+ 3. **Finish Recording**: On the final step, click **`✓ Save & Finish Flow`** or click the active **`🎬 Step N (Finish)`** button in the dock.
33
+
34
+ ---
35
+
36
+ ## 📌 Numbered Step Markers on Screen
37
+
38
+ When notes belong to a scenario:
39
+ - **Glowing Amber/Cyan Step Pins**: Displayed on target elements with **`🎬 Step 1`**, **`🎬 Step 2`**, **`🎬 Step 3`** badges.
40
+ - **Dynamic Anchoring**: Pins remain attached to elements during scrolling, viewport resizing, or SPA route transitions.
41
+
42
+ ---
43
+
44
+ ## 🔍 Interactive Stepper Walk-Through
45
+
46
+ Clicking any step pin opens the Note & Scenario Card:
47
+
48
+ - **Header**: Shows the scenario title and current step (e.g. `🎬 Step 2 of 4: Checkout Promo Flow`).
49
+ - **Sequential Stepper Bar**:
50
+ - Click **`◀ Step 1`** to inspect the previous action.
51
+ - Click **`Step 3 ▶`** to advance to the next action.
52
+ - **Actions**:
53
+ - **`✅ Resolve Note`**: Mark individual steps as resolved.
54
+ - **`🗑️ Delete`**: Delete single step.
55
+ - **`🗑️ Delete Flow`**: Wipe the entire multi-step scenario from the database.
56
+
57
+ ---
58
+
59
+ ## 🤖 AI Coding Agent MCP Integration
60
+
61
+ AI agents can retrieve the full step-by-step reproduction journey using MCP tools:
62
+
63
+ ### 1. `list_scenarios`
64
+ Lists all recorded scenarios for a project with total step counts and statuses.
65
+
66
+ ### 2. `get_scenario`
67
+ Retrieves all ordered steps in chronological sequence with selectors, bounding boxes, routes, and screenshots.
68
+
69
+ ```typescript
70
+ // Example agent query
71
+ const scenario = await client.callTool("get_scenario", {
72
+ scenarioId: "scen_checkout_123"
73
+ });
74
+
75
+ // Returns:
76
+ // {
77
+ // id: "scen_checkout_123",
78
+ // title: "Checkout Promo Flow",
79
+ // stepsCount: 3,
80
+ // steps: [
81
+ // { stepNumber: 1, type: "element", message: "Click Cart button", targetSelector: "#btn-cart", route: "/shop" },
82
+ // { stepNumber: 2, type: "element", message: "Enter coupon PROMO", targetSelector: "#input-coupon", route: "/cart" },
83
+ // { stepNumber: 3, type: "region", message: "Price overflow", route: "/cart", screenshot: "..." }
84
+ // ]
85
+ // }
86
+ ```