@lensmcp/protocol-types 1.18.14 → 1.20.0

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/node.js CHANGED
@@ -1 +1 @@
1
- "use strict";import{z as e}from"zod";import{SourceLocationSchema as t}from"./source-location.js";import{TraceContextSchema as n}from"./context.js";export const TraceNodeTypeSchema=e.enum(["session","browser-context","tab","renderer","router","route","page","component","element","slot","render","react-mount","react-unmount","hook","effect","effect-run","memo","memo-compute","ui-event","handler","animation","animation-frame","transition","timer","api-client-call","http-request","http-response","server-process","nest-app","nest-module","nest-provider","singleton-instance","server-request","guard","controller","service-method","loop","loop-iteration","queue-job","db-query","redis-op","promise","promise-continuation","state-store","state-update","selector","selector-update","visual-frame","visual-violation","style-change","layout-change","memory-owner","memory-mutation","memory-retention","heap-snapshot","build-event","lint-event","typecheck-event","test-event","bundle-report","hmr-update"]),LifecycleSchema=e.enum(["created","active","completed","disposed","errored"]),TraceNodeSchema=e.object({id:e.string(),parentTraceNodeId:e.string().optional(),type:TraceNodeTypeSchema,logicalId:e.string().optional(),instanceId:e.string().optional(),generation:e.number().int().nonnegative().optional(),lifecycle:LifecycleSchema,context:n,name:e.string(),startTime:e.number().int().nonnegative(),endTime:e.number().int().nonnegative().optional(),durationMs:e.number().nonnegative().optional(),location:t.optional(),attributes:e.record(e.string(),e.unknown())});
1
+ "use strict";import{z as e}from"zod";import{SourceLocationSchema as t}from"./source-location.js";import{TraceContextSchema as o}from"./context.js";export const TraceNodeTypeSchema=e.enum(["session","browser-context","tab","renderer","router","route","page","component","element","slot","render","react-mount","react-unmount","hook","effect","effect-run","memo","memo-compute","ui-event","handler","animation","animation-frame","transition","timer","api-client-call","http-request","http-response","server-process","nest-app","nest-module","nest-provider","singleton-instance","server-request","guard","controller","service-method","loop","loop-iteration","queue-job","db-query","redis-op","promise","promise-continuation","state-store","state-update","selector","selector-update","visual-frame","visual-violation","style-change","layout-change","memory-owner","memory-mutation","memory-retention","heap-snapshot","build-event","lint-event","typecheck-event","test-event","bundle-report","hmr-update"]),LifecycleSchema=e.enum(["created","active","completed","disposed","errored"]),TraceNodeSchema=e.object({id:e.string(),parentTraceNodeId:e.string().optional(),type:TraceNodeTypeSchema,logicalId:e.string().optional(),instanceId:e.string().optional(),generation:e.number().int().nonnegative().optional(),lifecycle:LifecycleSchema,context:o,name:e.string(),startTime:e.number().int().nonnegative(),endTime:e.number().int().nonnegative().optional(),durationMs:e.number().nonnegative().optional(),location:t.optional(),attributes:e.record(e.string(),e.unknown())});
@@ -1 +1 @@
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");
1
+ "use strict";var h=Object.defineProperty;var u=(e,i)=>h(e,"name",{value:i,configurable:!0});import{z as t}from"zod";export const ProducerStateSchema=t.enum(["none","connected"]),ProducerRunStatusSchema=t.enum(["running","clean","failing","error"]),ProducerReportSchema=t.object({id:t.string(),tool:t.string(),project:t.string().optional(),firstReportedAt:t.number().int().nonnegative(),lastReportedAt:t.number().int().nonnegative(),lastRunStatus:ProducerRunStatusSchema,lastRunDurationMs:t.number().int().nonnegative().optional(),errorCount:t.number().int().nonnegative(),warningCount:t.number().int().nonnegative().optional(),error:t.string().optional()}),ProducerHealthSchema=t.object({producer:ProducerStateSchema,producers:t.array(ProducerReportSchema),lastReportedAt:t.number().int().nonnegative().optional(),ageMs:t.number().int().nonnegative().optional(),stale:t.boolean(),detail:t.string()}),PRODUCER_STALE_AFTER_MS=10*6e4;export function summariseProducers(e){const i=e.now??Date.now(),r=[...e.producers].sort((n,p)=>p.lastReportedAt-n.lastReportedAt);if(r.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 c=r[0].lastReportedAt,a=Math.max(0,i-c),d=a>PRODUCER_STALE_AFTER_MS,l=r.filter(n=>n.lastRunStatus==="failing"),s=r.filter(n=>n.lastRunStatus==="error"),o=[`${r.length} ${e.domain} producer${r.length===1?"":"s"} reporting (${r.map(n=>n.id).join(", ")}); newest report ${g(a)}.`];return s.length>0&&o.push(`${s.length} produced NO verdict (the tool itself failed): ${s.map(n=>`${n.id} \u2014 ${n.error??"unknown error"}`).join("; ")}.`),l.length>0&&o.push(`${l.length} reporting errors.`),d&&o.push(`Older than ${Math.round(PRODUCER_STALE_AFTER_MS/6e4)}m \u2014 the verdict may predate the current source.`),{producer:"connected",producers:r,lastReportedAt:c,ageMs:a,stale:d,detail:o.join(" ")}}u(summariseProducers,"summariseProducers");function g(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`}u(g,"describeAge");
@@ -237,6 +237,14 @@ export declare const AgentStorageStatsSchema: z.ZodObject<{
237
237
  truncatedEvents: z.ZodOptional<z.ZodNumber>;
238
238
  truncatedBytesReclaimed: z.ZodOptional<z.ZodNumber>;
239
239
  rawByteLimit: z.ZodOptional<z.ZodNumber>;
240
+ reducers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
241
+ residentEvents: z.ZodNumber;
242
+ residentBytes: z.ZodNumber;
243
+ evictedEvents: z.ZodNumber;
244
+ evictedForBytes: z.ZodNumber;
245
+ eventCap: z.ZodNumber;
246
+ byteCap: z.ZodNumber;
247
+ }, z.core.$strip>>>;
240
248
  }, z.core.$strip>;
241
249
  export type AgentStorageStats = z.infer<typeof AgentStorageStatsSchema>;
242
250
  export declare const AgentSessionSchema: z.ZodObject<{
@@ -278,6 +286,14 @@ export declare const AgentSessionSchema: z.ZodObject<{
278
286
  truncatedEvents: z.ZodOptional<z.ZodNumber>;
279
287
  truncatedBytesReclaimed: z.ZodOptional<z.ZodNumber>;
280
288
  rawByteLimit: z.ZodOptional<z.ZodNumber>;
289
+ reducers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
290
+ residentEvents: z.ZodNumber;
291
+ residentBytes: z.ZodNumber;
292
+ evictedEvents: z.ZodNumber;
293
+ evictedForBytes: z.ZodNumber;
294
+ eventCap: z.ZodNumber;
295
+ byteCap: z.ZodNumber;
296
+ }, z.core.$strip>>>;
281
297
  }, z.core.$strip>>;
282
298
  }, z.core.$strip>;
283
299
  export type AgentSession = z.infer<typeof AgentSessionSchema>;
package/lib/resources.js CHANGED
@@ -1 +1 @@
1
- "use strict";import{z as n}from"zod";import{SCHEMA_VERSION as i}from"./schema-version.js";import{SourceLocationSchema as o}from"./source-location.js";import{SeveritySchema as t}from"./event.js";import{ProducerHealthSchema as e}from"./producer-health.js";export const URI_SCHEMES=["agent","events","build","lint","typecheck","test","runtime","render","visual","flow","story","trace","graph","bundle","security","perf","deps","memory","browser","react","valtio","nest","next","process"],ResourceEnvelopeSchema=n.object({$schema:n.string().optional(),schemaVersion:n.literal(i),revision:n.number().int().nonnegative(),updatedAt:n.string().datetime().optional()}),AgentStatusKindSchema=n.enum(["starting","clean","warning","failing"]),AgentBlockingItemSchema=n.object({source:n.string(),severity:t,title:n.string(),fingerprint:n.string(),resource:n.string(),pageId:n.string().optional(),flowId:n.string().optional(),location:o.optional()}),AgentChecksSchema=n.object({typecheck:n.enum(["passed","failed","unknown"]).optional(),lint:n.enum(["passed","failed","unknown"]).optional(),build:n.enum(["passed","failed","unknown"]).optional(),runtime:n.enum(["passed","failed","warning","unknown"]).optional(),visual:n.enum(["passed","failed","warning","unknown"]).optional(),memory:n.enum(["passed","failed","warning","unknown"]).optional()}),AgentServerModeSchema=n.enum(["embedded","shared"]),AgentServerInfoSchema=n.object({mode:AgentServerModeSchema,pid:n.number(),startedAt:n.string(),url:n.string().optional()}),AgentCurrentStatusSchema=ResourceEnvelopeSchema.extend({sessionId:n.string(),status:AgentStatusKindSchema,activeTab:n.string().optional(),tabsWithIssues:n.array(n.string()).optional(),blocking:n.array(AgentBlockingItemSchema),warnings:n.array(AgentBlockingItemSchema).default([]),suggestedReads:n.array(n.string()),checks:AgentChecksSchema.optional(),server:AgentServerInfoSchema.optional()}),AgentStorageStatsSchema=n.object({eventsResident:n.number().int().nonnegative(),eventsResidentBytes:n.number().int().nonnegative(),eventsIngested:n.number().int().nonnegative(),eventsDropped:n.number().int().nonnegative(),eventsDroppedForBytes:n.number().int().nonnegative().optional(),eventCap:n.number().int().nonnegative().optional(),eventByteCap:n.number().int().nonnegative().optional(),artifactsResident:n.number().int().nonnegative().optional(),artifactsResidentBytes:n.number().int().nonnegative().optional(),artifactsDropped:n.number().int().nonnegative().optional(),artifactByteCap:n.number().int().nonnegative().optional(),truncatedEvents:n.number().int().nonnegative().optional(),truncatedBytesReclaimed:n.number().int().nonnegative().optional(),rawByteLimit:n.number().int().nonnegative().optional()}),AgentSessionSchema=ResourceEnvelopeSchema.extend({sessionId:n.string(),supportedResources:n.array(n.string()),supportedTools:n.array(n.string()),supportedJobs:n.array(n.string()),supportedChannels:n.array(n.string()),subscribedByDefault:n.array(n.string()),transports:n.array(n.enum(["stdio","http","socket"])),host:n.object({platform:n.string(),node:n.string()}),project:n.object({name:n.string(),nxVersion:n.string().optional()}),storage:AgentStorageStatsSchema.optional()});const r=n.object({id:n.string(),timestamp:n.number().int().nonnegative(),message:n.string(),fingerprint:n.string(),code:n.string().optional(),rule:n.string().optional(),severity:t.optional(),file:n.string().optional(),line:n.number().int().nonnegative().optional(),column:n.number().int().nonnegative().optional(),project:n.string().optional()});export const TypecheckCurrentSchema=ResourceEnvelopeSchema.merge(e).extend({status:n.enum(["unknown","clean","failing"]),errorCount:n.number().int().nonnegative(),lastRunAt:n.number().int().nonnegative().optional()}),TypecheckErrorsSchema=ResourceEnvelopeSchema.merge(e).extend({errors:n.array(r)}),LintCurrentSchema=ResourceEnvelopeSchema.merge(e).extend({status:n.enum(["unknown","clean","warning","failing"]),errorCount:n.number().int().nonnegative(),warningCount:n.number().int().nonnegative(),lastRunAt:n.number().int().nonnegative().optional()}),BuildCurrentSchema=ResourceEnvelopeSchema.merge(e).extend({status:n.enum(["unknown","clean","warning","failing"]),hmrUpdates:n.number().int().nonnegative(),lastRunAt:n.number().int().nonnegative().optional()});
1
+ "use strict";import{z as n}from"zod";import{SCHEMA_VERSION as o}from"./schema-version.js";import{SourceLocationSchema as i}from"./source-location.js";import{SeveritySchema as t}from"./event.js";import{ProducerHealthSchema as e}from"./producer-health.js";export const URI_SCHEMES=["agent","events","build","lint","typecheck","test","runtime","render","visual","flow","story","trace","graph","bundle","security","perf","deps","memory","browser","react","valtio","nest","next","process"],ResourceEnvelopeSchema=n.object({$schema:n.string().optional(),schemaVersion:n.literal(o),revision:n.number().int().nonnegative(),updatedAt:n.string().datetime().optional()}),AgentStatusKindSchema=n.enum(["starting","clean","warning","failing"]),AgentBlockingItemSchema=n.object({source:n.string(),severity:t,title:n.string(),fingerprint:n.string(),resource:n.string(),pageId:n.string().optional(),flowId:n.string().optional(),location:i.optional()}),AgentChecksSchema=n.object({typecheck:n.enum(["passed","failed","unknown"]).optional(),lint:n.enum(["passed","failed","unknown"]).optional(),build:n.enum(["passed","failed","unknown"]).optional(),runtime:n.enum(["passed","failed","warning","unknown"]).optional(),visual:n.enum(["passed","failed","warning","unknown"]).optional(),memory:n.enum(["passed","failed","warning","unknown"]).optional()}),AgentServerModeSchema=n.enum(["embedded","shared"]),AgentServerInfoSchema=n.object({mode:AgentServerModeSchema,pid:n.number(),startedAt:n.string(),url:n.string().optional()}),AgentCurrentStatusSchema=ResourceEnvelopeSchema.extend({sessionId:n.string(),status:AgentStatusKindSchema,activeTab:n.string().optional(),tabsWithIssues:n.array(n.string()).optional(),blocking:n.array(AgentBlockingItemSchema),warnings:n.array(AgentBlockingItemSchema).default([]),suggestedReads:n.array(n.string()),checks:AgentChecksSchema.optional(),server:AgentServerInfoSchema.optional()}),AgentStorageStatsSchema=n.object({eventsResident:n.number().int().nonnegative(),eventsResidentBytes:n.number().int().nonnegative(),eventsIngested:n.number().int().nonnegative(),eventsDropped:n.number().int().nonnegative(),eventsDroppedForBytes:n.number().int().nonnegative().optional(),eventCap:n.number().int().nonnegative().optional(),eventByteCap:n.number().int().nonnegative().optional(),artifactsResident:n.number().int().nonnegative().optional(),artifactsResidentBytes:n.number().int().nonnegative().optional(),artifactsDropped:n.number().int().nonnegative().optional(),artifactByteCap:n.number().int().nonnegative().optional(),truncatedEvents:n.number().int().nonnegative().optional(),truncatedBytesReclaimed:n.number().int().nonnegative().optional(),rawByteLimit:n.number().int().nonnegative().optional(),reducers:n.record(n.string(),n.object({residentEvents:n.number().int().nonnegative(),residentBytes:n.number().int().nonnegative(),evictedEvents:n.number().int().nonnegative(),evictedForBytes:n.number().int().nonnegative(),eventCap:n.number().int().nonnegative(),byteCap:n.number().int().nonnegative()})).optional()}),AgentSessionSchema=ResourceEnvelopeSchema.extend({sessionId:n.string(),supportedResources:n.array(n.string()),supportedTools:n.array(n.string()),supportedJobs:n.array(n.string()),supportedChannels:n.array(n.string()),subscribedByDefault:n.array(n.string()),transports:n.array(n.enum(["stdio","http","socket"])),host:n.object({platform:n.string(),node:n.string()}),project:n.object({name:n.string(),nxVersion:n.string().optional()}),storage:AgentStorageStatsSchema.optional()});const r=n.object({id:n.string(),timestamp:n.number().int().nonnegative(),message:n.string(),fingerprint:n.string(),code:n.string().optional(),rule:n.string().optional(),severity:t.optional(),file:n.string().optional(),line:n.number().int().nonnegative().optional(),column:n.number().int().nonnegative().optional(),project:n.string().optional()});export const TypecheckCurrentSchema=ResourceEnvelopeSchema.merge(e).extend({status:n.enum(["unknown","clean","failing"]),errorCount:n.number().int().nonnegative(),lastRunAt:n.number().int().nonnegative().optional()}),TypecheckErrorsSchema=ResourceEnvelopeSchema.merge(e).extend({errors:n.array(r)}),LintCurrentSchema=ResourceEnvelopeSchema.merge(e).extend({status:n.enum(["unknown","clean","warning","failing"]),errorCount:n.number().int().nonnegative(),warningCount:n.number().int().nonnegative(),lastRunAt:n.number().int().nonnegative().optional()}),BuildCurrentSchema=ResourceEnvelopeSchema.merge(e).extend({status:n.enum(["unknown","clean","warning","failing"]),hmrUpdates:n.number().int().nonnegative(),lastRunAt:n.number().int().nonnegative().optional()});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/protocol-types",
3
- "version": "1.18.14",
3
+ "version": "1.20.0",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",