stellar-cyber-mcp-agents
Version:
Model Context Protocol (MCP) server for Stellar Cyber security operations with specialized multi-agent analysis capabilities
97 lines • 3.34 kB
JavaScript
/**
* Core types for the multi-agent system
*/
export var AgentType;
(function (AgentType) {
AgentType["HUB"] = "hub";
AgentType["INVESTIGATION"] = "investigation";
AgentType["CORRELATION"] = "correlation";
AgentType["NETWORK_ANALYSIS"] = "network_analysis";
AgentType["MALWARE_ANALYSIS"] = "malware_analysis";
AgentType["CREDENTIAL_ANALYSIS"] = "credential_analysis";
AgentType["CAMPAIGN_DETECTION"] = "campaign_detection";
AgentType["WORKFLOW"] = "workflow";
})(AgentType || (AgentType = {}));
export var AgentState;
(function (AgentState) {
AgentState["INITIALIZING"] = "initializing";
AgentState["READY"] = "ready";
AgentState["BUSY"] = "busy";
AgentState["ERROR"] = "error";
AgentState["STOPPING"] = "stopping";
AgentState["STOPPED"] = "stopped";
})(AgentState || (AgentState = {}));
export var AgentHealth;
(function (AgentHealth) {
AgentHealth["HEALTHY"] = "healthy";
AgentHealth["DEGRADED"] = "degraded";
AgentHealth["UNHEALTHY"] = "unhealthy";
AgentHealth["CRITICAL"] = "critical";
})(AgentHealth || (AgentHealth = {}));
export var RequestPriority;
(function (RequestPriority) {
RequestPriority[RequestPriority["LOW"] = 1] = "LOW";
RequestPriority[RequestPriority["MEDIUM"] = 2] = "MEDIUM";
RequestPriority[RequestPriority["HIGH"] = 3] = "HIGH";
RequestPriority[RequestPriority["CRITICAL"] = 4] = "CRITICAL";
})(RequestPriority || (RequestPriority = {}));
export var AgentEventType;
(function (AgentEventType) {
AgentEventType["AGENT_STARTED"] = "agent_started";
AgentEventType["AGENT_STOPPED"] = "agent_stopped";
AgentEventType["AGENT_ERROR"] = "agent_error";
AgentEventType["AGENT_HEARTBEAT"] = "agent_heartbeat";
AgentEventType["REQUEST_RECEIVED"] = "request_received";
AgentEventType["REQUEST_PROCESSED"] = "request_processed";
AgentEventType["CAPABILITY_ADDED"] = "capability_added";
AgentEventType["CAPABILITY_REMOVED"] = "capability_removed";
})(AgentEventType || (AgentEventType = {}));
export class BaseAgent {
metadata;
registry;
channel;
logger;
metrics;
state = AgentState.INITIALIZING;
health = AgentHealth.HEALTHY;
constructor(metadata, registry, channel, logger, metrics) {
this.metadata = metadata;
this.registry = registry;
this.channel = channel;
this.logger = logger;
this.metrics = metrics;
}
getId() {
return this.metadata.id;
}
getMetadata() {
return this.metadata;
}
getState() {
return this.state;
}
getHealth() {
return this.health;
}
setState(state) {
this.state = state;
this.logger.debug(`Agent state changed to ${state}`, { agentId: this.metadata.id });
}
setHealth(health) {
this.health = health;
this.logger.debug(`Agent health changed to ${health}`, { agentId: this.metadata.id });
}
emitEvent(type, data) {
const event = {
id: crypto.randomUUID(),
sourceAgentId: this.metadata.id,
type,
data,
timestamp: new Date()
};
this.channel.broadcastEvent(event).catch(error => {
this.logger.error('Failed to broadcast event', { event, error });
});
}
}
//# sourceMappingURL=agent.js.map