@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.
140 lines • 4.43 kB
TypeScript
/**
* Relationship Manager - Discovers and manages cross-element relationships
*
* Implements GraphRAG-style relationship tracking between elements:
* - similar_to: Semantic similarity (Jaccard-based)
* - used_by / uses: Usage dependencies
* - prerequisite_for / depends_on: Learning paths
* - helps_debug / debugged_by: Debugging relationships
* - contradicts / supports: Conflicting or supporting elements
*
* Features:
* - Automatic relationship discovery from content
* - Graph traversal for relationship paths
* - Relationship strength scoring
* - Bidirectional relationship tracking
*
* FIXES IMPLEMENTED (Issue #1099):
* - Uses centralized element ID parsing utilities
* - Consistent ID format handling
*/
import { EnhancedIndex } from './types/IndexTypes.js';
import { NLPScoringManager } from './NLPScoringManager.js';
import { VerbTriggerManager } from './VerbTriggerManager.js';
import { IndexConfigManager } from './config/IndexConfig.js';
/**
* Relationship types and their inverse mappings
*/
export declare const RELATIONSHIP_TYPES: {
readonly similar_to: "similar_to";
readonly uses: "used_by";
readonly used_by: "uses";
readonly prerequisite_for: "depends_on";
readonly depends_on: "prerequisite_for";
readonly requires: "required_by";
readonly required_by: "requires";
readonly helps_debug: "debugged_by";
readonly debugged_by: "helps_debug";
readonly supports: "supported_by";
readonly supported_by: "supports";
readonly contradicts: "contradicts";
readonly complements: "complements";
readonly parent_of: "child_of";
readonly child_of: "parent_of";
readonly contains: "contained_by";
readonly contained_by: "contains";
readonly follows: "preceded_by";
readonly preceded_by: "follows";
readonly example_of: "has_example";
readonly has_example: "example_of";
};
export type RelationshipType = keyof typeof RELATIONSHIP_TYPES;
/**
* Relationship discovery configuration
*/
export interface RelationshipConfig {
minConfidence?: number;
maxRelationshipsPerElement?: number;
enableAutoDiscovery?: boolean;
customPatterns?: RelationshipPattern[];
}
/**
* Pattern for discovering relationships
*/
export interface RelationshipPattern {
type: RelationshipType;
pattern: RegExp;
confidence: number;
bidirectional?: boolean;
}
/**
* Graph traversal options
*/
export interface TraversalOptions {
maxDepth?: number;
relationshipTypes?: RelationshipType[];
minStrength?: number;
visited?: Set<string>;
}
/**
* Path between elements
*/
export interface ElementPath {
path: string[];
relationships: RelationshipType[];
totalStrength: number;
}
export interface RelationshipManagerOptions {
config?: RelationshipConfig;
indexConfigManager: IndexConfigManager;
verbTriggerManager: VerbTriggerManager;
nlpScoring: NLPScoringManager;
}
export declare class RelationshipManager {
private _nlpScoring;
private verbTriggers;
private config;
private readonly defaultPatterns;
constructor(options: RelationshipManagerOptions);
/**
* Discover relationships for all elements in the index
*/
discoverRelationships(index: EnhancedIndex): Promise<void>;
/**
* Discover relationships for a single element
*/
private discoverElementRelationships;
/**
* Discover relationships based on verb associations
*/
private discoverVerbRelationships;
/**
* Add inverse relationship if applicable
*/
private addInverseRelationship;
/**
* Find element by partial name match
*/
private findElementByName;
/**
* Get combined text from element for analysis
*/
private getElementText;
/**
* Extract text from nested object
*/
private extractTextFromObject;
/**
* Find shortest path between two elements
*/
findPath(fromElement: string, toElement: string, index: EnhancedIndex, options?: TraversalOptions): ElementPath | null;
/**
* Get all connected elements within a certain depth
*/
getConnectedElements(element: string, index: EnhancedIndex, options?: TraversalOptions): Map<string, ElementPath>;
/**
* Get relationship statistics for the index
*/
getRelationshipStats(index: EnhancedIndex): Record<string, number>;
}
//# sourceMappingURL=RelationshipManager.d.ts.map