@lensmcp/core 1.26.1 → 1.26.2
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/lens-events.d.ts +9 -3
- package/lib/lens-events.js +2 -2
- package/package.json +2 -2
package/lib/lens-events.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type BaseEvent, type ErrorDismissalDraft, type MetricsChange } from '@lensmcp/protocol-types';
|
|
1
|
+
import { type BaseEvent, type ErrorDismissalDraft, type ExpectedFailureRule, type ExpectedRuleAuthor, type MetricsChange } from '@lensmcp/protocol-types';
|
|
2
2
|
/**
|
|
3
|
-
* Events the lens writes about itself — a dismissed error and its undo, a
|
|
4
|
-
* numbers and its undo — and the one way they reach the bus.
|
|
3
|
+
* Events the lens writes about itself — a dismissed error and its undo, a standing rule that expects a failure and its
|
|
4
|
+
* removal, a reset of a catalog's numbers and its undo — and the one way they reach the bus.
|
|
5
5
|
*
|
|
6
6
|
* Three processes can dismiss: the dashboard (a click), the MCP server (an agent's tool call, or
|
|
7
7
|
* the CLI through it). None of them changes its own memory. Each appends to the bus FILE and hears
|
|
@@ -13,6 +13,12 @@ export declare function lensEventFile(env?: Record<string, string | undefined>,
|
|
|
13
13
|
/** Stamped AT `until`: the reader clamps a dismissal to its own timestamp, so the two must agree. */
|
|
14
14
|
export declare function dismissalEvent(draft: ErrorDismissalDraft, sessionId: string): BaseEvent;
|
|
15
15
|
export declare function restoralEvent(groupId: string, sessionId: string, at: number): BaseEvent;
|
|
16
|
+
/**
|
|
17
|
+
* A standing rule (`@lensmcp/protocol-types` expected-failure.ts), stamped at its creation. The fingerprint is the kind
|
|
18
|
+
* and the rule's id: the flood guard's bucket, one per rule.
|
|
19
|
+
*/
|
|
20
|
+
export declare function expectedRuleEvent(rule: ExpectedFailureRule, sessionId: string): BaseEvent;
|
|
21
|
+
export declare function expectedRuleRemovedEvent(id: string, by: Exclude<ExpectedRuleAuthor, 'repository'>, sessionId: string, at: number): BaseEvent;
|
|
16
22
|
/**
|
|
17
23
|
* A reset of a catalog's numbers, or its undo (`@lensmcp/protocol-types` metrics-reset.ts), as the events that carry
|
|
18
24
|
* it: one for everything in the scope, else one per batch of ids the bus keeps whole — each stamped AT the reset, which
|
package/lib/lens-events.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`).join("")))}
|
|
1
|
+
"use strict";var l=Object.defineProperty;var s=(e,t)=>l(e,"name",{value:t,configurable:!0});var m=Object.defineProperty,i=s((e,t)=>m(e,"name",{value:t,configurable:!0}),"o");import{appendFileSync as v,closeSync as S,mkdirSync as y,openSync as x,renameSync as f,statSync as R,unlinkSync as _}from"node:fs";import{dirname as $,join as I}from"node:path";import{ERROR_DISMISSED as c,ERROR_RESTORED as d,EXPECTED_RULE_REMOVED as E,EXPECTED_RULE_SET as p,LENS_EVENT_SOURCE as b,METRICS_RESET as g,describeExpectedMatch as N,metricsIdBatches as k}from"@lensmcp/protocol-types";import{rotateBusFile as T}from"./bus-rotation.js";import{ulid as h}from"./ulid.js";export function lensEventFile(e=process.env,t=process.cwd()){return e.LENSMCP_EVENT_FILE??I(t,".lensmcp","events.jsonl")}s(lensEventFile,"lensEventFile"),i(lensEventFile,"lensEventFile");const a=i((e,t,n,r,o)=>({id:h(),sessionId:e,timestamp:t,source:b,category:"runtime",severity:"info",context:{sessionId:e},fingerprint:n,title:r,raw:o}),"lensEvent");export function dismissalEvent(e,t){return a(t,e.until,`${c}:${e.groupId}`,`error dismissed: ${e.title??e.groupId}`,{kind:c,groupId:e.groupId,until:e.until,eventIds:e.eventIds,...e.by?{by:e.by}:{},...e.reason?{reason:e.reason}:{},...e.title?{title:e.title}:{}})}s(dismissalEvent,"dismissalEvent"),i(dismissalEvent,"dismissalEvent");export function restoralEvent(e,t,n){return a(t,n,`${d}:${e}`,"error restored",{kind:d,groupId:e})}s(restoralEvent,"restoralEvent"),i(restoralEvent,"restoralEvent");export function expectedRuleEvent(e,t){return a(t,e.createdAt,`${p}:${e.id}`,`failure expected: ${e.title??N(e.match)}`,{kind:p,id:e.id,match:e.match,reason:e.reason,by:e.by,createdAt:e.createdAt,...e.expiresAt!==void 0?{expiresAt:e.expiresAt}:{},...e.title?{title:e.title}:{}})}s(expectedRuleEvent,"expectedRuleEvent"),i(expectedRuleEvent,"expectedRuleEvent");export function expectedRuleRemovedEvent(e,t,n,r){return a(n,r,`${E}:${e}`,"failure no longer expected",{kind:E,id:e,by:t})}s(expectedRuleRemovedEvent,"expectedRuleRemovedEvent"),i(expectedRuleRemovedEvent,"expectedRuleRemovedEvent");export function metricsChangeEvents(e,t,n){const r=e.kind===g;return(e.ids?k(e.ids):[void 0]).map(o=>a(t,n,`${e.kind}:${e.scope}`,`${r?"numbers reset":"numbers counted whole again"}: ${e.scope}${o?` \xB7 ${o.length}`:" \xB7 all"}`,{kind:e.kind,scope:e.scope,...r?{at:n}:{},...o?{ids:o}:{}}))}s(metricsChangeEvents,"metricsChangeEvents"),i(metricsChangeEvents,"metricsChangeEvents");const u=i((e,t,n)=>{const r=Number(process.env[e]);return Number.isFinite(r)&&n(r)?r:t},"envNumber");export function appendBusEvents(e,t){t.length!==0&&(y($(e),{recursive:!0}),T(e,{maxBytes:u("LENSMCP_EVENT_MAX_BYTES",50*1024*1024,n=>n>0),maxFiles:u("LENSMCP_EVENT_MAX_FILES",5,n=>n>=1&&n<=20),fs:{statSync:R,renameSync:f,unlinkSync:_,openSync:x,closeSync:S}}),v(e,t.map(n=>JSON.stringify(n)+`
|
|
2
|
+
`).join("")))}s(appendBusEvents,"appendBusEvents"),i(appendBusEvents,"appendBusEvents");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lensmcp/core",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
|
-
"@lensmcp/protocol-types": "1.26.
|
|
112
|
+
"@lensmcp/protocol-types": "1.26.2",
|
|
113
113
|
"tslib": "^2.3.0"
|
|
114
114
|
},
|
|
115
115
|
"license": "Apache-2.0",
|