@plitzi/sdk-shared 0.32.10 → 0.32.11
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/CHANGELOG.md +8 -0
- package/dist/types/ServerTypes.d.ts +51 -19
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -193,27 +193,58 @@ export type SSRRscConfig = {
|
|
|
193
193
|
/** Server-side cache TTL for RSC responses in milliseconds. Defaults to 30 000. Set to 0 to disable. */
|
|
194
194
|
cacheTtlMs?: number;
|
|
195
195
|
};
|
|
196
|
-
/**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
export type McpLogEvent = {
|
|
200
|
-
/** 'tool' for a plitzi_* tool call, 'resource' for a plitzi:// resource read. */
|
|
201
|
-
kind: 'tool' | 'resource';
|
|
202
|
-
/** The tool name (e.g. 'plitzi_apply') or the resource URI that was read. */
|
|
203
|
-
name: string;
|
|
204
|
-
/** Wall-clock duration of the handler, in milliseconds. */
|
|
196
|
+
/** What every log event carries, whatever layer it came from. */
|
|
197
|
+
type ServerLogEventBase = {
|
|
198
|
+
/** Wall-clock duration of the work the event describes, in milliseconds. */
|
|
205
199
|
durationMs: number;
|
|
206
|
-
/**
|
|
200
|
+
/** False when the work threw or answered an error status. */
|
|
207
201
|
ok: boolean;
|
|
208
|
-
/** The error message when `ok` is false. */
|
|
202
|
+
/** The error message when `ok` is false — never the request payload. */
|
|
209
203
|
error?: string;
|
|
210
|
-
/** A compact, truncated JSON summary of the tool arguments (tool events only). */
|
|
211
|
-
argsSummary?: string;
|
|
212
204
|
/** ISO-8601 timestamp of when the event was emitted. */
|
|
213
205
|
timestamp: string;
|
|
214
206
|
};
|
|
215
|
-
/**
|
|
216
|
-
|
|
207
|
+
/** One HTTP request served by ANY Plitzi server — SSR pages, RSC, plugin assets, the preview endpoint, MCP —
|
|
208
|
+
* emitted by the dispatcher once the request is answered, including the ones that failed or were rejected. */
|
|
209
|
+
export type ServerRequestLogEvent = ServerLogEventBase & {
|
|
210
|
+
kind: 'request';
|
|
211
|
+
/** Which server answered — the dispatcher label, e.g. 'SSR' or 'MCP'. */
|
|
212
|
+
server: string;
|
|
213
|
+
method: string;
|
|
214
|
+
/** Request path with query VALUES stripped and only the keys kept, e.g. '/search?q&page'. */
|
|
215
|
+
path: string;
|
|
216
|
+
/** The operation inside the request, when the answering stage names one — e.g. the MCP JSON-RPC method. */
|
|
217
|
+
operation?: string;
|
|
218
|
+
/** The HTTP status the server answered with. */
|
|
219
|
+
status: number;
|
|
220
|
+
};
|
|
221
|
+
/** One plitzi_* tool call inside an MCP request. Reported separately from the request because a failing tool
|
|
222
|
+
* still answers HTTP 200 — the failure lives in the JSON-RPC payload, so only this event exposes it. */
|
|
223
|
+
export type McpToolLogEvent = ServerLogEventBase & {
|
|
224
|
+
kind: 'tool';
|
|
225
|
+
/** The tool name, e.g. 'plitzi_apply'. */
|
|
226
|
+
name: string;
|
|
227
|
+
/** A compact SHAPE summary of the arguments — keys, value types and array lengths, never values. Set
|
|
228
|
+
* `MCP_LOG_ARGS=1` to dump the real arguments instead; they may carry user content, so it stays opt-in. */
|
|
229
|
+
argsSummary?: string;
|
|
230
|
+
};
|
|
231
|
+
/** One plitzi:// resource read inside an MCP request, named by the URI the request asked for. */
|
|
232
|
+
export type McpResourceLogEvent = ServerLogEventBase & {
|
|
233
|
+
kind: 'resource';
|
|
234
|
+
/** The resource URI that was read, e.g. 'plitzi://element/hero_1'. */
|
|
235
|
+
name: string;
|
|
236
|
+
};
|
|
237
|
+
/** Everything a Plitzi server reports about the work it does, as ONE stream: the HTTP requests it answers, plus
|
|
238
|
+
* the MCP tool calls and resource reads that happen inside them. Wire a single sink via `SSRServerConfig.logger`
|
|
239
|
+
* and switch on `kind` — a consumer can render it, ship it to a dashboard or drop the kinds it does not want.
|
|
240
|
+
*
|
|
241
|
+
* PII-free by construction: no headers, cookies, tokens, request body nor client IP ever reach an event, query
|
|
242
|
+
* values are stripped from paths and tool arguments are reduced to their shape. The request path itself is kept
|
|
243
|
+
* verbatim — it is what makes the log usable — so consumers that route identifiers through the path should treat
|
|
244
|
+
* that field accordingly. */
|
|
245
|
+
export type ServerLogEvent = ServerRequestLogEvent | McpToolLogEvent | McpResourceLogEvent;
|
|
246
|
+
/** The sink a consumer provides to receive every {@link ServerLogEvent} (see `SSRServerConfig.logger`). */
|
|
247
|
+
export type ServerLogger = (event: ServerLogEvent) => void;
|
|
217
248
|
export type SSRServerConfig = {
|
|
218
249
|
port?: number;
|
|
219
250
|
host?: string;
|
|
@@ -257,10 +288,10 @@ export type SSRServerConfig = {
|
|
|
257
288
|
enabled?: boolean;
|
|
258
289
|
path?: string;
|
|
259
290
|
};
|
|
260
|
-
/** Receives a
|
|
261
|
-
*
|
|
262
|
-
* `MCP_DEBUG=1
|
|
263
|
-
|
|
291
|
+
/** Receives a {@link ServerLogEvent} for every HTTP request this server answers — whatever stage answered it
|
|
292
|
+
* and whatever the outcome — plus every MCP tool call and resource read inside those requests. Without it the
|
|
293
|
+
* server reports nothing per request (the MCP events still reach the console when `MCP_DEBUG=1`). */
|
|
294
|
+
logger?: ServerLogger;
|
|
264
295
|
adapters: SSRAdapters;
|
|
265
296
|
/** Draft-preview endpoint for the MCP visual-preview tools (the RENDERER side). Off unless `enabled`. */
|
|
266
297
|
preview?: SSRPreviewConfig;
|
|
@@ -353,3 +384,4 @@ export type SSRPreviewConfig = {
|
|
|
353
384
|
/** Token time-to-live in milliseconds. Default 60000. */
|
|
354
385
|
ttlMs?: number;
|
|
355
386
|
};
|
|
387
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-shared",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.11",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -1184,9 +1184,6 @@
|
|
|
1184
1184
|
"./types/SegmentTypes": {
|
|
1185
1185
|
"types": "./dist/types/SegmentTypes.d.ts"
|
|
1186
1186
|
},
|
|
1187
|
-
"./types/ServerTypes": {
|
|
1188
|
-
"types": "./dist/types/ServerTypes.d.ts"
|
|
1189
|
-
},
|
|
1190
1187
|
"./types/SpaceTypes": {
|
|
1191
1188
|
"types": "./dist/types/SpaceTypes.d.ts"
|
|
1192
1189
|
},
|
|
@@ -1233,7 +1230,7 @@
|
|
|
1233
1230
|
},
|
|
1234
1231
|
"dependencies": {
|
|
1235
1232
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
1236
|
-
"@plitzi/nexus": "0.32.
|
|
1233
|
+
"@plitzi/nexus": "0.32.11",
|
|
1237
1234
|
"@plitzi/plitzi-ui": "^1.6.18",
|
|
1238
1235
|
"date-fns": "^4.4.0",
|
|
1239
1236
|
"date-fns-tz": "^3.2.0",
|