@lensmcp/protocol-types 1.25.23 → 1.25.25

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/index.d.ts CHANGED
@@ -22,3 +22,5 @@ export * from './lib/perf-rules.js';
22
22
  export * from './lib/sources.js';
23
23
  export * from './lib/page-visit.js';
24
24
  export * from './lib/replay.js';
25
+ export * from './lib/event-loop.js';
26
+ export * from './lib/workspace-actions.js';
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";export*from"./lib/schema-version.js";export*from"./lib/source-location.js";export*from"./lib/context.js";export*from"./lib/event.js";export*from"./lib/node.js";export*from"./lib/edge.js";export*from"./lib/attributes.js";export*from"./lib/producer-health.js";export*from"./lib/resources.js";export*from"./lib/tokens.js";export*from"./lib/capture-demand.js";export*from"./lib/bounded-clone.js";export*from"./lib/bounded-map.js";export*from"./lib/flood-guard.js";export*from"./lib/dashboard.js";export*from"./lib/log-query.js";export*from"./lib/error-dismissal.js";export*from"./lib/ai-content.js";export*from"./lib/http-exchange.js";export*from"./lib/pod-memory.js";export*from"./lib/perf-rules.js";export*from"./lib/sources.js";export*from"./lib/page-visit.js";export*from"./lib/replay.js";
1
+ "use strict";export*from"./lib/schema-version.js";export*from"./lib/source-location.js";export*from"./lib/context.js";export*from"./lib/event.js";export*from"./lib/node.js";export*from"./lib/edge.js";export*from"./lib/attributes.js";export*from"./lib/producer-health.js";export*from"./lib/resources.js";export*from"./lib/tokens.js";export*from"./lib/capture-demand.js";export*from"./lib/bounded-clone.js";export*from"./lib/bounded-map.js";export*from"./lib/flood-guard.js";export*from"./lib/dashboard.js";export*from"./lib/log-query.js";export*from"./lib/error-dismissal.js";export*from"./lib/ai-content.js";export*from"./lib/http-exchange.js";export*from"./lib/pod-memory.js";export*from"./lib/perf-rules.js";export*from"./lib/sources.js";export*from"./lib/page-visit.js";export*from"./lib/replay.js";export*from"./lib/event-loop.js";export*from"./lib/workspace-actions.js";
@@ -295,6 +295,85 @@ export interface DashWorktree {
295
295
  data?: string[];
296
296
  updatedAt?: string;
297
297
  }
298
+ /** Worktree management always runs on the main checkout's dashboard. */
299
+ export interface DashWorktreeManagement {
300
+ mainRoot: string;
301
+ managementUrl: string;
302
+ canManage: boolean;
303
+ worktrees: Array<{
304
+ key: string;
305
+ name: string;
306
+ root: string;
307
+ state: string;
308
+ branch?: string;
309
+ createdByLens: boolean;
310
+ data: string[];
311
+ }>;
312
+ }
313
+ export interface DashCheckoutChanges {
314
+ root: string;
315
+ head: string;
316
+ branch?: string;
317
+ changes: Array<{
318
+ path: string;
319
+ staged: string;
320
+ unstaged: string;
321
+ from?: string;
322
+ }>;
323
+ }
324
+ export interface DashWorktreeComparison {
325
+ at: number;
326
+ mode: 'working' | 'committed';
327
+ main: DashCheckoutChanges;
328
+ worktree: DashCheckoutChanges;
329
+ ahead: number;
330
+ behind: number;
331
+ files: Array<{
332
+ path: string;
333
+ kind: 'added' | 'deleted' | 'modified';
334
+ binary?: boolean;
335
+ unavailable?: string;
336
+ added?: number;
337
+ removed?: number;
338
+ }>;
339
+ total: number;
340
+ nextOffset?: number;
341
+ partial: boolean;
342
+ notes: string[];
343
+ }
344
+ export interface DashWorktreePatch {
345
+ path: string;
346
+ text?: string;
347
+ unavailable?: string;
348
+ truncated?: boolean;
349
+ }
350
+ export interface DashWorktreeRemoval {
351
+ token: string;
352
+ key: string;
353
+ name: string;
354
+ root: string;
355
+ directoryExists: boolean;
356
+ branch?: string;
357
+ changes: DashCheckoutChanges['changes'];
358
+ ahead: number;
359
+ data: string[];
360
+ canRemove: boolean;
361
+ reason?: string;
362
+ }
363
+ export interface DashWorktreeAction {
364
+ id: string;
365
+ key: string;
366
+ action: 'stop' | 'remove';
367
+ state: 'running' | 'succeeded' | 'failed';
368
+ stage: string;
369
+ startedAt: number;
370
+ finishedAt?: number;
371
+ error?: string;
372
+ directoryExists?: boolean;
373
+ remainingData?: string[];
374
+ remainingDataOmitted?: number;
375
+ branch?: string;
376
+ }
298
377
  export interface DashKpis {
299
378
  at: number;
300
379
  /** The window `last` covers, in seconds. */
@@ -513,6 +592,7 @@ export interface DashSegmentStats {
513
592
  }
514
593
  export interface DashFlowDetail {
515
594
  flowId: string;
595
+ eventLoopIncidents?: import('./event-loop.js').EventLoopIncident[];
516
596
  /** The reducer's own summary (kept as-is for older consumers). */
517
597
  summary: unknown;
518
598
  events: DashFlowNode[];
@@ -909,6 +989,8 @@ export interface DashRouteRun {
909
989
  requestId?: string;
910
990
  status?: number;
911
991
  durationMs?: number;
992
+ /** Duration is a streaming connection lifetime, not request/first-byte latency. */
993
+ streaming?: boolean;
912
994
  /** What its SQL statements took, summed (ms) — the statements its `sql:` touches count. */
913
995
  sqlMs?: number;
914
996
  /** Its SQL by its service's own count, when the service sent one — the whole of it, where `touches` may hold a part. */
@@ -947,6 +1029,7 @@ export interface DashRouteSummary {
947
1029
  at: number;
948
1030
  status?: number;
949
1031
  durationMs?: number;
1032
+ streaming?: boolean;
950
1033
  flowId?: string;
951
1034
  touches?: DashTouches;
952
1035
  };
@@ -1833,6 +1916,17 @@ export interface DashDbIndex {
1833
1916
  name: string;
1834
1917
  /** `CREATE INDEX … ON … USING btree (tenant_id, created_at)`. */
1835
1918
  definition: string;
1919
+ /** PostgreSQL catalog identity, used instead of parsing/lowercasing SQL text for equivalence. */
1920
+ access?: {
1921
+ method: string;
1922
+ attributes: number[];
1923
+ keyCount: number;
1924
+ operatorClasses: number[];
1925
+ collations: number[];
1926
+ options: number[];
1927
+ expressions: string | null;
1928
+ predicate: string | null;
1929
+ };
1836
1930
  unique: boolean;
1837
1931
  primary: boolean;
1838
1932
  /** False when a CREATE INDEX CONCURRENTLY failed and left it behind. */
@@ -1917,7 +2011,7 @@ export interface DashDbLint {
1917
2011
  /** The statements the lint looked at (the services' own: they touch a table), and how many have a name. */
1918
2012
  statements: number;
1919
2013
  named: number;
1920
- /** Errors first, then warnings; the busiest first; at most 60 (`more` says how many were left out). */
2014
+ /** Errors first, then warnings; the busiest first; complete list; large MCP answers are paged through result_query. */
1921
2015
  issues: DashDbLintIssue[];
1922
2016
  more: number;
1923
2017
  /** Each name: the statement it names now, and the versions it replaced (not seen since the current one came). */
@@ -1930,7 +2024,7 @@ export interface DashDbLint {
1930
2024
  }
1931
2025
  export interface DashDbLintIssue {
1932
2026
  severity: 'error' | 'warning';
1933
- rule: 'unnamed-statement' | 'name-reused' | 'review-below';
2027
+ rule: 'unnamed-statement' | 'name-reused' | 'review-below' | 'review-stale' | 'review-unverified';
1934
2028
  statement: string;
1935
2029
  name?: string;
1936
2030
  verb: string;
@@ -1953,6 +2047,7 @@ export interface DashDbLintIssue {
1953
2047
  overall: number;
1954
2048
  title?: string;
1955
2049
  top?: string;
2050
+ freshness?: DashReviewFreshness;
1956
2051
  };
1957
2052
  }
1958
2053
  /**
@@ -1978,6 +2073,7 @@ export interface DashDbStatementLint {
1978
2073
  overall?: number;
1979
2074
  title?: string;
1980
2075
  top?: string;
2076
+ freshness?: DashReviewFreshness;
1981
2077
  };
1982
2078
  /** The routes that ran it, newest first (`routes://lint` has their issues). */
1983
2079
  routes: string[];
@@ -1999,7 +2095,7 @@ export interface DashRoutesLintStatement {
1999
2095
  }
2000
2096
  export interface DashRoutesLintIssue {
2001
2097
  severity: 'error' | 'warning';
2002
- rule: 'unnamed-sql' | 'review-hole' | 'credential-in-url' | 'stack-in-error' | 'review-below' | 'sql-review-below' | 'sql-loop' | 'get-writes';
2098
+ rule: 'unnamed-sql' | 'review-hole' | 'review-stale' | 'review-unverified' | 'credential-in-url' | 'stack-in-error' | 'review-below' | 'sql-review-below' | 'sql-loop' | 'get-writes';
2003
2099
  /** The route's catalog id (`<service> <METHOD> <route>`), and its parts. */
2004
2100
  route: string;
2005
2101
  service: string;
@@ -2019,6 +2115,7 @@ export interface DashRoutesLintIssue {
2019
2115
  overall?: number;
2020
2116
  title?: string;
2021
2117
  top?: string;
2118
+ freshness?: DashReviewFreshness;
2022
2119
  low?: Array<{
2023
2120
  id: string;
2024
2121
  score: number;
@@ -2043,7 +2140,7 @@ export interface DashRoutesLint {
2043
2140
  /** The routes the lint looked at, and how many have a route review. */
2044
2141
  routes: number;
2045
2142
  reviewed: number;
2046
- /** Errors first, then warnings; the busiest first; at most 80 (`more` says how many were left out). */
2143
+ /** Errors first, then warnings; the busiest first; complete list; large MCP answers are paged through result_query. */
2047
2144
  issues: DashRoutesLintIssue[];
2048
2145
  more: number;
2049
2146
  /** Every route with an issue, and how many of each — none left out. */
@@ -2076,7 +2173,7 @@ export interface DashDbStatementStat {
2076
2173
  hitRatio?: number;
2077
2174
  }
2078
2175
  export interface DashDbFinding {
2079
- kind: 'unused-index' | 'duplicate-index' | 'invalid-index' | 'seq-scan' | 'dead-rows' | 'unindexed-foreign-key';
2176
+ kind: 'unused-index' | 'duplicate-index' | 'overlapping-index' | 'invalid-index' | 'seq-scan' | 'dead-rows' | 'unindexed-foreign-key';
2080
2177
  severity: 'high' | 'medium' | 'low';
2081
2178
  table: string;
2082
2179
  index?: string;
@@ -2134,6 +2231,8 @@ export interface DashKvCommandRun {
2134
2231
  key: string;
2135
2232
  /** The command as sent, values sized or masked. */
2136
2233
  command: string;
2234
+ /** Requested expiry semantics captured before redaction; absent on older events. Never contains values. */
2235
+ expiry?: 'set' | 'kept' | 'none' | 'unknown';
2137
2236
  result?: 'hit' | 'miss';
2138
2237
  durationMs?: number;
2139
2238
  service: string;
@@ -2665,7 +2764,13 @@ export interface DashAiRanFirst {
2665
2764
  why?: string;
2666
2765
  }
2667
2766
  /** A finished review as a list shows it: its overall score (under 70 a warning), when, and its run. */
2767
+ export interface DashReviewFreshness {
2768
+ state: 'current' | 'stale' | 'unknown';
2769
+ checkedAt?: number;
2770
+ why: string;
2771
+ }
2668
2772
  export interface DashReviewMark {
2773
+ freshness?: DashReviewFreshness;
2669
2774
  runId: string;
2670
2775
  at: number;
2671
2776
  overall?: number;
@@ -2880,7 +2985,7 @@ export interface DashSuggestions {
2880
2985
  /** One issue of `kv://lint`: a Redis / Valkey key family against what a coding agent fixes. */
2881
2986
  export interface DashKvLintIssue {
2882
2987
  severity: 'error' | 'warning';
2883
- rule: 'secret-in-key' | 'review-hole' | 'counter-unbounded' | 'no-expiry' | 'ttl-dropped' | 'persist' | 'oversized-value' | 'personal-data-in-key' | 'miss-heavy' | 'review-below';
2988
+ rule: 'secret-in-key' | 'review-hole' | 'review-stale' | 'review-unverified' | 'expiry-unverified' | 'counter-unbounded' | 'no-expiry' | 'ttl-dropped' | 'persist' | 'oversized-value' | 'personal-data-in-key' | 'miss-heavy' | 'review-below';
2884
2989
  /** The key family: the pattern with its ids folded (`session:*`). */
2885
2990
  pattern: string;
2886
2991
  /** The commands the services sent against it (`GET`, `INCRBY` …), its runs, who sent them, when last. */
@@ -2898,6 +3003,7 @@ export interface DashKvLintIssue {
2898
3003
  overall?: number;
2899
3004
  title?: string;
2900
3005
  top?: string;
3006
+ freshness?: DashReviewFreshness;
2901
3007
  low?: Array<{
2902
3008
  id: string;
2903
3009
  score: number;
@@ -2920,7 +3026,7 @@ export interface DashKvLint {
2920
3026
  families: number;
2921
3027
  reviewed: number;
2922
3028
  keysRead: boolean;
2923
- /** Errors first, then warnings; the busiest first; at most 80 (`more` says how many were left out). */
3029
+ /** Errors first, then warnings; the busiest first; complete list; large MCP answers are paged through result_query. */
2924
3030
  issues: DashKvLintIssue[];
2925
3031
  more: number;
2926
3032
  /** Every family with an issue, and how many of each. */
@@ -2936,7 +3042,7 @@ export interface DashKvLint {
2936
3042
  /** One issue of `queues://lint`: a BullMQ queue (or a family of per-run queues) against what a coding agent fixes. */
2937
3043
  export interface DashQueuesLintIssue {
2938
3044
  severity: 'error' | 'warning';
2939
- rule: 'eviction' | 'no-worker' | 'failing-no-retry' | 'review-hole' | 'no-backoff' | 'retention-unbounded' | 'schedule-late' | 'stalls' | 'retries-exhausted' | 'paused-backlog' | 'review-below';
3045
+ rule: 'eviction' | 'no-worker' | 'failing-no-retry' | 'review-hole' | 'review-stale' | 'review-unverified' | 'no-backoff' | 'retention-unbounded' | 'schedule-late' | 'stalls' | 'retries-exhausted' | 'paused-backlog' | 'review-below';
2940
3046
  /** `<store>/<db>/<queue>` — the queue the issue was read from (a family's busiest). */
2941
3047
  queue: string;
2942
3048
  name: string;
@@ -2953,6 +3059,7 @@ export interface DashQueuesLintIssue {
2953
3059
  overall?: number;
2954
3060
  title?: string;
2955
3061
  top?: string;
3062
+ freshness?: DashReviewFreshness;
2956
3063
  low?: Array<{
2957
3064
  id: string;
2958
3065
  score: number;
@@ -0,0 +1,65 @@
1
+ /** A loop is a process/thread lifetime or a browser document, never just a service name. */
2
+ export interface EventLoopIdentity {
3
+ id: string;
4
+ runtime: 'node' | 'browser';
5
+ project: string;
6
+ pid?: number;
7
+ threadId?: number;
8
+ tabId?: string;
9
+ loadId?: string;
10
+ }
11
+ export interface EventLoopScript {
12
+ url: string;
13
+ functionName?: string;
14
+ invoker?: string;
15
+ durationMs: number;
16
+ startAt: number;
17
+ }
18
+ export interface EventLoopEvidence {
19
+ eventId: string;
20
+ title: string;
21
+ kind: string;
22
+ startAt: number;
23
+ endAt: number;
24
+ flowId?: string;
25
+ requestId?: string;
26
+ /** Wall-time overlap is association, never proof that this operation blocked the loop. */
27
+ relation: 'executing' | 'overlap';
28
+ }
29
+ export interface EventLoopIncident {
30
+ id: string;
31
+ loop: EventLoopIdentity;
32
+ startAt: number;
33
+ endAt?: number;
34
+ observedAt: number;
35
+ durationMs: number;
36
+ state: 'recovered' | 'unresponsive' | 'unknown';
37
+ mechanism: 'callback' | 'heartbeat' | 'long-animation-frame' | 'longtask';
38
+ severity: 'warning' | 'error';
39
+ /** Exact async execution context, when measured inside a Node callback. Not a CPU profile. */
40
+ flowId?: string;
41
+ requestId?: string;
42
+ callbackType?: string;
43
+ scripts: EventLoopScript[];
44
+ evidence: EventLoopEvidence[];
45
+ evidenceTruncated: boolean;
46
+ explanation: string;
47
+ }
48
+ export interface EventLoopStatus {
49
+ loop: EventLoopIdentity;
50
+ lastSeen: number;
51
+ state: 'observed' | 'unresponsive' | 'unknown';
52
+ coverage: string;
53
+ meanMs?: number;
54
+ maxMs?: number;
55
+ p99Ms?: number;
56
+ utilization?: number;
57
+ }
58
+ export interface EventLoopsView {
59
+ loops: EventLoopStatus[];
60
+ incidents: EventLoopIncident[];
61
+ /** Bounded result: older incidents can be requested using before. */
62
+ nextBefore?: number;
63
+ persistence: 'disk' | 'memory';
64
+ retentionDays: number;
65
+ }
@@ -0,0 +1 @@
1
+ "use strict";export{};
@@ -0,0 +1,97 @@
1
+ export type WorkspaceActionKind = 'start' | 'stop' | 'restart' | 'migrate' | 'test' | 'e2e' | 'typecheck' | 'lint' | 'build' | 'verify' | 'worktree-stop' | 'worktree-remove';
2
+ export type WorkspaceActionState = 'queued' | 'running' | 'passed' | 'failed' | 'errored' | 'cancelled' | 'timeout';
3
+ export interface WorkspaceActionInput {
4
+ action: WorkspaceActionKind;
5
+ project: string;
6
+ target?: string;
7
+ worktree?: string;
8
+ timeoutMs?: number;
9
+ files?: string[];
10
+ testName?: string;
11
+ hard?: boolean;
12
+ /** Preparation of an existing instance. Only services started by this run are cleaned up. */
13
+ prepare?: {
14
+ migrationProject?: string;
15
+ migrationTarget?: string;
16
+ services?: string[];
17
+ };
18
+ }
19
+ export interface WorkspaceActionDescriptor {
20
+ id: string;
21
+ action: WorkspaceActionKind;
22
+ project: string;
23
+ target?: string;
24
+ runner?: 'jest' | 'vitest' | 'playwright' | 'opaque';
25
+ available: boolean;
26
+ reason?: string;
27
+ prerequisites: string[];
28
+ }
29
+ export interface WorkspaceActionFailure {
30
+ id: string;
31
+ name: string;
32
+ file?: string;
33
+ line?: number;
34
+ message: string;
35
+ occurrences: number;
36
+ }
37
+ export interface WorkspaceActionCounts {
38
+ passed: number;
39
+ failed: number;
40
+ skipped: number;
41
+ total: number;
42
+ }
43
+ export interface WorkspaceActionStep {
44
+ id: string;
45
+ action: WorkspaceActionKind | 'cleanup';
46
+ state: WorkspaceActionState | 'skipped';
47
+ durationMs: number;
48
+ target?: string;
49
+ exitCode?: number | null;
50
+ signal?: string;
51
+ counts?: WorkspaceActionCounts;
52
+ failureKind?: 'assertion' | 'setup' | 'runner-crash' | 'cancelled' | 'timeout' | 'command';
53
+ failures: WorkspaceActionFailure[];
54
+ omittedFailures: number;
55
+ note?: string;
56
+ migrations?: {
57
+ applied: number | null;
58
+ pending: number | null;
59
+ failed?: string;
60
+ };
61
+ worktree?: {
62
+ key: string;
63
+ directoryExists: boolean;
64
+ remainingData?: string[];
65
+ omittedData?: number;
66
+ branch?: string;
67
+ };
68
+ service?: {
69
+ name: string;
70
+ state: string;
71
+ ready: boolean;
72
+ };
73
+ evidence: {
74
+ log: string;
75
+ report?: string;
76
+ attachments?: string;
77
+ };
78
+ }
79
+ export interface WorkspaceActionRun {
80
+ runId: string;
81
+ scope: {
82
+ workspace: string;
83
+ worktree: string;
84
+ project: string;
85
+ };
86
+ action: WorkspaceActionKind;
87
+ state: WorkspaceActionState;
88
+ stage?: string;
89
+ queuedAt: number;
90
+ startedAt?: number;
91
+ completedAt?: number;
92
+ durationMs: number;
93
+ steps: WorkspaceActionStep[];
94
+ note?: string;
95
+ resultRef: string;
96
+ retentionDays: number;
97
+ }
@@ -0,0 +1 @@
1
+ "use strict";export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/protocol-types",
3
- "version": "1.25.23",
3
+ "version": "1.25.25",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",