UNPKG

dynamic-interaction

Version:

Dynamic interaction 动态交互mcp,用于cursor、windsurf、trae 等 AI 智能编辑器 Agent 运行时交互使用

57 lines (56 loc) 1.75 kB
"use strict"; /** * 标准错误类型定义 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ErrorCodes = exports.ValidationError = exports.SessionError = exports.WebSocketError = exports.ServerError = void 0; class ServerError extends Error { code; statusCode; constructor(message, code, statusCode = 500) { super(message); this.code = code; this.statusCode = statusCode; this.name = 'ServerError'; } } exports.ServerError = ServerError; class WebSocketError extends ServerError { constructor(message, code) { super(message, code, 400); this.name = 'WebSocketError'; } } exports.WebSocketError = WebSocketError; class SessionError extends ServerError { constructor(message, code) { super(message, code, 400); this.name = 'SessionError'; } } exports.SessionError = SessionError; class ValidationError extends ServerError { constructor(message) { super(message, 'VALIDATION_ERROR', 400); this.name = 'ValidationError'; } } exports.ValidationError = ValidationError; exports.ErrorCodes = { // WebSocket errors INVALID_MESSAGE_FORMAT: 'INVALID_MESSAGE_FORMAT', JSON_PARSE_ERROR: 'JSON_PARSE_ERROR', CONNECTION_ERROR: 'CONNECTION_ERROR', // Session errors SESSION_NOT_FOUND: 'SESSION_NOT_FOUND', SESSION_TIMEOUT: 'SESSION_TIMEOUT', SESSION_CREATION_ERROR: 'SESSION_CREATION_ERROR', // Server errors SERVER_START_ERROR: 'SERVER_START_ERROR', SERVER_STOP_ERROR: 'SERVER_STOP_ERROR', // Notification errors NOTIFICATION_ERROR: 'NOTIFICATION_ERROR', // General errors INVALID_MODE: 'INVALID_MODE', UNHANDLED_MESSAGE_TYPE: 'UNHANDLED_MESSAGE_TYPE' };