@lensmcp/protocol-types 1.16.31 → 1.17.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/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/lib/capture-demand.d.ts +61 -0
- package/lib/capture-demand.d.ts.map +1 -0
- package/lib/capture-demand.js +14 -0
- package/lib/resources.d.ts +63 -17
- package/lib/resources.d.ts.map +1 -1
- package/lib/resources.js +35 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC"}
|
package/index.js
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual-capture DEMAND contract — the cross-process rendezvous between the
|
|
3
|
+
* MCP server (which asks for a frame) and the browser-capture runner (which
|
|
4
|
+
* owns Chrome).
|
|
5
|
+
*
|
|
6
|
+
* Why a file and not the event bus: the bus is ONE-WAY. Producers (the Vite
|
|
7
|
+
* plugin, the NestJS instrumentation, the capture runner) append to
|
|
8
|
+
* `LENSMCP_EVENT_FILE` / the UDS socket and the MCP session tails it — nothing
|
|
9
|
+
* flows back. So `visual.capture_frame` publishing a `visual-capture-request`
|
|
10
|
+
* onto the MCP's in-process bus was a DEAD LETTER: the runner never saw it,
|
|
11
|
+
* which is why capture had to poll a live Chrome forever (measured on a real
|
|
12
|
+
* machine, 2026-07-29: 2 runners + >1GB of Chrome resident for 1d8h with
|
|
13
|
+
* nobody capturing). Both processes already share the event-file directory, so
|
|
14
|
+
* a single-line request file there is the cheapest signal that actually
|
|
15
|
+
* crosses the boundary — the runner stats one small file instead of holding a
|
|
16
|
+
* browser open on the chance someone asks.
|
|
17
|
+
*
|
|
18
|
+
* This module is deliberately node-free (no `node:path`/`node:fs`): protocol
|
|
19
|
+
* types are bundled into the BROWSER client runtime, so it exports only the
|
|
20
|
+
* filename + payload shape. Each side does its own path join / IO.
|
|
21
|
+
*/
|
|
22
|
+
import type { VisualFrameCause } from './attributes.js';
|
|
23
|
+
/** Request-file name, resolved as a sibling of `LENSMCP_EVENT_FILE`. */
|
|
24
|
+
export declare const CAPTURE_REQUEST_FILENAME = "capture-request.json";
|
|
25
|
+
/**
|
|
26
|
+
* Presence-file name (same directory). The runner writes it at startup and
|
|
27
|
+
* removes it on a clean stop.
|
|
28
|
+
*
|
|
29
|
+
* Its job is to keep the requester honest: `visual.capture_frame` now WAITS for
|
|
30
|
+
* the fresh frame it asked for (a cold browser needs ~1s), and without a way to
|
|
31
|
+
* tell "a runner is warming up" from "no runner exists" that wait would also be
|
|
32
|
+
* paid by every workspace running with capture disabled or no Chrome installed
|
|
33
|
+
* — an 8s stall for a frame that is never coming. With this, the tool waits
|
|
34
|
+
* only when a live runner is actually listening, and can say so when it isn't.
|
|
35
|
+
*/
|
|
36
|
+
export declare const CAPTURE_PRESENCE_FILENAME = "capture-runner.json";
|
|
37
|
+
/** Advertised by a live capture runner. `pid` is checkable with `kill(pid, 0)`,
|
|
38
|
+
* so a runner that was SIGKILLed leaves a file that readers can tell is dead. */
|
|
39
|
+
export interface CapturePresence {
|
|
40
|
+
pid: number;
|
|
41
|
+
/** `Date.now()` at runner startup. */
|
|
42
|
+
startedAt: number;
|
|
43
|
+
/** Dev URL this runner captures. */
|
|
44
|
+
url: string;
|
|
45
|
+
}
|
|
46
|
+
/** One capture request. Written whole (single `writeFileSync`) so a reader
|
|
47
|
+
* never sees a half-written line; `requestedAt` is the demand clock the
|
|
48
|
+
* runner's idle timer works off. */
|
|
49
|
+
export interface CaptureRequest {
|
|
50
|
+
/** `Date.now()` when the request was made. */
|
|
51
|
+
requestedAt: number;
|
|
52
|
+
/** Why the frame was asked for — becomes the frame's `causedBy`. Validate on
|
|
53
|
+
* read (`VisualFrameCauseSchema`): this arrives from another process, and a
|
|
54
|
+
* hand-edited file must not put a bogus cause on a published frame. */
|
|
55
|
+
cause: VisualFrameCause;
|
|
56
|
+
/** Whether to treat the captured frame as the stable final state. */
|
|
57
|
+
stable: boolean;
|
|
58
|
+
/** Opaque id, so a reader can tell two same-millisecond requests apart. */
|
|
59
|
+
requestId?: string;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=capture-demand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-demand.d.ts","sourceRoot":"","sources":["../../src/lib/capture-demand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAE/D;kFACkF;AAClF,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;qCAEqC;AACrC,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB;;4EAEwE;IACxE,KAAK,EAAE,gBAAgB,CAAC;IACxB,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;IAChB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Request-file name, resolved as a sibling of `LENSMCP_EVENT_FILE`. */
|
|
2
|
+
export const CAPTURE_REQUEST_FILENAME = 'capture-request.json';
|
|
3
|
+
/**
|
|
4
|
+
* Presence-file name (same directory). The runner writes it at startup and
|
|
5
|
+
* removes it on a clean stop.
|
|
6
|
+
*
|
|
7
|
+
* Its job is to keep the requester honest: `visual.capture_frame` now WAITS for
|
|
8
|
+
* the fresh frame it asked for (a cold browser needs ~1s), and without a way to
|
|
9
|
+
* tell "a runner is warming up" from "no runner exists" that wait would also be
|
|
10
|
+
* paid by every workspace running with capture disabled or no Chrome installed
|
|
11
|
+
* — an 8s stall for a frame that is never coming. With this, the tool waits
|
|
12
|
+
* only when a live runner is actually listening, and can say so when it isn't.
|
|
13
|
+
*/
|
|
14
|
+
export const CAPTURE_PRESENCE_FILENAME = 'capture-runner.json';
|
package/lib/resources.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ export declare const ResourceEnvelopeSchema: z.ZodObject<{
|
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
export type ResourceEnvelope = z.infer<typeof ResourceEnvelopeSchema>;
|
|
15
15
|
export declare const AgentStatusKindSchema: z.ZodEnum<{
|
|
16
|
-
warning: "warning";
|
|
17
16
|
starting: "starting";
|
|
18
17
|
clean: "clean";
|
|
18
|
+
warning: "warning";
|
|
19
19
|
failing: "failing";
|
|
20
20
|
}>;
|
|
21
21
|
export type AgentStatusKind = z.infer<typeof AgentStatusKindSchema>;
|
|
@@ -23,9 +23,9 @@ export declare const AgentBlockingItemSchema: z.ZodObject<{
|
|
|
23
23
|
source: z.ZodString;
|
|
24
24
|
severity: z.ZodEnum<{
|
|
25
25
|
error: "error";
|
|
26
|
+
warning: "warning";
|
|
26
27
|
debug: "debug";
|
|
27
28
|
info: "info";
|
|
28
|
-
warning: "warning";
|
|
29
29
|
fatal: "fatal";
|
|
30
30
|
}>;
|
|
31
31
|
title: z.ZodString;
|
|
@@ -45,37 +45,37 @@ export declare const AgentBlockingItemSchema: z.ZodObject<{
|
|
|
45
45
|
export type AgentBlockingItem = z.infer<typeof AgentBlockingItemSchema>;
|
|
46
46
|
export declare const AgentChecksSchema: z.ZodObject<{
|
|
47
47
|
typecheck: z.ZodOptional<z.ZodEnum<{
|
|
48
|
-
unknown: "unknown";
|
|
49
48
|
passed: "passed";
|
|
50
49
|
failed: "failed";
|
|
50
|
+
unknown: "unknown";
|
|
51
51
|
}>>;
|
|
52
52
|
lint: z.ZodOptional<z.ZodEnum<{
|
|
53
|
-
unknown: "unknown";
|
|
54
53
|
passed: "passed";
|
|
55
54
|
failed: "failed";
|
|
55
|
+
unknown: "unknown";
|
|
56
56
|
}>>;
|
|
57
57
|
build: z.ZodOptional<z.ZodEnum<{
|
|
58
|
-
unknown: "unknown";
|
|
59
58
|
passed: "passed";
|
|
60
59
|
failed: "failed";
|
|
60
|
+
unknown: "unknown";
|
|
61
61
|
}>>;
|
|
62
62
|
runtime: z.ZodOptional<z.ZodEnum<{
|
|
63
63
|
warning: "warning";
|
|
64
|
-
unknown: "unknown";
|
|
65
64
|
passed: "passed";
|
|
66
65
|
failed: "failed";
|
|
66
|
+
unknown: "unknown";
|
|
67
67
|
}>>;
|
|
68
68
|
visual: z.ZodOptional<z.ZodEnum<{
|
|
69
69
|
warning: "warning";
|
|
70
|
-
unknown: "unknown";
|
|
71
70
|
passed: "passed";
|
|
72
71
|
failed: "failed";
|
|
72
|
+
unknown: "unknown";
|
|
73
73
|
}>>;
|
|
74
74
|
memory: z.ZodOptional<z.ZodEnum<{
|
|
75
75
|
warning: "warning";
|
|
76
|
-
unknown: "unknown";
|
|
77
76
|
passed: "passed";
|
|
78
77
|
failed: "failed";
|
|
78
|
+
unknown: "unknown";
|
|
79
79
|
}>>;
|
|
80
80
|
}, z.core.$strip>;
|
|
81
81
|
export declare const AgentCurrentStatusSchema: z.ZodObject<{
|
|
@@ -85,9 +85,9 @@ export declare const AgentCurrentStatusSchema: z.ZodObject<{
|
|
|
85
85
|
updatedAt: z.ZodOptional<z.ZodString>;
|
|
86
86
|
sessionId: z.ZodString;
|
|
87
87
|
status: z.ZodEnum<{
|
|
88
|
-
warning: "warning";
|
|
89
88
|
starting: "starting";
|
|
90
89
|
clean: "clean";
|
|
90
|
+
warning: "warning";
|
|
91
91
|
failing: "failing";
|
|
92
92
|
}>;
|
|
93
93
|
activeTab: z.ZodOptional<z.ZodString>;
|
|
@@ -96,9 +96,9 @@ export declare const AgentCurrentStatusSchema: z.ZodObject<{
|
|
|
96
96
|
source: z.ZodString;
|
|
97
97
|
severity: z.ZodEnum<{
|
|
98
98
|
error: "error";
|
|
99
|
+
warning: "warning";
|
|
99
100
|
debug: "debug";
|
|
100
101
|
info: "info";
|
|
101
|
-
warning: "warning";
|
|
102
102
|
fatal: "fatal";
|
|
103
103
|
}>;
|
|
104
104
|
title: z.ZodString;
|
|
@@ -119,9 +119,9 @@ export declare const AgentCurrentStatusSchema: z.ZodObject<{
|
|
|
119
119
|
source: z.ZodString;
|
|
120
120
|
severity: z.ZodEnum<{
|
|
121
121
|
error: "error";
|
|
122
|
+
warning: "warning";
|
|
122
123
|
debug: "debug";
|
|
123
124
|
info: "info";
|
|
124
|
-
warning: "warning";
|
|
125
125
|
fatal: "fatal";
|
|
126
126
|
}>;
|
|
127
127
|
title: z.ZodString;
|
|
@@ -141,41 +141,71 @@ export declare const AgentCurrentStatusSchema: z.ZodObject<{
|
|
|
141
141
|
suggestedReads: z.ZodArray<z.ZodString>;
|
|
142
142
|
checks: z.ZodOptional<z.ZodObject<{
|
|
143
143
|
typecheck: z.ZodOptional<z.ZodEnum<{
|
|
144
|
-
unknown: "unknown";
|
|
145
144
|
passed: "passed";
|
|
146
145
|
failed: "failed";
|
|
146
|
+
unknown: "unknown";
|
|
147
147
|
}>>;
|
|
148
148
|
lint: z.ZodOptional<z.ZodEnum<{
|
|
149
|
-
unknown: "unknown";
|
|
150
149
|
passed: "passed";
|
|
151
150
|
failed: "failed";
|
|
151
|
+
unknown: "unknown";
|
|
152
152
|
}>>;
|
|
153
153
|
build: z.ZodOptional<z.ZodEnum<{
|
|
154
|
-
unknown: "unknown";
|
|
155
154
|
passed: "passed";
|
|
156
155
|
failed: "failed";
|
|
156
|
+
unknown: "unknown";
|
|
157
157
|
}>>;
|
|
158
158
|
runtime: z.ZodOptional<z.ZodEnum<{
|
|
159
159
|
warning: "warning";
|
|
160
|
-
unknown: "unknown";
|
|
161
160
|
passed: "passed";
|
|
162
161
|
failed: "failed";
|
|
162
|
+
unknown: "unknown";
|
|
163
163
|
}>>;
|
|
164
164
|
visual: z.ZodOptional<z.ZodEnum<{
|
|
165
165
|
warning: "warning";
|
|
166
|
-
unknown: "unknown";
|
|
167
166
|
passed: "passed";
|
|
168
167
|
failed: "failed";
|
|
168
|
+
unknown: "unknown";
|
|
169
169
|
}>>;
|
|
170
170
|
memory: z.ZodOptional<z.ZodEnum<{
|
|
171
171
|
warning: "warning";
|
|
172
|
-
unknown: "unknown";
|
|
173
172
|
passed: "passed";
|
|
174
173
|
failed: "failed";
|
|
174
|
+
unknown: "unknown";
|
|
175
175
|
}>>;
|
|
176
176
|
}, z.core.$strip>>;
|
|
177
177
|
}, z.core.$strip>;
|
|
178
178
|
export type AgentCurrentStatus = z.infer<typeof AgentCurrentStatusSchema>;
|
|
179
|
+
/**
|
|
180
|
+
* Hot-tier retention pressure.
|
|
181
|
+
*
|
|
182
|
+
* WHY it is on the bootstrap surface: every retention cap used to be a COUNT
|
|
183
|
+
* cap over payloads of arbitrary size, so the hot tier could hold hundreds of
|
|
184
|
+
* MB while every counter still read "5 000 events" — the growth was
|
|
185
|
+
* invisible from the outside (the MCP server was found at 395–720 MB RSS by
|
|
186
|
+
* looking at the process, not at any lens surface). These are the numbers
|
|
187
|
+
* that make a bounded tier observable: what is resident in BYTES, what was
|
|
188
|
+
* evicted to stay inside the budget, and how many producer payloads the
|
|
189
|
+
* ingest clamp had to shrink. `truncatedEvents` climbing is the signal that
|
|
190
|
+
* some producer is attaching megabytes per event.
|
|
191
|
+
*/
|
|
192
|
+
export declare const AgentStorageStatsSchema: z.ZodObject<{
|
|
193
|
+
eventsResident: z.ZodNumber;
|
|
194
|
+
eventsResidentBytes: z.ZodNumber;
|
|
195
|
+
eventsIngested: z.ZodNumber;
|
|
196
|
+
eventsDropped: z.ZodNumber;
|
|
197
|
+
eventsDroppedForBytes: z.ZodOptional<z.ZodNumber>;
|
|
198
|
+
eventCap: z.ZodOptional<z.ZodNumber>;
|
|
199
|
+
eventByteCap: z.ZodOptional<z.ZodNumber>;
|
|
200
|
+
artifactsResident: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
artifactsResidentBytes: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
artifactsDropped: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
artifactByteCap: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
truncatedEvents: z.ZodOptional<z.ZodNumber>;
|
|
205
|
+
truncatedBytesReclaimed: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
rawByteLimit: z.ZodOptional<z.ZodNumber>;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
export type AgentStorageStats = z.infer<typeof AgentStorageStatsSchema>;
|
|
179
209
|
export declare const AgentSessionSchema: z.ZodObject<{
|
|
180
210
|
$schema: z.ZodOptional<z.ZodString>;
|
|
181
211
|
schemaVersion: z.ZodLiteral<1>;
|
|
@@ -200,6 +230,22 @@ export declare const AgentSessionSchema: z.ZodObject<{
|
|
|
200
230
|
name: z.ZodString;
|
|
201
231
|
nxVersion: z.ZodOptional<z.ZodString>;
|
|
202
232
|
}, z.core.$strip>;
|
|
233
|
+
storage: z.ZodOptional<z.ZodObject<{
|
|
234
|
+
eventsResident: z.ZodNumber;
|
|
235
|
+
eventsResidentBytes: z.ZodNumber;
|
|
236
|
+
eventsIngested: z.ZodNumber;
|
|
237
|
+
eventsDropped: z.ZodNumber;
|
|
238
|
+
eventsDroppedForBytes: z.ZodOptional<z.ZodNumber>;
|
|
239
|
+
eventCap: z.ZodOptional<z.ZodNumber>;
|
|
240
|
+
eventByteCap: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
artifactsResident: z.ZodOptional<z.ZodNumber>;
|
|
242
|
+
artifactsResidentBytes: z.ZodOptional<z.ZodNumber>;
|
|
243
|
+
artifactsDropped: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
artifactByteCap: z.ZodOptional<z.ZodNumber>;
|
|
245
|
+
truncatedEvents: z.ZodOptional<z.ZodNumber>;
|
|
246
|
+
truncatedBytesReclaimed: z.ZodOptional<z.ZodNumber>;
|
|
247
|
+
rawByteLimit: z.ZodOptional<z.ZodNumber>;
|
|
248
|
+
}, z.core.$strip>>;
|
|
203
249
|
}, z.core.$strip>;
|
|
204
250
|
export type AgentSession = z.infer<typeof AgentSessionSchema>;
|
|
205
251
|
//# sourceMappingURL=resources.d.ts.map
|
package/lib/resources.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/lib/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,WAAW,+OAyBd,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAIrD,eAAO,MAAM,sBAAsB;;;;;iBAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAItE,eAAO,MAAM,qBAAqB;;;;;EAKhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;iBASlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO5B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/lib/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,WAAW,+OAyBd,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAIrD,eAAO,MAAM,sBAAsB;;;;;iBAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAItE,eAAO,MAAM,qBAAqB;;;;;EAKhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;iBASlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO5B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;iBAmBlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkB7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
package/lib/resources.js
CHANGED
|
@@ -75,6 +75,39 @@ export const AgentCurrentStatusSchema = ResourceEnvelopeSchema.extend({
|
|
|
75
75
|
checks: AgentChecksSchema.optional(),
|
|
76
76
|
});
|
|
77
77
|
// -------- agent://session --------
|
|
78
|
+
/**
|
|
79
|
+
* Hot-tier retention pressure.
|
|
80
|
+
*
|
|
81
|
+
* WHY it is on the bootstrap surface: every retention cap used to be a COUNT
|
|
82
|
+
* cap over payloads of arbitrary size, so the hot tier could hold hundreds of
|
|
83
|
+
* MB while every counter still read "5 000 events" — the growth was
|
|
84
|
+
* invisible from the outside (the MCP server was found at 395–720 MB RSS by
|
|
85
|
+
* looking at the process, not at any lens surface). These are the numbers
|
|
86
|
+
* that make a bounded tier observable: what is resident in BYTES, what was
|
|
87
|
+
* evicted to stay inside the budget, and how many producer payloads the
|
|
88
|
+
* ingest clamp had to shrink. `truncatedEvents` climbing is the signal that
|
|
89
|
+
* some producer is attaching megabytes per event.
|
|
90
|
+
*/
|
|
91
|
+
export const AgentStorageStatsSchema = z.object({
|
|
92
|
+
eventsResident: z.number().int().nonnegative(),
|
|
93
|
+
eventsResidentBytes: z.number().int().nonnegative(),
|
|
94
|
+
eventsIngested: z.number().int().nonnegative(),
|
|
95
|
+
eventsDropped: z.number().int().nonnegative(),
|
|
96
|
+
/** Of `eventsDropped`, those evicted because the BYTE budget was hit. */
|
|
97
|
+
eventsDroppedForBytes: z.number().int().nonnegative().optional(),
|
|
98
|
+
eventCap: z.number().int().nonnegative().optional(),
|
|
99
|
+
eventByteCap: z.number().int().nonnegative().optional(),
|
|
100
|
+
artifactsResident: z.number().int().nonnegative().optional(),
|
|
101
|
+
artifactsResidentBytes: z.number().int().nonnegative().optional(),
|
|
102
|
+
artifactsDropped: z.number().int().nonnegative().optional(),
|
|
103
|
+
artifactByteCap: z.number().int().nonnegative().optional(),
|
|
104
|
+
/** Events whose `raw` exceeded the per-event limit and was shrunk. */
|
|
105
|
+
truncatedEvents: z.number().int().nonnegative().optional(),
|
|
106
|
+
/** Approximate bytes never admitted thanks to that truncation. */
|
|
107
|
+
truncatedBytesReclaimed: z.number().int().nonnegative().optional(),
|
|
108
|
+
/** The per-event `raw` limit in force. */
|
|
109
|
+
rawByteLimit: z.number().int().nonnegative().optional(),
|
|
110
|
+
});
|
|
78
111
|
export const AgentSessionSchema = ResourceEnvelopeSchema.extend({
|
|
79
112
|
sessionId: z.string(),
|
|
80
113
|
supportedResources: z.array(z.string()),
|
|
@@ -91,4 +124,6 @@ export const AgentSessionSchema = ResourceEnvelopeSchema.extend({
|
|
|
91
124
|
name: z.string(),
|
|
92
125
|
nxVersion: z.string().optional(),
|
|
93
126
|
}),
|
|
127
|
+
/** Optional — absent when the backend reports no stats. */
|
|
128
|
+
storage: AgentStorageStatsSchema.optional(),
|
|
94
129
|
});
|