@armature-tech/mcp-analytics 0.6.12 → 0.6.13

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.
@@ -170,6 +170,17 @@ const isZodV3ObjectSchema = (value) => {
170
170
  "shape" in value &&
171
171
  typeof value.extend === "function");
172
172
  };
173
+ // A raw shape's values carry the same version brands as whole object schemas:
174
+ // `_zod` on every v4 schema, `_def` only on v3. The telemetry field we add must
175
+ // be built with the shape's own Zod major, because the MCP SDK rejects shapes
176
+ // that mix majors ("Mixed Zod versions detected in object shape") — which
177
+ // turned server startup into a crash for every Zod-4 raw-shape app (e.g. all
178
+ // SkyBridge/Alpic servers). An empty shape has nothing to sniff and keeps the
179
+ // v3 telemetry field; a single-version shape is accepted by the SDK in either
180
+ // major.
181
+ const rawShapeUsesZodV4 = (shape) => {
182
+ return Object.values(shape).some((value) => (0, utils_js_1.isRecord)(value) && "_zod" in value);
183
+ };
173
184
  // Strict mode is keyed on `user_intent` (V1 name); the pre-V1 `intent` config
174
185
  // key is still honored so internal callers don't break mid-migration.
175
186
  const isStrict = (config = {}) => {
@@ -259,7 +270,9 @@ const decorateInputSchemaWithTelemetry = (inputSchema, config = {}) => {
259
270
  if ((0, utils_js_1.isRawShape)(inputSchema)) {
260
271
  return {
261
272
  ...inputSchema,
262
- telemetry: (0, exports.createTelemetryInputSchema)(config),
273
+ telemetry: rawShapeUsesZodV4(inputSchema)
274
+ ? createTelemetryInputSchemaV4(config)
275
+ : (0, exports.createTelemetryInputSchema)(config),
263
276
  };
264
277
  }
265
278
  throw new Error("MCP analytics can only decorate undefined, Zod object, JSON object, or raw-shape input schemas.");
@@ -133,6 +133,17 @@ const isZodV3ObjectSchema = (value) => {
133
133
  "shape" in value &&
134
134
  typeof value.extend === "function");
135
135
  };
136
+ // A raw shape's values carry the same version brands as whole object schemas:
137
+ // `_zod` on every v4 schema, `_def` only on v3. The telemetry field we add must
138
+ // be built with the shape's own Zod major, because the MCP SDK rejects shapes
139
+ // that mix majors ("Mixed Zod versions detected in object shape") — which
140
+ // turned server startup into a crash for every Zod-4 raw-shape app (e.g. all
141
+ // SkyBridge/Alpic servers). An empty shape has nothing to sniff and keeps the
142
+ // v3 telemetry field; a single-version shape is accepted by the SDK in either
143
+ // major.
144
+ const rawShapeUsesZodV4 = (shape) => {
145
+ return Object.values(shape).some((value) => isRecord(value) && "_zod" in value);
146
+ };
136
147
  // Strict mode is keyed on `user_intent` (V1 name); the pre-V1 `intent` config
137
148
  // key is still honored so internal callers don't break mid-migration.
138
149
  const isStrict = (config = {}) => {
@@ -220,7 +231,9 @@ export const decorateInputSchemaWithTelemetry = (inputSchema, config = {}) => {
220
231
  if (isRawShape(inputSchema)) {
221
232
  return {
222
233
  ...inputSchema,
223
- telemetry: createTelemetryInputSchema(config),
234
+ telemetry: rawShapeUsesZodV4(inputSchema)
235
+ ? createTelemetryInputSchemaV4(config)
236
+ : createTelemetryInputSchema(config),
224
237
  };
225
238
  }
226
239
  throw new Error("MCP analytics can only decorate undefined, Zod object, JSON object, or raw-shape input schemas.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armature-tech/mcp-analytics",
3
- "version": "0.6.12",
3
+ "version": "0.6.13",
4
4
  "type": "module",
5
5
  "description": "MCP analytics wrapper SDK that instruments MCP tool declarations with telemetry.",
6
6
  "license": "Apache-2.0",