@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.
69 lines • 2.56 kB
TypeScript
/**
* Element Type Resolver - Shared utility for resolving missing element_type
* fields by searching the portfolio across all element managers.
*
* Used by any composite element type (ensembles, and future types like
* teams, workflows, pipelines) that references other elements.
*
* Issue #466: Replaces the silent '|| skill' default with portfolio lookup.
*/
/**
* Interface for managers passed to resolveElementTypes().
* Each manager is optional — only available managers are searched.
*
* PersonaManager uses findPersona() (synchronous) instead of the standard
* findByName() — both are supported.
*/
export interface ElementManagersForResolution {
skillManager?: {
findByName(name: string): Promise<any>;
};
templateManager?: {
findByName(name: string): Promise<any>;
};
agentManager?: {
findByName(name: string): Promise<any>;
};
memoryManager?: {
findByName(name: string): Promise<any>;
};
personaManager?: {
findPersona?(name: string): any;
};
ensembleManager?: {
findByName(name: string): Promise<any>;
};
}
/**
* Structured result from resolveElementTypes().
* Callers can inspect ambiguous/notFound to surface warnings to the user.
*/
export interface ResolveElementTypesResult {
/** Elements successfully resolved or already typed */
resolved: any[];
/** Elements found in multiple types — user must provide element_type */
ambiguous: Array<{
element_name: string;
found_in: string[];
}>;
/** Element names not found in any manager */
notFound: string[];
}
/**
* Resolve missing element_type fields by searching the portfolio.
*
* For each element without an element_type (or legacy type field), searches
* all provided managers to find which type the element belongs to.
*
* Resolution outcomes:
* - Found in exactly 1 type → element_type is set automatically
* - Found in multiple types → element is skipped with ambiguity warning
* - Not found in any type → element is skipped with not-found warning
* - Already has element_type → passed through unchanged
*
* @param elements - Raw element array (may have missing element_type)
* @param managers - Available element managers for portfolio lookup
* @returns Structured result with resolved elements and disambiguation info
*/
export declare function resolveElementTypes(elements: any[], managers: ElementManagersForResolution): Promise<ResolveElementTypesResult>;
//# sourceMappingURL=elementTypeResolver.d.ts.map