@plitzi/sdk-shared 0.32.9 → 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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @plitzi/sdk-shared
2
2
 
3
+ ## 0.32.11
4
+
5
+ ### Patch Changes
6
+
7
+ - v0.32.11
8
+ - Updated dependencies
9
+ - @plitzi/nexus@0.32.11
10
+
11
+ ## 0.32.10
12
+
13
+ ### Patch Changes
14
+
15
+ - v0.32.10
16
+ - Updated dependencies
17
+ - @plitzi/nexus@0.32.10
18
+
3
19
  ## 0.32.9
4
20
 
5
21
  ### Patch Changes
@@ -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
- /** A structured log event the MCP server emits for each tool call and resource read, so a CONSUMER can render its
197
- * own request log (dev tooling, a dashboard, structured logging). Wire a sink via `SSRServerConfig.mcpLogger`;
198
- * without one the server prints to the console only when `MCP_DEBUG=1`. */
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
- /** Whether the handler completed without throwing. */
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
- /** A sink the consumer provides to receive every MCP {@link McpLogEvent} (see `SSRServerConfig.mcpLogger`). */
216
- export type McpLogger = (event: McpLogEvent) => void;
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 structured {@link McpLogEvent} for every MCP tool call and resource read, so the consumer can
261
- * render its own request log (e.g. in dev mode). Without it, the MCP server logs to the console only when
262
- * `MCP_DEBUG=1`. */
263
- mcpLogger?: McpLogger;
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;
@@ -280,14 +311,6 @@ export type SSRServerConfig = {
280
311
  serviceUrl: string;
281
312
  renderBaseUrl: string;
282
313
  };
283
- /** MCP Apps: enables the interactive `ui://` render view plitzi_render links to. `sdkBase` is this server's
284
- * absolute origin (it must serve the Plitzi SDK bundle under /sdk-assets — see `static`); the iframe imports
285
- * the SDK from there and renders the widget client-side. When absent, the view is not registered. `devMode`
286
- * selects the SDK vendor bundle name (dev vs prod split), matching the SSR asset resolution. */
287
- renderApp?: {
288
- sdkBase: string;
289
- devMode?: boolean;
290
- };
291
314
  /** Backing store for draft-preview tokens. Defaults to an in-memory store (single replica); inject a shared
292
315
  * store (e.g. Redis) for multi-replica correctness. */
293
316
  draftStore?: DraftStore;
@@ -361,3 +384,4 @@ export type SSRPreviewConfig = {
361
384
  /** Token time-to-live in milliseconds. Default 60000. */
362
385
  ttlMs?: number;
363
386
  };
387
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-shared",
3
- "version": "0.32.9",
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,8 +1230,8 @@
1233
1230
  },
1234
1231
  "dependencies": {
1235
1232
  "@modelcontextprotocol/sdk": "^1.29.0",
1236
- "@plitzi/nexus": "0.32.9",
1237
- "@plitzi/plitzi-ui": "^1.6.17",
1233
+ "@plitzi/nexus": "0.32.11",
1234
+ "@plitzi/plitzi-ui": "^1.6.18",
1238
1235
  "date-fns": "^4.4.0",
1239
1236
  "date-fns-tz": "^3.2.0",
1240
1237
  "graphql-tag": "^2.12.7",
@@ -1271,16 +1268,16 @@
1271
1268
  "eslint-plugin-cypress": "^6.4.3",
1272
1269
  "eslint-plugin-flowtype": "8.0.3",
1273
1270
  "eslint-plugin-import": "^2.32.0",
1274
- "eslint-plugin-jsdoc": "^63.2.0",
1271
+ "eslint-plugin-jsdoc": "^63.2.2",
1275
1272
  "eslint-plugin-jsx-a11y": "^6.10.2",
1276
1273
  "eslint-plugin-prettier": "^5.5.6",
1277
1274
  "eslint-plugin-react": "^7.37.5",
1278
1275
  "eslint-plugin-react-hooks": "^7.1.1",
1279
1276
  "eslint-plugin-react-refresh": "^0.5.3",
1280
- "eslint-plugin-storybook": "^10.5.3",
1277
+ "eslint-plugin-storybook": "^10.5.4",
1281
1278
  "globals": "^17.7.0",
1282
1279
  "jsdom": "^29.1.1",
1283
- "postcss": "^8.5.22",
1280
+ "postcss": "^8.5.23",
1284
1281
  "prettier": "^3.9.6",
1285
1282
  "react": "^19.2.8",
1286
1283
  "react-dom": "^19.2.8",