@harness-fe/mcp-server 4.0.0-next.2 → 4.0.0-next.3

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 (100) hide show
  1. package/dist/bin.d.ts +2 -0
  2. package/dist/bin.js +15 -0
  3. package/dist/daemon.d.ts +3 -3
  4. package/dist/daemon.js +1 -1
  5. package/dist/index.d.ts +4 -4
  6. package/dist/index.js +3 -3
  7. package/dist/mcp.d.ts +2 -2
  8. package/dist/mcp.js +42 -16
  9. package/dist/mcpHttp.d.ts +2 -2
  10. package/dist/mcpHttp.js +8 -2
  11. package/package.json +5 -7
  12. package/src/bin.ts +19 -0
  13. package/src/daemon.ts +3 -3
  14. package/src/experimental.test.ts +2 -2
  15. package/src/index.ts +4 -4
  16. package/src/mcp.ts +44 -20
  17. package/src/mcpHttp.test.ts +3 -3
  18. package/src/mcpHttp.ts +10 -4
  19. package/src/mcpLayer.e2e.test.ts +2 -2
  20. package/src/newCapabilities.e2e.test.ts +3 -3
  21. package/dist/auth.d.ts +0 -53
  22. package/dist/auth.js +0 -212
  23. package/dist/bridge.d.ts +0 -323
  24. package/dist/bridge.js +0 -1618
  25. package/dist/cli.d.ts +0 -18
  26. package/dist/cli.js +0 -293
  27. package/dist/dashboardApi.d.ts +0 -40
  28. package/dist/dashboardApi.js +0 -142
  29. package/dist/dashboardSpa.d.ts +0 -18
  30. package/dist/dashboardSpa.js +0 -180
  31. package/dist/dashboardUrl.d.ts +0 -13
  32. package/dist/dashboardUrl.js +0 -18
  33. package/dist/eventsHandler.d.ts +0 -24
  34. package/dist/eventsHandler.js +0 -114
  35. package/dist/identity.d.ts +0 -90
  36. package/dist/identity.js +0 -123
  37. package/dist/openBrowser.d.ts +0 -33
  38. package/dist/openBrowser.js +0 -63
  39. package/dist/remoteBridge.d.ts +0 -61
  40. package/dist/remoteBridge.js +0 -307
  41. package/dist/replayCreate.d.ts +0 -36
  42. package/dist/replayCreate.js +0 -156
  43. package/dist/replayViewer.d.ts +0 -20
  44. package/dist/replayViewer.js +0 -168
  45. package/dist/sessionRouter.d.ts +0 -45
  46. package/dist/sessionRouter.js +0 -88
  47. package/dist/store/JsonMemoryStore.d.ts +0 -52
  48. package/dist/store/JsonMemoryStore.js +0 -119
  49. package/dist/store/JsonTaskStore.d.ts +0 -21
  50. package/dist/store/JsonTaskStore.js +0 -53
  51. package/dist/store/JsonlStore.d.ts +0 -128
  52. package/dist/store/JsonlStore.js +0 -1172
  53. package/dist/store/MemoryEventStore.d.ts +0 -47
  54. package/dist/store/MemoryEventStore.js +0 -111
  55. package/dist/store/WriteQueue.d.ts +0 -51
  56. package/dist/store/WriteQueue.js +0 -142
  57. package/dist/store/index.d.ts +0 -6
  58. package/dist/store/index.js +0 -5
  59. package/dist/store/types.d.ts +0 -427
  60. package/dist/store/types.js +0 -19
  61. package/dist/visitorTimeline.d.ts +0 -24
  62. package/dist/visitorTimeline.js +0 -68
  63. package/src/auth.test.ts +0 -90
  64. package/src/auth.ts +0 -248
  65. package/src/bridge-auth.test.ts +0 -196
  66. package/src/bridge.test.ts +0 -1708
  67. package/src/bridge.ts +0 -1854
  68. package/src/cli.ts +0 -338
  69. package/src/dashboardApi.test.ts +0 -235
  70. package/src/dashboardApi.ts +0 -184
  71. package/src/dashboardSpa.test.ts +0 -239
  72. package/src/dashboardSpa.ts +0 -195
  73. package/src/dashboardUrl.test.ts +0 -46
  74. package/src/dashboardUrl.ts +0 -28
  75. package/src/eventsHandler.test.ts +0 -247
  76. package/src/eventsHandler.ts +0 -136
  77. package/src/identity.test.ts +0 -109
  78. package/src/identity.ts +0 -137
  79. package/src/openBrowser.test.ts +0 -103
  80. package/src/openBrowser.ts +0 -81
  81. package/src/remoteBridge.test.ts +0 -119
  82. package/src/remoteBridge.ts +0 -404
  83. package/src/replay.test.ts +0 -271
  84. package/src/replayCreate.ts +0 -194
  85. package/src/replayViewer.ts +0 -173
  86. package/src/sessionRouter.ts +0 -119
  87. package/src/store/JsonMemoryStore.test.ts +0 -175
  88. package/src/store/JsonMemoryStore.ts +0 -128
  89. package/src/store/JsonTaskStore.test.ts +0 -212
  90. package/src/store/JsonTaskStore.ts +0 -59
  91. package/src/store/JsonlStore.test.ts +0 -1538
  92. package/src/store/JsonlStore.ts +0 -1325
  93. package/src/store/MemoryEventStore.test.ts +0 -119
  94. package/src/store/MemoryEventStore.ts +0 -151
  95. package/src/store/WriteQueue.ts +0 -165
  96. package/src/store/identityTagging.test.ts +0 -67
  97. package/src/store/index.ts +0 -29
  98. package/src/store/types.ts +0 -532
  99. package/src/visitorTimeline.test.ts +0 -197
  100. package/src/visitorTimeline.ts +0 -89
@@ -1,532 +0,0 @@
1
- /**
2
- * Store types — the public interface for the JSONL-based persistence layer.
3
- *
4
- * v0.4.0 layout (new, flat):
5
- * {dataDir}/projects/{projectId}/meta.json
6
- * {dataDir}/projects/{projectId}/tasks.json
7
- * {dataDir}/projects/{projectId}/memory.json
8
- * {dataDir}/projects/{projectId}/notes.jsonl
9
- * {dataDir}/projects/{projectId}/builds/{buildId}/meta.json
10
- * {dataDir}/tabs/{tabId}/meta.json
11
- * {dataDir}/sessions/{sessionId}/meta.json ← one per pageload
12
- * {dataDir}/sessions/{sessionId}/timeline.jsonl ← mixed parent+child events
13
- * {dataDir}/sessions/{sessionId}/recording.jsonl ← rrweb chunks
14
- * {dataDir}/visitors/{visitorId}/meta.json ← per-browser identity (0.5+)
15
- *
16
- * Legacy layout (v0.3.x, read-only fallback — daemon warns on startup):
17
- * {dataDir}/{projectId}/sessions/{buildId}/tabs/{tabId}/...
18
- */
19
-
20
- import type { Task, VisitorEnv } from '@harness-fe/protocol';
21
-
22
- // Re-export the MCP SDK's EventStore types so consumers (and embedders) can
23
- // plug in custom resumable-stream backends without depending on the SDK
24
- // directly. The default implementation is `MemoryEventStore`.
25
- export type {
26
- EventId,
27
- EventStore,
28
- StreamId,
29
- } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
30
-
31
- // ─── Event types ─────────────────────────────────────────────────────────────
32
-
33
- /** Short type codes used in JSONL lines to keep files compact. */
34
- export type EventType =
35
- | 'log' // browser console
36
- | 'err' // browser JS error
37
- | 'req' // network request (start)
38
- | 'res' // network response (end)
39
- | 'cmd' // MCP command sent to runtime/plugin
40
- | 'resp' // MCP command response
41
- | 'hmr' // HMR update from build plugin
42
- | 'task' // user annotation task submitted
43
- | 'task:claim' // annotation task claimed by agent
44
- | 'task:resolve' // annotation task resolved by agent
45
- | 'rrweb' // rrweb recording chunk
46
- | 'node:log' // Node.js stdout from build plugin
47
- | 'node:err' // Node.js stderr from build plugin
48
- | 'note' // project-level note written by agent/user
49
- | 'load' // page-load initial snapshot
50
- | 'storage' // localStorage/sessionStorage/cookie mutation
51
- | 'ws' // WebSocket frame (open / send / recv / close)
52
- | 'navigation' // history.pushState/replaceState/popstate/hashchange + location.* setters
53
- | 'globals' // window.X get/set/delete (build-time-watched keys)
54
- | 'indexeddb' // IDB open / put / add / get / delete / clear / cursor
55
- | 'server-log' // Node.js console log from node-runtime SDK
56
- | 'server-err' // Node.js uncaughtException / unhandledRejection from node-runtime SDK
57
- | 'server-action'// Route Handler / Server Action timing from withHarnessTracing()
58
- | 'app-log' // Explicit log call via @harness-fe/log (user-initiated, distinct from auto-captured console)
59
- | string; // extensible — future types don't need schema changes
60
-
61
- /** A single event line in a JSONL file. Carries row-level projectId/buildId tags. */
62
- export interface StoreEvent {
63
- /**
64
- * Server-assigned monotonic integer per session (assigned at enqueue time).
65
- * Optional on input — the store layer assigns this.
66
- * Always present on events returned by `tail` and `search`.
67
- */
68
- seq?: number;
69
- /** Unix timestamp in milliseconds. */
70
- ts: number;
71
- /** Short event type code. */
72
- t: EventType;
73
- /** Tab ID — present for tab-scoped events. */
74
- tab?: string;
75
- /**
76
- * Load/session ID on tab-scoped events. Kept for backward compat with
77
- * v0.3.x event lines and bridge code that still stamps event.load.
78
- */
79
- load?: string;
80
- /**
81
- * Row-level project ID. Stamped by the bridge before calling appendEvent().
82
- */
83
- projectId?: string;
84
- /**
85
- * Row-level build ID. Stamped by the bridge.
86
- */
87
- buildId?: string;
88
- /**
89
- * Row-level visitor ID. Stamped by the bridge from the registered peer
90
- * or the frame's own `visitorId`. Lets agents filter timeline by
91
- * "everything from this user" without join lookups.
92
- */
93
- visitorId?: string;
94
- /** Event payload — structure depends on `t`. */
95
- d?: unknown;
96
- }
97
-
98
- // ─── Metadata shapes ─────────────────────────────────────────────────────────
99
-
100
- export interface ProjectMeta {
101
- id: string;
102
- createdAt: number;
103
- lastActiveAt: number;
104
- parentProjectId?: string;
105
- displayName?: string;
106
- tags?: string[];
107
- /**
108
- * Caller-identity tag (4.0 · P1): principal id that first created this
109
- * project. Write-once (locked on creation like `createdAt`); informational
110
- * in P1, the basis for `project → agent` routing/isolation in P3.
111
- */
112
- createdBy?: string;
113
- metadata?: Record<string, unknown>;
114
- }
115
-
116
- /**
117
- * Per-build metadata. Lives at projects/{projectId}/builds/{buildId}/meta.json.
118
- */
119
- export interface BuildMeta {
120
- id: string;
121
- projectId: string;
122
- builtAt: number;
123
- gitSha?: string;
124
- gitDirty?: boolean;
125
- sourceDigest?: string;
126
- nodeVersion?: string;
127
- /** 'vite' | 'webpack' | 'esbuild' | 'rspack' | … */
128
- bundler?: string;
129
- bundlerVersion?: string;
130
- /** Timestamp when this build's dev server was closed. */
131
- endedAt?: number;
132
- metadata?: Record<string, unknown>;
133
- }
134
-
135
- /**
136
- * Node in a project tree returned by `getProjectTree`.
137
- */
138
- export interface ProjectTreeNode {
139
- id: string;
140
- displayName?: string;
141
- tags?: string[];
142
- children: ProjectTreeNode[];
143
- }
144
-
145
- /**
146
- * Per-tab metadata. Lives at tabs/{tabId}/meta.json.
147
- * A tab spans multiple sessions and may host multiple projects.
148
- */
149
- export interface TabMeta {
150
- id: string;
151
- userAgent?: string;
152
- connectedAt: number;
153
- disconnectedAt?: number;
154
- metadata?: Record<string, unknown>;
155
- }
156
-
157
- /**
158
- * Per-session (pageload) metadata. Lives at sessions/{sessionId}/meta.json.
159
- * A session = one pageload. Multiple projects/iframes may participate
160
- * (they share sessionId via tryInheritFromParent).
161
- */
162
- export interface SessionMeta {
163
- /** sessionId generated by the runtime (shared across same-origin iframes). */
164
- id: string;
165
- tabId: string;
166
- startedAt: number;
167
- endedAt?: number;
168
- url?: string;
169
- title?: string;
170
- referrer?: string;
171
- userAgent?: string;
172
- /**
173
- * Every (projectId, buildId) pair that participated in this pageload.
174
- * Merge semantics: new participants are appended on each upsertSession call.
175
- */
176
- participants: Array<{ projectId: string; buildId?: string; joinedAt: number }>;
177
- initial?: {
178
- viewport?: { w: number; h: number; dpr: number };
179
- storageKeys?: { local?: number; session?: number; cookie?: number };
180
- storageTruncated?: boolean;
181
- };
182
- /**
183
- * Caller-identity tag (4.0 · P1): principal id of the connection that
184
- * opened this session. Write-once. Informational in P1.
185
- */
186
- createdBy?: string;
187
- metadata?: Record<string, unknown>;
188
- }
189
-
190
- /**
191
- * Per-visitor identity. Lives at visitors/{visitorId}/meta.json. Stitches a
192
- * user's activity across pageloads / refreshes / tabs.
193
- */
194
- export interface VisitorMeta {
195
- /** visitorId — anonymous UUID persisted in browser localStorage. */
196
- id: string;
197
- /** App-supplied identifier (latest non-empty value wins). */
198
- userId?: string;
199
- firstSeenAt: number;
200
- lastSeenAt: number;
201
- /** Distinct sessions (pageloads) attributed to this visitor. */
202
- sessionCount: number;
203
- /** LRU-capped list of distinct tabIds seen (max 50). */
204
- tabIds: string[];
205
- /** Distinct projects this visitor has touched (max 50). */
206
- projectIds: string[];
207
- /** Last-seen environment snapshot. */
208
- lastEnv?: VisitorEnv;
209
- }
210
-
211
- // ─── Query options ────────────────────────────────────────────────────────────
212
-
213
- export interface TailOptions {
214
- /** Number of lines to return from the end. Default 50. */
215
- n?: number;
216
- /** Filter by event type(s). */
217
- type?: EventType | EventType[];
218
- /** Only return events after this timestamp. */
219
- since?: number;
220
- /** Only return events before this timestamp. */
221
- until?: number;
222
- /** Filter by projectId (useful for multi-project session timelines). */
223
- projectId?: string;
224
- }
225
-
226
- export interface SearchOptions {
227
- /** Filter by event type(s). */
228
- type?: EventType | EventType[];
229
- /** Max results. Default 50. */
230
- limit?: number;
231
- }
232
-
233
- export interface RecordingChunkSummary {
234
- chunkId: string;
235
- tabId: string;
236
- startTs: number;
237
- endTs: number;
238
- eventCount: number;
239
- }
240
-
241
- export interface RecordingChunk extends RecordingChunkSummary {
242
- events: unknown[];
243
- }
244
-
245
- /**
246
- * Metadata for a saved replay export.
247
- */
248
- export interface ReplayExportMeta {
249
- exportId: string;
250
- projectId: string;
251
- sessionId: string;
252
- tabId?: string;
253
- label?: string;
254
- since: number;
255
- until: number;
256
- startTs: number;
257
- endTs: number;
258
- chunkCount: number;
259
- eventCount: number;
260
- bytes: number;
261
- createdAt: number;
262
- }
263
-
264
- // ─── Summary ─────────────────────────────────────────────────────────────────
265
-
266
- export interface SessionSummary {
267
- session: SessionMeta;
268
- counts: Partial<Record<EventType, number>>;
269
- lastError?: StoreEvent;
270
- lastActivity?: number;
271
- tabs: string[];
272
- }
273
-
274
- // ─── Retention ───────────────────────────────────────────────────────────────
275
-
276
- export interface RetentionPolicy {
277
- /** Delete sessions older than this many days. Default 7. */
278
- maxAgeDays?: number;
279
- /** Keep at most this many sessions globally. Default 200. */
280
- maxSessions?: number;
281
- /** Delete recording.jsonl files older than this many days. Default 3. */
282
- recordingRetentionDays?: number;
283
- /** Keep at most this many recording chunks per session. */
284
- maxRecordingChunksPerSession?: number;
285
- /** Keep at most this many bytes of recording data per session. */
286
- maxRecordingBytesPerSession?: number;
287
- /** Prefer keeping chunks that overlap rrweb markers when trimming. */
288
- preserveMarkedChunks?: boolean;
289
- /** Keep at most this many replay exports per project. Default 50. */
290
- maxExportsPerProject?: number;
291
- /** Keep at most this many bytes of replay exports per project. Default 200MB. */
292
- maxExportBytesPerProject?: number;
293
- /** Keep at most this many BuildMeta records per project. Default 100. */
294
- maxBuildsPerProject?: number;
295
-
296
- // ─── Legacy aliases (v0.3.x backward compat for existing callers) ─────
297
- /** @deprecated Use maxSessions. */
298
- maxSessionsPerProject?: number;
299
- /** @deprecated Use maxRecordingChunksPerSession. */
300
- maxRecordingChunksPerTab?: number;
301
- /** @deprecated Use maxRecordingBytesPerSession. */
302
- maxRecordingBytesPerTab?: number;
303
- }
304
-
305
- export interface PurgeResult {
306
- sessionsDeleted: number;
307
- recordingsDeleted: number;
308
- exportsDeleted: number;
309
- buildsDeleted?: number;
310
- bytesFreed: number;
311
- }
312
-
313
- // ─── Task store interface ─────────────────────────────────────────────────────
314
-
315
- export interface ITaskStore {
316
- loadTasks(projectId: string): Task[];
317
- saveTasks(projectId: string, tasks: Task[]): void;
318
- }
319
-
320
- // ─── Memory store interface ───────────────────────────────────────────────────
321
-
322
- export interface MemoryEntry {
323
- key: string;
324
- value: string;
325
- updatedAt: number;
326
- }
327
-
328
- export interface IMemoryStore {
329
- get(projectId: string, key: string): MemoryEntry | undefined;
330
- set(projectId: string, key: string, value: string): MemoryEntry;
331
- delete(projectId: string, key: string): boolean;
332
- list(projectId: string): MemoryEntry[];
333
- }
334
-
335
- // ─── Store interface ──────────────────────────────────────────────────────────
336
-
337
- export interface IStore {
338
- // ── Build lifecycle ────────────────────────────────────────────────────
339
-
340
- /**
341
- * Open a new build (dev server start / prod build). Returns buildId.
342
- * Writes projects/{projectId}/builds/{buildId}/meta.json.
343
- * (Replaces openSession() from v0.3.x)
344
- */
345
- openBuild(projectId: string, patch?: Partial<Omit<BuildMeta, 'id' | 'projectId' | 'builtAt'>>): string;
346
-
347
- /**
348
- * Mark a build as ended.
349
- * (Replaces closeSession() for build-plugin connections from v0.3.x)
350
- */
351
- closeBuild(buildId: string, closedAt?: number): void;
352
-
353
- // ── Tab lifecycle ──────────────────────────────────────────────────────
354
-
355
- /**
356
- * Write or update tab metadata at tabs/{tabId}/meta.json.
357
- * Merge semantics: caller-provided fields overwrite, others preserved.
358
- */
359
- upsertTab(tabId: string, patch: Partial<Omit<TabMeta, 'id'>>): TabMeta;
360
-
361
- /** Get tab metadata. */
362
- getTab(tabId: string): TabMeta | undefined;
363
-
364
- /**
365
- * Mark a tab as disconnected.
366
- * New signature: (tabId, disconnectedAt?) — no sessionId param.
367
- */
368
- closeTab(tabId: string, disconnectedAt?: number): void;
369
-
370
- // ── Session lifecycle (pageload) ───────────────────────────────────────
371
-
372
- /**
373
- * Open or update a session (one pageload). Writes sessions/{sessionId}/meta.json.
374
- * participants list is extended (not replaced) on each call.
375
- * (Replaces openLoad() from v0.3.x)
376
- */
377
- upsertSession(
378
- sessionId: string,
379
- meta: Partial<Omit<SessionMeta, 'id'>> & { tabId: string; startedAt: number },
380
- ): SessionMeta;
381
-
382
- /**
383
- * Mark a session as ended.
384
- * (Replaces closeLatestLoad() from v0.3.x)
385
- */
386
- closeSession(sessionId: string, endedAt?: number): void;
387
-
388
- /** Get session metadata. */
389
- getSession(sessionId: string): SessionMeta | undefined;
390
-
391
- /**
392
- * List sessions by recency.
393
- * New signature: opts object with optional tabId / projectId / buildId / limit.
394
- * (Replaces listSessions(projectId, limit?) from v0.3.x)
395
- */
396
- listSessions(opts?: { tabId?: string; projectId?: string; buildId?: string; limit?: number }): SessionMeta[];
397
-
398
- // ── Write ──────────────────────────────────────────────────────────────
399
-
400
- /**
401
- * Append a single event to sessions/{sessionId}/timeline.jsonl.
402
- * event.projectId and event.buildId should be pre-stamped by the bridge.
403
- * (Replaces append(sessionId=buildId, event, tabId?) from v0.3.x)
404
- */
405
- appendEvent(sessionId: string, event: StoreEvent): void;
406
-
407
- /**
408
- * Append a batch of events.
409
- * (Replaces appendBatch() from v0.3.x)
410
- */
411
- appendEventBatch(sessionId: string, events: StoreEvent[]): void;
412
-
413
- /**
414
- * Append an rrweb recording chunk to sessions/{sessionId}/recording.jsonl.
415
- * (Replaces appendRecording(sessionId, tabId, chunk, loadId?) from v0.3.x)
416
- */
417
- appendRecording(sessionId: string, chunk: unknown): void;
418
-
419
- /** Write a project-level note. */
420
- writeNote(projectId: string, key: string, value: string): void;
421
-
422
- // ── Project metadata ───────────────────────────────────────────────────
423
-
424
- /**
425
- * Upsert project metadata. `id` and `createdAt` are never overwritten.
426
- * Throws if `patch.parentProjectId` would create a cycle.
427
- */
428
- upsertProject(projectId: string, patch: Partial<Omit<ProjectMeta, 'id' | 'createdAt'>>): ProjectMeta;
429
-
430
- /** Read a single project's metadata. */
431
- getProject(projectId: string): ProjectMeta | undefined;
432
-
433
- /** List all known projects. */
434
- listProjects(): ProjectMeta[];
435
-
436
- // ── Build metadata ─────────────────────────────────────────────────────
437
-
438
- /** Upsert build metadata. Creates the project dir if missing. */
439
- upsertBuild(projectId: string, buildId: string, patch: Partial<Omit<BuildMeta, 'id' | 'projectId'>>): BuildMeta;
440
-
441
- /** Read a single build's metadata. */
442
- getBuild(projectId: string, buildId: string): BuildMeta | undefined;
443
-
444
- /** List builds for a project, newest first. */
445
- listBuilds(projectId: string, limit?: number): BuildMeta[];
446
-
447
- // ── Project tree ───────────────────────────────────────────────────────
448
-
449
- /** Get a forest (or sub-tree from `rootId`) from parentProjectId links. */
450
- getProjectTree(rootId?: string): ProjectTreeNode[];
451
-
452
- // ── Visitor metadata (0.5+) ─────────────────────────────────────────────
453
-
454
- /**
455
- * Upsert visitor metadata. Merges with existing meta:
456
- * - `firstSeenAt` preserved; `lastSeenAt` advances
457
- * - `sessionCount` increments when caller passes `incrementSession: true`
458
- * - `tabIds` / `projectIds` deduped and LRU-capped at 50
459
- * - `userId` overwritten if patch carries a non-empty value
460
- * - `lastEnv` overwritten if patch carries one
461
- */
462
- upsertVisitor(
463
- visitorId: string,
464
- patch: {
465
- userId?: string;
466
- seenAt?: number;
467
- incrementSession?: boolean;
468
- addTabId?: string;
469
- addProjectId?: string;
470
- lastEnv?: VisitorEnv;
471
- },
472
- ): VisitorMeta;
473
-
474
- /** Read a single visitor's metadata. */
475
- getVisitor(visitorId: string): VisitorMeta | undefined;
476
-
477
- /** List known visitors, newest lastSeenAt first. */
478
- listVisitors(opts?: { projectId?: string; limit?: number }): VisitorMeta[];
479
-
480
- // ── Read ───────────────────────────────────────────────────────────────
481
-
482
- /**
483
- * Read the last N events from a session timeline.
484
- * New signature: no tabId param (tab is implicit per session).
485
- */
486
- tail(sessionId: string, opts?: TailOptions): StoreEvent[];
487
-
488
- /** Search events in a session timeline by substring match. */
489
- search(sessionId: string, query: string, opts?: SearchOptions): StoreEvent[];
490
-
491
- /** List recording chunks for a session. */
492
- listRecordings(sessionId: string): RecordingChunkSummary[];
493
-
494
- /** Return recording chunks overlapping the requested time window. */
495
- sliceRecordings(sessionId: string, since: number, until: number): RecordingChunk[];
496
-
497
- /** Persist a replay export. */
498
- writeExport(input: {
499
- sessionId: string;
500
- tabId?: string;
501
- since: number;
502
- until: number;
503
- label?: string;
504
- events: unknown[];
505
- startTs: number;
506
- endTs: number;
507
- chunkCount: number;
508
- }): ReplayExportMeta;
509
-
510
- /** Read export metadata by id. */
511
- getExport(exportId: string): ReplayExportMeta | undefined;
512
-
513
- /** Read the raw events array for an export. */
514
- readExportEvents(exportId: string): unknown[] | undefined;
515
-
516
- /** List exports for a project, newest first. */
517
- listExports(projectId: string, limit?: number): ReplayExportMeta[];
518
-
519
- /** Get a summary of a session (counts, last error, etc.). */
520
- summary(sessionId: string): SessionSummary;
521
-
522
- /** Read project notes. */
523
- listNotes(projectId: string): Array<{ key: string; value: string; ts: number }>;
524
-
525
- // ── Maintenance ────────────────────────────────────────────────────────
526
-
527
- /** Delete old sessions and recordings according to retention policy. */
528
- purge(policy?: RetentionPolicy): PurgeResult;
529
-
530
- /** Close any open file handles. */
531
- close(): void | Promise<void>;
532
- }