@lensmcp/protocol-types 1.25.2 → 1.25.5

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.
@@ -106,7 +106,8 @@ export interface DashService {
106
106
  min?: number;
107
107
  max?: number;
108
108
  };
109
- workers: string[];
109
+ /** Its `serve` workers — each declared one, with what its devserver has said of it. */
110
+ workers: DashWorker[];
110
111
  lastColdStartMs?: number;
111
112
  restarts: number;
112
113
  buildFailed: boolean;
@@ -141,6 +142,40 @@ export interface DashService {
141
142
  /** What its running pods weigh, from their own post-GC reports (`pod-memory` events). Absent until one reports. */
142
143
  memory?: DashServiceMemory;
143
144
  }
145
+ /**
146
+ * A service's `serve` worker (issues/closed/foodguard-80): a queue consumer or a background loop its devserver runs
147
+ * beside the pods, started again when it crashes. One that is not `running` is work nobody is doing.
148
+ */
149
+ export interface DashWorker {
150
+ name: string;
151
+ /**
152
+ * `running` · `restarting` — it crashed and starts again at `nextAt` · `crash-looping` — it keeps crashing, each wait
153
+ * longer · `exited` — it ended on its own, or its bundle is missing: not started again until the next build ·
154
+ * `stopped` — its service stopped · `unknown` — declared, and its devserver has said nothing of it (one from before
155
+ * 1.25.3 says nothing).
156
+ */
157
+ state: 'running' | 'restarting' | 'crash-looping' | 'exited' | 'stopped' | 'unknown';
158
+ pid?: number;
159
+ /** When it entered this state. */
160
+ since?: number;
161
+ /** Crashes this session. */
162
+ crashes: number;
163
+ /** Crashes in a row (restarting / crash-looping). */
164
+ inARow?: number;
165
+ /** When it is started again. */
166
+ nextAt?: number;
167
+ /** Why it is not running (exited / stopped). */
168
+ reason?: string;
169
+ /** The last time it ended unasked: how, and what it printed last. */
170
+ lastCrash?: {
171
+ at: number;
172
+ exitCode: number | null;
173
+ signal: string | null;
174
+ reading?: string;
175
+ external?: boolean;
176
+ lines: string[];
177
+ };
178
+ }
144
179
  /** A service's pods, summed: what the Cluster tab's memory column shows. Bytes throughout. */
145
180
  export interface DashServiceMemory {
146
181
  /** Heap after each pod's latest full GC. */
@@ -486,6 +521,17 @@ export interface DashFlowDetail {
486
521
  segmentStats?: DashSegmentStats;
487
522
  /** Present when the read asked for one segment (`?segment=`): `events` then holds only that segment. */
488
523
  focus?: DashFlowSegment;
524
+ /**
525
+ * Present when the flow was no longer in the live window and was read back — from the workspace's event history
526
+ * (30 days) or the bus files. `complete: false`: older events of it may be missing.
527
+ */
528
+ recovered?: {
529
+ from: 'bus' | 'history';
530
+ events: number;
531
+ complete: boolean;
532
+ /** Its list summary (title, route, duration, outcome) — the live flow list does not hold it. */
533
+ summary?: DashFlowSummary;
534
+ };
489
535
  }
490
536
  export interface DashLogLine {
491
537
  seq: number;
@@ -1120,6 +1166,35 @@ export interface DashSqlFinding {
1120
1166
  tool: string;
1121
1167
  at: number;
1122
1168
  }
1169
+ /**
1170
+ * A place in the services' own code where something ran — what a coding agent opens. From the stack the tap took at
1171
+ * the call: the service's nearest frame, and the callers above it.
1172
+ */
1173
+ export interface DashCodeSite {
1174
+ /** `server/apps/engine/src/users/users.service.ts:42 (UsersService.findAll)` — what to open. */
1175
+ at: string;
1176
+ /** Relative to the workspace root when inside it. */
1177
+ file: string;
1178
+ /** The source line: TypeScript's when the lens could map it (`exact`), else the line the stack said. */
1179
+ line: number;
1180
+ column?: number;
1181
+ /** The function the line is in, or — when that one has no name (an arrow) — the nearest named caller. */
1182
+ symbol?: string;
1183
+ /** False: the line is the transpiled module's (close to the source's, not equal) — open `symbol` instead. */
1184
+ exact: boolean;
1185
+ /** The file was edited after this last ran: the line may have moved — find `symbol`. */
1186
+ changed?: boolean;
1187
+ /** The callers above it, nearest first. */
1188
+ via?: Array<{
1189
+ file: string;
1190
+ line: number;
1191
+ symbol?: string;
1192
+ }>;
1193
+ /** Runs that carried this site (the taps sample — a share of all runs), the services, and when it was last seen. */
1194
+ seen: number;
1195
+ services: string[];
1196
+ lastSeenAt: number;
1197
+ }
1123
1198
  export interface DashSqlTemplateSummary {
1124
1199
  /** 12 hex characters — the statement's shape (`@lensmcp/core/sql-shape`). */
1125
1200
  id: string;
@@ -1131,6 +1206,10 @@ export interface DashSqlTemplateSummary {
1131
1206
  suggestedName?: string;
1132
1207
  /** Its newest finished SQL review, when it has one. */
1133
1208
  review?: DashReviewMark;
1209
+ /** Where in the services' code it runs — each code path the taps saw, the busiest first (planning/code-locations). */
1210
+ sites?: DashCodeSite[];
1211
+ /** An unnamed statement its named version replaced (edited as it was named): that statement's id — not one to name. */
1212
+ replacedBy?: string;
1134
1213
  /** SELECT · INSERT · UPDATE · DELETE · …; a WITH reads as the statement it leads to. */
1135
1214
  verb: string;
1136
1215
  tables: string[];
@@ -1175,6 +1254,8 @@ export interface DashSqlTemplateDetail extends DashSqlTemplateSummary {
1175
1254
  }
1176
1255
  export interface DashSqlTable {
1177
1256
  name: string;
1257
+ /** The databases the statements that touch it ran on (the pg tap names each); absent from an older tap. */
1258
+ databases?: string[];
1178
1259
  /** Runs of reading statements that touched it, and of writing ones. */
1179
1260
  reads: number;
1180
1261
  writes: number;
@@ -1452,6 +1533,9 @@ export interface DashDbLintIssue {
1452
1533
  fix: string;
1453
1534
  /** For an unnamed statement: a name in the convention, to start from. */
1454
1535
  suggestedName?: string;
1536
+ /** Where in the code it runs — its busiest code path — and the others (planning/code-locations). */
1537
+ where?: string;
1538
+ sites?: DashCodeSite[];
1455
1539
  review?: {
1456
1540
  runId: string;
1457
1541
  at: number;
@@ -1970,8 +2054,8 @@ export interface DashAiRun {
1970
2054
  workspace: string;
1971
2055
  /** `queued`: waiting for a free slot (`queue` says how many are ahead); one job per target, at most N at once. */
1972
2056
  status: 'queued' | 'running' | 'done' | 'failed';
1973
- /** Started by itself (Settings › Features — a route that changed, a statement once named); absent: someone asked. */
1974
- trigger?: 'auto';
2057
+ /** Who started it, and so which daily allowance it spends from (`DashAiTrigger`); absent: someone asked, before that was recorded. */
2058
+ trigger?: DashAiTrigger;
1975
2059
  queue?: {
1976
2060
  ahead: number;
1977
2061
  max: number;
@@ -2382,12 +2466,24 @@ export interface DashAiTokens {
2382
2466
  };
2383
2467
  providers: DashAiProviderInfo[];
2384
2468
  tokens: DashAiToken[];
2385
- /** What this workspace's model calls cost today (UTC, estimated), and its daily cap. */
2469
+ /** What this workspace's model calls cost today (UTC, estimated) — and by who asked, against each one's daily allowance. */
2386
2470
  today: {
2387
2471
  usd: number;
2388
- capUsd?: number;
2472
+ by?: Record<DashAiTrigger, {
2473
+ usd: number;
2474
+ capUsd?: number;
2475
+ }>;
2389
2476
  };
2390
2477
  }
2478
+ /**
2479
+ * Who asked for a model call — each has its own daily allowance (Settings › Features), so reviews that start by
2480
+ * themselves can never use up what a person or an agent asks for:
2481
+ * auto started by itself (Settings › Features — a statement once named, a route that changed)
2482
+ * click a person in the dashboard (Review with Claude, Ask AI, a key's test)
2483
+ * agent a coding agent over MCP (`review.* { run: true }`)
2484
+ */
2485
+ export type DashAiTrigger = 'auto' | 'click' | 'agent';
2486
+ export declare const DASH_AI_TRIGGERS: readonly DashAiTrigger[];
2391
2487
  /** One path a service read or wrote, by operation — from the fs tap's per-second aggregates. */
2392
2488
  export interface DashFilePath {
2393
2489
  /** `<service> <op> <path>`. */
@@ -2408,6 +2504,45 @@ export interface DashFilePath {
2408
2504
  flowId?: string;
2409
2505
  /** Route catalog ids whose requests touched it, most recent first. */
2410
2506
  routes: string[];
2507
+ /** Its latest uses, newest first (at most 20): when, how often in that second, the bytes, and the flow and request. */
2508
+ uses?: DashFileUse[];
2509
+ }
2510
+ /** One use of a path: a second of the fs tap's aggregate, for one flow. */
2511
+ export interface DashFileUse {
2512
+ at: number;
2513
+ n: number;
2514
+ bytes: number;
2515
+ flowId?: string;
2516
+ requestId?: string;
2517
+ }
2518
+ /**
2519
+ * `/api/files/read?path=` — a path the services touched, as it is on disk now (read-only). `content=1` adds its first
2520
+ * 64 KB of text, redacted — never a file named like a secret (`.env`, keys, certificates), never a binary, and only on a
2521
+ * loopback-bound dashboard.
2522
+ */
2523
+ export interface DashFileRead {
2524
+ path: string;
2525
+ /** Where it was looked for: the workspace root joined with `path`. */
2526
+ resolved: string;
2527
+ exists: boolean;
2528
+ kind?: 'file' | 'directory' | 'other';
2529
+ bytes?: number;
2530
+ modifiedAt?: number;
2531
+ createdAt?: number;
2532
+ /** Why it was not read, when it was not (outside the workspace, a secret's name, binary, not loopback). */
2533
+ refused?: string;
2534
+ /** Present when asked for and readable. */
2535
+ content?: {
2536
+ text: string;
2537
+ truncated: boolean;
2538
+ redacted: boolean;
2539
+ lines: number;
2540
+ };
2541
+ /** A directory's first entries. */
2542
+ entries?: Array<{
2543
+ name: string;
2544
+ kind: 'file' | 'directory' | 'other';
2545
+ }>;
2411
2546
  }
2412
2547
  /** `/api/catalog/files` — every path the services read or wrote, newest first, kept 30 days. */
2413
2548
  export interface DashFiles {
@@ -2722,8 +2857,9 @@ export interface DashDbPrep {
2722
2857
  /** One thing an agent did through the lens: a tool call, a resource read, what it said it is doing. */
2723
2858
  export interface DashAgentEvent {
2724
2859
  at: number;
2725
- kind: 'tool' | 'read' | 'say';
2726
- /** The tool or the resource URI; `agent.task` for `say`. */
2860
+ /** `ask`: a prompt the person gave it (the Claude Code plugin's hook) — `result` holds its first line. */
2861
+ kind: 'tool' | 'read' | 'say' | 'ask';
2862
+ /** The tool or the resource URI; `agent.task` for `say`; `prompt` for `ask`. */
2727
2863
  name: string;
2728
2864
  /** Its arguments, redacted, as JSON (at most 2 KB). */
2729
2865
  args?: string;
@@ -2753,6 +2889,12 @@ export interface DashAgentSession {
2753
2889
  task?: string;
2754
2890
  step?: string;
2755
2891
  saidAt?: number;
2892
+ /**
2893
+ * What the person last asked it — the prompt's first line, recorded by the LensMCP Claude Code plugin's
2894
+ * `UserPromptSubmit` hook, so a session shows its task even when the agent never calls `agent.task`.
2895
+ */
2896
+ asked?: string;
2897
+ askedAt?: number;
2756
2898
  conn: {
2757
2899
  transport: string;
2758
2900
  /** The lens server's pid, and the shim's (the `lensmcp mcp` process the client started), when it said. */
package/lib/dashboard.js CHANGED
@@ -1 +1 @@
1
- "use strict";export const DASHBOARD_PROTOCOL=1,DASH_PERF_KINDS=["n-plus-one","db-in-loop","render-storm","slow-path","slow-route","slow-query","missing-index","leak","egress-slow","duplicate-requests","perf-rule","db-connection","other"];
1
+ "use strict";export const DASHBOARD_PROTOCOL=1,DASH_PERF_KINDS=["n-plus-one","db-in-loop","render-storm","slow-path","slow-route","slow-query","missing-index","leak","egress-slow","duplicate-requests","perf-rule","db-connection","other"],DASH_AI_TRIGGERS=["auto","click","agent"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/protocol-types",
3
- "version": "1.25.2",
3
+ "version": "1.25.5",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",