@lensmcp/protocol-types 1.25.79 → 1.26.1

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 (55) hide show
  1. package/index.d.ts +9 -1
  2. package/index.js +1 -1
  3. package/lib/ai-call-groups.js +2 -2
  4. package/lib/ai-call-row.js +3 -3
  5. package/lib/ai-call.js +9 -9
  6. package/lib/ai-context.js +6 -6
  7. package/lib/ai-origins.js +9 -9
  8. package/lib/attributes.d.ts +15 -0
  9. package/lib/attributes.js +1 -1
  10. package/lib/bounded-clone.js +1 -1
  11. package/lib/bounded-map.js +1 -1
  12. package/lib/bounded-writer.js +1 -1
  13. package/lib/capture-demand.js +1 -1
  14. package/lib/changes.d.ts +48 -0
  15. package/lib/dashboard-lint.d.ts +207 -0
  16. package/lib/dashboard-lint.js +1 -0
  17. package/lib/dashboard-path.d.ts +15 -0
  18. package/lib/dashboard-path.js +1 -0
  19. package/lib/dashboard.d.ts +198 -3
  20. package/lib/error-cause.d.ts +69 -0
  21. package/lib/error-cause.js +5 -0
  22. package/lib/error-dismissal.js +1 -1
  23. package/lib/event-loop.d.ts +57 -1
  24. package/lib/event-loop.js +1 -1
  25. package/lib/flood-guard.js +1 -1
  26. package/lib/follow-ups.d.ts +238 -0
  27. package/lib/follow-ups.js +1 -0
  28. package/lib/goal-design.d.ts +51 -0
  29. package/lib/goal-design.js +1 -1
  30. package/lib/goal-outcome.d.ts +12 -1
  31. package/lib/goal-retro.d.ts +21 -0
  32. package/lib/lint-coverage.d.ts +113 -0
  33. package/lib/lint-coverage.js +1 -0
  34. package/lib/log-query.js +1 -1
  35. package/lib/metrics-reset.js +1 -1
  36. package/lib/overseer-findings.js +1 -1
  37. package/lib/perf-rules.js +1 -1
  38. package/lib/pod-memory.d.ts +2 -0
  39. package/lib/pod-memory.js +1 -1
  40. package/lib/producer-health.js +1 -1
  41. package/lib/role-fidelity.d.ts +210 -0
  42. package/lib/role-fidelity.js +1 -0
  43. package/lib/sources.js +1 -1
  44. package/lib/system-report.js +1 -1
  45. package/lib/team-delivery.d.ts +38 -4
  46. package/lib/team-delivery.js +1 -1
  47. package/lib/team-design.d.ts +224 -0
  48. package/lib/team-design.js +1 -1
  49. package/lib/team-prompts.d.ts +16 -7
  50. package/lib/team-prompts.js +4 -47
  51. package/lib/team-skills.d.ts +355 -0
  52. package/lib/team-skills.js +1 -0
  53. package/lib/team.d.ts +95 -1
  54. package/lib/team.js +1 -1
  55. package/package.json +1 -1
@@ -0,0 +1,238 @@
1
+ import type { DesignConcern, DesignStage, DesignType } from './goal-design.js';
2
+ /**
3
+ * A finished goal's follow-ups (Suggestions › Follow-ups, 2026-11-10): what it left — open tasks under it or found by its
4
+ * QA run, its next list, the follow-up work its retrospective named — collected by code with no model once its
5
+ * retrospective ended (or at the person's «Collect»), then organized into proposed goals by one Claude call the person
6
+ * approves. Nothing becomes a goal, and no task moves, until the person makes a proposal a goal or combines it.
7
+ */
8
+ /** Where a follow-up came from: an open task the goal left (`task`), its next list (`next`), its retrospective (`retro`). */
9
+ export type DashFollowUpSource = 'task' | 'next' | 'retro';
10
+ export interface DashFollowUpItem {
11
+ /** Stable within its goal: `t:<taskId>`, `n:<next item id>`, `r:<12 hex of its title>`. */
12
+ id: string;
13
+ source: DashFollowUpSource;
14
+ /** The same work named by another source too, folded into this one (de-duplicated). */
15
+ also?: DashFollowUpSource[];
16
+ title: string;
17
+ why?: string;
18
+ /** A task: the task, its kind, role and paths. */
19
+ taskId?: string;
20
+ kind?: string;
21
+ role?: string;
22
+ paths?: string[];
23
+ /** A parentless task the goal's QA run found (the board's «found by»): that run's title. */
24
+ foundBy?: string;
25
+ /** A next item: who put it there, and the task it was moved from («moved to next»). */
26
+ by?: string;
27
+ from?: string;
28
+ /** A retrospective's follow-up: the task ids it rests on. */
29
+ evidence?: string[];
30
+ /** Read live — a task's state now. */
31
+ state?: string;
32
+ /** Read live — a task that completed or was cancelled since: no longer a follow-up. */
33
+ closed?: boolean;
34
+ /** Read live — marked reviewed: its proposal dismissed, or the person dropped it as stale. */
35
+ reviewed?: {
36
+ at: number;
37
+ why: string;
38
+ proposal?: string;
39
+ };
40
+ /** Read live — the open proposal that covers it. */
41
+ proposal?: string;
42
+ /** Read live — the goal it went into. */
43
+ goal?: {
44
+ id: string;
45
+ title: string;
46
+ };
47
+ }
48
+ /** One finished goal's follow-ups as collected, with what became of them (read live). */
49
+ export interface DashFollowUpGoal {
50
+ goalId: string;
51
+ title: string;
52
+ /** The goal now: completed or cancelled, its outcome. */
53
+ state?: string;
54
+ outcome?: string;
55
+ finishedAt?: number;
56
+ collectedAt: number;
57
+ /** After its retrospective ended (`retro`), or the person's «Collect» (`person`). */
58
+ by: 'retro' | 'person';
59
+ /** Its retrospective when collected: its follow-ups were read from a done one. */
60
+ retro?: 'done' | 'failed' | 'none';
61
+ items: DashFollowUpItem[];
62
+ /** Items still to decide: open, not reviewed, in no goal and no open proposal. */
63
+ unseen: number;
64
+ /** What organizing it may cost, estimated (no model call): Claude groups its items into proposed goals. */
65
+ organizeUsd?: number;
66
+ /** Organized: the run, what it cost, the proposals it made. */
67
+ organized?: {
68
+ runId: string;
69
+ at: number;
70
+ costUsd: number;
71
+ proposals: string[];
72
+ };
73
+ /** A run organizing it now. */
74
+ organizing?: {
75
+ runId: string;
76
+ since: number;
77
+ };
78
+ }
79
+ export type DashFollowUpProposalState = 'open' | 'goal' | 'dismissed' | 'combined';
80
+ /** A goal Claude proposes from follow-ups — or, from «Reorganize all», from follow-ups and review suggestions together. */
81
+ export interface DashFollowUpProposal {
82
+ /** `fp-` and 10 hex. */
83
+ id: string;
84
+ from: 'organize' | 'reorganize';
85
+ runId: string;
86
+ at: number;
87
+ title: string;
88
+ why: string;
89
+ priority: 'high' | 'medium' | 'low';
90
+ size: 'S' | 'M' | 'L';
91
+ type: DesignType;
92
+ concerns: DesignConcern[];
93
+ /** The draft design in the design-first format (Markdown, front matter to brief). */
94
+ design: string;
95
+ /**
96
+ * LensMCP's check of the draft (the design check every design passes). No problem and no question: «Make it a goal»
97
+ * opens the goal at once, approved by the click. Otherwise «Make it a goal (design first)»: it waits for approval.
98
+ */
99
+ check: {
100
+ problems: string[];
101
+ warnings: string[];
102
+ questions: number;
103
+ };
104
+ /** The follow-up items it covers, each with its finished goal. */
105
+ items: Array<{
106
+ goalId: string;
107
+ itemId: string;
108
+ }>;
109
+ /** The review suggestions it covers (`sg-…`, Reorganize all). */
110
+ suggestions?: string[];
111
+ /** Open proposals it replaces (Reorganize all): made a goal, they read «combined». */
112
+ replaces?: string[];
113
+ /** The finished goals its items come from, by title. */
114
+ goals: Array<{
115
+ id: string;
116
+ title: string;
117
+ }>;
118
+ /** Clearly the same work as an open proposal or a live goal — said rather than duplicated. */
119
+ sameAs?: {
120
+ kind: 'proposal' | 'goal';
121
+ id: string;
122
+ title: string;
123
+ why: string;
124
+ };
125
+ state: DashFollowUpProposalState;
126
+ stateAt?: number;
127
+ /** Why it was dismissed, or the goal's words. */
128
+ note?: string;
129
+ /** Made a goal, or combined into one: the goal now, the tasks moved under it, the tasks made for items that were none, the moves refused. */
130
+ goal?: {
131
+ id: string;
132
+ title: string;
133
+ state?: string;
134
+ stage?: DesignStage;
135
+ moved: string[];
136
+ created: string[];
137
+ refused: Array<{
138
+ taskId: string;
139
+ title: string;
140
+ why: string;
141
+ }>;
142
+ };
143
+ }
144
+ /** One approved run's result: its proposals, what it would drop as stale (with why), and what it read. */
145
+ export interface DashFollowUpPlan {
146
+ runId: string;
147
+ kind: 'organize' | 'reorganize';
148
+ at: number;
149
+ costUsd: number;
150
+ model: string;
151
+ /** The finished goals it organized (Organize) or read items of (Reorganize all). */
152
+ goals: string[];
153
+ proposals: string[];
154
+ stale: Array<{
155
+ goalId?: string;
156
+ itemId?: string;
157
+ suggestion?: string;
158
+ proposal?: string;
159
+ title: string;
160
+ why: string;
161
+ reviewed?: boolean;
162
+ }>;
163
+ read: {
164
+ items: number;
165
+ suggestions: number;
166
+ proposals: number;
167
+ goals: number;
168
+ };
169
+ /** What was not read, to keep the message bounded — «N more not read» and how they were chosen. */
170
+ notRead?: string[];
171
+ /** What LensMCP dropped from the answer, and why. */
172
+ dropped?: string[];
173
+ }
174
+ export interface DashFollowUpRun {
175
+ runId: string;
176
+ kind: 'organize' | 'reorganize';
177
+ status: 'queued' | 'running' | 'done' | 'failed';
178
+ step: string;
179
+ startedAt: number;
180
+ finishedAt?: number;
181
+ costUsd: number;
182
+ error?: string;
183
+ goals: string[];
184
+ proposals?: string[];
185
+ }
186
+ /** The counts the sidebar, the Suggestions tab and the Team page show. */
187
+ export interface DashFollowUpCounts {
188
+ /** Follow-up items still to decide (open, not reviewed, in no goal) across collected goals. */
189
+ unseen: number;
190
+ /** Collected goals with items to decide and no proposal yet: ready to organize. */
191
+ ready: number;
192
+ /** Open proposals. */
193
+ open: number;
194
+ /** Finished goals not collected yet («Collect all»). */
195
+ uncollected: number;
196
+ }
197
+ /** `GET /api/team/follow-ups`. */
198
+ export interface DashFollowUps {
199
+ goals: DashFollowUpGoal[];
200
+ proposals: DashFollowUpProposal[];
201
+ /** Newest first, at most 10. */
202
+ plans: DashFollowUpPlan[];
203
+ counts: DashFollowUpCounts;
204
+ /** What «Organize all» would organize now, and may cost — no model call. */
205
+ organizeAll?: {
206
+ goals: number;
207
+ items: number;
208
+ estimateUsd?: number;
209
+ };
210
+ /** Runs organizing or reorganizing now. */
211
+ runs: DashFollowUpRun[];
212
+ /** Today's dashboard (`click`) allowance: these runs are the person's, approved one by one. */
213
+ allowance: {
214
+ capUsd: number;
215
+ spentUsd: number;
216
+ leftUsd: number;
217
+ };
218
+ }
219
+ /** Organize / Reorganize all before it spends: what it reads, what it leaves out, what it may cost. */
220
+ export interface DashFollowUpEstimate {
221
+ kind: 'organize' | 'reorganize';
222
+ goals: string[];
223
+ items: number;
224
+ suggestions: number;
225
+ proposals: number;
226
+ notRead?: string[];
227
+ model: string;
228
+ inputTokens: number;
229
+ estimateUsd?: number;
230
+ maxUsd: number;
231
+ allowance: {
232
+ capUsd: number;
233
+ spentUsd: number;
234
+ leftUsd: number;
235
+ };
236
+ ready: boolean;
237
+ why?: string;
238
+ }
@@ -0,0 +1 @@
1
+ "use strict";export{};
@@ -55,6 +55,39 @@ export interface DashDesignFigure {
55
55
  bytes: number;
56
56
  sha256: string;
57
57
  }
58
+ /**
59
+ * What the person decides on, read from a version when it is handed in: the budget its Brief asks for and two lines of
60
+ * its Summary. The Inbox shows it on the list and above the document: a design runs to thousands of words, and the
61
+ * person approves from the first screen.
62
+ */
63
+ export interface DashDesignDecision {
64
+ /** The Brief's budget: its packages («builds»), its working hours and its spend in dollars. */
65
+ builds?: number;
66
+ hours?: number;
67
+ spendUsd?: number;
68
+ /** The Summary's «Risk:» line: the worst it can do, and its undo. */
69
+ risk?: string;
70
+ /** The Summary's «Not proved here:» line: what approval accepts unproved, and who proves it later. */
71
+ unproved?: string;
72
+ }
73
+ /**
74
+ * Who wrote a version, as far as its hand-in could tell. The overseer has one session in a repository, and every hand-in
75
+ * made as the overseer carries its name: a design launch's, and any other session's that ran the same command.
76
+ * launch one of the overseer's own launches — `purpose` says which: a design launch writes designs
77
+ * session another agent session handed it in as the overseer: its client, and its role and name on the team's board
78
+ * when the board holds it
79
+ * terminal handed in as the overseer from a shell no agent runs
80
+ * person the person's own hand-in: Inbox › Designs, or their terminal
81
+ * lensmcp LensMCP's own run (a goal made from suggestions or follow-ups)
82
+ */
83
+ export interface DashDesignWriter {
84
+ kind: 'launch' | 'session' | 'terminal' | 'person' | 'lensmcp';
85
+ launchId?: string;
86
+ purpose?: 'round' | 'design' | 'inbox';
87
+ client?: 'claude' | 'codex';
88
+ role?: string;
89
+ name?: string;
90
+ }
58
91
  /** One version of a design: what it was, who wrote it, its questions, and what LensMCP's check warned about. */
59
92
  export interface DashDesignVersion {
60
93
  n: number;
@@ -74,7 +107,21 @@ export interface DashDesignVersion {
74
107
  amendment?: boolean;
75
108
  /** What changed since the previous version, in the author's words. */
76
109
  changes?: string;
110
+ /** What the person decides on. Absent on a version stored before it was kept: read from the version's file instead. */
111
+ decision?: DashDesignDecision;
112
+ /** Who wrote it. Absent on a version stored before it was recorded: {@link designWriter} reads what `by` alone says. */
113
+ writer?: DashDesignWriter;
77
114
  }
115
+ /**
116
+ * Who wrote a version: what its hand-in recorded, else what `by` alone says — the person (`user`) and LensMCP's own run
117
+ * (`lensmcp`) were always told apart. Undefined: handed in as the overseer before the hand-in recorded who it was.
118
+ */
119
+ export declare function designWriter(v: Pick<DashDesignVersion, 'by' | 'byName' | 'writer'>): DashDesignWriter | undefined;
120
+ /**
121
+ * {@link designWriter} in words, for a page and a terminal alike: «written by a design launch on Claude Code», «handed
122
+ * in by a Codex session with no role on this team», «written by the person».
123
+ */
124
+ export declare function designWriterText(v: Pick<DashDesignVersion, 'by' | 'byName' | 'writer'>): string;
78
125
  /** The person's answer to one question: an option, words, or both. Unanswered questions take the recommended option. */
79
126
  export interface DashDesignAnswer {
80
127
  id: string;
@@ -147,6 +194,8 @@ export interface DashDesignBrief {
147
194
  amendment?: boolean;
148
195
  request: DashDesignRequest;
149
196
  updatedAt: number;
197
+ /** What the person decides on in the newest version: its budget, and its Summary's «Risk:» and «Not proved here:». */
198
+ decision?: DashDesignDecision;
150
199
  }
151
200
  export interface DashDesignsAnswer {
152
201
  designs: DashDesignBrief[];
@@ -172,6 +221,8 @@ export interface DashDesignAnswerOne {
172
221
  markdown?: string;
173
222
  /** The previous version's Markdown, for the page's diff. */
174
223
  previous?: string;
224
+ /** What the person decides on in the version shown: kept with it, else read from its Markdown. */
225
+ decision?: DashDesignDecision;
175
226
  }
176
227
  /** The template a person (or the overseer) fills in, for a type and its concerns. */
177
228
  export interface DashDesignTemplate {
@@ -1 +1 @@
1
- "use strict";export const DESIGN_TYPES=["bug","investigation","performance","reliability","feature","architecture","maintenance"],DESIGN_CONCERNS=["security","data","api","ui","integration","operations"],DESIGN_TYPE_INFO={bug:{label:"Bug",when:"Something works wrong, and the cause is known or can be found by reading the code."},investigation:{label:"Investigation",when:"Symptoms without a known cause: research first, and the goal ends in a decision or a fix."},performance:{label:"Performance",when:"Something is measurably slow, heavy or costly: a baseline the lens measured and a target."},reliability:{label:"Reliability",when:"Crashes, stalls, flaky tests, lost work, CI or the machine: how it fails and how often."},feature:{label:"Feature",when:"Someone can do something they cannot do now."},architecture:{label:"Architecture",when:"Boundaries, contracts or structure change, in steps that each ship."},maintenance:{label:"Maintenance",when:"Upgrades, moves, tooling and cleanup: no new behaviour, and nothing breaks."}},DESIGN_CONCERN_INFO={security:{label:"Security",when:"Auth, permissions, secrets, input from outside, or anything an attacker would read."},data:{label:"Data",when:"Schema, migrations, backfills, or data already stored."},api:{label:"API",when:"A request or response other code or other people depend on."},ui:{label:"UI",when:"Screens, flows or what a person sees."},integration:{label:"Integration",when:"A service outside the repository: its API, keys, limits and failures."},operations:{label:"Operations",when:"How it deploys, runs, is watched and is rolled back."}},DESIGN_STAGES=["proposed","requested","drafting","waiting","changes","approved","declined"];
1
+ "use strict";var o=Object.defineProperty;var t=(n,e)=>o(n,"name",{value:e,configurable:!0});var s=Object.defineProperty,a=t((n,e)=>s(n,"name",{value:e,configurable:!0}),"a"),l=Object.defineProperty,i=a((n,e)=>l(n,"name",{value:e,configurable:!0}),"a");export const DESIGN_TYPES=["bug","investigation","performance","reliability","feature","architecture","maintenance"],DESIGN_CONCERNS=["security","data","api","ui","integration","operations"],DESIGN_TYPE_INFO={bug:{label:"Bug",when:"Something works wrong, and the cause is known or can be found by reading the code."},investigation:{label:"Investigation",when:"Symptoms without a known cause: research first, and the goal ends in a decision or a fix."},performance:{label:"Performance",when:"Something is measurably slow, heavy or costly: a baseline the lens measured and a target."},reliability:{label:"Reliability",when:"Crashes, stalls, flaky tests, lost work, CI or the machine: how it fails and how often."},feature:{label:"Feature",when:"Someone can do something they cannot do now."},architecture:{label:"Architecture",when:"Boundaries, contracts or structure change, in steps that each ship."},maintenance:{label:"Maintenance",when:"Upgrades, moves, tooling and cleanup: no new behaviour, and nothing breaks."}},DESIGN_CONCERN_INFO={security:{label:"Security",when:"Auth, permissions, secrets, input from outside, or anything an attacker would read."},data:{label:"Data",when:"Schema, migrations, backfills, or data already stored."},api:{label:"API",when:"A request or response other code or other people depend on."},ui:{label:"UI",when:"Screens, flows or what a person sees."},integration:{label:"Integration",when:"A service outside the repository: its API, keys, limits and failures."},operations:{label:"Operations",when:"How it deploys, runs, is watched and is rolled back."}},DESIGN_STAGES=["proposed","requested","drafting","waiting","changes","approved","declined"];export function designWriter(n){if(n.writer)return n.writer;if(n.by==="user")return{kind:"person"};if(n.by==="lensmcp")return{kind:"lensmcp",...n.byName?{name:n.byName}:{}}}t(designWriter,"designWriter"),a(designWriter,"designWriter"),i(designWriter,"designWriter");const c={claude:"Claude Code",codex:"Codex"};export function designWriterText(n){const e=designWriter(n);if(!e)return"who handed it in was not recorded";const r=e.client?c[e.client]:void 0;switch(e.kind){case"person":return"written by the person";case"lensmcp":return"written by LensMCP's own run";case"terminal":return"handed in from a terminal, as the overseer";case"session":return`handed in by ${r?`a ${r}`:"an agent's"} session${e.role?`, the team's ${e.role}`:" with no role on this team"}`;case"launch":return e.purpose==="design"?`written by a design launch${r?` on ${r}`:""}`:`handed in by the overseer's ${e.purpose==="inbox"?"inbox launch":e.purpose==="round"?"round":"launch"}${r?` on ${r}`:""}`}}t(designWriterText,"designWriterText"),a(designWriterText,"designWriterText"),i(designWriterText,"designWriterText");
@@ -1,3 +1,4 @@
1
+ import type { DashRoleFidelity } from './role-fidelity.js';
1
2
  import type { DashTeamKind, DashTeamOutcome, DashTeamReviewFlow, DashTeamReviewReviews, DashTeamReviewWork, DashTeamTaskState } from './team.js';
2
3
  /**
3
4
  * A goal's outcome row (planning/team/18 RT-D16): its run's outcomes in numbers, written when its archive is, or by the
@@ -27,11 +28,15 @@ export interface DashGoalOutcome {
27
28
  afterApproval: DashGoalOutcomeContradiction[];
28
29
  /** Per check: seeded, its verdicts, caught later (check-counts.ts), without the review ids. */
29
30
  checks: DashGoalOutcomeCheck[];
31
+ /** `notRun`: runs closed «not run — the person's decision» (issues/closed/overseer-78) — counted in `runs`, never passed. */
30
32
  qa: {
31
33
  runs: number;
32
34
  passed: number;
33
35
  failed: number;
36
+ notRun?: number;
34
37
  };
38
+ /** Test authors' tasks closed «not run — the person's decision» (overseer-78): tests nobody wrote, by their decision. */
39
+ testsNotRun?: number;
35
40
  /** Per kind of task: how many, ms waited from created to first claim, ms worked from first claim to closed. */
36
41
  time: Partial<Record<DashTeamKind, {
37
42
  tasks: number;
@@ -69,9 +74,15 @@ export interface DashGoalOutcome {
69
74
  lessons?: DashGoalOutcomeLesson[];
70
75
  /**
71
76
  * Transcript mistakes LensMCP's recipes counted (planning/team/18 gate 7) — kept by the goal's retrospective, which
72
- * reads the transcripts; absent on a row no retrospective read.
77
+ * reads the transcripts; absent on a row no retrospective read. A row written since planning/team/26 R7 keeps the
78
+ * same counts in `roles.recipes` instead.
73
79
  */
74
80
  transcripts?: DashGoalTranscripts;
81
+ /**
82
+ * Whether the goal's agents did what their roles say (planning/team/26 R7), measured from their transcripts when the
83
+ * goal was archived, or later on demand. Absent on a row written before it, until measured: «not measured».
84
+ */
85
+ roles?: DashRoleFidelity;
75
86
  /** Items left out past a cap — the row counts what it read. */
76
87
  truncated?: {
77
88
  tasks?: number;
@@ -36,6 +36,16 @@ export interface DashGoalRetro {
36
36
  findings?: string[];
37
37
  merged?: string[];
38
38
  dropped?: string[];
39
+ /**
40
+ * Work in the project's own code the goal left undone or found, as the retrospective named it — not a team-file patch
41
+ * (those are findings) and not a LensMCP issue: at most 10, collected with the goal's follow-ups (Suggestions › Follow-ups).
42
+ */
43
+ followUps?: Array<{
44
+ title: string;
45
+ why: string;
46
+ evidence?: string[];
47
+ paths?: string[];
48
+ }>;
39
49
  /** The earlier proposals it graded before proposing (RT-D16). */
40
50
  graded?: Array<{
41
51
  id: string;
@@ -63,3 +73,14 @@ export interface DashGoalRetroAnswer {
63
73
  spentTodayUsd: number;
64
74
  };
65
75
  }
76
+ /**
77
+ * What a retrospective did with the queue behind the repository's ten open proposals (planning/team/26): a proposal
78
+ * that finds the ten places taken waits there — at most thirty, the one that came back most often first — and is
79
+ * dropped no more.
80
+ */
81
+ export interface DashGoalRetro {
82
+ /** This goal's proposals that wait, each in words: how often it has come back, and when it becomes a proposal. */
83
+ queued?: string[];
84
+ /** Findings made from the queue at this look, once a place was free. */
85
+ promoted?: string[];
86
+ }
@@ -0,0 +1,113 @@
1
+ /** What a lint run covered (`raw.coverage`): the lens replaces the findings of exactly those files. */
2
+ export type LintCoverageKind = 'tree' | 'paths' | 'changed' | 'incremental';
3
+ /** The saved status an incremental run was computed on top of: this checkout's own, or the main checkout's. */
4
+ export interface LintBaseRef {
5
+ from: 'own' | 'main';
6
+ sha: string;
7
+ run: string;
8
+ }
9
+ export interface LintCoverage {
10
+ kind: LintCoverageKind;
11
+ /** The checkout root, absolute: every path below is relative to it (`.` is the root). */
12
+ root: string;
13
+ dirs: string[];
14
+ /** Files linted one by one. On one event, the part of the list that event carries (`fileCount` counts them all). */
15
+ files: string[];
16
+ /** Files that are gone — deleted, or renamed away: their findings are dropped. Listed like `files`. */
17
+ gone: string[];
18
+ fileCount: number;
19
+ goneCount: number;
20
+ /** On a run's record in `lint://current`, whose `dirs` list is cut: how many folders it covered. */
21
+ dirCount?: number;
22
+ /** Files ESLint linted, and the ones it was given that its config ignores. */
23
+ linted: number;
24
+ notLinted?: number;
25
+ /** A changed run: the files git does not track yet, and the ref it compared with (HEAD without one). */
26
+ untracked?: number;
27
+ since?: string;
28
+ /** The commit the checkout was at, and whether it had uncommitted changes. */
29
+ head?: string;
30
+ dirty?: boolean;
31
+ /** Lintable files with uncommitted changes then: the next incremental run lints them again. `uncommittedMore`: too many to be a base. */
32
+ uncommitted?: string[];
33
+ uncommittedMore?: boolean;
34
+ /** A full or incremental run: each lint input at the root (ESLint's config, package.json, the lockfile, tsconfig) and its content hash — empty when it is not there. */
35
+ inputs?: Array<[string, string]>;
36
+ /** The folder whose lint this is (`.`); `projects`: only the workspace's projects in it were linted. */
37
+ folder?: string;
38
+ projects?: boolean;
39
+ base?: LintBaseRef;
40
+ /** A full run with ESLint's cache off (`--full`). */
41
+ fromZero?: boolean;
42
+ /** The caller passed ESLint its own arguments: the run counts only the files in ESLint's results, and nothing builds on it. */
43
+ narrowed?: boolean;
44
+ }
45
+ /** The event kind that carries the rest of a coverage list too long for the run's START. */
46
+ export declare const LINT_COVER_KIND = "lint-cover";
47
+ /** The uncommitted files a status remembers, at most: with more it is not a base. */
48
+ export declare const MAX_LINT_UNCOMMITTED = 500;
49
+ /** The coverage an event carries, checked; undefined when absent, malformed or cut by the bus clamp. */
50
+ export declare function readLintCoverage(raw: unknown): LintCoverage | undefined;
51
+ export interface LintBaseError {
52
+ /** Relative to the base's root. */
53
+ file: string;
54
+ line?: number;
55
+ column?: number;
56
+ rule: string;
57
+ message: string;
58
+ }
59
+ /** A saved full lint a run can build on (`lint://base`): what it was computed on, and what it holds. */
60
+ export interface LintBase {
61
+ /** Whose it is, as the answering lens sees it: its own checkout's, or the main checkout's. */
62
+ from: 'own' | 'main';
63
+ /** The checkout root it is of, the folder in it the full lint is of (`.`), and whether it linted the workspace's projects only. */
64
+ root: string;
65
+ folder: string;
66
+ projects?: boolean;
67
+ /** The run that last brought it up to date, when, and the commit it was computed on. */
68
+ run: string;
69
+ at: number;
70
+ sha?: string;
71
+ /** Why nothing can be built on it, when nothing can. */
72
+ unusable?: string;
73
+ /** Files and folders to lint again whatever git says: uncommitted then, or linted by a run of their own since. */
74
+ again: string[];
75
+ againDirs: string[];
76
+ inputs?: Array<[string, string]>;
77
+ full: {
78
+ at: number;
79
+ sha?: string;
80
+ fromZero?: boolean;
81
+ };
82
+ updates: number;
83
+ errorCount: number;
84
+ warningCount: number;
85
+ /** Every file with findings — path, errors, warnings — up to a cap (`moreFiles` past it). */
86
+ files: Array<[string, number, number]>;
87
+ moreFiles?: number;
88
+ errors: LintBaseError[];
89
+ moreErrors?: number;
90
+ }
91
+ export interface LintBaseAnswer {
92
+ schemaVersion: 1;
93
+ /** In order: this checkout's own saved lint, then the main checkout's. */
94
+ bases: LintBase[];
95
+ why?: string;
96
+ }
97
+ /** What the label is made of: `paths` are the folders and files covered, as the reader shows them (`.` is the whole checkout). */
98
+ export interface LintCoverageWords {
99
+ kind: LintCoverageKind;
100
+ paths: readonly string[];
101
+ more?: number;
102
+ files?: number;
103
+ gone?: number;
104
+ untracked?: number;
105
+ /** What a changed run compared with (HEAD without), or the commit an incremental run built on. */
106
+ since?: string;
107
+ narrowed?: boolean;
108
+ projects?: number;
109
+ }
110
+ /** What a run covered, in words: «whole checkout», «apps/web», «12 changed files since HEAD». */
111
+ export declare function lintCoverageLabel(c: LintCoverageWords, opts?: {
112
+ untracked?: boolean;
113
+ }): string;
@@ -0,0 +1 @@
1
+ "use strict";var C=Object.defineProperty;var p=(e,r)=>C(e,"name",{value:r,configurable:!0});var k=Object.defineProperty,h=p((e,r)=>k(e,"name",{value:r,configurable:!0}),"g"),A=Object.defineProperty,d=h((e,r)=>A(e,"name",{value:r,configurable:!0}),"i");import{TRUNCATION_MARKER_KEY as j}from"./bounded-clone.js";export const LINT_COVER_KIND="lint-cover",MAX_LINT_UNCOMMITTED=500;const L=["tree","paths","changed","incremental"],m=d(e=>Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.length>0):[],"strings"),i=d(e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0,"count"),l=d(e=>typeof e=="string"&&e?e:void 0,"text");export function readLintCoverage(e){if(!e||typeof e!="object"||e[j])return;const r=e.coverage;if(!r||typeof r!="object")return;const t=r,n=t.kind,a=t.root;if(!L.includes(n)||typeof a!="string"||!a)return;const u=m(t.dirs),o=m(t.files),g=m(t.gone),$=i(t.notLinted),y=i(t.untracked),s=t.base&&typeof t.base=="object"?t.base:void 0,v=s&&l(s.sha)&&l(s.run)?{from:s.from==="main"?"main":"own",sha:s.sha,run:s.run}:void 0,b=Array.isArray(t.inputs)?t.inputs.flatMap(f=>Array.isArray(f)&&typeof f[0]=="string"&&typeof f[1]=="string"?[[f[0],f[1]]]:[]):void 0;return{kind:n,root:a,dirs:u,files:o,gone:g,fileCount:i(t.fileCount)??o.length,goneCount:i(t.goneCount)??g.length,linted:i(t.linted)??0,...i(t.dirCount)!==void 0?{dirCount:i(t.dirCount)}:{},...$?{notLinted:$}:{},...y?{untracked:y}:{},...l(t.since)?{since:t.since}:{},...l(t.head)?{head:t.head}:{},...typeof t.dirty=="boolean"?{dirty:t.dirty}:{},...Array.isArray(t.uncommitted)?{uncommitted:m(t.uncommitted)}:{},...t.uncommittedMore===!0?{uncommittedMore:!0}:{},...b?{inputs:b}:{},...l(t.folder)?{folder:t.folder}:{},...t.projects===!0?{projects:!0}:{},...v?{base:v}:{},...t.fromZero===!0?{fromZero:!0}:{},...t.narrowed===!0?{narrowed:!0}:{}}}p(readLintCoverage,"readLintCoverage"),h(readLintCoverage,"readLintCoverage"),d(readLintCoverage,"readLintCoverage");const c=d((e,r)=>`${e} ${r}${e===1?"":"s"}`,"some");export function lintCoverageLabel(e,r={}){const t=e.files??0,n=e.gone??0;if(e.kind==="changed"){const o=`since ${e.since??"HEAD"}`;if(!t)return`${c(n,"deleted file")} ${o}`;const g=r.untracked&&e.untracked?` (${e.untracked} untracked)`:"";return`${c(t,"changed file")} ${o}${g}${n?`, ${n} deleted`:""}`}if(e.kind==="incremental"){const o=e.since?` since ${e.since.slice(0,7)}`:"";return!t&&!n?`nothing changed${o}`:t?`${c(t,"file")} changed${o}${n?`, ${n} deleted`:""}`:`${c(n,"file")} deleted${o}`}if(e.kind==="tree"&&e.projects)return`the workspace\u2019s ${c(e.projects,"project")}`;if(e.kind==="tree"&&e.paths[0]===".")return"whole checkout";if(e.narrowed)return`${c(t,"file")} ESLint linted with the caller\u2019s arguments`;const a=e.paths.slice(0,3).join(", "),u=(e.more??0)+Math.max(0,e.paths.length-3);return u?`${a} +${u} more`:a}p(lintCoverageLabel,"lintCoverageLabel"),h(lintCoverageLabel,"lintCoverageLabel"),d(lintCoverageLabel,"lintCoverageLabel");
package/lib/log-query.js CHANGED
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var a=(e,r)=>m(e,"name",{value:r,configurable:!0});var L=Object.defineProperty,c=a((e,r)=>L(e,"name",{value:r,configurable:!0}),"c");const d={level:"level",severity:"level",service:"service",svc:"service",src:"service",source:"service",flow:"flow",trace:"trace",request:"trace",category:"category",cat:"category",ms:"ms"},h={warn:"warning",err:"error"},p=/(-?)(?:([A-Za-z]+):)?(?:"([^"]*)"|(\S+))/g;export function parseLogQuery(e){const r=[],t=[];for(const s of e.matchAll(p)){const[o,n,f,w,g]=s,u=(w??g??"").trim(),i=f?d[f.toLowerCase()]:void 0;if(i&&u){const y=i==="level"?h[u.toLowerCase()]??u.toLowerCase():u;r.push({key:i,value:y,negate:n==="-"})}else o.trim()&&t.push(o.trim())}return{tokens:r,text:t.join(" ")}}a(parseLogQuery,"parseLogQuery"),c(parseLogQuery,"parseLogQuery");export function formatLogQuery(e){const r=c(t=>/\s/.test(t)?`"${t}"`:t,"quote");return[...e.tokens.map(t=>`${t.negate?"-":""}${t.key}:${r(t.value)}`),e.text].filter(Boolean).join(" ")}a(formatLogQuery,"formatLogQuery"),c(formatLogQuery,"formatLogQuery");function v(e,r){if(e===void 0)return!1;const t=/^(>=|<=|>|<|=)?\s*(\d+(?:\.\d+)?)$/.exec(r);if(!t)return!1;const s=Number(t[2]);switch(t[1]){case">":return e>s;case"<":return e<s;case"<=":return e<=s;case"=":return e===s;default:return e>=s}}a(v,"h"),c(v,"msMatches");function l(e,r){const t=r.value.toLowerCase();switch(r.key){case"level":return e.severity.toLowerCase()===t;case"service":return e.source.toLowerCase()===t;case"flow":return!!e.flowId&&e.flowId.toLowerCase().startsWith(t);case"trace":return!!e.requestId&&e.requestId.toLowerCase().startsWith(t);case"category":return e.category.toLowerCase()===t;case"ms":return v(e.durationMs,r.value)}}a(l,"i"),c(l,"tokenMatches");export function matchesLogQuery(e,r,t){const s=new Map;for(const o of r.tokens){if(o.negate){if(l(e,o))return!1;continue}const n=s.get(o.key);n?n.push(o):s.set(o.key,[o])}for(const o of s.values())if(!o.some(n=>l(e,n)))return!1;if(r.text){const o=`${e.title} ${e.message??""} ${e.source} ${e.flowId??""}`;return t?t(o):o.toLowerCase().includes(r.text.toLowerCase())}return!0}a(matchesLogQuery,"matchesLogQuery"),c(matchesLogQuery,"matchesLogQuery");
1
+ "use strict";var L=Object.defineProperty;var a=(e,t)=>L(e,"name",{value:t,configurable:!0});var d=Object.defineProperty,c=a((e,t)=>d(e,"name",{value:t,configurable:!0}),"a"),h=Object.defineProperty,u=c((e,t)=>h(e,"name",{value:t,configurable:!0}),"c");const p={level:"level",severity:"level",service:"service",svc:"service",src:"service",source:"service",flow:"flow",trace:"trace",request:"trace",category:"category",cat:"category",ms:"ms"},C={warn:"warning",err:"error"},k=/(-?)(?:([A-Za-z]+):)?(?:"([^"]*)"|(\S+))/g;export function parseLogQuery(e){const t=[],r=[];for(const s of e.matchAll(k)){const[o,n,g,y,w]=s,i=(y??w??"").trim(),l=g?p[g.toLowerCase()]:void 0;if(l&&i){const m=l==="level"?C[i.toLowerCase()]??i.toLowerCase():i;t.push({key:l,value:m,negate:n==="-"})}else o.trim()&&r.push(o.trim())}return{tokens:t,text:r.join(" ")}}a(parseLogQuery,"parseLogQuery"),c(parseLogQuery,"parseLogQuery"),u(parseLogQuery,"parseLogQuery");export function formatLogQuery(e){const t=u(r=>/\s/.test(r)?`"${r}"`:r,"quote");return[...e.tokens.map(r=>`${r.negate?"-":""}${r.key}:${t(r.value)}`),e.text].filter(Boolean).join(" ")}a(formatLogQuery,"formatLogQuery"),c(formatLogQuery,"formatLogQuery"),u(formatLogQuery,"formatLogQuery");function v(e,t){if(e===void 0)return!1;const r=/^(>=|<=|>|<|=)?\s*(\d+(?:\.\d+)?)$/.exec(t);if(!r)return!1;const s=Number(r[2]);switch(r[1]){case">":return e>s;case"<":return e<s;case"<=":return e<=s;case"=":return e===s;default:return e>=s}}a(v,"v"),c(v,"h"),u(v,"msMatches");function f(e,t){const r=t.value.toLowerCase();switch(t.key){case"level":return e.severity.toLowerCase()===r;case"service":return e.source.toLowerCase()===r;case"flow":return!!e.flowId&&e.flowId.toLowerCase().startsWith(r);case"trace":return!!e.requestId&&e.requestId.toLowerCase().startsWith(r);case"category":return e.category.toLowerCase()===r;case"ms":return v(e.durationMs,t.value)}}a(f,"l"),c(f,"i"),u(f,"tokenMatches");export function matchesLogQuery(e,t,r){const s=new Map;for(const o of t.tokens){if(o.negate){if(f(e,o))return!1;continue}const n=s.get(o.key);n?n.push(o):s.set(o.key,[o])}for(const o of s.values())if(!o.some(n=>f(e,n)))return!1;if(t.text){const o=`${e.title} ${e.message??""} ${e.source} ${e.flowId??""}`;return r?r(o):o.toLowerCase().includes(t.text.toLowerCase())}return!0}a(matchesLogQuery,"matchesLogQuery"),c(matchesLogQuery,"matchesLogQuery"),u(matchesLogQuery,"matchesLogQuery");
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var i=(t,e)=>a(t,"name",{value:e,configurable:!0});var S=Object.defineProperty,o=i((t,e)=>S(t,"name",{value:e,configurable:!0}),"s");import{LENS_EVENT_SOURCE as f}from"./error-dismissal.js";export const METRICS_RESET="metrics-reset",METRICS_RESTORED="metrics-restored",METRICS_SCOPES=["sql","external"],MAX_METRICS_RESET_IDS=500,MAX_METRICS_RESET_ID_LENGTH=512,METRICS_RESET_IDS_PER_EVENT=64;const l=16*1024,u=o(t=>t==="sql"||t==="external","isScope"),E=o(t=>typeof t=="string"&&t.length>0&&t.length<=MAX_METRICS_RESET_ID_LENGTH,"isId");export function readMetricsReset(t){if(t.source!==f||!t.raw||typeof t.raw!="object")return;const e=t.raw,r=e.kind;if(r!==METRICS_RESET&&r!==METRICS_RESTORED)return;const n=e.scope;if(!u(n))return;let s;if(e.ids!==void 0&&(!Array.isArray(e.ids)||(s=[...new Set(e.ids.filter(E))].slice(0,METRICS_RESET_IDS_PER_EVENT),!s.length)))return;if(r===METRICS_RESTORED)return{kind:r,scope:n,...s?{ids:s}:{}};const c=e.at;if(!(typeof c!="number"||!Number.isFinite(c)))return{kind:r,scope:n,at:Math.min(c,t.timestamp),...s?{ids:s}:{}}}i(readMetricsReset,"readMetricsReset"),o(readMetricsReset,"readMetricsReset");export function metricsIdBatches(t){const e=[];let r=[],n=0;for(const s of new Set(t.filter(E)))r.length&&(r.length>=METRICS_RESET_IDS_PER_EVENT||n+s.length+3>l)&&(e.push(r),r=[],n=0),r.push(s),n+=s.length+3;return r.length&&e.push(r),e}i(metricsIdBatches,"metricsIdBatches"),o(metricsIdBatches,"metricsIdBatches");
1
+ "use strict";var l=Object.defineProperty;var i=(e,t)=>l(e,"name",{value:t,configurable:!0});var f=Object.defineProperty,a=i((e,t)=>f(e,"name",{value:t,configurable:!0}),"i"),u=Object.defineProperty,c=a((e,t)=>u(e,"name",{value:t,configurable:!0}),"s");import{LENS_EVENT_SOURCE as S}from"./error-dismissal.js";export const METRICS_RESET="metrics-reset",METRICS_RESTORED="metrics-restored",METRICS_SCOPES=["sql","external"],MAX_METRICS_RESET_IDS=500,MAX_METRICS_RESET_ID_LENGTH=512,METRICS_RESET_IDS_PER_EVENT=64;const d=16*1024,p=c(e=>e==="sql"||e==="external","isScope"),E=c(e=>typeof e=="string"&&e.length>0&&e.length<=MAX_METRICS_RESET_ID_LENGTH,"isId");export function readMetricsReset(e){if(e.source!==S||!e.raw||typeof e.raw!="object")return;const t=e.raw,r=t.kind;if(r!==METRICS_RESET&&r!==METRICS_RESTORED)return;const n=t.scope;if(!p(n))return;let s;if(t.ids!==void 0&&(!Array.isArray(t.ids)||(s=[...new Set(t.ids.filter(E))].slice(0,METRICS_RESET_IDS_PER_EVENT),!s.length)))return;if(r===METRICS_RESTORED)return{kind:r,scope:n,...s?{ids:s}:{}};const o=t.at;if(!(typeof o!="number"||!Number.isFinite(o)))return{kind:r,scope:n,at:Math.min(o,e.timestamp),...s?{ids:s}:{}}}i(readMetricsReset,"readMetricsReset"),a(readMetricsReset,"readMetricsReset"),c(readMetricsReset,"readMetricsReset");export function metricsIdBatches(e){const t=[];let r=[],n=0;for(const s of new Set(e.filter(E)))r.length&&(r.length>=METRICS_RESET_IDS_PER_EVENT||n+s.length+3>d)&&(t.push(r),r=[],n=0),r.push(s),n+=s.length+3;return r.length&&t.push(r),t}i(metricsIdBatches,"metricsIdBatches"),a(metricsIdBatches,"metricsIdBatches"),c(metricsIdBatches,"metricsIdBatches");
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var i=(e,n)=>c(e,"name",{value:n,configurable:!0});var u=Object.defineProperty,o=i((e,n)=>u(e,"name",{value:n,configurable:!0}),"s");export const FINDING_RUN_KINDS=["operate","stop-launch","close-session","role","role-off","check","rule","flow","lesson"];export function findingLive(e){return e.state==="open"||e.state==="proposed"||e.state==="applied"}i(findingLive,"findingLive"),o(findingLive,"findingLive");export function findingRunsActions(e,n={}){return e.actions.some(s=>FINDING_RUN_KINDS.includes(s.kind)||s.kind==="issue"&&n.issuesFolder===!0)}i(findingRunsActions,"findingRunsActions"),o(findingRunsActions,"findingRunsActions");export function findingsForCheck(e,n,s){const r=`repo:${n}/team.${s}`;return e.filter(t=>findingLive(t)&&t.checks.includes(r))}i(findingsForCheck,"findingsForCheck"),o(findingsForCheck,"findingsForCheck");
1
+ "use strict";var u=Object.defineProperty;var i=(e,n)=>u(e,"name",{value:n,configurable:!0});var f=Object.defineProperty,s=i((e,n)=>f(e,"name",{value:n,configurable:!0}),"i"),d=Object.defineProperty,r=s((e,n)=>d(e,"name",{value:n,configurable:!0}),"s");export const FINDING_RUN_KINDS=["operate","stop-launch","close-session","role","role-off","check","rule","flow","lesson"];export function findingLive(e){return e.state==="open"||e.state==="proposed"||e.state==="applied"}i(findingLive,"findingLive"),s(findingLive,"findingLive"),r(findingLive,"findingLive");export function findingRunsActions(e,n={}){return e.actions.some(o=>FINDING_RUN_KINDS.includes(o.kind)||o.kind==="issue"&&n.issuesFolder===!0)}i(findingRunsActions,"findingRunsActions"),s(findingRunsActions,"findingRunsActions"),r(findingRunsActions,"findingRunsActions");export function findingsForCheck(e,n,o){const c=`repo:${n}/team.${o}`;return e.filter(t=>findingLive(t)&&t.checks.includes(c))}i(findingsForCheck,"findingsForCheck"),s(findingsForCheck,"findingsForCheck"),r(findingsForCheck,"findingsForCheck");
package/lib/perf-rules.js CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var o=(r,e)=>u(r,"name",{value:e,configurable:!0});var c=Object.defineProperty,a=o((r,e)=>c(r,"name",{value:e,configurable:!0}),"o");export const PERF_RULE_IDS=["bundle/heavy-barrel-import","pod/heap-budget","pod/retained-generation"],PERF_RULE_EVENT_KINDS=["perf-rule-finding","perf-rule-retracted","perf-rule-scan"],PERF_RULES_DOC="https://github.com/kiwiapps-ltd/lensmcp/blob/main/docs/lensmcp/concepts/memory-and-build-cost.mdx",PERF_RULE_DOCS={"bundle/heavy-barrel-import":`${PERF_RULES_DOC}#bundleheavy-barrel-import`,"pod/heap-budget":`${PERF_RULES_DOC}#podheap-budget`,"pod/retained-generation":`${PERF_RULES_DOC}#podretained-generation`};export function perfRuleFingerprint(r,e,n){return`perf-rule:${r}:${e}:${n}`}o(perfRuleFingerprint,"perfRuleFingerprint"),a(perfRuleFingerprint,"perfRuleFingerprint");export function perfRuleScanFingerprint(r,e){return`perf-rule-scan:${r}:${e}`}o(perfRuleScanFingerprint,"perfRuleScanFingerprint"),a(perfRuleScanFingerprint,"perfRuleScanFingerprint");const s=/^[a-z][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/,l=12,f=4e3,t=a((r,e=f)=>typeof r=="string"&&r.length>0&&r.length<=e,"isText");export function asPerfRuleRaw(r){if(!r||typeof r!="object")return;const e=r;if(!PERF_RULE_EVENT_KINDS.includes(e.kind)||typeof e.rule!="string"||!s.test(e.rule)||!t(e.project,512))return;if(e.kind==="perf-rule-scan"){const i=e.open;return!Array.isArray(i)||i.length>256||!i.every(p=>t(p,512))?void 0:r}if(!t(e.subject,512))return;if(e.kind==="perf-rule-retracted")return r;if(e.severity!=="warning"&&e.severity!=="error"||!t(e.title)||!t(e.summary)||!t(e.verify)||!t(e.docs,1024))return;const n=e.fix;if(!(!Array.isArray(n)||n.length===0||n.length>l||!n.every(i=>t(i)))&&!(!e.evidence||typeof e.evidence!="object"||Array.isArray(e.evidence))&&!(!e.cost||typeof e.cost!="object"||Array.isArray(e.cost)))return r}o(asPerfRuleRaw,"asPerfRuleRaw"),a(asPerfRuleRaw,"asPerfRuleRaw");
1
+ "use strict";var c=Object.defineProperty;var a=(r,e)=>c(r,"name",{value:e,configurable:!0});var l=Object.defineProperty,o=a((r,e)=>l(r,"name",{value:e,configurable:!0}),"o"),f=Object.defineProperty,p=o((r,e)=>f(r,"name",{value:e,configurable:!0}),"o");export const PERF_RULE_IDS=["bundle/heavy-barrel-import","pod/heap-budget","pod/retained-generation"],PERF_RULE_EVENT_KINDS=["perf-rule-finding","perf-rule-retracted","perf-rule-scan"],PERF_RULES_DOC="https://github.com/kiwiapps-ltd/lensmcp/blob/main/docs/lensmcp/concepts/memory-and-build-cost.mdx",PERF_RULE_DOCS={"bundle/heavy-barrel-import":`${PERF_RULES_DOC}#bundleheavy-barrel-import`,"pod/heap-budget":`${PERF_RULES_DOC}#podheap-budget`,"pod/retained-generation":`${PERF_RULES_DOC}#podretained-generation`};export function perfRuleFingerprint(r,e,n){return`perf-rule:${r}:${e}:${n}`}a(perfRuleFingerprint,"perfRuleFingerprint"),o(perfRuleFingerprint,"perfRuleFingerprint"),p(perfRuleFingerprint,"perfRuleFingerprint");export function perfRuleScanFingerprint(r,e){return`perf-rule-scan:${r}:${e}`}a(perfRuleScanFingerprint,"perfRuleScanFingerprint"),o(perfRuleScanFingerprint,"perfRuleScanFingerprint"),p(perfRuleScanFingerprint,"perfRuleScanFingerprint");const s=/^[a-z][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/,d=12,y=4e3,t=p((r,e=y)=>typeof r=="string"&&r.length>0&&r.length<=e,"isText");export function asPerfRuleRaw(r){if(!r||typeof r!="object")return;const e=r;if(!PERF_RULE_EVENT_KINDS.includes(e.kind)||typeof e.rule!="string"||!s.test(e.rule)||!t(e.project,512))return;if(e.kind==="perf-rule-scan"){const i=e.open;return!Array.isArray(i)||i.length>256||!i.every(u=>t(u,512))?void 0:r}if(!t(e.subject,512))return;if(e.kind==="perf-rule-retracted")return r;if(e.severity!=="warning"&&e.severity!=="error"||!t(e.title)||!t(e.summary)||!t(e.verify)||!t(e.docs,1024))return;const n=e.fix;if(!(!Array.isArray(n)||n.length===0||n.length>d||!n.every(i=>t(i)))&&!(!e.evidence||typeof e.evidence!="object"||Array.isArray(e.evidence))&&!(!e.cost||typeof e.cost!="object"||Array.isArray(e.cost)))return r}a(asPerfRuleRaw,"asPerfRuleRaw"),o(asPerfRuleRaw,"asPerfRuleRaw"),p(asPerfRuleRaw,"asPerfRuleRaw");
@@ -55,6 +55,8 @@ export interface PodMemoryReportRaw extends PodMemoryIdentityRaw {
55
55
  baseline?: number;
56
56
  /** How long the collection paused the pod, ms. */
57
57
  gcMs: number;
58
+ /** How long requests in flight held it back, ms, when they did. */
59
+ deferredMs?: number;
58
60
  /** The generation the latest swap replaced. */
59
61
  previousGen?: number;
60
62
  /** Is it still in memory? `null` when there is none. */
package/lib/pod-memory.js CHANGED
@@ -1 +1 @@
1
- "use strict";var t=Object.defineProperty;var r=(o,e)=>t(o,"name",{value:e,configurable:!0});var d=Object.defineProperty,m=r((o,e)=>d(o,"name",{value:e,configurable:!0}),"r");export const POD_MEMORY_KINDS=["pod-memory","pod-memory-retained","pod-memory-released","pod-memory-exited"];export function asPodMemoryRaw(o){if(!o||typeof o!="object")return;const e=o;if(POD_MEMORY_KINDS.includes(e.kind)&&!(typeof e.project!="string"||!e.project)&&!(typeof e.pod!="number"||typeof e.pid!="number")&&!(e.kind==="pod-memory"&&(typeof e.live!="number"||!Number.isFinite(e.live)))&&!((e.kind==="pod-memory-retained"||e.kind==="pod-memory-released")&&typeof e.gen!="number"))return o}r(asPodMemoryRaw,"asPodMemoryRaw"),m(asPodMemoryRaw,"asPodMemoryRaw");
1
+ "use strict";var n=Object.defineProperty;var o=(r,e)=>n(r,"name",{value:e,configurable:!0});var d=Object.defineProperty,t=o((r,e)=>d(r,"name",{value:e,configurable:!0}),"r"),m=Object.defineProperty,i=t((r,e)=>m(r,"name",{value:e,configurable:!0}),"r");export const POD_MEMORY_KINDS=["pod-memory","pod-memory-retained","pod-memory-released","pod-memory-exited"];export function asPodMemoryRaw(r){if(!r||typeof r!="object")return;const e=r;if(POD_MEMORY_KINDS.includes(e.kind)&&!(typeof e.project!="string"||!e.project)&&!(typeof e.pod!="number"||typeof e.pid!="number")&&!(e.kind==="pod-memory"&&(typeof e.live!="number"||!Number.isFinite(e.live)))&&!((e.kind==="pod-memory-retained"||e.kind==="pod-memory-released")&&typeof e.gen!="number"))return r}o(asPodMemoryRaw,"asPodMemoryRaw"),t(asPodMemoryRaw,"asPodMemoryRaw"),i(asPodMemoryRaw,"asPodMemoryRaw");
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var i=(t,o)=>m(t,"name",{value:o,configurable:!0});var R=Object.defineProperty,p=i((t,o)=>R(t,"name",{value:o,configurable:!0}),"u");import{z as e}from"zod";export const ProducerStateSchema=e.enum(["none","connected"]),ProducerRunStatusSchema=e.enum(["running","clean","failing","error"]),ProducerReportSchema=e.object({id:e.string(),tool:e.string(),project:e.string().optional(),firstReportedAt:e.number().int().nonnegative(),lastReportedAt:e.number().int().nonnegative(),lastRunStatus:ProducerRunStatusSchema,lastRunDurationMs:e.number().int().nonnegative().optional(),errorCount:e.number().int().nonnegative(),warningCount:e.number().int().nonnegative().optional(),error:e.string().optional()}),ProducerHealthSchema=e.object({producer:ProducerStateSchema,producers:e.array(ProducerReportSchema),lastReportedAt:e.number().int().nonnegative().optional(),ageMs:e.number().int().nonnegative().optional(),stale:e.boolean(),detail:e.string()}),PRODUCER_STALE_AFTER_MS=10*6e4;export function summariseProducers(t){const o=t.now??Date.now(),n=[...t.producers].sort((r,h)=>h.lastReportedAt-r.lastReportedAt);if(n.length===0)return{producer:"none",producers:[],stale:!1,detail:`No ${t.domain} producer has ever reported into this session \u2014 this is NOT a clean result, nothing is watching. ${t.noProducerHint}`};const d=n[0].lastReportedAt,u=Math.max(0,o-d),l=u>PRODUCER_STALE_AFTER_MS,c=n.filter(r=>r.lastRunStatus==="failing"),s=n.filter(r=>r.lastRunStatus==="error"),a=[`${n.length} ${t.domain} producer${n.length===1?"":"s"} reporting (${n.map(r=>r.id).join(", ")}); newest report ${g(u)}.`];return s.length>0&&a.push(`${s.length} produced NO verdict (the tool itself failed): ${s.map(r=>`${r.id} \u2014 ${r.error??"unknown error"}`).join("; ")}.`),c.length>0&&a.push(`${c.length} reporting errors.`),l&&a.push(`Older than ${Math.round(PRODUCER_STALE_AFTER_MS/6e4)}m \u2014 the verdict may predate the current source.`),{producer:"connected",producers:n,lastReportedAt:d,ageMs:u,stale:l,detail:a.join(" ")}}i(summariseProducers,"summariseProducers"),p(summariseProducers,"summariseProducers");function g(t){return t<1e3?"just now":t<6e4?`${Math.round(t/1e3)}s ago`:t<36e5?`${Math.round(t/6e4)}m ago`:`${Math.round(t/36e5)}h ago`}i(g,"g"),p(g,"describeAge");
1
+ "use strict";var R=Object.defineProperty;var i=(e,o)=>R(e,"name",{value:o,configurable:!0});var $=Object.defineProperty,d=i((e,o)=>$(e,"name",{value:o,configurable:!0}),"i"),b=Object.defineProperty,m=d((e,o)=>b(e,"name",{value:o,configurable:!0}),"u");import{z as r}from"zod";export const ProducerStateSchema=r.enum(["none","connected"]),ProducerRunStatusSchema=r.enum(["running","clean","failing","error"]),ProducerReportSchema=r.object({id:r.string(),tool:r.string(),project:r.string().optional(),firstReportedAt:r.number().int().nonnegative(),lastReportedAt:r.number().int().nonnegative(),lastRunStatus:ProducerRunStatusSchema,lastRunDurationMs:r.number().int().nonnegative().optional(),errorCount:r.number().int().nonnegative(),warningCount:r.number().int().nonnegative().optional(),error:r.string().optional()}),ProducerHealthSchema=r.object({producer:ProducerStateSchema,producers:r.array(ProducerReportSchema),lastReportedAt:r.number().int().nonnegative().optional(),ageMs:r.number().int().nonnegative().optional(),stale:r.boolean(),detail:r.string()}),PRODUCER_STALE_AFTER_MS=10*6e4;export function summariseProducers(e){const o=e.now??Date.now(),t=[...e.producers].sort((n,h)=>h.lastReportedAt-n.lastReportedAt);if(t.length===0)return{producer:"none",producers:[],stale:!1,detail:`No ${e.domain} producer has ever reported into this session \u2014 this is NOT a clean result, nothing is watching. ${e.noProducerHint}`};const l=t[0].lastReportedAt,u=Math.max(0,o-l),p=u>PRODUCER_STALE_AFTER_MS,g=t.filter(n=>n.lastRunStatus==="failing"),s=t.filter(n=>n.lastRunStatus==="error"),a=[`${t.length} ${e.domain} producer${t.length===1?"":"s"} reporting (${t.map(n=>n.id).join(", ")}); newest report ${c(u)}.`];return s.length>0&&a.push(`${s.length} produced NO verdict (the tool itself failed): ${s.map(n=>`${n.id} \u2014 ${n.error??"unknown error"}`).join("; ")}.`),g.length>0&&a.push(`${g.length} reporting errors.`),p&&a.push(`Older than ${Math.round(PRODUCER_STALE_AFTER_MS/6e4)}m \u2014 the verdict may predate the current source.`),{producer:"connected",producers:t,lastReportedAt:l,ageMs:u,stale:p,detail:a.join(" ")}}i(summariseProducers,"summariseProducers"),d(summariseProducers,"summariseProducers"),m(summariseProducers,"summariseProducers");function c(e){return e<1e3?"just now":e<6e4?`${Math.round(e/1e3)}s ago`:e<36e5?`${Math.round(e/6e4)}m ago`:`${Math.round(e/36e5)}h ago`}i(c,"g"),d(c,"g"),m(c,"describeAge");