UNPKG

mcp-server-debug-thinking

Version:

Graph-based MCP server for systematic debugging using Problem-Solution Trees and Hypothesis-Experiment-Learning cycles

154 lines 4.61 kB
/** * デバッグプロセスをグラフ構造で表現するための型定義 * 問題解決の流れをノードとエッジでモデル化 */ /** * ノードタイプ: デバッグプロセスの各段階を表現 * - problem: デバッグ対象の問題/エラー * - hypothesis: 問題の原因に関する仮説 * - experiment: 仮説を検証するための実験 * - observation: 実験結果の観察 * - learning: 観察から得た知見 * - solution: 問題の解決策 */ export type NodeType = "problem" | "hypothesis" | "experiment" | "observation" | "learning" | "solution"; /** * エッジタイプ: ノード間の意味的な関係を定義 * 各タイプはデバッグプロセスの自然な流れを表現 */ export type EdgeType = "decomposes" | "hypothesizes" | "tests" | "produces" | "learns" | "contradicts" | "supports" | "solves"; /** * 基本ノードインターフェース * すべてのノードタイプが共通で持つプロパティ */ export interface Node { id: string; type: NodeType; content: string; metadata: { createdAt: Date; updatedAt: Date; confidence?: number; status?: "open" | "investigating" | "solved" | "abandoned"; tags: string[]; [key: string]: unknown; }; } /** * エッジインターフェース * ノード間の方向性を持つ関係を表現 */ export interface Edge { id: string; type: EdgeType; from: string; to: string; strength: number; metadata?: { reasoning?: string; evidence?: string; createdAt: Date; [key: string]: unknown; }; } /** * デバッググラフ全体の構造 * ノードとエッジのMap、ルート問題、メタ情報を保持 */ export interface DebugGraph { nodes: Map<string, Node>; edges: Map<string, Edge>; roots: string[]; metadata: { createdAt: Date; lastModified: Date; sessionCount: number; }; } /** * ノードタイプ別の詳細インターフェース * 各ノードタイプが持つ固有のメタデータを型安全に定義 */ /** * 問題ノード: デバッグ対象のエラーや不具合 */ export interface ProblemNode extends Node { type: "problem"; metadata: Node["metadata"] & { errorMessage?: string; context?: { language?: string; framework?: string; environment?: string; }; isRoot: boolean; }; } /** * 仮説ノード: 問題の原因に関する推測 */ export interface HypothesisNode extends Node { type: "hypothesis"; metadata: Node["metadata"] & { confidence: number; assumptions?: string[]; testable: boolean; }; } /** * 実験ノード: 仮説を検証するためのアクション */ export interface ExperimentNode extends Node { type: "experiment"; metadata: Node["metadata"] & { code?: string; commands?: string[]; expectedOutcome: string; environment?: Record<string, unknown>; }; } /** * 観察ノード: 実験の結果として得られたデータ */ export interface ObservationNode extends Node { type: "observation"; metadata: Node["metadata"] & { output?: string; metrics?: Record<string, unknown>; unexpected?: boolean; }; } /** * 学習ノード: デバッグプロセスから得た知見や教訓 */ export interface LearningNode extends Node { type: "learning"; metadata: Node["metadata"] & { applicability: string; confidence: number; category?: "pattern" | "anti-pattern" | "best-practice" | "insight"; }; } /** * 解決策ノード: 問題を解決する具体的な方法 */ export interface SolutionNode extends Node { type: "solution"; metadata: Node["metadata"] & { implementation: string; verified: boolean; sideEffects?: string[]; alternativeApproaches?: string[]; }; } /** * 型ガード関数群 * ノードが特定の型であることを安全にチェック */ export declare function isProblemNode(node: Node): node is ProblemNode; export declare function isHypothesisNode(node: Node): node is HypothesisNode; export declare function isExperimentNode(node: Node): node is ExperimentNode; export declare function isObservationNode(node: Node): node is ObservationNode; export declare function isLearningNode(node: Node): node is LearningNode; export declare function isSolutionNode(node: Node): node is SolutionNode; //# sourceMappingURL=graph.d.ts.map