@runtimescope/collector 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SecureContextOptions } from 'node:tls';
2
2
 
3
- type EventType = 'network' | 'console' | 'session' | 'state' | 'render' | 'dom_snapshot' | 'performance' | 'database' | 'recon_metadata' | 'recon_design_tokens' | 'recon_fonts' | 'recon_layout_tree' | 'recon_accessibility' | 'recon_computed_styles' | 'recon_element_snapshot' | 'recon_asset_inventory';
3
+ type EventType = 'network' | 'console' | 'session' | 'state' | 'render' | 'dom_snapshot' | 'performance' | 'database' | 'custom' | 'recon_metadata' | 'recon_design_tokens' | 'recon_fonts' | 'recon_layout_tree' | 'recon_accessibility' | 'recon_computed_styles' | 'recon_element_snapshot' | 'recon_asset_inventory';
4
4
  interface BaseEvent {
5
5
  eventId: string;
6
6
  sessionId: string;
@@ -129,6 +129,16 @@ interface DatabaseEvent extends BaseEvent {
129
129
  error?: string;
130
130
  params?: string;
131
131
  }
132
+ interface CustomEvent extends BaseEvent {
133
+ eventType: 'custom';
134
+ name: string;
135
+ properties?: Record<string, unknown>;
136
+ }
137
+ interface CustomEventFilter {
138
+ name?: string;
139
+ sinceSeconds?: number;
140
+ sessionId?: string;
141
+ }
132
142
  type DetectedFramework = 'react' | 'vue' | 'angular' | 'svelte' | 'solid' | 'preact' | 'htmx' | 'unknown';
133
143
  type DetectedMetaFramework = 'nextjs' | 'nuxt' | 'sveltekit' | 'remix' | 'astro' | 'gatsby' | 'unknown';
134
144
  type DetectedUILibrary = 'tailwind' | 'mui' | 'chakra' | 'shadcn' | 'bootstrap' | 'antd' | 'radix' | 'unknown';
@@ -450,7 +460,7 @@ interface ReconFilter {
450
460
  url?: string;
451
461
  }
452
462
  type ReconEventType = 'recon_metadata' | 'recon_design_tokens' | 'recon_fonts' | 'recon_layout_tree' | 'recon_accessibility' | 'recon_computed_styles' | 'recon_element_snapshot' | 'recon_asset_inventory';
453
- type RuntimeEvent = NetworkEvent | ConsoleEvent | SessionEvent | StateEvent | RenderEvent | DomSnapshotEvent | PerformanceEvent | DatabaseEvent | ReconMetadataEvent | ReconDesignTokensEvent | ReconFontsEvent | ReconLayoutTreeEvent | ReconAccessibilityEvent | ReconComputedStylesEvent | ReconElementSnapshotEvent | ReconAssetInventoryEvent;
463
+ type RuntimeEvent = NetworkEvent | ConsoleEvent | SessionEvent | StateEvent | RenderEvent | DomSnapshotEvent | PerformanceEvent | DatabaseEvent | CustomEvent | ReconMetadataEvent | ReconDesignTokensEvent | ReconFontsEvent | ReconLayoutTreeEvent | ReconAccessibilityEvent | ReconComputedStylesEvent | ReconElementSnapshotEvent | ReconAssetInventoryEvent;
454
464
  interface NetworkFilter {
455
465
  sinceSeconds?: number;
456
466
  urlPattern?: string;
@@ -576,9 +586,10 @@ interface SessionDiffResult {
576
586
  };
577
587
  }
578
588
  interface SessionSnapshot {
589
+ id?: number;
579
590
  sessionId: string;
580
591
  project: string;
581
- snapshotPath?: string;
592
+ label?: string;
582
593
  metrics: SessionMetrics;
583
594
  buildMeta?: BuildMeta;
584
595
  createdAt: number;
@@ -855,12 +866,15 @@ declare class SqliteStore {
855
866
  flush(): void;
856
867
  saveSession(info: SessionInfoExtended): void;
857
868
  updateSessionDisconnected(sessionId: string, disconnectedAt: number): void;
858
- saveSessionMetrics(sessionId: string, project: string, metrics: unknown): void;
869
+ saveSessionMetrics(sessionId: string, project: string, metrics: unknown, label?: string): void;
859
870
  getEvents(filter: HistoricalFilter): RuntimeEvent[];
860
871
  getEventCount(filter: HistoricalFilter): number;
861
872
  getSessions(project: string, limit?: number): SessionInfoExtended[];
862
- getSessionMetrics(sessionId: string): unknown | null;
873
+ getSessionMetrics(sessionId: string): SessionMetrics | null;
874
+ getSessionSnapshots(sessionId: string): SessionSnapshot[];
875
+ getSnapshotById(snapshotId: number): SessionSnapshot | null;
863
876
  getEventsByType(project: string, eventType: EventType, sinceMs?: number): RuntimeEvent[];
877
+ private migrateSessionMetrics;
864
878
  deleteOldEvents(beforeTimestamp: number): number;
865
879
  vacuum(): void;
866
880
  close(): void;
@@ -921,6 +935,7 @@ declare class EventStore {
921
935
  getRenderEvents(filter?: RenderFilter): RenderEvent[];
922
936
  getPerformanceMetrics(filter?: PerformanceFilter): PerformanceEvent[];
923
937
  getDatabaseEvents(filter?: DatabaseFilter): DatabaseEvent[];
938
+ getCustomEvents(filter?: CustomEventFilter): CustomEvent[];
924
939
  private getLatestReconEvent;
925
940
  private getReconEvents;
926
941
  getReconMetadata(filter?: ReconFilter): ReconMetadataEvent | null;
@@ -1028,8 +1043,6 @@ declare class ProjectManager {
1028
1043
  get rootDir(): string;
1029
1044
  getProjectDir(projectName: string): string;
1030
1045
  getProjectDbPath(projectName: string): string;
1031
- getSessionsDir(projectName: string): string;
1032
- getSessionSnapshotPath(projectName: string, sessionId: string, timestamp: number): string;
1033
1046
  ensureGlobalDir(): void;
1034
1047
  ensureProjectDir(projectName: string): void;
1035
1048
  getGlobalConfig(): GlobalConfig;
@@ -1111,6 +1124,7 @@ declare class CollectorServer {
1111
1124
  private pendingHandshakes;
1112
1125
  private pendingCommands;
1113
1126
  private sqliteStores;
1127
+ private connectCallbacks;
1114
1128
  private disconnectCallbacks;
1115
1129
  private pruneTimer;
1116
1130
  private tlsConfig;
@@ -1122,6 +1136,7 @@ declare class CollectorServer {
1122
1136
  getSqliteStore(projectName: string): SqliteStore | undefined;
1123
1137
  getSqliteStores(): Map<string, SqliteStore>;
1124
1138
  getRateLimiter(): SessionRateLimiter;
1139
+ onConnect(cb: (sessionId: string, projectName: string) => void): void;
1125
1140
  onDisconnect(cb: (sessionId: string, projectName: string) => void): void;
1126
1141
  start(options?: CollectorServerOptions): Promise<void>;
1127
1142
  private tryStart;
@@ -1135,6 +1150,11 @@ declare class CollectorServer {
1135
1150
  getFirstSessionId(): string | undefined;
1136
1151
  /** Get the project name for a session */
1137
1152
  getProjectForSession(sessionId: string): string | undefined;
1153
+ /** Get all connected session IDs with their project names */
1154
+ getConnectedSessions(): {
1155
+ sessionId: string;
1156
+ projectName: string;
1157
+ }[];
1138
1158
  /** Send a command to the SDK and await the response */
1139
1159
  sendCommand(sessionId: string, command: {
1140
1160
  command: string;
@@ -1308,12 +1328,330 @@ declare class SessionManager {
1308
1328
  private store;
1309
1329
  constructor(projectManager: ProjectManager, sqliteStores: Map<string, SqliteStore>, store: EventStore);
1310
1330
  computeMetrics(sessionId: string, project: string, events: RuntimeEvent[]): SessionMetrics;
1311
- createSnapshot(sessionId: string, project: string): SessionSnapshot;
1331
+ createSnapshot(sessionId: string, project: string, label?: string): SessionSnapshot;
1332
+ getSessionSnapshots(project: string, sessionId: string): SessionSnapshot[];
1333
+ getSnapshotById(project: string, snapshotId: number): SessionSnapshot | null;
1312
1334
  getSessionHistory(project: string, limit?: number): SessionSnapshot[];
1313
1335
  }
1314
1336
 
1315
1337
  declare function compareSessions(metricsA: SessionMetrics, metricsB: SessionMetrics): SessionDiffResult;
1316
1338
 
1339
+ type ProjectPhase = 'preliminary' | 'application_development' | 'post_implementation';
1340
+ type ProjectStatus = 'active' | 'suspended' | 'abandoned';
1341
+ interface PmProject {
1342
+ id: string;
1343
+ name: string;
1344
+ path?: string;
1345
+ claudeProjectKey?: string;
1346
+ runtimescopeProject?: string;
1347
+ phase: ProjectPhase;
1348
+ managementAuthorized: boolean;
1349
+ probableToComplete: boolean;
1350
+ projectStatus: ProjectStatus;
1351
+ category?: string;
1352
+ sdkInstalled?: boolean;
1353
+ createdAt: number;
1354
+ updatedAt: number;
1355
+ metadata?: Record<string, unknown>;
1356
+ }
1357
+ type TaskStatus = 'todo' | 'in_progress' | 'done';
1358
+ type TaskPriority = 'low' | 'medium' | 'high' | 'urgent';
1359
+ type TaskSource = 'manual' | 'claude_session' | 'github_issue';
1360
+ interface PmTask {
1361
+ id: string;
1362
+ projectId?: string;
1363
+ title: string;
1364
+ description?: string;
1365
+ status: TaskStatus;
1366
+ priority: TaskPriority;
1367
+ labels: string[];
1368
+ source: TaskSource;
1369
+ sourceRef?: string;
1370
+ sortOrder: number;
1371
+ assignedTo?: string;
1372
+ dueDate?: string;
1373
+ createdAt: number;
1374
+ updatedAt: number;
1375
+ completedAt?: number;
1376
+ }
1377
+ interface PmSession {
1378
+ id: string;
1379
+ projectId: string;
1380
+ jsonlPath: string;
1381
+ jsonlSize?: number;
1382
+ firstPrompt?: string;
1383
+ summary?: string;
1384
+ slug?: string;
1385
+ model?: string;
1386
+ version?: string;
1387
+ gitBranch?: string;
1388
+ messageCount: number;
1389
+ userMessageCount: number;
1390
+ assistantMessageCount: number;
1391
+ totalInputTokens: number;
1392
+ totalOutputTokens: number;
1393
+ totalCacheCreationTokens: number;
1394
+ totalCacheReadTokens: number;
1395
+ costMicrodollars: number;
1396
+ startedAt: number;
1397
+ endedAt?: number;
1398
+ activeMinutes: number;
1399
+ compactionCount: number;
1400
+ preCompactionTokens?: number;
1401
+ permissionMode?: string;
1402
+ createdAt: number;
1403
+ updatedAt: number;
1404
+ }
1405
+ interface SessionStats {
1406
+ totalSessions: number;
1407
+ totalActiveMinutes: number;
1408
+ totalCostMicrodollars: number;
1409
+ totalInputTokens: number;
1410
+ totalOutputTokens: number;
1411
+ avgSessionMinutes: number;
1412
+ modelBreakdown: {
1413
+ model: string;
1414
+ sessions: number;
1415
+ cost: number;
1416
+ }[];
1417
+ }
1418
+ interface PmNote {
1419
+ id: string;
1420
+ projectId?: string;
1421
+ sessionId?: string;
1422
+ title: string;
1423
+ content: string;
1424
+ pinned: boolean;
1425
+ tags: string[];
1426
+ createdAt: number;
1427
+ updatedAt: number;
1428
+ }
1429
+ type CapexClassification = 'capitalizable' | 'expensed';
1430
+ type WorkType = 'coding' | 'testing' | 'design' | 'planning' | 'maintenance' | 'bug_fix';
1431
+ interface PmCapexEntry {
1432
+ id: string;
1433
+ projectId: string;
1434
+ sessionId: string;
1435
+ classification: CapexClassification;
1436
+ workType?: WorkType;
1437
+ activeMinutes: number;
1438
+ costMicrodollars: number;
1439
+ adjustmentFactor: number;
1440
+ adjustedCostMicrodollars: number;
1441
+ confirmed: boolean;
1442
+ confirmedAt?: number;
1443
+ confirmedBy?: string;
1444
+ notes?: string;
1445
+ period: string;
1446
+ createdAt: number;
1447
+ updatedAt: number;
1448
+ }
1449
+ interface CapexSummary {
1450
+ projectId: string;
1451
+ period?: {
1452
+ start: string;
1453
+ end: string;
1454
+ };
1455
+ totalSessions: number;
1456
+ totalActiveMinutes: number;
1457
+ totalCostMicrodollars: number;
1458
+ capitalizableCostMicrodollars: number;
1459
+ expensedCostMicrodollars: number;
1460
+ confirmedCount: number;
1461
+ unconfirmedCount: number;
1462
+ byMonth: {
1463
+ period: string;
1464
+ capitalizable: number;
1465
+ expensed: number;
1466
+ activeMinutes: number;
1467
+ }[];
1468
+ }
1469
+ type GitFileStatus = 'M' | 'A' | 'D' | 'R' | '?' | 'C' | 'U';
1470
+ interface GitFileChange {
1471
+ path: string;
1472
+ status: GitFileStatus;
1473
+ oldPath?: string;
1474
+ }
1475
+ interface GitStatus {
1476
+ branch: string;
1477
+ staged: GitFileChange[];
1478
+ unstaged: GitFileChange[];
1479
+ untracked: GitFileChange[];
1480
+ isGitRepo: boolean;
1481
+ }
1482
+ interface GitCommit {
1483
+ hash: string;
1484
+ shortHash: string;
1485
+ subject: string;
1486
+ message: string;
1487
+ author: string;
1488
+ relativeDate: string;
1489
+ refs: string;
1490
+ }
1491
+ interface MemoryFile {
1492
+ filename: string;
1493
+ content: string;
1494
+ sizeBytes: number;
1495
+ }
1496
+ interface RulesFiles {
1497
+ global: {
1498
+ path: string;
1499
+ content: string;
1500
+ exists: boolean;
1501
+ };
1502
+ project: {
1503
+ path: string;
1504
+ content: string;
1505
+ exists: boolean;
1506
+ };
1507
+ local: {
1508
+ path: string;
1509
+ content: string;
1510
+ exists: boolean;
1511
+ };
1512
+ }
1513
+
1514
+ interface PmStoreOptions {
1515
+ dbPath: string;
1516
+ walMode?: boolean;
1517
+ }
1518
+ declare class PmStore {
1519
+ private db;
1520
+ constructor(options: PmStoreOptions);
1521
+ private createSchema;
1522
+ private runMigrations;
1523
+ upsertProject(project: PmProject): void;
1524
+ getProject(id: string): PmProject | null;
1525
+ listProjects(): PmProject[];
1526
+ updateProject(id: string, updates: Partial<PmProject>): void;
1527
+ listCategories(): string[];
1528
+ private mapProjectRow;
1529
+ createTask(task: PmTask): PmTask;
1530
+ updateTask(id: string, updates: Partial<PmTask>): void;
1531
+ deleteTask(id: string): void;
1532
+ listTasks(projectId?: string, status?: TaskStatus): PmTask[];
1533
+ reorderTask(id: string, status: TaskStatus, sortOrder: number): void;
1534
+ private mapTaskRow;
1535
+ upsertSession(session: PmSession): void;
1536
+ getSession(id: string): PmSession | null;
1537
+ listSessions(projectId?: string, opts?: {
1538
+ limit?: number;
1539
+ offset?: number;
1540
+ startDate?: string;
1541
+ endDate?: string;
1542
+ hideEmpty?: boolean;
1543
+ }): PmSession[];
1544
+ getSessionStats(projectId?: string, opts?: {
1545
+ startDate?: string;
1546
+ endDate?: string;
1547
+ hideEmpty?: boolean;
1548
+ }): SessionStats;
1549
+ getProjectSummaries(opts?: {
1550
+ startDate?: string;
1551
+ endDate?: string;
1552
+ hideEmpty?: boolean;
1553
+ }): ProjectSummaryRow[];
1554
+ private mapSessionRow;
1555
+ createNote(note: PmNote): PmNote;
1556
+ updateNote(id: string, updates: Partial<PmNote>): void;
1557
+ deleteNote(id: string): void;
1558
+ listNotes(opts?: {
1559
+ projectId?: string;
1560
+ pinned?: boolean;
1561
+ }): PmNote[];
1562
+ private mapNoteRow;
1563
+ upsertCapexEntry(entry: PmCapexEntry): void;
1564
+ listCapexEntries(projectId: string, opts?: {
1565
+ month?: string;
1566
+ confirmed?: boolean;
1567
+ }): PmCapexEntry[];
1568
+ updateCapexEntry(id: string, updates: Partial<PmCapexEntry>): void;
1569
+ confirmCapexEntry(id: string, confirmedBy?: string): void;
1570
+ getCapexSummary(projectId: string, opts?: {
1571
+ startDate?: string;
1572
+ endDate?: string;
1573
+ }): CapexSummary;
1574
+ exportCapexCsv(projectId: string, opts?: {
1575
+ startDate?: string;
1576
+ endDate?: string;
1577
+ }): string;
1578
+ private mapCapexRow;
1579
+ close(): void;
1580
+ }
1581
+ interface ProjectSummaryRow {
1582
+ id: string;
1583
+ name: string;
1584
+ path: string | null;
1585
+ category: string | null;
1586
+ sdk_installed: number;
1587
+ runtimescope_project: string | null;
1588
+ session_count: number;
1589
+ total_cost: number;
1590
+ total_active_minutes: number;
1591
+ last_session_at: number | null;
1592
+ total_messages: number;
1593
+ }
1594
+
1595
+ interface DiscoveryResult {
1596
+ projectsDiscovered: number;
1597
+ projectsUpdated: number;
1598
+ sessionsDiscovered: number;
1599
+ sessionsUpdated: number;
1600
+ errors: string[];
1601
+ }
1602
+ declare class ProjectDiscovery {
1603
+ private pmStore;
1604
+ private projectManager;
1605
+ private readonly claudeBaseDir;
1606
+ constructor(pmStore: PmStore, projectManager: ProjectManager, claudeBaseDir?: string);
1607
+ /**
1608
+ * Run full discovery: Claude Code projects + RuntimeScope projects.
1609
+ * Never throws — all errors are captured in the result.
1610
+ */
1611
+ discoverAll(): Promise<DiscoveryResult>;
1612
+ /**
1613
+ * Discover Claude Code projects from ~/.claude/projects/.
1614
+ */
1615
+ discoverClaudeProjects(): Promise<Partial<DiscoveryResult>>;
1616
+ /**
1617
+ * Discover RuntimeScope projects from ~/.runtimescope/projects/.
1618
+ */
1619
+ discoverRuntimeScopeProjects(): Promise<Partial<DiscoveryResult>>;
1620
+ /**
1621
+ * Index all sessions for a given project.
1622
+ * Returns the number of sessions indexed (new or updated).
1623
+ */
1624
+ indexProjectSessions(projectId: string): Promise<number>;
1625
+ /**
1626
+ * Process a single Claude project directory key.
1627
+ */
1628
+ private processClaudeProject;
1629
+ /**
1630
+ * Try to resolve the filesystem path from the sessions-index.json projectPath field.
1631
+ */
1632
+ private resolvePathFromIndex;
1633
+ /**
1634
+ * Index sessions for a Claude project directly (used during discovery).
1635
+ * Returns counts of discovered and updated sessions.
1636
+ */
1637
+ private indexSessionsForClaudeProject;
1638
+ /**
1639
+ * Build a PmSession from the fast sessions-index.json entry.
1640
+ * Token counts and cost are zeroed since the index doesn't contain them;
1641
+ * they will be populated on a subsequent full parse if needed.
1642
+ */
1643
+ private buildSessionFromIndex;
1644
+ /**
1645
+ * Build a PmSession by fully parsing a .jsonl file.
1646
+ */
1647
+ private buildSessionFromJsonl;
1648
+ /**
1649
+ * Create or update a CapEx entry stub for a session.
1650
+ * Defaults to 'expensed' classification, unconfirmed.
1651
+ */
1652
+ private upsertCapexStub;
1653
+ }
1654
+
1317
1655
  interface HttpServerOptions {
1318
1656
  port?: number;
1319
1657
  host?: string;
@@ -1328,15 +1666,20 @@ declare class HttpServer {
1328
1666
  private processMonitor;
1329
1667
  private authManager;
1330
1668
  private allowedOrigins;
1669
+ private rateLimiter;
1331
1670
  private dashboardClients;
1332
1671
  private eventListener;
1333
1672
  private routes;
1673
+ private pmRouter;
1334
1674
  private sdkBundlePath;
1335
1675
  private activePort;
1336
1676
  private startedAt;
1337
1677
  constructor(store: EventStore, processMonitor?: ProcessMonitor, options?: {
1338
1678
  authManager?: AuthManager;
1339
1679
  allowedOrigins?: string[];
1680
+ rateLimiter?: SessionRateLimiter;
1681
+ pmStore?: PmStore;
1682
+ discovery?: ProjectDiscovery;
1340
1683
  });
1341
1684
  private registerRoutes;
1342
1685
  /**
@@ -1348,9 +1691,36 @@ declare class HttpServer {
1348
1691
  private tryStart;
1349
1692
  stop(): Promise<void>;
1350
1693
  broadcastEvent(event: RuntimeEvent): void;
1694
+ broadcastSessionChange(type: 'session_connected' | 'session_disconnected', sessionId: string, appName: string): void;
1695
+ private broadcastDevServer;
1351
1696
  private handleRequest;
1352
1697
  private setCorsHeaders;
1698
+ private readBody;
1353
1699
  private json;
1354
1700
  }
1355
1701
 
1356
- export { type ApiChangeRecord, type ApiContract, type ApiContractField, ApiDiscoveryEngine, type ApiEndpoint, type ApiEndpointHealth, type ApiKeyEntry, type AuthConfig, type AuthInfo, AuthManager, BUILT_IN_RULES, type BackgroundSpriteSheet, type BaseEvent, type BuildMeta, type BuildStatus, type CSSArchitecture, type CSSCustomProperty, CollectorServer, type CollectorServerOptions, type ColorToken, type CommandResponse, type ComputedStyleEntry, ConnectionManager, type ConsoleEvent, type ConsoleFilter, type ConsoleLevel, DataBrowser, type DatabaseConnectionConfig, type DatabaseEvent, type DatabaseFilter, type DatabaseOperation, type DatabaseSchema, type DatabaseSource, type DeployLog, type DetectedBuildTool, type DetectedFramework, type DetectedHosting, type DetectedIssue, type DetectedMetaFramework, type DetectedUILibrary, type DevProcess, type DevProcessType, type DomSnapshotEvent, type ElementSnapshotNode, type EventBatchPayload, EventStore, type EventType, type FontFaceInfo, type FontUsage, type FormFieldInfo, type GlobalConfig, type GraphQLOperation, type HandshakePayload, type HeadingInfo, type HistoricalFilter, HttpServer, type HttpServerOptions, type IconFontInfo, type ImageAsset, type IndexSuggestion, InfraConnector, type InfraOverview, type InfrastructureConfig, type InlineSVGAsset, type InteractiveElementInfo, type IssueSeverity, type LandmarkInfo, type LayoutNode, type ManagedConnection, type MaskSpriteSheet, type MetricDelta, type NetworkEvent, type NetworkFilter, type NormalizedQueryStats, type PerformanceEvent, type PerformanceFilter, type PerformanceMetricName, type PortUsage, ProcessMonitor, type ProjectConfig, ProjectManager, type RateLimitConfig, type ReadOptions, type ReadResult, type ReconAccessibilityEvent, type ReconAssetInventoryEvent, type ReconComputedStylesEvent, type ReconDesignTokensEvent, type ReconElementSnapshotEvent, type ReconEventType, type ReconFilter, type ReconFontsEvent, type ReconLayoutTreeEvent, type ReconMetadataEvent, type RedactionRule, Redactor, type RedactorConfig, type RenderComponentProfile, type RenderEvent, type RenderFilter, RingBuffer, type RuntimeEvent, type RuntimeLog, type SVGSpriteSymbol, type SchemaColumn, type SchemaForeignKey, type SchemaIndex, SchemaIntrospector, type SchemaTable, type ServerCommand, type ServerMetricName, type ServiceInfo, type SessionDiffResult, type SessionEvent, type SessionInfo, type SessionInfoExtended, SessionManager, type SessionMetrics, SessionRateLimiter, type SessionSnapshot, type SpacingValue, type SpriteFrame, SqliteStore, type SqliteStoreOptions, type StateEvent, type StateFilter, type TechStackDetection, type TimelineFilter, type TlsConfig, type ToolResponse, type TypographyToken, type WSMessage, type WebVitalRating, type WriteOptions, type WriteResult, aggregateQueryStats, compareSessions, detectIssues, detectN1Queries, detectOverfetching, detectSlowQueries, generateApiKey, loadTlsOptions, resolveTlsConfig, suggestIndexes };
1702
+ interface ParseResult {
1703
+ session: Partial<PmSession>;
1704
+ messageTimestamps: number[];
1705
+ }
1706
+ /**
1707
+ * Sum gaps between consecutive timestamps where gap < idle threshold.
1708
+ * Returns total active time in minutes.
1709
+ */
1710
+ declare function calculateActiveMinutes(timestamps: number[], idleThresholdMs?: number): number;
1711
+ /**
1712
+ * Calculate cost in microdollars from token counts and model name.
1713
+ * Formula: (input * pricing.input + output * pricing.output
1714
+ * + cacheCreation * pricing.cacheWrite + cacheRead * pricing.cacheRead) / 1_000_000
1715
+ */
1716
+ declare function calculateCostMicrodollars(model: string, inputTokens: number, outputTokens: number, cacheCreationTokens: number, cacheReadTokens: number): number;
1717
+ /**
1718
+ * Stream-parse a Claude Code session JSONL file and extract metadata.
1719
+ *
1720
+ * Uses Node.js readline + createReadStream for memory-safe line-by-line
1721
+ * parsing of files up to ~192 MB. Each line is independently JSON.parse'd;
1722
+ * malformed lines are silently skipped.
1723
+ */
1724
+ declare function parseSessionJsonl(jsonlPath: string, sessionId: string, projectId: string): Promise<ParseResult>;
1725
+
1726
+ export { type ApiChangeRecord, type ApiContract, type ApiContractField, ApiDiscoveryEngine, type ApiEndpoint, type ApiEndpointHealth, type ApiKeyEntry, type AuthConfig, type AuthInfo, AuthManager, BUILT_IN_RULES, type BackgroundSpriteSheet, type BaseEvent, type BuildMeta, type BuildStatus, type CSSArchitecture, type CSSCustomProperty, type CapexClassification, type CapexSummary, CollectorServer, type CollectorServerOptions, type ColorToken, type CommandResponse, type ComputedStyleEntry, ConnectionManager, type ConsoleEvent, type ConsoleFilter, type ConsoleLevel, type CustomEvent, type CustomEventFilter, DataBrowser, type DatabaseConnectionConfig, type DatabaseEvent, type DatabaseFilter, type DatabaseOperation, type DatabaseSchema, type DatabaseSource, type DeployLog, type DetectedBuildTool, type DetectedFramework, type DetectedHosting, type DetectedIssue, type DetectedMetaFramework, type DetectedUILibrary, type DevProcess, type DevProcessType, type DomSnapshotEvent, type ElementSnapshotNode, type EventBatchPayload, EventStore, type EventType, type FontFaceInfo, type FontUsage, type FormFieldInfo, type GitCommit, type GitFileChange, type GitFileStatus, type GitStatus, type GlobalConfig, type GraphQLOperation, type HandshakePayload, type HeadingInfo, type HistoricalFilter, HttpServer, type HttpServerOptions, type IconFontInfo, type ImageAsset, type IndexSuggestion, InfraConnector, type InfraOverview, type InfrastructureConfig, type InlineSVGAsset, type InteractiveElementInfo, type IssueSeverity, type LandmarkInfo, type LayoutNode, type ManagedConnection, type MaskSpriteSheet, type MemoryFile, type MetricDelta, type NetworkEvent, type NetworkFilter, type NormalizedQueryStats, type PerformanceEvent, type PerformanceFilter, type PerformanceMetricName, type PmCapexEntry, type PmNote, type PmProject, type PmSession, PmStore, type PmTask, type PortUsage, ProcessMonitor, type ProjectConfig, ProjectDiscovery, ProjectManager, type ProjectPhase, type ProjectStatus, type RateLimitConfig, type ReadOptions, type ReadResult, type ReconAccessibilityEvent, type ReconAssetInventoryEvent, type ReconComputedStylesEvent, type ReconDesignTokensEvent, type ReconElementSnapshotEvent, type ReconEventType, type ReconFilter, type ReconFontsEvent, type ReconLayoutTreeEvent, type ReconMetadataEvent, type RedactionRule, Redactor, type RedactorConfig, type RenderComponentProfile, type RenderEvent, type RenderFilter, RingBuffer, type RulesFiles, type RuntimeEvent, type RuntimeLog, type SVGSpriteSymbol, type SchemaColumn, type SchemaForeignKey, type SchemaIndex, SchemaIntrospector, type SchemaTable, type ServerCommand, type ServerMetricName, type ServiceInfo, type SessionDiffResult, type SessionEvent, type SessionInfo, type SessionInfoExtended, SessionManager, type SessionMetrics, SessionRateLimiter, type SessionSnapshot, type SessionStats, type SpacingValue, type SpriteFrame, SqliteStore, type SqliteStoreOptions, type StateEvent, type StateFilter, type TaskPriority, type TaskSource, type TaskStatus, type TechStackDetection, type TimelineFilter, type TlsConfig, type ToolResponse, type TypographyToken, type WSMessage, type WebVitalRating, type WorkType, type WriteOptions, type WriteResult, aggregateQueryStats, calculateActiveMinutes, calculateCostMicrodollars, compareSessions, detectIssues, detectN1Queries, detectOverfetching, detectSlowQueries, generateApiKey, loadTlsOptions, parseSessionJsonl, resolveTlsConfig, suggestIndexes };