modality-kit 0.15.4 → 0.16.1

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/dist/index.js CHANGED
@@ -1,11 +1,15 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
2
6
  var __export = (target, all) => {
3
7
  for (var name in all)
4
8
  __defProp(target, name, {
5
9
  get: all[name],
6
10
  enumerable: true,
7
11
  configurable: true,
8
- set: (newValue) => all[name] = () => newValue
12
+ set: __exportSetter.bind(all, name)
9
13
  });
10
14
  };
11
15
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
@@ -73,6 +77,13 @@ function formatSuccessResponse(successData, content) {
73
77
  if (contetnBlock.length > 0) {
74
78
  result.content.push(...contetnBlock);
75
79
  }
80
+ if (process.env.DEBUG) {
81
+ const size = JSON.stringify(result).length;
82
+ result.content.push({
83
+ type: "text",
84
+ text: `Response size: ${size} bytes`
85
+ });
86
+ }
76
87
  return result;
77
88
  }
78
89
  function formatErrorResponse(errorData, operation, meta) {
@@ -2550,7 +2561,7 @@ class Doc {
2550
2561
  var version = {
2551
2562
  major: 4,
2552
2563
  minor: 3,
2553
- patch: 5
2564
+ patch: 6
2554
2565
  };
2555
2566
 
2556
2567
  // node_modules/zod/v4/core/schemas.js
@@ -3836,7 +3847,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3836
3847
  if (keyResult instanceof Promise) {
3837
3848
  throw new Error("Async schemas not supported in object keys currently");
3838
3849
  }
3839
- const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length && keyResult.issues.some((iss) => iss.code === "invalid_type" && iss.expected === "number");
3850
+ const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
3840
3851
  if (checkNumericKey) {
3841
3852
  const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
3842
3853
  if (retryResult instanceof Promise) {
@@ -11207,7 +11218,7 @@ function finalize(ctx, schema) {
11207
11218
  }
11208
11219
  }
11209
11220
  }
11210
- if (refSchema.$ref) {
11221
+ if (refSchema.$ref && refSeen.def) {
11211
11222
  for (const key in schema2) {
11212
11223
  if (key === "$ref" || key === "allOf")
11213
11224
  continue;
@@ -14644,7 +14655,7 @@ var STANDARD_ERROR_MESSAGES = {
14644
14655
 
14645
14656
  // src/JSONRPCUtils.ts
14646
14657
  class JSONRPCUtils {
14647
- static validateMessage(message) {
14658
+ static validateBatchMessage(message) {
14648
14659
  if (Array.isArray(message)) {
14649
14660
  if (message.length === 0) {
14650
14661
  return {
@@ -14664,8 +14675,9 @@ class JSONRPCUtils {
14664
14675
  message,
14665
14676
  messageType: "batch"
14666
14677
  };
14678
+ } else {
14679
+ return this.validateSingleMessage(message);
14667
14680
  }
14668
- return this.validateSingleMessage(message);
14669
14681
  }
14670
14682
  static validateSingleMessage(message) {
14671
14683
  if (!message || typeof message !== "object") {
@@ -15230,7 +15242,7 @@ class JSONRPCManager extends JSONRPCCall {
15230
15242
  if (!message) {
15231
15243
  throw new ERROR_PARSE_ERROR("Failed to parse JSON-RPC message");
15232
15244
  }
15233
- const validation = JSONRPCUtils.validateMessage(message);
15245
+ const validation = JSONRPCUtils.validateBatchMessage(message);
15234
15246
  if (!validation.valid) {
15235
15247
  const errorResponse = JSONRPCUtils.createErrorResponse(validation.error, message.id || null);
15236
15248
  return this.sendMessage(errorResponse, options);
@@ -15470,7 +15482,7 @@ class WebSocketClient {
15470
15482
  if (!message) {
15471
15483
  throw new Error(`deserialize returned null or undefined ${event.data}`);
15472
15484
  }
15473
- const validMessage = JSONRPCUtils.validateMessage(message);
15485
+ const validMessage = JSONRPCUtils.validateBatchMessage(message);
15474
15486
  if (validMessage.valid) {
15475
15487
  const message2 = validMessage.message;
15476
15488
  if (message2.method === "server.connected") {
@@ -12,7 +12,7 @@ export declare class JSONRPCUtils {
12
12
  /**
13
13
  * Validate a JSON-RPC message (supports batch requests)
14
14
  */
15
- static validateMessage(message: any): JSONRPCValidationResult;
15
+ static validateBatchMessage(message: any): JSONRPCValidationResult;
16
16
  /**
17
17
  * Validate a single JSON-RPC message
18
18
  */
@@ -113,7 +113,7 @@ export declare abstract class JSONRPCManager<TContext> extends JSONRPCCall {
113
113
  /**
114
114
  * Process incoming WebSocket message
115
115
  */
116
- validateMessage(data: string | Buffer | Record<string, any>, options?: any): Promise<void>;
116
+ validateMessage(data: string | Buffer | Record<string, any>, options?: any): Promise<any>;
117
117
  /**
118
118
  * Get manager statistics
119
119
  */
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.15.4",
2
+ "version": "0.16.1",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",
@@ -13,9 +13,9 @@
13
13
  "author": "Hill <hill@kimo.com>",
14
14
  "license": "ISC",
15
15
  "devDependencies": {
16
- "@modelcontextprotocol/sdk": "^1.24.2",
17
- "modality-bun-kit": "^0.0.1",
18
- "zod": "^4.3.5"
16
+ "@modelcontextprotocol/sdk": "^1.29.0",
17
+ "modality-bun-kit": "^0.0.3",
18
+ "zod": "^4.3.6"
19
19
  },
20
20
  "exports": {
21
21
  "types": "./dist/types/index.d.ts",