modality-kit 0.10.1 → 0.10.2

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
@@ -5018,7 +5018,23 @@ var JSONRPCErrorCode;
5018
5018
  JSONRPCErrorCode2[JSONRPCErrorCode2["RATE_LIMIT_ERROR"] = -32005] = "RATE_LIMIT_ERROR";
5019
5019
  JSONRPCErrorCode2[JSONRPCErrorCode2["VALIDATION_ERROR"] = -32006] = "VALIDATION_ERROR";
5020
5020
  })(JSONRPCErrorCode ||= {});
5021
+ var STANDARD_ERROR_MESSAGES = {
5022
+ [-32700 /* PARSE_ERROR */]: "Parse error",
5023
+ [-32600 /* INVALID_REQUEST */]: "Invalid Request",
5024
+ [-32601 /* METHOD_NOT_FOUND */]: "Method not found",
5025
+ [-32602 /* INVALID_PARAMS */]: "Invalid params",
5026
+ [-32603 /* INTERNAL_ERROR */]: "Internal error",
5027
+ [-32099 /* SERVER_ERROR_START */]: "Server error",
5028
+ [-32000 /* SERVER_ERROR_END */]: "Server error",
5029
+ [-32001 /* TIMEOUT_ERROR */]: "Request timeout",
5030
+ [-32002 /* CONNECTION_ERROR */]: "Connection error",
5031
+ [-32003 /* AUTHENTICATION_ERROR */]: "Authentication required",
5032
+ [-32004 /* AUTHORIZATION_ERROR */]: "Authorization failed",
5033
+ [-32005 /* RATE_LIMIT_ERROR */]: "Rate limit exceeded",
5034
+ [-32006 /* VALIDATION_ERROR */]: "Validation error"
5035
+ };
5021
5036
 
5037
+ // src/JSONRPCUtils.ts
5022
5038
  class JSONRPCUtils {
5023
5039
  static validateMessage(message) {
5024
5040
  if (Array.isArray(message)) {
@@ -5153,21 +5169,6 @@ class JSONRPCUtils {
5153
5169
  }
5154
5170
  }
5155
5171
  }
5156
- var STANDARD_ERROR_MESSAGES = {
5157
- [-32700 /* PARSE_ERROR */]: "Parse error",
5158
- [-32600 /* INVALID_REQUEST */]: "Invalid Request",
5159
- [-32601 /* METHOD_NOT_FOUND */]: "Method not found",
5160
- [-32602 /* INVALID_PARAMS */]: "Invalid params",
5161
- [-32603 /* INTERNAL_ERROR */]: "Internal error",
5162
- [-32099 /* SERVER_ERROR_START */]: "Server error",
5163
- [-32000 /* SERVER_ERROR_END */]: "Server error",
5164
- [-32001 /* TIMEOUT_ERROR */]: "Request timeout",
5165
- [-32002 /* CONNECTION_ERROR */]: "Connection error",
5166
- [-32003 /* AUTHENTICATION_ERROR */]: "Authentication required",
5167
- [-32004 /* AUTHORIZATION_ERROR */]: "Authorization failed",
5168
- [-32005 /* RATE_LIMIT_ERROR */]: "Rate limit exceeded",
5169
- [-32006 /* VALIDATION_ERROR */]: "Validation error"
5170
- };
5171
5172
 
5172
5173
  // src/util_pending.ts
5173
5174
  class PendingOperationsBase {
@@ -5921,10 +5922,13 @@ class LruCache {
5921
5922
  this.values.set(key, value);
5922
5923
  }
5923
5924
  }
5925
+ // src/util_tests/isTestEnvironment.ts
5926
+ var isTestEnvironment = globalThis.Bun?.main?.includes?.("test");
5924
5927
  export {
5925
5928
  withErrorHandling,
5926
5929
  setupAITools,
5927
5930
  loadVersion,
5931
+ isTestEnvironment,
5928
5932
  getLoggerInstance,
5929
5933
  formatSuccessResponse,
5930
5934
  formatErrorResponse,
@@ -0,0 +1,74 @@
1
+ /**
2
+ * JSON-RPC 2.0 Utility Functions
3
+ *
4
+ * Utility class for JSON-RPC message handling, validation, and creation.
5
+ * Extracted from schemas/jsonrpc.ts for independent use.
6
+ */
7
+ import { JSONRPCErrorCode, type JSONRPCParams, type JSONRPCId, type JSONRPCRequest, type JSONRPCNotification, type JSONRPCSuccessResponse, type JSONRPCErrorResponse, type JSONRPCError, type JSONRPCResponse, type JSONRPCMessage, type JSONRPCValidationResult } from './schemas/jsonrpc.js';
8
+ /**
9
+ * Utility functions for JSON-RPC message handling
10
+ */
11
+ export declare class JSONRPCUtils {
12
+ /**
13
+ * Validate a JSON-RPC message (supports batch requests)
14
+ */
15
+ static validateMessage(message: any): JSONRPCValidationResult;
16
+ /**
17
+ * Validate a single JSON-RPC message
18
+ */
19
+ static validateSingleMessage(message: any): JSONRPCValidationResult;
20
+ /**
21
+ * Create a JSON-RPC request
22
+ */
23
+ static createRequest(method: string, params?: JSONRPCParams, options?: {
24
+ customId?: JSONRPCId;
25
+ }): JSONRPCRequest;
26
+ /**
27
+ * Create a JSON-RPC notification
28
+ */
29
+ static createNotification(method: string, params?: JSONRPCParams): JSONRPCNotification;
30
+ /**
31
+ * Create a JSON-RPC success response
32
+ */
33
+ static createSuccessResponse(result: any, id: JSONRPCId): JSONRPCSuccessResponse;
34
+ /**
35
+ * Create a JSON-RPC error response
36
+ */
37
+ static createErrorResponse(error: JSONRPCError, id: JSONRPCId): JSONRPCErrorResponse;
38
+ /**
39
+ * Create a standard JSON-RPC error
40
+ */
41
+ static createError(code: JSONRPCErrorCode | number, message: string, data?: any): JSONRPCError;
42
+ /**
43
+ * Generate a unique ID for requests
44
+ */
45
+ static generateId(): string;
46
+ /**
47
+ * Check if a message is a JSON-RPC request
48
+ */
49
+ static isRequest(message: any): message is JSONRPCRequest;
50
+ /**
51
+ * Check if a message is a JSON-RPC notification
52
+ */
53
+ static isNotification(message: any): message is JSONRPCNotification;
54
+ /**
55
+ * Check if a message is a JSON-RPC response
56
+ */
57
+ static isResponse(message: any): message is JSONRPCResponse;
58
+ /**
59
+ * Check if a response is a success response
60
+ */
61
+ static isSuccessResponse(response: JSONRPCResponse): response is JSONRPCSuccessResponse;
62
+ /**
63
+ * Check if a response is an error response
64
+ */
65
+ static isErrorResponse(response: JSONRPCResponse): response is JSONRPCErrorResponse;
66
+ /**
67
+ * Serialize a JSON-RPC message to string
68
+ */
69
+ static serialize(message: JSONRPCMessage): string;
70
+ /**
71
+ * Deserialize a JSON-RPC message from string
72
+ */
73
+ static deserialize(data: string): JSONRPCMessage | null;
74
+ }
@@ -10,9 +10,14 @@ export { loadVersion } from "./util_version";
10
10
  export { compressWithLanguageDetection as compressText } from "./util_text_compression";
11
11
  export { JSONRPCCall, createDataPendingOperations } from "./util_pending";
12
12
  export type { DataPendingOperation, PendingOperation } from "./util_pending";
13
- export { JSONRPCUtils, JSONRPCErrorCode } from "./schemas/jsonrpc";
13
+ export { JSONRPCUtils } from "./JSONRPCUtils";
14
+ export { JSONRPCErrorCode } from "./schemas/jsonrpc";
14
15
  export type { JSONRPCMessage, JSONRPCRequest, JSONRPCNotification, JSONRPCResponse, JSONRPCBatchRequest, JSONRPCBatchResponse, JSONRPCErrorResponse, JSONRPCValidationResult, JSONRPCError, JSONRPCParams, CommandExecuteParams, NotificationSendParams, } from "./schemas/jsonrpc";
15
16
  export { JSONRPCManager } from "./jsonrpc-manager";
16
17
  export type { JSONRPCManagerEvents, JSONRPCManagerConfig, } from "./jsonrpc-manager";
17
18
  export { WebSocketClient } from "./websocket-client";
18
19
  export { LruCache } from "./lruCache";
20
+ /**
21
+ * For test tool
22
+ */
23
+ export { isTestEnvironment } from "./util_tests/isTestEnvironment";
@@ -153,73 +153,6 @@ export interface JSONRPCValidationResult {
153
153
  /** Parsed message type */
154
154
  messageType?: "request" | "notification" | "response" | "batch";
155
155
  }
156
- /**
157
- * Utility functions for JSON-RPC message handling
158
- */
159
- export declare class JSONRPCUtils {
160
- /**
161
- * Validate a JSON-RPC message (supports batch requests)
162
- */
163
- static validateMessage(message: any): JSONRPCValidationResult;
164
- /**
165
- * Validate a single JSON-RPC message
166
- */
167
- static validateSingleMessage(message: any): JSONRPCValidationResult;
168
- /**
169
- * Create a JSON-RPC request
170
- */
171
- static createRequest(method: string, params?: JSONRPCParams, options?: {
172
- customId?: JSONRPCId;
173
- }): JSONRPCRequest;
174
- /**
175
- * Create a JSON-RPC notification
176
- */
177
- static createNotification(method: string, params?: JSONRPCParams): JSONRPCNotification;
178
- /**
179
- * Create a JSON-RPC success response
180
- */
181
- static createSuccessResponse(result: any, id: JSONRPCId): JSONRPCSuccessResponse;
182
- /**
183
- * Create a JSON-RPC error response
184
- */
185
- static createErrorResponse(error: JSONRPCError, id: JSONRPCId): JSONRPCErrorResponse;
186
- /**
187
- * Create a standard JSON-RPC error
188
- */
189
- static createError(code: JSONRPCErrorCode | number, message: string, data?: any): JSONRPCError;
190
- /**
191
- * Generate a unique ID for requests
192
- */
193
- static generateId(): string;
194
- /**
195
- * Check if a message is a JSON-RPC request
196
- */
197
- static isRequest(message: any): message is JSONRPCRequest;
198
- /**
199
- * Check if a message is a JSON-RPC notification
200
- */
201
- static isNotification(message: any): message is JSONRPCNotification;
202
- /**
203
- * Check if a message is a JSON-RPC response
204
- */
205
- static isResponse(message: any): message is JSONRPCResponse;
206
- /**
207
- * Check if a response is a success response
208
- */
209
- static isSuccessResponse(response: JSONRPCResponse): response is JSONRPCSuccessResponse;
210
- /**
211
- * Check if a response is an error response
212
- */
213
- static isErrorResponse(response: JSONRPCResponse): response is JSONRPCErrorResponse;
214
- /**
215
- * Serialize a JSON-RPC message to string
216
- */
217
- static serialize(message: JSONRPCMessage): string;
218
- /**
219
- * Deserialize a JSON-RPC message from string
220
- */
221
- static deserialize(data: string): JSONRPCMessage | null;
222
- }
223
156
  /**
224
157
  * Standard error messages for common JSON-RPC errors
225
158
  */
@@ -0,0 +1 @@
1
+ export declare const isTestEnvironment: boolean;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.10.1",
2
+ "version": "0.10.2",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",