modality-kit 0.12.12 → 0.12.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.
package/dist/index.js CHANGED
@@ -5599,7 +5599,11 @@ class JSONRPCManager extends JSONRPCCall {
5599
5599
  if (error.message.includes("connection")) {
5600
5600
  return JSONRPCUtils.createError(-32002 /* CONNECTION_ERROR */, STANDARD_ERROR_MESSAGES[-32002 /* CONNECTION_ERROR */]);
5601
5601
  }
5602
- return JSONRPCUtils.createError(error?.code || -32603 /* INTERNAL_ERROR */, STANDARD_ERROR_MESSAGES[-32603 /* INTERNAL_ERROR */], { originalError: error.message });
5602
+ const code = error?.code || -32603 /* INTERNAL_ERROR */;
5603
+ const errorType = STANDARD_ERROR_MESSAGES[code];
5604
+ return JSONRPCUtils.createError(code, error.message || errorType, {
5605
+ errorType
5606
+ });
5603
5607
  }
5604
5608
  sendMessage(message, options) {
5605
5609
  console.warn("JSONRPCManager.sendMessage not implemented - message not sent:");
@@ -5650,8 +5654,8 @@ class JSONRPCManager extends JSONRPCCall {
5650
5654
  }
5651
5655
  } catch (err) {
5652
5656
  const error = err;
5653
- console.error("Error handling WebSocket message:", error);
5654
- const errorResponse = JSONRPCUtils.createErrorResponse(JSONRPCUtils.createError(-32603 /* INTERNAL_ERROR */, "Internal error"), null);
5657
+ console.error("Error handling validateMessage:", error);
5658
+ const errorResponse = JSONRPCUtils.createErrorResponse(this.config.errorHandler(error), null);
5655
5659
  return this.sendMessage(errorResponse, options);
5656
5660
  }
5657
5661
  }
@@ -5956,5 +5960,6 @@ export {
5956
5960
  JSONRPCManager,
5957
5961
  JSONRPCErrorCode,
5958
5962
  JSONRPCCall,
5959
- ErrorCode
5963
+ ErrorCode,
5964
+ ERROR_METHOD_NOT_FOUND
5960
5965
  };
@@ -18,6 +18,7 @@ export { JSONRPCManager } from "./jsonrpc-manager";
18
18
  export { JSONRPCErrorCode } from "./schemas/jsonrpc";
19
19
  export type { JSONRPCManagerEvents, JSONRPCManagerConfig, } from "./jsonrpc-manager";
20
20
  export type { JSONRPCMessage, JSONRPCRequest, JSONRPCNotification, JSONRPCResponse, JSONRPCBatchRequest, JSONRPCBatchResponse, JSONRPCErrorResponse, JSONRPCValidationResult, JSONRPCError, JSONRPCParams, CommandExecuteParams, NotificationSendParams, } from "./schemas/jsonrpc";
21
+ export { ERROR_METHOD_NOT_FOUND } from "./jsonrpc-manager";
21
22
  /**
22
23
  * For test tool
23
24
  */
@@ -1,4 +1,12 @@
1
+ /**
2
+ * JSON-RPC Manager
3
+ *
4
+ * Clean JSON-RPC 2.0 implementation for communication.
5
+ * Provides method registration, routing, and lifecycle management.
6
+ */
7
+ import { ErrorCode } from "./util_error";
1
8
  import { JSONRPCCall } from "./util_pending";
9
+ import { JSONRPCErrorCode } from "./schemas/jsonrpc";
2
10
  import type { JSONRPCRequest, JSONRPCMessage, JSONRPCError, JSONRPCParams } from "./schemas/jsonrpc";
3
11
  /**
4
12
  * Method handler function signature
@@ -43,6 +51,9 @@ export interface JSONRPCManagerEvents<TContext> {
43
51
  onMethodResponse?: (method: string, result: any, context: TContext) => void;
44
52
  onMethodError?: (method: string, error: JSONRPCError, context: TContext) => void;
45
53
  }
54
+ export declare class ERROR_METHOD_NOT_FOUND extends ErrorCode {
55
+ readonly code = JSONRPCErrorCode.METHOD_NOT_FOUND;
56
+ }
46
57
  /**
47
58
  * Central JSON-RPC Manager class
48
59
  */
@@ -74,7 +85,7 @@ export declare class JSONRPCManager<TContext> extends JSONRPCCall {
74
85
  /**
75
86
  * Send a message (to be overridden by implementation)
76
87
  */
77
- protected sendMessage(message: JSONRPCMessage, options: TContext): any;
88
+ protected sendMessage(message: JSONRPCMessage, options?: TContext): any;
78
89
  /**
79
90
  * Send a JSON-RPC notification (no response expected)
80
91
  */
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.12.12",
2
+ "version": "0.12.13",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",
@@ -29,7 +29,7 @@
29
29
  "build:types": "bun tsc -p ./",
30
30
  "build:src": "bun build src/index.ts --outdir dist",
31
31
  "build": "bun run build:clean && bun run build:src && bun run build:types",
32
- "dev": "bunx concurrently 'bunx --watch tsc -p ./' 'bun build:src -- --watch --sourcemap=inline'",
32
+ "dev": "bunx concurrently 'bun --watch tsc -p ./' 'bun build:src -- --watch --sourcemap=inline'",
33
33
  "test": "bun test",
34
34
  "prepublishOnly": "npm run build && npm run test"
35
35
  },