mcp-subagents
Version:
Multi-Agent AI Orchestration via Model Context Protocol - Access specialized CLI AI agents (Aider, Qwen, Gemini, Goose, etc.) with intelligent fallback and configuration
71 lines • 2.3 kB
JavaScript
import { SERVER_IDENTITY } from './constants.js';
export class AgentOrchestratorError extends Error {
details;
constructor(message, details) {
super(`[${SERVER_IDENTITY.displayName}] ${message}`);
this.details = details;
this.name = this.constructor.name;
// Ensure stack trace is captured
if (Error.captureStackTrace) {
Error.captureStackTrace(this, AgentOrchestratorError);
}
}
}
export class ConfigValidationError extends AgentOrchestratorError {
zodErrors;
code = 'CONFIG_VALIDATION_ERROR';
category = 'validation';
constructor(message, zodErrors) {
super(message, zodErrors);
this.zodErrors = zodErrors;
// Ensure stack trace is captured
if (Error.captureStackTrace) {
Error.captureStackTrace(this, ConfigValidationError);
}
}
}
export class AgentNotFoundError extends AgentOrchestratorError {
details;
code = 'AGENT_NOT_FOUND';
category = 'configuration';
constructor(message, details) {
super(message, details);
this.details = details;
// Ensure stack trace is captured
if (Error.captureStackTrace) {
Error.captureStackTrace(this, AgentNotFoundError);
}
}
}
export class AgentExecutionError extends AgentOrchestratorError {
agent;
exitCode;
stderr;
code = 'AGENT_EXECUTION_ERROR';
category = 'execution';
constructor(message, agent, exitCode, stderr) {
super(message, { agent, exitCode, stderr });
this.agent = agent;
this.exitCode = exitCode;
this.stderr = stderr;
this.name = 'AgentExecutionError';
// Ensure stack trace is captured
if (Error.captureStackTrace) {
Error.captureStackTrace(this, AgentExecutionError);
}
}
}
export class MCPValidationError extends AgentOrchestratorError {
zodErrors;
code = 'MCP_VALIDATION_ERROR';
category = 'validation';
constructor(message, zodErrors) {
super(message, zodErrors);
this.zodErrors = zodErrors;
// Ensure stack trace is captured
if (Error.captureStackTrace) {
Error.captureStackTrace(this, MCPValidationError);
}
}
}
//# sourceMappingURL=errors.js.map