@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.
125 lines • 3.36 kB
TypeScript
/**
* AgentManager - Handles CRUD operations for Agent elements
* Follows patterns from PersonaElementManager and MemoryManager
*
* SECURITY: Uses FileLockManager for atomic operations and SecureYamlParser for safe YAML parsing
*/
import { Agent } from './Agent.js';
import { AgentMetadata, AgentState } from './types.js';
import { IElementManager, ElementValidationResult } from '../../types/elements/index.js';
import { ElementType } from '../../portfolio/types.js';
interface ElementCreationResult {
success: boolean;
message: string;
element?: Agent;
}
export declare class AgentManager implements IElementManager<Agent> {
private readonly agentsPath;
private readonly stateCache;
constructor(portfolioPath: string);
/**
* Initialize the agents directory structure
*/
initialize(): Promise<void>;
/**
* Create a new agent
*/
create(name: string, description: string, content: string, metadata?: Partial<AgentMetadata>): Promise<ElementCreationResult>;
/**
* Read an agent by name
*/
read(name: string): Promise<Agent | null>;
/**
* Update an agent
*/
update(name: string, updates: Partial<AgentMetadata>, content?: string): Promise<boolean>;
/**
* Delete an agent
*/
delete(name: string): Promise<void>;
/**
* List all agents
*/
list(): Promise<Agent[]>;
/**
* Check if an agent exists
*/
exists(name: string): Promise<boolean>;
/**
* Validate an agent name
*/
validateName(name: string): {
valid: boolean;
error?: string;
};
/**
* Get element type
*/
getElementType(): ElementType;
/**
* Load agent state from file
*/
private loadAgentState;
/**
* Save agent state to file
*/
saveAgentState(name: string, state: AgentState): Promise<void>;
/**
* Parse agent file content
*/
private parseAgentFile;
/**
* Serialize agent to file format
*/
private serializeToFile;
/**
* Get filename for agent
*/
private getFilename;
/**
* Validate element name
*/
private validateElementName;
/**
* Get current user for attribution
*/
private getCurrentUserForAttribution;
/**
* Find an agent by predicate
*/
find(predicate: (element: Agent) => boolean): Promise<Agent | undefined>;
/**
* Find many agents by predicate
*/
findMany(predicate: (element: Agent) => boolean): Promise<Agent[]>;
/**
* Validate an agent
*/
validate(element: Agent): ElementValidationResult;
/**
* Validate a path
*/
validatePath(path: string): boolean;
/**
* Get file extension
*/
getFileExtension(): string;
/**
* Import an agent from data
*/
importElement(data: string, format?: 'json' | 'yaml' | 'markdown'): Promise<Agent>;
/**
* Export an agent to a format
*/
exportElement(element: Agent, format?: 'json' | 'yaml' | 'markdown'): Promise<string>;
/**
* Save an agent to a specific path
*/
save(element: Agent, targetPath: string): Promise<void>;
/**
* Load an agent from a specific path
*/
load(targetPath: string): Promise<Agent>;
}
export {};
//# sourceMappingURL=AgentManager.d.ts.map