@lensmcp/protocol-types 1.25.2 → 1.25.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.
- package/lib/dashboard.d.ts +113 -6
- package/lib/dashboard.js +1 -1
- package/package.json +1 -1
package/lib/dashboard.d.ts
CHANGED
|
@@ -486,6 +486,17 @@ export interface DashFlowDetail {
|
|
|
486
486
|
segmentStats?: DashSegmentStats;
|
|
487
487
|
/** Present when the read asked for one segment (`?segment=`): `events` then holds only that segment. */
|
|
488
488
|
focus?: DashFlowSegment;
|
|
489
|
+
/**
|
|
490
|
+
* Present when the flow was no longer in the live window and was read back — from the workspace's event history
|
|
491
|
+
* (30 days) or the bus files. `complete: false`: older events of it may be missing.
|
|
492
|
+
*/
|
|
493
|
+
recovered?: {
|
|
494
|
+
from: 'bus' | 'history';
|
|
495
|
+
events: number;
|
|
496
|
+
complete: boolean;
|
|
497
|
+
/** Its list summary (title, route, duration, outcome) — the live flow list does not hold it. */
|
|
498
|
+
summary?: DashFlowSummary;
|
|
499
|
+
};
|
|
489
500
|
}
|
|
490
501
|
export interface DashLogLine {
|
|
491
502
|
seq: number;
|
|
@@ -1120,6 +1131,35 @@ export interface DashSqlFinding {
|
|
|
1120
1131
|
tool: string;
|
|
1121
1132
|
at: number;
|
|
1122
1133
|
}
|
|
1134
|
+
/**
|
|
1135
|
+
* A place in the services' own code where something ran — what a coding agent opens. From the stack the tap took at
|
|
1136
|
+
* the call: the service's nearest frame, and the callers above it.
|
|
1137
|
+
*/
|
|
1138
|
+
export interface DashCodeSite {
|
|
1139
|
+
/** `server/apps/engine/src/users/users.service.ts:42 (UsersService.findAll)` — what to open. */
|
|
1140
|
+
at: string;
|
|
1141
|
+
/** Relative to the workspace root when inside it. */
|
|
1142
|
+
file: string;
|
|
1143
|
+
/** The source line: TypeScript's when the lens could map it (`exact`), else the line the stack said. */
|
|
1144
|
+
line: number;
|
|
1145
|
+
column?: number;
|
|
1146
|
+
/** The function the line is in, or — when that one has no name (an arrow) — the nearest named caller. */
|
|
1147
|
+
symbol?: string;
|
|
1148
|
+
/** False: the line is the transpiled module's (close to the source's, not equal) — open `symbol` instead. */
|
|
1149
|
+
exact: boolean;
|
|
1150
|
+
/** The file was edited after this last ran: the line may have moved — find `symbol`. */
|
|
1151
|
+
changed?: boolean;
|
|
1152
|
+
/** The callers above it, nearest first. */
|
|
1153
|
+
via?: Array<{
|
|
1154
|
+
file: string;
|
|
1155
|
+
line: number;
|
|
1156
|
+
symbol?: string;
|
|
1157
|
+
}>;
|
|
1158
|
+
/** Runs that carried this site (the taps sample — a share of all runs), the services, and when it was last seen. */
|
|
1159
|
+
seen: number;
|
|
1160
|
+
services: string[];
|
|
1161
|
+
lastSeenAt: number;
|
|
1162
|
+
}
|
|
1123
1163
|
export interface DashSqlTemplateSummary {
|
|
1124
1164
|
/** 12 hex characters — the statement's shape (`@lensmcp/core/sql-shape`). */
|
|
1125
1165
|
id: string;
|
|
@@ -1131,6 +1171,10 @@ export interface DashSqlTemplateSummary {
|
|
|
1131
1171
|
suggestedName?: string;
|
|
1132
1172
|
/** Its newest finished SQL review, when it has one. */
|
|
1133
1173
|
review?: DashReviewMark;
|
|
1174
|
+
/** Where in the services' code it runs — each code path the taps saw, the busiest first (planning/code-locations). */
|
|
1175
|
+
sites?: DashCodeSite[];
|
|
1176
|
+
/** An unnamed statement its named version replaced (edited as it was named): that statement's id — not one to name. */
|
|
1177
|
+
replacedBy?: string;
|
|
1134
1178
|
/** SELECT · INSERT · UPDATE · DELETE · …; a WITH reads as the statement it leads to. */
|
|
1135
1179
|
verb: string;
|
|
1136
1180
|
tables: string[];
|
|
@@ -1175,6 +1219,8 @@ export interface DashSqlTemplateDetail extends DashSqlTemplateSummary {
|
|
|
1175
1219
|
}
|
|
1176
1220
|
export interface DashSqlTable {
|
|
1177
1221
|
name: string;
|
|
1222
|
+
/** The databases the statements that touch it ran on (the pg tap names each); absent from an older tap. */
|
|
1223
|
+
databases?: string[];
|
|
1178
1224
|
/** Runs of reading statements that touched it, and of writing ones. */
|
|
1179
1225
|
reads: number;
|
|
1180
1226
|
writes: number;
|
|
@@ -1452,6 +1498,9 @@ export interface DashDbLintIssue {
|
|
|
1452
1498
|
fix: string;
|
|
1453
1499
|
/** For an unnamed statement: a name in the convention, to start from. */
|
|
1454
1500
|
suggestedName?: string;
|
|
1501
|
+
/** Where in the code it runs — its busiest code path — and the others (planning/code-locations). */
|
|
1502
|
+
where?: string;
|
|
1503
|
+
sites?: DashCodeSite[];
|
|
1455
1504
|
review?: {
|
|
1456
1505
|
runId: string;
|
|
1457
1506
|
at: number;
|
|
@@ -1970,8 +2019,8 @@ export interface DashAiRun {
|
|
|
1970
2019
|
workspace: string;
|
|
1971
2020
|
/** `queued`: waiting for a free slot (`queue` says how many are ahead); one job per target, at most N at once. */
|
|
1972
2021
|
status: 'queued' | 'running' | 'done' | 'failed';
|
|
1973
|
-
/**
|
|
1974
|
-
trigger?:
|
|
2022
|
+
/** Who started it, and so which daily allowance it spends from (`DashAiTrigger`); absent: someone asked, before that was recorded. */
|
|
2023
|
+
trigger?: DashAiTrigger;
|
|
1975
2024
|
queue?: {
|
|
1976
2025
|
ahead: number;
|
|
1977
2026
|
max: number;
|
|
@@ -2382,12 +2431,24 @@ export interface DashAiTokens {
|
|
|
2382
2431
|
};
|
|
2383
2432
|
providers: DashAiProviderInfo[];
|
|
2384
2433
|
tokens: DashAiToken[];
|
|
2385
|
-
/** What this workspace's model calls cost today (UTC, estimated)
|
|
2434
|
+
/** What this workspace's model calls cost today (UTC, estimated) — and by who asked, against each one's daily allowance. */
|
|
2386
2435
|
today: {
|
|
2387
2436
|
usd: number;
|
|
2388
|
-
|
|
2437
|
+
by?: Record<DashAiTrigger, {
|
|
2438
|
+
usd: number;
|
|
2439
|
+
capUsd?: number;
|
|
2440
|
+
}>;
|
|
2389
2441
|
};
|
|
2390
2442
|
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Who asked for a model call — each has its own daily allowance (Settings › Features), so reviews that start by
|
|
2445
|
+
* themselves can never use up what a person or an agent asks for:
|
|
2446
|
+
* auto started by itself (Settings › Features — a statement once named, a route that changed)
|
|
2447
|
+
* click a person in the dashboard (Review with Claude, Ask AI, a key's test)
|
|
2448
|
+
* agent a coding agent over MCP (`review.* { run: true }`)
|
|
2449
|
+
*/
|
|
2450
|
+
export type DashAiTrigger = 'auto' | 'click' | 'agent';
|
|
2451
|
+
export declare const DASH_AI_TRIGGERS: readonly DashAiTrigger[];
|
|
2391
2452
|
/** One path a service read or wrote, by operation — from the fs tap's per-second aggregates. */
|
|
2392
2453
|
export interface DashFilePath {
|
|
2393
2454
|
/** `<service> <op> <path>`. */
|
|
@@ -2408,6 +2469,45 @@ export interface DashFilePath {
|
|
|
2408
2469
|
flowId?: string;
|
|
2409
2470
|
/** Route catalog ids whose requests touched it, most recent first. */
|
|
2410
2471
|
routes: string[];
|
|
2472
|
+
/** Its latest uses, newest first (at most 20): when, how often in that second, the bytes, and the flow and request. */
|
|
2473
|
+
uses?: DashFileUse[];
|
|
2474
|
+
}
|
|
2475
|
+
/** One use of a path: a second of the fs tap's aggregate, for one flow. */
|
|
2476
|
+
export interface DashFileUse {
|
|
2477
|
+
at: number;
|
|
2478
|
+
n: number;
|
|
2479
|
+
bytes: number;
|
|
2480
|
+
flowId?: string;
|
|
2481
|
+
requestId?: string;
|
|
2482
|
+
}
|
|
2483
|
+
/**
|
|
2484
|
+
* `/api/files/read?path=` — a path the services touched, as it is on disk now (read-only). `content=1` adds its first
|
|
2485
|
+
* 64 KB of text, redacted — never a file named like a secret (`.env`, keys, certificates), never a binary, and only on a
|
|
2486
|
+
* loopback-bound dashboard.
|
|
2487
|
+
*/
|
|
2488
|
+
export interface DashFileRead {
|
|
2489
|
+
path: string;
|
|
2490
|
+
/** Where it was looked for: the workspace root joined with `path`. */
|
|
2491
|
+
resolved: string;
|
|
2492
|
+
exists: boolean;
|
|
2493
|
+
kind?: 'file' | 'directory' | 'other';
|
|
2494
|
+
bytes?: number;
|
|
2495
|
+
modifiedAt?: number;
|
|
2496
|
+
createdAt?: number;
|
|
2497
|
+
/** Why it was not read, when it was not (outside the workspace, a secret's name, binary, not loopback). */
|
|
2498
|
+
refused?: string;
|
|
2499
|
+
/** Present when asked for and readable. */
|
|
2500
|
+
content?: {
|
|
2501
|
+
text: string;
|
|
2502
|
+
truncated: boolean;
|
|
2503
|
+
redacted: boolean;
|
|
2504
|
+
lines: number;
|
|
2505
|
+
};
|
|
2506
|
+
/** A directory's first entries. */
|
|
2507
|
+
entries?: Array<{
|
|
2508
|
+
name: string;
|
|
2509
|
+
kind: 'file' | 'directory' | 'other';
|
|
2510
|
+
}>;
|
|
2411
2511
|
}
|
|
2412
2512
|
/** `/api/catalog/files` — every path the services read or wrote, newest first, kept 30 days. */
|
|
2413
2513
|
export interface DashFiles {
|
|
@@ -2722,8 +2822,9 @@ export interface DashDbPrep {
|
|
|
2722
2822
|
/** One thing an agent did through the lens: a tool call, a resource read, what it said it is doing. */
|
|
2723
2823
|
export interface DashAgentEvent {
|
|
2724
2824
|
at: number;
|
|
2725
|
-
|
|
2726
|
-
|
|
2825
|
+
/** `ask`: a prompt the person gave it (the Claude Code plugin's hook) — `result` holds its first line. */
|
|
2826
|
+
kind: 'tool' | 'read' | 'say' | 'ask';
|
|
2827
|
+
/** The tool or the resource URI; `agent.task` for `say`; `prompt` for `ask`. */
|
|
2727
2828
|
name: string;
|
|
2728
2829
|
/** Its arguments, redacted, as JSON (at most 2 KB). */
|
|
2729
2830
|
args?: string;
|
|
@@ -2753,6 +2854,12 @@ export interface DashAgentSession {
|
|
|
2753
2854
|
task?: string;
|
|
2754
2855
|
step?: string;
|
|
2755
2856
|
saidAt?: number;
|
|
2857
|
+
/**
|
|
2858
|
+
* What the person last asked it — the prompt's first line, recorded by the LensMCP Claude Code plugin's
|
|
2859
|
+
* `UserPromptSubmit` hook, so a session shows its task even when the agent never calls `agent.task`.
|
|
2860
|
+
*/
|
|
2861
|
+
asked?: string;
|
|
2862
|
+
askedAt?: number;
|
|
2756
2863
|
conn: {
|
|
2757
2864
|
transport: string;
|
|
2758
2865
|
/** 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"];
|