UNPKG

@dollhousemcp/mcp-server

Version:

DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.

145 lines 4.17 kB
/** * Agent element implementation. * Autonomous goal-oriented actors with decision-making capabilities. * * SECURITY MEASURES IMPLEMENTED: * 1. Goal validation to prevent malicious objectives * 2. Decision framework sandboxing * 3. State size limits to prevent DoS * 4. Risk assessment for damage prevention * 5. Audit logging for all decisions and actions */ import { BaseElement } from '../BaseElement.js'; import { IElement, ElementValidationResult } from '../../types/elements/index.js'; import { AgentGoal, AgentDecision, AgentState, AgentMetadata } from './types.js'; import { RuleEngineConfig } from './ruleEngineConfig.js'; export declare class Agent extends BaseElement implements IElement { private state; private isDirtyState; private ruleEngineConfig; constructor(metadata: Partial<AgentMetadata>); /** * Add a new goal with security validation */ addGoal(goal: Partial<AgentGoal>): AgentGoal; /** * Make a decision for a goal */ makeDecision(goalId: string, context?: Record<string, any>): Promise<AgentDecision>; /** * Execute decision framework */ private executeDecisionFramework; /** * Rule-based decision making */ private ruleBasedDecision; /** * Programmatic decision making */ private programmaticDecision; /** * Assess risk for a decision */ private assessRisk; /** * Calculate Eisenhower quadrant */ private calculateEisenhowerQuadrant; /** * Validate goal for security threats */ private validateGoalSecurity; /** * Get agent state */ getState(): Readonly<AgentState>; /** * Update agent context */ updateContext(key: string, value: any): void; /** * Complete a goal */ completeGoal(goalId: string, outcome?: 'success' | 'failure' | 'partial'): void; /** * Detect dependency cycles in goal dependencies * MEDIUM PRIORITY IMPROVEMENT: Prevents circular dependencies between goals */ private detectDependencyCycle; /** * Get goals by status */ getGoalsByStatus(status: AgentGoal['status']): AgentGoal[]; /** * Get goals by quadrant */ getGoalsByQuadrant(quadrant: AgentGoal['eisenhowerQuadrant']): AgentGoal[]; /** * Calculate agent performance metrics * MEDIUM PRIORITY IMPROVEMENT: Enhanced to include decision timing metrics */ getPerformanceMetrics(): { successRate: number; averageCompletionTime: number; goalsCompleted: number; goalsInProgress: number; decisionAccuracy: number; averageDecisionTimeMs?: number; averageFrameworkTimeMs?: number; averageRiskAssessmentTimeMs?: number; }; /** * Validate the agent */ validate(): ElementValidationResult; /** * Serialize agent including state */ serialize(): string; /** * Deserialize agent including state */ deserialize(data: string): void; /** * Agent activation */ activate(): Promise<void>; /** * Agent deactivation */ deactivate(): Promise<void>; /** * Check if agent needs state persistence */ needsStatePersistence(): boolean; /** * Mark state as persisted */ markStatePersisted(): void; /** * Create a goal from a template * LOW PRIORITY IMPROVEMENT: Goal template system for common patterns */ addGoalFromTemplate(templateId: string, customFields: Record<string, any>): AgentGoal; /** * Get template recommendations based on goal description */ getGoalTemplateRecommendations(description: string): string[]; /** * Validate a goal against its template */ validateGoalTemplate(goalId: string): { valid: boolean; errors: string[]; }; /** * Update rule engine configuration */ updateRuleEngineConfig(config: Partial<RuleEngineConfig>): void; /** * Get current rule engine configuration */ getRuleEngineConfig(): Readonly<RuleEngineConfig>; } //# sourceMappingURL=Agent.d.ts.map