@lensmcp/core 1.25.8 → 1.25.10
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/flow-shape.d.ts +2 -2
- package/lib/resource-store.d.ts +7 -0
- package/lib/resource-store.js +1 -1
- package/package.json +2 -2
package/lib/flow-shape.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export declare function trimFlowEvent(event: BaseEvent, opts?: FlowShapeOptions)
|
|
|
68
68
|
captured?: string[] | undefined;
|
|
69
69
|
error?: string | undefined;
|
|
70
70
|
outcome?: "returned" | "threw" | undefined;
|
|
71
|
-
source: "nx" | "vite" | "typescript" | "eslint" | "rollup" | "client-runtime" | "chrome" | "react" | "valtio" | "nestjs" | "nextjs" | "db" | "redis" | "queue" | "memory" | "visual" | "perf" | "security" | "gateway" | "external" | "ai" | "lens";
|
|
71
|
+
source: "nx" | "vite" | "typescript" | "eslint" | "rollup" | "client-runtime" | "chrome" | "react" | "valtio" | "nestjs" | "nextjs" | "db" | "redis" | "queue" | "memory" | "visual" | "perf" | "security" | "gateway" | "external" | "ai" | "lens" | "custom";
|
|
72
72
|
category: "db" | "memory" | "visual" | "security" | "ai" | "build" | "lint" | "typecheck" | "test" | "runtime" | "render" | "trace" | "state" | "network" | "backend" | "performance" | "deps" | "cluster" | "agent";
|
|
73
73
|
severity: "error" | "debug" | "info" | "warning" | "fatal";
|
|
74
74
|
title: string;
|
|
@@ -137,7 +137,7 @@ export declare function buildFlowDetail(rawEvents: BaseEvent[], opts?: FlowShape
|
|
|
137
137
|
captured?: string[] | undefined;
|
|
138
138
|
error?: string | undefined;
|
|
139
139
|
outcome?: "returned" | "threw" | undefined;
|
|
140
|
-
source: "nx" | "vite" | "typescript" | "eslint" | "rollup" | "client-runtime" | "chrome" | "react" | "valtio" | "nestjs" | "nextjs" | "db" | "redis" | "queue" | "memory" | "visual" | "perf" | "security" | "gateway" | "external" | "ai" | "lens";
|
|
140
|
+
source: "nx" | "vite" | "typescript" | "eslint" | "rollup" | "client-runtime" | "chrome" | "react" | "valtio" | "nestjs" | "nextjs" | "db" | "redis" | "queue" | "memory" | "visual" | "perf" | "security" | "gateway" | "external" | "ai" | "lens" | "custom";
|
|
141
141
|
category: "db" | "memory" | "visual" | "security" | "ai" | "build" | "lint" | "typecheck" | "test" | "runtime" | "render" | "trace" | "state" | "network" | "backend" | "performance" | "deps" | "cluster" | "agent";
|
|
142
142
|
severity: "error" | "debug" | "info" | "warning" | "fatal";
|
|
143
143
|
title: string;
|
package/lib/resource-store.d.ts
CHANGED
|
@@ -49,6 +49,13 @@ export declare class ResourceStore {
|
|
|
49
49
|
constructor(opts?: ResourceStoreOptions);
|
|
50
50
|
register(uri: string, produce: ResourceProducer): Unsubscribe;
|
|
51
51
|
read(uri: string): Promise<ResourceValue>;
|
|
52
|
+
/**
|
|
53
|
+
* The resource as produced at most `maxAgeMs` ago — by its own recompute or a read — else produced now. For a reader
|
|
54
|
+
* that can take it that old and reads it as part of its own recompute: `agent://current-status` reads ~13 signal
|
|
55
|
+
* resources each time, and `read` produced each whole again (routes lint, the SQL lint…) — 2.6 GB of allocation a
|
|
56
|
+
* minute on FoodGuard's traffic (foodguard-72). The value is shared: never changed in place.
|
|
57
|
+
*/
|
|
58
|
+
readRecent(uri: string, maxAgeMs: number): Promise<ResourceValue>;
|
|
52
59
|
list(): string[];
|
|
53
60
|
/**
|
|
54
61
|
* Recompute the JSON, bump the revision counter if it differs, and
|
package/lib/resource-store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var h=Object.defineProperty;var a=(n,e)=>h(n,"name",{value:e,configurable:!0});var d=Object.defineProperty,c=a((n,e)=>d(n,"name",{value:e,configurable:!0}),"a");export class ResourceStore{static{a(this,"ResourceStore")}static{c(this,"ResourceStore")}constructor(e={}){this.entries=new Map,this.subs=new Map,this.queued=new Map,this.lastRun=new Map,this.lastCost=new Map,this.coalesceMs=Math.max(0,e.coalesceMs??0),this.costFactor=Math.max(0,e.costFactor??0),this.maxGapMs=Math.max(0,e.maxGapMs??3e4)}register(e,s){if(this.entries.has(e))throw new Error(`Resource already registered: ${e}`);return this.entries.set(e,{uri:e,produce:s,revision:0}),()=>{this.entries.delete(e),this.subs.delete(e),this.lastRun.delete(e),this.lastCost.delete(e)}}async read(e){const s=this.entries.get(e);if(!s)throw new Error(`Unknown resource: ${e}`);const t=await s.produce();return s.produced={at:Date.now(),value:t},t}async readRecent(e,s){const t=this.entries.get(e);if(!t)throw new Error(`Unknown resource: ${e}`);return t.produced&&Date.now()-t.produced.at<=s?t.produced.value:this.read(e)}list(){return[...this.entries.keys()]}markDirty(e){if(this.coalesceMs===0&&this.costFactor===0)return this.recompute(e);if(!this.entries.has(e))return Promise.resolve();const s=this.queued.get(e);if(s)return s;const t=Math.max(0,(this.lastRun.get(e)??Number.NEGATIVE_INFINITY)+this.gapFor(e)-Date.now()),r=new Promise(i=>{const o=c(()=>{this.queued.delete(e),this.lastRun.set(e,Date.now()),this.recompute(e).then(i,()=>i())},"go");t===0?setImmediate(o):setTimeout(o,t).unref?.()});return this.queued.set(e,r),r}gapFor(e){const s=this.lastCost.get(e)??0;return Math.max(this.coalesceMs,Math.min(this.maxGapMs,this.costFactor*s))}cost(e){return this.lastCost.get(e)}async recompute(e){const s=this.entries.get(e);if(!s)return;const t=performance.now(),r=await s.produce();s.produced={at:Date.now(),value:r};const i=JSON.stringify(r);if(this.lastCost.set(e,performance.now()-t),i===s.lastJson)return;s.lastJson=i,s.revision+=1;const o=this.subs.get(e);if(o)for(const u of o)try{u(e,s.revision)}catch{}}revision(e){return this.entries.get(e)?.revision}subscribe(e,s){let t=this.subs.get(e);return t||(t=new Set,this.subs.set(e,t)),t.add(s),()=>{t?.delete(s)}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lensmcp/core",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@lensmcp/protocol-types": "1.25.
|
|
67
|
+
"@lensmcp/protocol-types": "1.25.10",
|
|
68
68
|
"tslib": "^2.3.0"
|
|
69
69
|
},
|
|
70
70
|
"license": "Apache-2.0",
|