@lensmcp/protocol-types 1.24.5 → 1.25.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.
package/lib/dashboard.js CHANGED
@@ -1 +1 @@
1
- "use strict";export const DASHBOARD_PROTOCOL=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","other"];
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var s=(t,r)=>f(t,"name",{value:r,configurable:!0});var E=Object.defineProperty,S=s((t,r)=>E(t,"name",{value:r,configurable:!0}),"s");export const ERROR_DISMISSED="error-dismissed",ERROR_RESTORED="error-restored",LENS_EVENT_SOURCE="lens",MAX_DISMISSAL_EVENT_IDS=200;const g=2048;export const MAX_DISMISSAL_REASON_CHARS=500;const m=300,I=new Set(["dashboard","cli","agent"]);export function readErrorDismissal(t){if(t.source!==LENS_EVENT_SOURCE||!t.raw||typeof t.raw!="object")return;const r=t.raw,i=r.groupId;if(typeof i!="string"||i.length===0||i.length>2048)return;if(r.kind===ERROR_RESTORED)return{kind:ERROR_RESTORED,groupId:i};if(r.kind!==ERROR_DISMISSED)return;const n=r.until;if(typeof n!="number"||!Number.isFinite(n))return;const c=Array.isArray(r.eventIds)?r.eventIds.filter(e=>typeof e=="string"&&e.length>0).slice(0,200):[],o=I.has(r.by)?r.by:void 0,a=S((e,l)=>typeof e=="string"&&e.trim()?e.trim().slice(0,l):void 0,"text"),d=a(r.reason,500),u=a(r.title,300);return{kind:ERROR_DISMISSED,groupId:i,until:Math.min(n,t.timestamp),eventIds:c,...o?{by:o}:{},...d?{reason:d}:{},...u?{title:u}:{}}}s(readErrorDismissal,"readErrorDismissal"),S(readErrorDismissal,"readErrorDismissal");
1
+ "use strict";var E=Object.defineProperty;var s=(e,r)=>E(e,"name",{value:r,configurable:!0});var m=Object.defineProperty,c=s((e,r)=>m(e,"name",{value:r,configurable:!0}),"s"),p=Object.defineProperty,l=c((e,r)=>p(e,"name",{value:r,configurable:!0}),"s");export const ERROR_DISMISSED="error-dismissed",ERROR_RESTORED="error-restored",LENS_EVENT_SOURCE="lens",MAX_DISMISSAL_EVENT_IDS=200;const y=2048;export const MAX_DISMISSAL_REASON_CHARS=500;const b=300,I=new Set(["dashboard","cli","agent"]);export function readErrorDismissal(e){if(e.source!==LENS_EVENT_SOURCE||!e.raw||typeof e.raw!="object")return;const r=e.raw,i=r.groupId;if(typeof i!="string"||i.length===0||i.length>2048)return;if(r.kind===ERROR_RESTORED)return{kind:ERROR_RESTORED,groupId:i};if(r.kind!==ERROR_DISMISSED)return;const n=r.until;if(typeof n!="number"||!Number.isFinite(n))return;const f=Array.isArray(r.eventIds)?r.eventIds.filter(t=>typeof t=="string"&&t.length>0).slice(0,200):[],o=I.has(r.by)?r.by:void 0,a=l((t,S)=>typeof t=="string"&&t.trim()?t.trim().slice(0,S):void 0,"text"),d=a(r.reason,500),u=a(r.title,300);return{kind:ERROR_DISMISSED,groupId:i,until:Math.min(n,e.timestamp),eventIds:f,...o?{by:o}:{},...d?{reason:d}:{},...u?{title:u}:{}}}s(readErrorDismissal,"readErrorDismissal"),c(readErrorDismissal,"readErrorDismissal"),l(readErrorDismissal,"readErrorDismissal");
package/lib/event.d.ts CHANGED
@@ -43,13 +43,14 @@ export declare const EventCategorySchema: z.ZodEnum<{
43
43
  performance: "performance";
44
44
  deps: "deps";
45
45
  cluster: "cluster";
46
+ agent: "agent";
46
47
  }>;
47
48
  export type EventCategory = z.infer<typeof EventCategorySchema>;
48
49
  export declare const SeveritySchema: z.ZodEnum<{
50
+ error: "error";
49
51
  debug: "debug";
50
52
  info: "info";
51
53
  warning: "warning";
52
- error: "error";
53
54
  fatal: "fatal";
54
55
  }>;
55
56
  export type Severity = z.infer<typeof SeveritySchema>;
@@ -100,12 +101,13 @@ export declare const BaseEventSchema: z.ZodObject<{
100
101
  performance: "performance";
101
102
  deps: "deps";
102
103
  cluster: "cluster";
104
+ agent: "agent";
103
105
  }>;
104
106
  severity: z.ZodEnum<{
107
+ error: "error";
105
108
  debug: "debug";
106
109
  info: "info";
107
110
  warning: "warning";
108
- error: "error";
109
111
  fatal: "fatal";
110
112
  }>;
111
113
  context: z.ZodObject<{
package/lib/event.js CHANGED
@@ -1 +1 @@
1
- "use strict";import{z as e}from"zod";import{SourceLocationSchema as t}from"./source-location.js";import{TraceContextSchema as r}from"./context.js";export const EventSourceSchema=e.enum(["nx","vite","typescript","eslint","rollup","client-runtime","chrome","react","valtio","nestjs","nextjs","db","redis","queue","memory","visual","perf","security","gateway","external","ai","lens"]),EventCategorySchema=e.enum(["build","lint","typecheck","test","runtime","render","visual","trace","state","network","backend","db","memory","performance","security","deps","cluster","ai"]),SeveritySchema=e.enum(["debug","info","warning","error","fatal"]),BaseEventSchema=e.object({id:e.string(),sessionId:e.string(),timestamp:e.number().int().nonnegative(),source:EventSourceSchema,category:EventCategorySchema,severity:SeveritySchema,context:r,fingerprint:e.string(),title:e.string(),message:e.string().optional(),location:t.optional(),relatedFiles:e.array(e.string()).optional(),relatedUrls:e.array(e.string()).optional(),raw:e.unknown().optional()});
1
+ "use strict";import{z as e}from"zod";import{SourceLocationSchema as t}from"./source-location.js";import{TraceContextSchema as r}from"./context.js";export const EventSourceSchema=e.enum(["nx","vite","typescript","eslint","rollup","client-runtime","chrome","react","valtio","nestjs","nextjs","db","redis","queue","memory","visual","perf","security","gateway","external","ai","lens"]),EventCategorySchema=e.enum(["build","lint","typecheck","test","runtime","render","visual","trace","state","network","backend","db","memory","performance","security","deps","cluster","ai","agent"]),SeveritySchema=e.enum(["debug","info","warning","error","fatal"]),BaseEventSchema=e.object({id:e.string(),sessionId:e.string(),timestamp:e.number().int().nonnegative(),source:EventSourceSchema,category:EventCategorySchema,severity:SeveritySchema,context:r,fingerprint:e.string(),title:e.string(),message:e.string().optional(),location:t.optional(),relatedFiles:e.array(e.string()).optional(),relatedUrls:e.array(e.string()).optional(),raw:e.unknown().optional()});
@@ -1 +1 @@
1
- "use strict";var S=Object.defineProperty;var i=(t,n)=>S(t,"name",{value:n,configurable:!0});var m=Object.defineProperty,u=i((t,n)=>m(t,"name",{value:n,configurable:!0}),"o");function d(){const t=typeof process<"u"?process.env?.LENSMCP_EVENT_MAX_EPS:void 0;if(t===void 0||t==="")return;if(t==="off")return"off";const n=Number(t);if(Number.isFinite(n))return n<=0?"off":n}i(d,"S"),u(d,"envPerSec");export function createEventFloodGuard(t){const n=t?.envOverride===!1?void 0:d();if(n==="off")return{admit:u(()=>({ok:!0,suppressed:0}),"admit")};const l=n??t?.perSec??5,f=Math.max(1,t?.burst??Math.max(30,l*4)),c=t?.maxKeys??2048,r=new Map,p=u(o=>{for(const[s,e]of r)o-e.lastSeenAt>6e4&&r.delete(s);if(r.size>c){const s=[...r.entries()].sort((e,a)=>e[1].lastSeenAt-a[1].lastSeenAt);for(let e=0;e<s.length>>1;e++)r.delete(s[e][0])}},"evictStale");return{admit(o){const s=Date.now();let e=r.get(o);e||(r.size>=c&&p(s),e={tokens:f,lastRefillAt:s,suppressed:0,lastSeenAt:s},r.set(o,e)),e.lastSeenAt=s;const a=s-e.lastRefillAt;if(a>0&&(e.tokens=Math.min(f,e.tokens+a/1e3*l),e.lastRefillAt=s),e.tokens>=1){e.tokens-=1;const v=e.suppressed;return e.suppressed=0,{ok:!0,suppressed:v}}return e.suppressed+=1,{ok:!1,suppressed:0}}}}i(createEventFloodGuard,"createEventFloodGuard"),u(createEventFloodGuard,"createEventFloodGuard");
1
+ "use strict";var S=Object.defineProperty;var i=(t,s)=>S(t,"name",{value:s,configurable:!0});var A=Object.defineProperty,f=i((t,s)=>A(t,"name",{value:s,configurable:!0}),"i"),k=Object.defineProperty,u=f((t,s)=>k(t,"name",{value:s,configurable:!0}),"o");function l(){const t=typeof process<"u"?process.env?.LENSMCP_EVENT_MAX_EPS:void 0;if(t===void 0||t==="")return;if(t==="off")return"off";const s=Number(t);if(Number.isFinite(s))return s<=0?"off":s}i(l,"d"),f(l,"S"),u(l,"envPerSec");export function createEventFloodGuard(t){const s=t?.envOverride===!1?void 0:l();if(s==="off")return{admit:u(()=>({ok:!0,suppressed:0}),"admit")};const c=s??t?.perSec??5,d=Math.max(1,t?.burst??Math.max(30,c*4)),p=t?.maxKeys??2048,n=new Map,v=u(o=>{for(const[r,e]of n)o-e.lastSeenAt>6e4&&n.delete(r);if(n.size>p){const r=[...n.entries()].sort((e,a)=>e[1].lastSeenAt-a[1].lastSeenAt);for(let e=0;e<r.length>>1;e++)n.delete(r[e][0])}},"evictStale");return{admit(o){const r=Date.now();let e=n.get(o);e||(n.size>=p&&v(r),e={tokens:d,lastRefillAt:r,suppressed:0,lastSeenAt:r},n.set(o,e)),e.lastSeenAt=r;const a=r-e.lastRefillAt;if(a>0&&(e.tokens=Math.min(d,e.tokens+a/1e3*c),e.lastRefillAt=r),e.tokens>=1){e.tokens-=1;const m=e.suppressed;return e.suppressed=0,{ok:!0,suppressed:m}}return e.suppressed+=1,{ok:!1,suppressed:0}}}}i(createEventFloodGuard,"createEventFloodGuard"),f(createEventFloodGuard,"createEventFloodGuard"),u(createEventFloodGuard,"createEventFloodGuard");
@@ -0,0 +1,80 @@
1
+ /**
2
+ * One HTTP exchange the lens captured (R6): a service's outbound call as it went over the wire — its request and
3
+ * response headers (redacted), the query string and the bodies (redacted, the first 64 KB of each), and for a
4
+ * server-sent-events response every event with the moment it arrived. Kept OFF the bus, one file per exchange under
5
+ * `.lensmcp/http/`; the bus event carries its `exchangeId`. Capture: `LENSMCP_HTTP_CAPTURE=off | headers | bodies`.
6
+ *
7
+ * An AI provider's call keeps its conversation out of here: its headers, sizes and stream timing are captured, its
8
+ * prompt and completion only by the AI tap, opt-in (`LENSMCP_AI_CAPTURE=content`).
9
+ */
10
+ export interface HttpExchangeBody {
11
+ contentType: string;
12
+ /** Every byte it had, kept or not. */
13
+ size: number;
14
+ /** The bytes kept as text (the first 64 KB). */
15
+ kept: number;
16
+ text?: string;
17
+ /** A binary body: its digest instead of its bytes (when it was small enough to hash). */
18
+ sha256?: string;
19
+ truncated: boolean;
20
+ /** Why there is no text: `binary`, `form-data`, `stream` (a request body sent as a stream), `ai`. */
21
+ omitted?: 'binary' | 'form-data' | 'stream' | 'ai';
22
+ }
23
+ export interface HttpExchangeStreamEvent {
24
+ /** Since the request started. */
25
+ atMs: number;
26
+ event: string;
27
+ bytes: number;
28
+ /** Its data, redacted, at most 4 KB — absent for an AI provider's stream. */
29
+ data?: string;
30
+ }
31
+ export interface HttpExchange {
32
+ schemaVersion: 1;
33
+ id: string;
34
+ capturedAt: number;
35
+ side: 'egress';
36
+ service?: string;
37
+ flowId?: string;
38
+ requestId?: string;
39
+ method: string;
40
+ /** Scheme, host and path — the query is in `request.query`, redacted. */
41
+ url: string;
42
+ host: string;
43
+ path: string;
44
+ status?: number;
45
+ statusText?: string;
46
+ /** A transport error: refused, reset, timed out, aborted. */
47
+ error?: string;
48
+ startedAt: number;
49
+ /** When the response headers arrived. */
50
+ ttfbMs?: number;
51
+ /** When the body ended (or the call failed). */
52
+ durationMs?: number;
53
+ capture: 'headers' | 'bodies';
54
+ request: {
55
+ headers: Array<[string, string]>;
56
+ query?: Array<[string, string]>;
57
+ body?: HttpExchangeBody;
58
+ };
59
+ response: {
60
+ headers: Array<[string, string]>;
61
+ body?: HttpExchangeBody;
62
+ stream?: {
63
+ protocol: 'sse';
64
+ firstEventMs?: number;
65
+ events: HttpExchangeStreamEvent[];
66
+ bytes: number;
67
+ total: number;
68
+ cut?: boolean;
69
+ };
70
+ };
71
+ /** What the lens removed before storing: header names, and body fields (paths). */
72
+ redacted: {
73
+ headers: string[];
74
+ bodyFields: string[];
75
+ };
76
+ /** An AI provider's call: no conversation here (see above). */
77
+ ai?: {
78
+ provider: string;
79
+ };
80
+ }
@@ -0,0 +1 @@
1
+ "use strict";export{};
@@ -0,0 +1,30 @@
1
+ import type { DashLogLine } from './dashboard.js';
2
+ /**
3
+ * The Logs query language, shared by the dashboard server (`/api/logs?query=`) and the UI, so a query
4
+ * means the same thing whether the ring is filtered on the server or a live tail in the browser.
5
+ *
6
+ * level:error service:engine -category:sql trace:mvc8tc6 ms:>500 timeout
7
+ *
8
+ * `key:value` tokens and free text. The same key twice is OR (`level:error level:warning`), different
9
+ * keys are AND; `-key:value` excludes. Values with spaces are quoted (`service:"my api"`). Free text
10
+ * matches the title, message, service and flow id, case-insensitively. A token with an unknown key is
11
+ * free text, so a URL like `GET:/x` is still searchable.
12
+ */
13
+ export type LogQueryKey = 'level' | 'service' | 'flow' | 'trace' | 'category' | 'ms';
14
+ export interface LogQueryToken {
15
+ key: LogQueryKey;
16
+ value: string;
17
+ negate: boolean;
18
+ }
19
+ export interface ParsedLogQuery {
20
+ tokens: LogQueryToken[];
21
+ /** The free text, words joined by single spaces. */
22
+ text: string;
23
+ }
24
+ export declare function parseLogQuery(input: string): ParsedLogQuery;
25
+ export declare function formatLogQuery(q: ParsedLogQuery): string;
26
+ /**
27
+ * Whether a line passes the query. `textMatch` replaces the plain substring test of the free text —
28
+ * the UI passes a compiled regex there in its Regex mode.
29
+ */
30
+ export declare function matchesLogQuery(line: DashLogLine, q: ParsedLogQuery, textMatch?: (haystack: string) => boolean): boolean;
@@ -0,0 +1 @@
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");
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");
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");
@@ -14,18 +14,18 @@ export declare const ResourceEnvelopeSchema: z.ZodObject<{
14
14
  export type ResourceEnvelope = z.infer<typeof ResourceEnvelopeSchema>;
15
15
  export declare const AgentStatusKindSchema: z.ZodEnum<{
16
16
  warning: "warning";
17
- starting: "starting";
18
17
  clean: "clean";
19
18
  failing: "failing";
19
+ starting: "starting";
20
20
  }>;
21
21
  export type AgentStatusKind = z.infer<typeof AgentStatusKindSchema>;
22
22
  export declare const AgentBlockingItemSchema: z.ZodObject<{
23
23
  source: z.ZodString;
24
24
  severity: z.ZodEnum<{
25
+ error: "error";
25
26
  debug: "debug";
26
27
  info: "info";
27
28
  warning: "warning";
28
- error: "error";
29
29
  fatal: "fatal";
30
30
  }>;
31
31
  title: z.ZodString;
@@ -114,19 +114,19 @@ export declare const AgentCurrentStatusSchema: z.ZodObject<{
114
114
  sessionId: z.ZodString;
115
115
  status: z.ZodEnum<{
116
116
  warning: "warning";
117
- starting: "starting";
118
117
  clean: "clean";
119
118
  failing: "failing";
119
+ starting: "starting";
120
120
  }>;
121
121
  activeTab: z.ZodOptional<z.ZodString>;
122
122
  tabsWithIssues: z.ZodOptional<z.ZodArray<z.ZodString>>;
123
123
  blocking: z.ZodArray<z.ZodObject<{
124
124
  source: z.ZodString;
125
125
  severity: z.ZodEnum<{
126
+ error: "error";
126
127
  debug: "debug";
127
128
  info: "info";
128
129
  warning: "warning";
129
- error: "error";
130
130
  fatal: "fatal";
131
131
  }>;
132
132
  title: z.ZodString;
@@ -150,10 +150,10 @@ export declare const AgentCurrentStatusSchema: z.ZodObject<{
150
150
  warnings: z.ZodDefault<z.ZodArray<z.ZodObject<{
151
151
  source: z.ZodString;
152
152
  severity: z.ZodEnum<{
153
+ error: "error";
153
154
  debug: "debug";
154
155
  info: "info";
155
156
  warning: "warning";
156
- error: "error";
157
157
  fatal: "fatal";
158
158
  }>;
159
159
  title: z.ZodString;
@@ -327,10 +327,10 @@ declare const CheckEntrySchema: z.ZodObject<{
327
327
  code: z.ZodOptional<z.ZodString>;
328
328
  rule: z.ZodOptional<z.ZodString>;
329
329
  severity: z.ZodOptional<z.ZodEnum<{
330
+ error: "error";
330
331
  debug: "debug";
331
332
  info: "info";
332
333
  warning: "warning";
333
- error: "error";
334
334
  fatal: "fatal";
335
335
  }>>;
336
336
  file: z.ZodOptional<z.ZodString>;
@@ -356,9 +356,9 @@ export declare const TypecheckCurrentSchema: z.ZodObject<{
356
356
  lastReportedAt: z.ZodNumber;
357
357
  lastRunStatus: z.ZodEnum<{
358
358
  error: "error";
359
+ running: "running";
359
360
  clean: "clean";
360
361
  failing: "failing";
361
- running: "running";
362
362
  }>;
363
363
  lastRunDurationMs: z.ZodOptional<z.ZodNumber>;
364
364
  errorCount: z.ZodNumber;
@@ -395,9 +395,9 @@ export declare const TypecheckErrorsSchema: z.ZodObject<{
395
395
  lastReportedAt: z.ZodNumber;
396
396
  lastRunStatus: z.ZodEnum<{
397
397
  error: "error";
398
+ running: "running";
398
399
  clean: "clean";
399
400
  failing: "failing";
400
- running: "running";
401
401
  }>;
402
402
  lastRunDurationMs: z.ZodOptional<z.ZodNumber>;
403
403
  errorCount: z.ZodNumber;
@@ -416,10 +416,10 @@ export declare const TypecheckErrorsSchema: z.ZodObject<{
416
416
  code: z.ZodOptional<z.ZodString>;
417
417
  rule: z.ZodOptional<z.ZodString>;
418
418
  severity: z.ZodOptional<z.ZodEnum<{
419
+ error: "error";
419
420
  debug: "debug";
420
421
  info: "info";
421
422
  warning: "warning";
422
- error: "error";
423
423
  fatal: "fatal";
424
424
  }>>;
425
425
  file: z.ZodOptional<z.ZodString>;
@@ -446,9 +446,9 @@ export declare const LintCurrentSchema: z.ZodObject<{
446
446
  lastReportedAt: z.ZodNumber;
447
447
  lastRunStatus: z.ZodEnum<{
448
448
  error: "error";
449
+ running: "running";
449
450
  clean: "clean";
450
451
  failing: "failing";
451
- running: "running";
452
452
  }>;
453
453
  lastRunDurationMs: z.ZodOptional<z.ZodNumber>;
454
454
  errorCount: z.ZodNumber;
@@ -487,9 +487,9 @@ export declare const BuildCurrentSchema: z.ZodObject<{
487
487
  lastReportedAt: z.ZodNumber;
488
488
  lastRunStatus: z.ZodEnum<{
489
489
  error: "error";
490
+ running: "running";
490
491
  clean: "clean";
491
492
  failing: "failing";
492
- running: "running";
493
493
  }>;
494
494
  lastRunDurationMs: z.ZodOptional<z.ZodNumber>;
495
495
  errorCount: z.ZodNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/protocol-types",
3
- "version": "1.24.5",
3
+ "version": "1.25.1",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",