mcp-adr-analysis-server 2.1.9 → 2.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -8
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/index.d.ts +78 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1793 -577
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompts/index.d.ts.map +1 -1
- package/dist/src/prompts/index.js +23 -6
- package/dist/src/prompts/index.js.map +1 -1
- package/dist/src/prompts/validated-pattern-prompts.d.ts +33 -0
- package/dist/src/prompts/validated-pattern-prompts.d.ts.map +1 -0
- package/dist/src/prompts/validated-pattern-prompts.js +337 -0
- package/dist/src/prompts/validated-pattern-prompts.js.map +1 -0
- package/dist/src/resources/adr-by-id-resource.d.ts +116 -0
- package/dist/src/resources/adr-by-id-resource.d.ts.map +1 -0
- package/dist/src/resources/adr-by-id-resource.js +213 -0
- package/dist/src/resources/adr-by-id-resource.js.map +1 -0
- package/dist/src/resources/code-quality-resource.d.ts +105 -0
- package/dist/src/resources/code-quality-resource.d.ts.map +1 -0
- package/dist/src/resources/code-quality-resource.js +282 -0
- package/dist/src/resources/code-quality-resource.js.map +1 -0
- package/dist/src/resources/deployment-history-resource.d.ts +214 -0
- package/dist/src/resources/deployment-history-resource.d.ts.map +1 -0
- package/dist/src/resources/deployment-history-resource.js +308 -0
- package/dist/src/resources/deployment-history-resource.js.map +1 -0
- package/dist/src/resources/deployment-status-resource.d.ts +256 -0
- package/dist/src/resources/deployment-status-resource.d.ts.map +1 -0
- package/dist/src/resources/deployment-status-resource.js +665 -0
- package/dist/src/resources/deployment-status-resource.js.map +1 -0
- package/dist/src/resources/environment-analysis-resource.d.ts +237 -0
- package/dist/src/resources/environment-analysis-resource.d.ts.map +1 -0
- package/dist/src/resources/environment-analysis-resource.js +646 -0
- package/dist/src/resources/environment-analysis-resource.js.map +1 -0
- package/dist/src/resources/index.d.ts +6 -2
- package/dist/src/resources/index.d.ts.map +1 -1
- package/dist/src/resources/index.js +247 -492
- package/dist/src/resources/index.js.map +1 -1
- package/dist/src/resources/memory-snapshots-resource.d.ts +180 -0
- package/dist/src/resources/memory-snapshots-resource.d.ts.map +1 -0
- package/dist/src/resources/memory-snapshots-resource.js +847 -0
- package/dist/src/resources/memory-snapshots-resource.js.map +1 -0
- package/dist/src/resources/pattern-base-code-by-platform-resource.d.ts +35 -0
- package/dist/src/resources/pattern-base-code-by-platform-resource.d.ts.map +1 -0
- package/dist/src/resources/pattern-base-code-by-platform-resource.js +72 -0
- package/dist/src/resources/pattern-base-code-by-platform-resource.js.map +1 -0
- package/dist/src/resources/pattern-by-name-resource.d.ts +53 -0
- package/dist/src/resources/pattern-by-name-resource.d.ts.map +1 -0
- package/dist/src/resources/pattern-by-name-resource.js +200 -0
- package/dist/src/resources/pattern-by-name-resource.js.map +1 -0
- package/dist/src/resources/pattern-sources-by-platform-resource.d.ts +26 -0
- package/dist/src/resources/pattern-sources-by-platform-resource.d.ts.map +1 -0
- package/dist/src/resources/pattern-sources-by-platform-resource.js +59 -0
- package/dist/src/resources/pattern-sources-by-platform-resource.js.map +1 -0
- package/dist/src/resources/project-metrics-resource.d.ts +180 -0
- package/dist/src/resources/project-metrics-resource.d.ts.map +1 -0
- package/dist/src/resources/project-metrics-resource.js +487 -0
- package/dist/src/resources/project-metrics-resource.js.map +1 -0
- package/dist/src/resources/project-status-resource.d.ts +75 -0
- package/dist/src/resources/project-status-resource.d.ts.map +1 -0
- package/dist/src/resources/project-status-resource.js +189 -0
- package/dist/src/resources/project-status-resource.js.map +1 -0
- package/dist/src/resources/research-by-topic-resource.d.ts +21 -0
- package/dist/src/resources/research-by-topic-resource.d.ts.map +1 -0
- package/dist/src/resources/research-by-topic-resource.js +125 -0
- package/dist/src/resources/research-by-topic-resource.js.map +1 -0
- package/dist/src/resources/research-index-resource.d.ts +100 -0
- package/dist/src/resources/research-index-resource.d.ts.map +1 -0
- package/dist/src/resources/research-index-resource.js +200 -0
- package/dist/src/resources/research-index-resource.js.map +1 -0
- package/dist/src/resources/resource-cache.d.ts +144 -0
- package/dist/src/resources/resource-cache.d.ts.map +1 -0
- package/dist/src/resources/resource-cache.js +316 -0
- package/dist/src/resources/resource-cache.js.map +1 -0
- package/dist/src/resources/resource-router.d.ts +45 -0
- package/dist/src/resources/resource-router.d.ts.map +1 -0
- package/dist/src/resources/resource-router.js +96 -0
- package/dist/src/resources/resource-router.js.map +1 -0
- package/dist/src/resources/rule-by-id-resource.d.ts +38 -0
- package/dist/src/resources/rule-by-id-resource.d.ts.map +1 -0
- package/dist/src/resources/rule-by-id-resource.js +104 -0
- package/dist/src/resources/rule-by-id-resource.js.map +1 -0
- package/dist/src/resources/rule-catalog-resource.d.ts +126 -0
- package/dist/src/resources/rule-catalog-resource.d.ts.map +1 -0
- package/dist/src/resources/rule-catalog-resource.js +224 -0
- package/dist/src/resources/rule-catalog-resource.js.map +1 -0
- package/dist/src/resources/rule-generation-resource.d.ts +80 -0
- package/dist/src/resources/rule-generation-resource.d.ts.map +1 -0
- package/dist/src/resources/rule-generation-resource.js +282 -0
- package/dist/src/resources/rule-generation-resource.js.map +1 -0
- package/dist/src/resources/technology-by-name-resource.d.ts +43 -0
- package/dist/src/resources/technology-by-name-resource.d.ts.map +1 -0
- package/dist/src/resources/technology-by-name-resource.js +176 -0
- package/dist/src/resources/technology-by-name-resource.js.map +1 -0
- package/dist/src/resources/todo-by-id-resource.d.ts +46 -0
- package/dist/src/resources/todo-by-id-resource.d.ts.map +1 -0
- package/dist/src/resources/todo-by-id-resource.js +192 -0
- package/dist/src/resources/todo-by-id-resource.js.map +1 -0
- package/dist/src/resources/todo-list-resource.d.ts +96 -0
- package/dist/src/resources/todo-list-resource.d.ts.map +1 -0
- package/dist/src/resources/todo-list-resource.js +209 -0
- package/dist/src/resources/todo-list-resource.js.map +1 -0
- package/dist/src/resources/validated-pattern-by-platform-resource.d.ts +14 -0
- package/dist/src/resources/validated-pattern-by-platform-resource.d.ts.map +1 -0
- package/dist/src/resources/validated-pattern-by-platform-resource.js +45 -0
- package/dist/src/resources/validated-pattern-by-platform-resource.js.map +1 -0
- package/dist/src/resources/validated-patterns-catalog-resource.d.ts +36 -0
- package/dist/src/resources/validated-patterns-catalog-resource.d.ts.map +1 -0
- package/dist/src/resources/validated-patterns-catalog-resource.js +57 -0
- package/dist/src/resources/validated-patterns-catalog-resource.js.map +1 -0
- package/dist/src/templates/domain-knowledge-templates.d.ts.map +1 -1
- package/dist/src/templates/domain-knowledge-templates.js +49 -49
- package/dist/src/templates/domain-knowledge-templates.js.map +1 -1
- package/dist/src/tools/adr-bootstrap-validation-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-bootstrap-validation-tool.js +214 -4
- package/dist/src/tools/adr-bootstrap-validation-tool.js.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.d.ts +2 -2
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.js +129 -12
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
- package/dist/src/tools/adr-validation-tool.d.ts +98 -0
- package/dist/src/tools/adr-validation-tool.d.ts.map +1 -0
- package/dist/src/tools/adr-validation-tool.js +372 -0
- package/dist/src/tools/adr-validation-tool.js.map +1 -0
- package/dist/src/tools/bootstrap-validation-loop-tool.d.ts +262 -0
- package/dist/src/tools/bootstrap-validation-loop-tool.d.ts.map +1 -0
- package/dist/src/tools/bootstrap-validation-loop-tool.js +1934 -0
- package/dist/src/tools/bootstrap-validation-loop-tool.js.map +1 -0
- package/dist/src/tools/conversation-memory-tool.d.ts +48 -0
- package/dist/src/tools/conversation-memory-tool.d.ts.map +1 -0
- package/dist/src/tools/conversation-memory-tool.js +254 -0
- package/dist/src/tools/conversation-memory-tool.js.map +1 -0
- package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-analysis-tool.js +82 -6
- package/dist/src/tools/deployment-analysis-tool.js.map +1 -1
- package/dist/src/tools/deployment-guidance-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-guidance-tool.js +126 -25
- package/dist/src/tools/deployment-guidance-tool.js.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.js +166 -5
- package/dist/src/tools/deployment-readiness-tool.js.map +1 -1
- package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/environment-analysis-tool.js +36 -1
- package/dist/src/tools/environment-analysis-tool.js.map +1 -1
- package/dist/src/tools/expand-analysis-tool.d.ts +23 -0
- package/dist/src/tools/expand-analysis-tool.d.ts.map +1 -0
- package/dist/src/tools/expand-analysis-tool.js +107 -0
- package/dist/src/tools/expand-analysis-tool.js.map +1 -0
- package/dist/src/tools/get-server-context-tool.d.ts +67 -0
- package/dist/src/tools/get-server-context-tool.d.ts.map +1 -0
- package/dist/src/tools/get-server-context-tool.js +75 -0
- package/dist/src/tools/get-server-context-tool.js.map +1 -0
- package/dist/src/tools/interactive-adr-planning-tool.d.ts.map +1 -1
- package/dist/src/tools/interactive-adr-planning-tool.js +82 -9
- package/dist/src/tools/interactive-adr-planning-tool.js.map +1 -1
- package/dist/src/tools/llm-cloud-management-tool.d.ts +62 -0
- package/dist/src/tools/llm-cloud-management-tool.d.ts.map +1 -0
- package/dist/src/tools/llm-cloud-management-tool.js +202 -0
- package/dist/src/tools/llm-cloud-management-tool.js.map +1 -0
- package/dist/src/tools/llm-database-management-tool.d.ts +62 -0
- package/dist/src/tools/llm-database-management-tool.d.ts.map +1 -0
- package/dist/src/tools/llm-database-management-tool.js +203 -0
- package/dist/src/tools/llm-database-management-tool.js.map +1 -0
- package/dist/src/tools/llm-web-search-tool.d.ts +59 -0
- package/dist/src/tools/llm-web-search-tool.d.ts.map +1 -0
- package/dist/src/tools/llm-web-search-tool.js +165 -0
- package/dist/src/tools/llm-web-search-tool.js.map +1 -0
- package/dist/src/tools/mcp-planning-tool.d.ts.map +1 -1
- package/dist/src/tools/mcp-planning-tool.js +10 -3
- package/dist/src/tools/mcp-planning-tool.js.map +1 -1
- package/dist/src/tools/memory-loading-tool.d.ts.map +1 -1
- package/dist/src/tools/memory-loading-tool.js +4 -2
- package/dist/src/tools/memory-loading-tool.js.map +1 -1
- package/dist/src/tools/perform-research-tool.d.ts +61 -0
- package/dist/src/tools/perform-research-tool.d.ts.map +1 -0
- package/dist/src/tools/perform-research-tool.js +324 -0
- package/dist/src/tools/perform-research-tool.js.map +1 -0
- package/dist/src/tools/research-question-tool.d.ts.map +1 -1
- package/dist/src/tools/research-question-tool.js +11 -9
- package/dist/src/tools/research-question-tool.js.map +1 -1
- package/dist/src/tools/review-existing-adrs-tool.d.ts.map +1 -1
- package/dist/src/tools/review-existing-adrs-tool.js +42 -3
- package/dist/src/tools/review-existing-adrs-tool.js.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.d.ts +15 -94
- package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.js +2 -2
- package/dist/src/tools/tool-chain-orchestrator.js.map +1 -1
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +25 -120
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -1
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js +91 -2
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -1
- package/dist/src/types/ape-framework.d.ts +50 -283
- package/dist/src/types/ape-framework.d.ts.map +1 -1
- package/dist/src/types/conversation-context.d.ts.map +1 -1
- package/dist/src/types/conversation-context.js +12 -12
- package/dist/src/types/conversation-context.js.map +1 -1
- package/dist/src/types/conversation-memory.d.ts +184 -0
- package/dist/src/types/conversation-memory.d.ts.map +1 -0
- package/dist/src/types/conversation-memory.js +8 -0
- package/dist/src/types/conversation-memory.js.map +1 -0
- package/dist/src/types/index.d.ts +112 -339
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/knowledge-generation.d.ts +96 -401
- package/dist/src/types/knowledge-generation.d.ts.map +1 -1
- package/dist/src/types/knowledge-graph-schemas.d.ts +77 -715
- package/dist/src/types/knowledge-graph-schemas.d.ts.map +1 -1
- package/dist/src/types/knowledge-graph-schemas.js +8 -8
- package/dist/src/types/knowledge-graph-schemas.js.map +1 -1
- package/dist/src/types/memory-entities.d.ts +1230 -6164
- package/dist/src/types/memory-entities.d.ts.map +1 -1
- package/dist/src/types/memory-entities.js +8 -8
- package/dist/src/types/memory-entities.js.map +1 -1
- package/dist/src/types/reflexion-framework.d.ts +35 -264
- package/dist/src/types/reflexion-framework.d.ts.map +1 -1
- package/dist/src/types/reflexion-framework.js +1 -1
- package/dist/src/types/reflexion-framework.js.map +1 -1
- package/dist/src/types/state-reinforcement.d.ts +87 -0
- package/dist/src/types/state-reinforcement.d.ts.map +1 -0
- package/dist/src/types/state-reinforcement.js +5 -0
- package/dist/src/types/state-reinforcement.js.map +1 -0
- package/dist/src/types/tiered-response.d.ts +61 -0
- package/dist/src/types/tiered-response.d.ts.map +1 -0
- package/dist/src/types/tiered-response.js +8 -0
- package/dist/src/types/tiered-response.js.map +1 -0
- package/dist/src/types/tool-context.d.ts +50 -0
- package/dist/src/types/tool-context.d.ts.map +1 -0
- package/dist/src/types/tool-context.js +20 -0
- package/dist/src/types/tool-context.js.map +1 -0
- package/dist/src/utils/adr-action-analyzer.d.ts +23 -0
- package/dist/src/utils/adr-action-analyzer.d.ts.map +1 -0
- package/dist/src/utils/adr-action-analyzer.js +323 -0
- package/dist/src/utils/adr-action-analyzer.js.map +1 -0
- package/dist/src/utils/adr-context-detector.d.ts +33 -0
- package/dist/src/utils/adr-context-detector.d.ts.map +1 -0
- package/dist/src/utils/adr-context-detector.js +279 -0
- package/dist/src/utils/adr-context-detector.js.map +1 -0
- package/dist/src/utils/adr-discovery.d.ts +28 -2
- package/dist/src/utils/adr-discovery.d.ts.map +1 -1
- package/dist/src/utils/adr-discovery.js +91 -7
- package/dist/src/utils/adr-discovery.js.map +1 -1
- package/dist/src/utils/adr-knowledge-initializer.d.ts +54 -0
- package/dist/src/utils/adr-knowledge-initializer.d.ts.map +1 -0
- package/dist/src/utils/adr-knowledge-initializer.js +240 -0
- package/dist/src/utils/adr-knowledge-initializer.js.map +1 -0
- package/dist/src/utils/adr-timeline-extractor.d.ts +21 -0
- package/dist/src/utils/adr-timeline-extractor.d.ts.map +1 -0
- package/dist/src/utils/adr-timeline-extractor.js +294 -0
- package/dist/src/utils/adr-timeline-extractor.js.map +1 -0
- package/dist/src/utils/adr-timeline-types.d.ts +234 -0
- package/dist/src/utils/adr-timeline-types.d.ts.map +1 -0
- package/dist/src/utils/adr-timeline-types.js +7 -0
- package/dist/src/utils/adr-timeline-types.js.map +1 -0
- package/dist/src/utils/ai-executor.d.ts +36 -0
- package/dist/src/utils/ai-executor.d.ts.map +1 -1
- package/dist/src/utils/ai-executor.js +39 -3
- package/dist/src/utils/ai-executor.js.map +1 -1
- package/dist/src/utils/apply-cot-enhancement.d.ts.map +1 -1
- package/dist/src/utils/apply-cot-enhancement.js +15 -15
- package/dist/src/utils/apply-cot-enhancement.js.map +1 -1
- package/dist/src/utils/automatic-prompt-engineering.d.ts.map +1 -1
- package/dist/src/utils/automatic-prompt-engineering.js +68 -58
- package/dist/src/utils/automatic-prompt-engineering.js.map +1 -1
- package/dist/src/utils/conditional-request.d.ts +105 -0
- package/dist/src/utils/conditional-request.d.ts.map +1 -0
- package/dist/src/utils/conditional-request.js +186 -0
- package/dist/src/utils/conditional-request.js.map +1 -0
- package/dist/src/utils/config.d.ts +72 -18
- package/dist/src/utils/config.d.ts.map +1 -1
- package/dist/src/utils/config.js +75 -0
- package/dist/src/utils/config.js.map +1 -1
- package/dist/src/utils/context-document-manager.d.ts +112 -0
- package/dist/src/utils/context-document-manager.d.ts.map +1 -0
- package/dist/src/utils/context-document-manager.js +351 -0
- package/dist/src/utils/context-document-manager.js.map +1 -0
- package/dist/src/utils/conversation-memory-manager.d.ts +86 -0
- package/dist/src/utils/conversation-memory-manager.d.ts.map +1 -0
- package/dist/src/utils/conversation-memory-manager.js +443 -0
- package/dist/src/utils/conversation-memory-manager.js.map +1 -0
- package/dist/src/utils/dag-executor.d.ts +106 -0
- package/dist/src/utils/dag-executor.d.ts.map +1 -0
- package/dist/src/utils/dag-executor.js +420 -0
- package/dist/src/utils/dag-executor.js.map +1 -0
- package/dist/src/utils/deployment-analysis.d.ts.map +1 -1
- package/dist/src/utils/deployment-analysis.js +17 -9
- package/dist/src/utils/deployment-analysis.js.map +1 -1
- package/dist/src/utils/deployment-type-registry.d.ts +52 -0
- package/dist/src/utils/deployment-type-registry.d.ts.map +1 -0
- package/dist/src/utils/deployment-type-registry.js +543 -0
- package/dist/src/utils/deployment-type-registry.js.map +1 -0
- package/dist/src/utils/dynamic-deployment-intelligence.d.ts +117 -0
- package/dist/src/utils/dynamic-deployment-intelligence.d.ts.map +1 -0
- package/dist/src/utils/dynamic-deployment-intelligence.js +445 -0
- package/dist/src/utils/dynamic-deployment-intelligence.js.map +1 -0
- package/dist/src/utils/environment-analysis.d.ts.map +1 -1
- package/dist/src/utils/environment-analysis.js +63 -44
- package/dist/src/utils/environment-analysis.js.map +1 -1
- package/dist/src/utils/environment-capability-registry.d.ts +101 -0
- package/dist/src/utils/environment-capability-registry.d.ts.map +1 -0
- package/dist/src/utils/environment-capability-registry.js +489 -0
- package/dist/src/utils/environment-capability-registry.js.map +1 -0
- package/dist/src/utils/index.d.ts +3 -3
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +3 -3
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/knowledge-generation.d.ts.map +1 -1
- package/dist/src/utils/knowledge-generation.js +61 -35
- package/dist/src/utils/knowledge-generation.js.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.d.ts +19 -0
- package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.js +165 -1
- package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
- package/dist/src/utils/llm-artifact-detector.d.ts.map +1 -1
- package/dist/src/utils/llm-artifact-detector.js +28 -24
- package/dist/src/utils/llm-artifact-detector.js.map +1 -1
- package/dist/src/utils/mermaid-diagrams.d.ts +101 -0
- package/dist/src/utils/mermaid-diagrams.d.ts.map +1 -0
- package/dist/src/utils/mermaid-diagrams.js +445 -0
- package/dist/src/utils/mermaid-diagrams.js.map +1 -0
- package/dist/src/utils/monitoring.d.ts +249 -0
- package/dist/src/utils/monitoring.d.ts.map +1 -0
- package/dist/src/utils/monitoring.js +513 -0
- package/dist/src/utils/monitoring.js.map +1 -0
- package/dist/src/utils/pattern-contribution-helper.d.ts +60 -0
- package/dist/src/utils/pattern-contribution-helper.d.ts.map +1 -0
- package/dist/src/utils/pattern-contribution-helper.js +308 -0
- package/dist/src/utils/pattern-contribution-helper.js.map +1 -0
- package/dist/src/utils/pattern-loader.d.ts +183 -0
- package/dist/src/utils/pattern-loader.d.ts.map +1 -0
- package/dist/src/utils/pattern-loader.js +200 -0
- package/dist/src/utils/pattern-loader.js.map +1 -0
- package/dist/src/utils/pattern-research-utility.d.ts +107 -0
- package/dist/src/utils/pattern-research-utility.d.ts.map +1 -0
- package/dist/src/utils/pattern-research-utility.js +360 -0
- package/dist/src/utils/pattern-research-utility.js.map +1 -0
- package/dist/src/utils/pattern-to-dag-converter.d.ts +62 -0
- package/dist/src/utils/pattern-to-dag-converter.d.ts.map +1 -0
- package/dist/src/utils/pattern-to-dag-converter.js +265 -0
- package/dist/src/utils/pattern-to-dag-converter.js.map +1 -0
- package/dist/src/utils/platform-detector.d.ts +86 -0
- package/dist/src/utils/platform-detector.d.ts.map +1 -0
- package/dist/src/utils/platform-detector.js +509 -0
- package/dist/src/utils/platform-detector.js.map +1 -0
- package/dist/src/utils/prompt-composition.d.ts.map +1 -1
- package/dist/src/utils/prompt-composition.js +1 -4
- package/dist/src/utils/prompt-composition.js.map +1 -1
- package/dist/src/utils/reflexion.d.ts.map +1 -1
- package/dist/src/utils/reflexion.js +51 -42
- package/dist/src/utils/reflexion.js.map +1 -1
- package/dist/src/utils/research-integration.d.ts.map +1 -1
- package/dist/src/utils/research-integration.js +8 -2
- package/dist/src/utils/research-integration.js.map +1 -1
- package/dist/src/utils/research-orchestrator.d.ts +209 -0
- package/dist/src/utils/research-orchestrator.d.ts.map +1 -0
- package/dist/src/utils/research-orchestrator.js +863 -0
- package/dist/src/utils/research-orchestrator.js.map +1 -0
- package/dist/src/utils/research-questions.d.ts.map +1 -1
- package/dist/src/utils/research-questions.js +4 -1
- package/dist/src/utils/research-questions.js.map +1 -1
- package/dist/src/utils/resource-extractor.d.ts +57 -0
- package/dist/src/utils/resource-extractor.d.ts.map +1 -0
- package/dist/src/utils/resource-extractor.js +323 -0
- package/dist/src/utils/resource-extractor.js.map +1 -0
- package/dist/src/utils/resource-versioning.d.ts +124 -0
- package/dist/src/utils/resource-versioning.d.ts.map +1 -0
- package/dist/src/utils/resource-versioning.js +272 -0
- package/dist/src/utils/resource-versioning.js.map +1 -0
- package/dist/src/utils/root-manager.d.ts +118 -0
- package/dist/src/utils/root-manager.d.ts.map +1 -0
- package/dist/src/utils/root-manager.js +154 -0
- package/dist/src/utils/root-manager.js.map +1 -0
- package/dist/src/utils/rule-generation.d.ts.map +1 -1
- package/dist/src/utils/rule-generation.js +4 -1
- package/dist/src/utils/rule-generation.js.map +1 -1
- package/dist/src/utils/server-context-generator.d.ts +47 -0
- package/dist/src/utils/server-context-generator.d.ts.map +1 -0
- package/dist/src/utils/server-context-generator.js +666 -0
- package/dist/src/utils/server-context-generator.js.map +1 -0
- package/dist/src/utils/state-reinforcement-manager.d.ts +60 -0
- package/dist/src/utils/state-reinforcement-manager.d.ts.map +1 -0
- package/dist/src/utils/state-reinforcement-manager.js +200 -0
- package/dist/src/utils/state-reinforcement-manager.js.map +1 -0
- package/dist/src/utils/system-card-manager.d.ts +194 -0
- package/dist/src/utils/system-card-manager.d.ts.map +1 -0
- package/dist/src/utils/system-card-manager.js +336 -0
- package/dist/src/utils/system-card-manager.js.map +1 -0
- package/dist/src/utils/tiered-response-manager.d.ts +40 -0
- package/dist/src/utils/tiered-response-manager.d.ts.map +1 -0
- package/dist/src/utils/tiered-response-manager.js +243 -0
- package/dist/src/utils/tiered-response-manager.js.map +1 -0
- package/dist/src/utils/tree-sitter-analyzer.d.ts.map +1 -1
- package/dist/src/utils/tree-sitter-analyzer.js +83 -11
- package/dist/src/utils/tree-sitter-analyzer.js.map +1 -1
- package/dist/src/utils/validated-pattern-definitions.d.ts +219 -0
- package/dist/src/utils/validated-pattern-definitions.d.ts.map +1 -0
- package/dist/src/utils/validated-pattern-definitions.js +1511 -0
- package/dist/src/utils/validated-pattern-definitions.js.map +1 -0
- package/package.json +21 -12
- package/dist/src/prompts/todo-prompts.d.ts +0 -49
- package/dist/src/prompts/todo-prompts.d.ts.map +0 -1
- package/dist/src/prompts/todo-prompts.js +0 -824
- package/dist/src/prompts/todo-prompts.js.map +0 -1
- package/dist/src/types/todo-json-schemas.d.ts +0 -17
- package/dist/src/types/todo-json-schemas.d.ts.map +0 -1
- package/dist/src/types/todo-json-schemas.js +0 -9
- package/dist/src/types/todo-json-schemas.js.map +0 -1
- package/dist/src/utils/todo-file-watcher.d.ts +0 -14
- package/dist/src/utils/todo-file-watcher.d.ts.map +0 -1
- package/dist/src/utils/todo-file-watcher.js +0 -25
- package/dist/src/utils/todo-file-watcher.js.map +0 -1
|
@@ -0,0 +1,847 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory Snapshots Resource
|
|
3
|
+
*
|
|
4
|
+
* MCP Resource implementation for memory system snapshots and queries.
|
|
5
|
+
* Bridges to memory-loading-tool for actual operations.
|
|
6
|
+
*
|
|
7
|
+
* URI Templates:
|
|
8
|
+
* - adr://memory-snapshots/current - Current memory snapshot
|
|
9
|
+
* - adr://memory-snapshots/query - Query memory entities
|
|
10
|
+
* - adr://memory-snapshots/entity/{entityId} - Get specific entity
|
|
11
|
+
* - adr://memory-snapshots/related/{entityId} - Find related entities
|
|
12
|
+
* - adr://memory-snapshots/intelligence - Memory intelligence analysis
|
|
13
|
+
* - adr://memory-snapshots/load-adrs - Load ADRs into memory
|
|
14
|
+
*
|
|
15
|
+
* Query Parameters:
|
|
16
|
+
* - entityTypes: Filter by entity types (comma-separated)
|
|
17
|
+
* - tags: Filter by tags (comma-separated)
|
|
18
|
+
* - textQuery: Text search query
|
|
19
|
+
* - relationshipTypes: Filter by relationship types (comma-separated)
|
|
20
|
+
* - confidenceThreshold: Minimum confidence score (0-1)
|
|
21
|
+
* - relevanceThreshold: Minimum relevance score (0-1)
|
|
22
|
+
* - limit: Maximum results to return
|
|
23
|
+
* - sortBy: Sort order (relevance, confidence, lastModified, created, accessCount)
|
|
24
|
+
* - includeRelated: Include related entities (true/false)
|
|
25
|
+
* - relationshipDepth: Depth of relationships to traverse (1-5)
|
|
26
|
+
* - maxDepth: Maximum depth for find_related (1-10)
|
|
27
|
+
* - forceReload: Force reload of ADRs (true/false)
|
|
28
|
+
*/
|
|
29
|
+
import { MemoryLoadingTool } from '../tools/memory-loading-tool.js';
|
|
30
|
+
import { EnhancedLogger } from '../utils/enhanced-logging.js';
|
|
31
|
+
import { ResourceCache } from './resource-cache.js';
|
|
32
|
+
export class MemorySnapshotsResource {
|
|
33
|
+
memoryLoadingTool;
|
|
34
|
+
logger;
|
|
35
|
+
cache;
|
|
36
|
+
CACHE_TTL = 5 * 60; // 5 minutes in seconds
|
|
37
|
+
constructor(memoryLoadingTool) {
|
|
38
|
+
this.memoryLoadingTool = memoryLoadingTool || new MemoryLoadingTool();
|
|
39
|
+
this.logger = new EnhancedLogger({});
|
|
40
|
+
this.cache = new ResourceCache();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Parse memory URI to extract operation and entity ID
|
|
44
|
+
*/
|
|
45
|
+
parseUri(uri) {
|
|
46
|
+
// Remove protocol and base path
|
|
47
|
+
const path = uri.replace('adr://memory-snapshots/', '');
|
|
48
|
+
// Handle entity and related URIs with ID
|
|
49
|
+
if (path.startsWith('entity/')) {
|
|
50
|
+
return {
|
|
51
|
+
operation: 'entity',
|
|
52
|
+
entityId: path.replace('entity/', ''),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (path.startsWith('related/')) {
|
|
56
|
+
return {
|
|
57
|
+
operation: 'related',
|
|
58
|
+
entityId: path.replace('related/', ''),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// Handle other operations
|
|
62
|
+
switch (path) {
|
|
63
|
+
case 'current':
|
|
64
|
+
return { operation: 'current' };
|
|
65
|
+
case 'query':
|
|
66
|
+
return { operation: 'query' };
|
|
67
|
+
case 'intelligence':
|
|
68
|
+
return { operation: 'intelligence' };
|
|
69
|
+
case 'load-adrs':
|
|
70
|
+
return { operation: 'load-adrs' };
|
|
71
|
+
default:
|
|
72
|
+
throw new Error(`Invalid memory URI: ${uri}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parse query parameters from URI
|
|
77
|
+
*/
|
|
78
|
+
parseQueryParams(uri) {
|
|
79
|
+
const queryString = uri.split('?')[1];
|
|
80
|
+
if (!queryString)
|
|
81
|
+
return {};
|
|
82
|
+
const params = {};
|
|
83
|
+
const pairs = queryString.split('&');
|
|
84
|
+
for (const pair of pairs) {
|
|
85
|
+
const [key, value] = pair.split('=');
|
|
86
|
+
if (key && value) {
|
|
87
|
+
params[decodeURIComponent(key)] = decodeURIComponent(value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return params;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Convert query parameters to memory loading tool parameters
|
|
94
|
+
*/
|
|
95
|
+
buildToolParams(operation, entityId, queryParams) {
|
|
96
|
+
const params = {};
|
|
97
|
+
// Set action based on operation
|
|
98
|
+
switch (operation) {
|
|
99
|
+
case 'current':
|
|
100
|
+
params.action = 'create_snapshot';
|
|
101
|
+
break;
|
|
102
|
+
case 'query':
|
|
103
|
+
params.action = 'query_entities';
|
|
104
|
+
break;
|
|
105
|
+
case 'entity':
|
|
106
|
+
params.action = 'get_entity';
|
|
107
|
+
params.entityId = entityId;
|
|
108
|
+
break;
|
|
109
|
+
case 'related':
|
|
110
|
+
params.action = 'find_related';
|
|
111
|
+
params.entityId = entityId;
|
|
112
|
+
if (queryParams['maxDepth']) {
|
|
113
|
+
params.maxDepth = parseInt(queryParams['maxDepth'], 10);
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
case 'intelligence':
|
|
117
|
+
params.action = 'get_intelligence';
|
|
118
|
+
break;
|
|
119
|
+
case 'load-adrs':
|
|
120
|
+
params.action = 'load_adrs';
|
|
121
|
+
if (queryParams['forceReload']) {
|
|
122
|
+
params.forceReload = queryParams['forceReload'] === 'true';
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
// Build query object for query_entities action
|
|
127
|
+
if (operation === 'query') {
|
|
128
|
+
params.query = {};
|
|
129
|
+
if (queryParams['entityTypes']) {
|
|
130
|
+
params.query.entityTypes = queryParams['entityTypes'].split(',');
|
|
131
|
+
}
|
|
132
|
+
if (queryParams['tags']) {
|
|
133
|
+
params.query.tags = queryParams['tags'].split(',');
|
|
134
|
+
}
|
|
135
|
+
if (queryParams['textQuery']) {
|
|
136
|
+
params.query.textQuery = queryParams['textQuery'];
|
|
137
|
+
}
|
|
138
|
+
if (queryParams['relationshipTypes']) {
|
|
139
|
+
params.query.relationshipTypes = queryParams['relationshipTypes'].split(',');
|
|
140
|
+
}
|
|
141
|
+
if (queryParams['confidenceThreshold']) {
|
|
142
|
+
params.query.confidenceThreshold = parseFloat(queryParams['confidenceThreshold']);
|
|
143
|
+
}
|
|
144
|
+
if (queryParams['relevanceThreshold']) {
|
|
145
|
+
params.query.relevanceThreshold = parseFloat(queryParams['relevanceThreshold']);
|
|
146
|
+
}
|
|
147
|
+
if (queryParams['limit']) {
|
|
148
|
+
params.query.limit = parseInt(queryParams['limit'], 10);
|
|
149
|
+
}
|
|
150
|
+
if (queryParams['sortBy']) {
|
|
151
|
+
params.query.sortBy = queryParams['sortBy'];
|
|
152
|
+
}
|
|
153
|
+
if (queryParams['includeRelated']) {
|
|
154
|
+
params.query.includeRelated = queryParams['includeRelated'] === 'true';
|
|
155
|
+
}
|
|
156
|
+
if (queryParams['relationshipDepth']) {
|
|
157
|
+
params.query.relationshipDepth = parseInt(queryParams['relationshipDepth'], 10);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return params;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Extract structured data from memory loading tool response
|
|
164
|
+
*/
|
|
165
|
+
extractMemoryData(toolResponse) {
|
|
166
|
+
try {
|
|
167
|
+
const parsed = JSON.parse(toolResponse);
|
|
168
|
+
// Handle different response structures based on action
|
|
169
|
+
if (parsed.status === 'success') {
|
|
170
|
+
return parsed;
|
|
171
|
+
}
|
|
172
|
+
if (parsed.status === 'no_adrs_found') {
|
|
173
|
+
return {
|
|
174
|
+
status: 'empty',
|
|
175
|
+
message: parsed.message,
|
|
176
|
+
recommendations: parsed.recommendations || [],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (parsed.status === 'not_found') {
|
|
180
|
+
return {
|
|
181
|
+
status: 'not_found',
|
|
182
|
+
message: parsed.message,
|
|
183
|
+
entityId: parsed.entityId,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
return parsed;
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
// If JSON parsing fails, return raw text
|
|
190
|
+
return {
|
|
191
|
+
status: 'raw',
|
|
192
|
+
content: toolResponse,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Generate human-readable content from memory data
|
|
198
|
+
*/
|
|
199
|
+
formatMemoryContent(operation, data, queryParams) {
|
|
200
|
+
const sections = [];
|
|
201
|
+
// Header
|
|
202
|
+
sections.push('# Memory Snapshots Resource');
|
|
203
|
+
sections.push(`Operation: ${operation}`);
|
|
204
|
+
sections.push('');
|
|
205
|
+
// Handle different operations
|
|
206
|
+
switch (operation) {
|
|
207
|
+
case 'current':
|
|
208
|
+
return this.formatSnapshotContent(data);
|
|
209
|
+
case 'query':
|
|
210
|
+
return this.formatQueryContent(data, queryParams);
|
|
211
|
+
case 'entity':
|
|
212
|
+
return this.formatEntityContent(data);
|
|
213
|
+
case 'related':
|
|
214
|
+
return this.formatRelatedContent(data);
|
|
215
|
+
case 'intelligence':
|
|
216
|
+
return this.formatIntelligenceContent(data);
|
|
217
|
+
case 'load-adrs':
|
|
218
|
+
return this.formatLoadAdrsContent(data);
|
|
219
|
+
default:
|
|
220
|
+
sections.push('## Raw Data');
|
|
221
|
+
sections.push('```json');
|
|
222
|
+
sections.push(JSON.stringify(data, null, 2));
|
|
223
|
+
sections.push('```');
|
|
224
|
+
}
|
|
225
|
+
return sections.join('\n');
|
|
226
|
+
}
|
|
227
|
+
formatSnapshotContent(data) {
|
|
228
|
+
const sections = [];
|
|
229
|
+
sections.push('# Memory Snapshot');
|
|
230
|
+
sections.push('');
|
|
231
|
+
if (data.status === 'success' && data.snapshot) {
|
|
232
|
+
const snapshot = data.snapshot;
|
|
233
|
+
sections.push('## Snapshot Information');
|
|
234
|
+
sections.push(`- **ID**: ${snapshot.id}`);
|
|
235
|
+
sections.push(`- **Timestamp**: ${snapshot.timestamp}`);
|
|
236
|
+
sections.push(`- **Version**: ${snapshot.version}`);
|
|
237
|
+
sections.push('');
|
|
238
|
+
sections.push('## Entity Summary');
|
|
239
|
+
sections.push(`- **Total Entities**: ${snapshot.entitySummary.totalEntities}`);
|
|
240
|
+
sections.push(`- **Average Confidence**: ${(snapshot.entitySummary.averageConfidence * 100).toFixed(1)}%`);
|
|
241
|
+
sections.push('');
|
|
242
|
+
sections.push('### Entities by Type');
|
|
243
|
+
for (const [type, count] of Object.entries(snapshot.entitySummary.byType)) {
|
|
244
|
+
sections.push(`- ${type}: ${count}`);
|
|
245
|
+
}
|
|
246
|
+
sections.push('');
|
|
247
|
+
sections.push('## Relationship Summary');
|
|
248
|
+
sections.push(`- **Total Relationships**: ${snapshot.relationshipSummary.totalRelationships}`);
|
|
249
|
+
sections.push('');
|
|
250
|
+
sections.push('### Relationships by Type');
|
|
251
|
+
for (const [type, count] of Object.entries(snapshot.relationshipSummary.byType)) {
|
|
252
|
+
sections.push(`- ${type}: ${count}`);
|
|
253
|
+
}
|
|
254
|
+
sections.push('');
|
|
255
|
+
sections.push('## Intelligence Summary');
|
|
256
|
+
sections.push(`- **Discovered Patterns**: ${snapshot.intelligenceSummary.discoveredPatterns}`);
|
|
257
|
+
sections.push(`- **Suggested Relationships**: ${snapshot.intelligenceSummary.suggestedRelationships}`);
|
|
258
|
+
sections.push(`- **Next Actions**: ${snapshot.intelligenceSummary.nextActions}`);
|
|
259
|
+
sections.push(`- **Knowledge Gaps**: ${snapshot.intelligenceSummary.knowledgeGaps}`);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
sections.push(`Status: ${data.status || 'unknown'}`);
|
|
263
|
+
sections.push('');
|
|
264
|
+
sections.push('```json');
|
|
265
|
+
sections.push(JSON.stringify(data, null, 2));
|
|
266
|
+
sections.push('```');
|
|
267
|
+
}
|
|
268
|
+
return sections.join('\n');
|
|
269
|
+
}
|
|
270
|
+
formatQueryContent(data, queryParams) {
|
|
271
|
+
const sections = [];
|
|
272
|
+
sections.push('# Memory Query Results');
|
|
273
|
+
sections.push('');
|
|
274
|
+
if (data.status === 'success' && data.entities) {
|
|
275
|
+
sections.push('## Query Information');
|
|
276
|
+
sections.push(`- **Total Results**: ${data.query.totalResults}`);
|
|
277
|
+
sections.push(`- **Returned**: ${data.query.returnedResults}`);
|
|
278
|
+
sections.push(`- **Execution Time**: ${data.query.executionTime}ms`);
|
|
279
|
+
sections.push('');
|
|
280
|
+
if (Object.keys(queryParams).length > 0) {
|
|
281
|
+
sections.push('### Applied Filters');
|
|
282
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
283
|
+
sections.push(`- ${key}: ${value}`);
|
|
284
|
+
}
|
|
285
|
+
sections.push('');
|
|
286
|
+
}
|
|
287
|
+
sections.push('## Entities');
|
|
288
|
+
for (const entity of data.entities) {
|
|
289
|
+
sections.push(`### ${entity.title}`);
|
|
290
|
+
sections.push(`- **ID**: ${entity.id}`);
|
|
291
|
+
sections.push(`- **Type**: ${entity.type}`);
|
|
292
|
+
sections.push(`- **Confidence**: ${(entity.confidence * 100).toFixed(1)}%`);
|
|
293
|
+
if (entity.relevance !== undefined) {
|
|
294
|
+
sections.push(`- **Relevance**: ${(entity.relevance * 100).toFixed(1)}%`);
|
|
295
|
+
}
|
|
296
|
+
sections.push(`- **Access Count**: ${entity.accessCount}`);
|
|
297
|
+
sections.push(`- **Relationships**: ${entity.relationshipCount}`);
|
|
298
|
+
sections.push(`- **Tags**: ${entity.tags.join(', ')}`);
|
|
299
|
+
sections.push('');
|
|
300
|
+
sections.push(`**Description**: ${entity.description}`);
|
|
301
|
+
sections.push('');
|
|
302
|
+
if (entity.adrStatus) {
|
|
303
|
+
sections.push(`- **ADR Status**: ${entity.adrStatus}`);
|
|
304
|
+
sections.push(`- **Implementation Status**: ${entity.implementationStatus}`);
|
|
305
|
+
sections.push('');
|
|
306
|
+
}
|
|
307
|
+
if (entity.artifactType) {
|
|
308
|
+
sections.push(`- **Artifact Type**: ${entity.artifactType}`);
|
|
309
|
+
sections.push(`- **Format**: ${entity.format}`);
|
|
310
|
+
sections.push('');
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (data.relationships && data.relationships.length > 0) {
|
|
314
|
+
sections.push('## Relationships');
|
|
315
|
+
for (const rel of data.relationships) {
|
|
316
|
+
sections.push(`- **${rel.type}**: ${rel.sourceId} → ${rel.targetId}`);
|
|
317
|
+
sections.push(` - Strength: ${(rel.strength * 100).toFixed(1)}%`);
|
|
318
|
+
sections.push(` - Confidence: ${(rel.confidence * 100).toFixed(1)}%`);
|
|
319
|
+
}
|
|
320
|
+
sections.push('');
|
|
321
|
+
}
|
|
322
|
+
if (data.intelligence) {
|
|
323
|
+
sections.push('## Intelligence Insights');
|
|
324
|
+
if (data.intelligence.patterns && data.intelligence.patterns.length > 0) {
|
|
325
|
+
sections.push('### Patterns');
|
|
326
|
+
for (const pattern of data.intelligence.patterns) {
|
|
327
|
+
sections.push(`- ${pattern.pattern} (confidence: ${(pattern.confidence * 100).toFixed(1)}%)`);
|
|
328
|
+
}
|
|
329
|
+
sections.push('');
|
|
330
|
+
}
|
|
331
|
+
if (data.intelligence.recommendations && data.intelligence.recommendations.length > 0) {
|
|
332
|
+
sections.push('### Recommendations');
|
|
333
|
+
for (const rec of data.intelligence.recommendations) {
|
|
334
|
+
sections.push(`- ${rec.action}`);
|
|
335
|
+
}
|
|
336
|
+
sections.push('');
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
sections.push(`Status: ${data.status || 'unknown'}`);
|
|
342
|
+
sections.push('');
|
|
343
|
+
sections.push('```json');
|
|
344
|
+
sections.push(JSON.stringify(data, null, 2));
|
|
345
|
+
sections.push('```');
|
|
346
|
+
}
|
|
347
|
+
return sections.join('\n');
|
|
348
|
+
}
|
|
349
|
+
formatEntityContent(data) {
|
|
350
|
+
const sections = [];
|
|
351
|
+
sections.push('# Memory Entity Details');
|
|
352
|
+
sections.push('');
|
|
353
|
+
if (data.status === 'success' && data.entity) {
|
|
354
|
+
const entity = data.entity;
|
|
355
|
+
sections.push('## Entity Information');
|
|
356
|
+
sections.push(`- **ID**: ${entity.id}`);
|
|
357
|
+
sections.push(`- **Title**: ${entity.title}`);
|
|
358
|
+
sections.push(`- **Type**: ${entity.type}`);
|
|
359
|
+
sections.push(`- **Confidence**: ${(entity.confidence * 100).toFixed(1)}%`);
|
|
360
|
+
if (entity.relevance !== undefined) {
|
|
361
|
+
sections.push(`- **Relevance**: ${(entity.relevance * 100).toFixed(1)}%`);
|
|
362
|
+
}
|
|
363
|
+
sections.push(`- **Created**: ${entity.created}`);
|
|
364
|
+
sections.push(`- **Last Modified**: ${entity.lastModified}`);
|
|
365
|
+
sections.push(`- **Tags**: ${entity.tags.join(', ')}`);
|
|
366
|
+
sections.push('');
|
|
367
|
+
sections.push('## Description');
|
|
368
|
+
sections.push(entity.description);
|
|
369
|
+
sections.push('');
|
|
370
|
+
sections.push('## Access Pattern');
|
|
371
|
+
sections.push(`- **Access Count**: ${entity.accessPattern.accessCount}`);
|
|
372
|
+
sections.push(`- **Last Access**: ${entity.accessPattern.lastAccess}`);
|
|
373
|
+
sections.push(`- **Access Frequency**: ${entity.accessPattern.accessFrequency}`);
|
|
374
|
+
sections.push('');
|
|
375
|
+
if (entity.evolution) {
|
|
376
|
+
sections.push('## Evolution');
|
|
377
|
+
sections.push(`- **Version**: ${entity.evolution.version}`);
|
|
378
|
+
sections.push(`- **Change Count**: ${entity.evolution.changeHistory.length}`);
|
|
379
|
+
sections.push('');
|
|
380
|
+
}
|
|
381
|
+
sections.push('## Direct Relationships');
|
|
382
|
+
for (const rel of entity.relationships) {
|
|
383
|
+
sections.push(`- **${rel.type}**: ${rel.relatedEntityId}`);
|
|
384
|
+
sections.push(` - Strength: ${(rel.strength * 100).toFixed(1)}%`);
|
|
385
|
+
}
|
|
386
|
+
sections.push('');
|
|
387
|
+
if (data.relatedEntities && data.relatedEntities.length > 0) {
|
|
388
|
+
sections.push('## Related Entities');
|
|
389
|
+
for (const related of data.relatedEntities) {
|
|
390
|
+
sections.push(`### ${related.title}`);
|
|
391
|
+
sections.push(`- **ID**: ${related.id}`);
|
|
392
|
+
sections.push(`- **Type**: ${related.type}`);
|
|
393
|
+
sections.push(`- **Confidence**: ${(related.confidence * 100).toFixed(1)}%`);
|
|
394
|
+
sections.push('');
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (data.intelligence &&
|
|
398
|
+
data.intelligence.suggestedActions &&
|
|
399
|
+
data.intelligence.suggestedActions.length > 0) {
|
|
400
|
+
sections.push('## Suggested Actions');
|
|
401
|
+
for (const action of data.intelligence.suggestedActions) {
|
|
402
|
+
sections.push(`- ${action.action}`);
|
|
403
|
+
}
|
|
404
|
+
sections.push('');
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else if (data.status === 'not_found') {
|
|
408
|
+
sections.push(`⚠️ Entity not found: ${data.entityId}`);
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
sections.push(`Status: ${data.status || 'unknown'}`);
|
|
412
|
+
sections.push('');
|
|
413
|
+
sections.push('```json');
|
|
414
|
+
sections.push(JSON.stringify(data, null, 2));
|
|
415
|
+
sections.push('```');
|
|
416
|
+
}
|
|
417
|
+
return sections.join('\n');
|
|
418
|
+
}
|
|
419
|
+
formatRelatedContent(data) {
|
|
420
|
+
const sections = [];
|
|
421
|
+
sections.push('# Related Entities');
|
|
422
|
+
sections.push('');
|
|
423
|
+
if (data.status === 'success') {
|
|
424
|
+
sections.push('## Query Information');
|
|
425
|
+
sections.push(`- **Source Entity**: ${data.sourceEntityId}`);
|
|
426
|
+
sections.push(`- **Max Depth**: ${data.maxDepth}`);
|
|
427
|
+
sections.push(`- **Total Related**: ${data.statistics.totalRelatedEntities}`);
|
|
428
|
+
sections.push('');
|
|
429
|
+
sections.push('## Statistics');
|
|
430
|
+
sections.push('### Path Distribution');
|
|
431
|
+
for (const [depth, count] of Object.entries(data.statistics.pathDistribution)) {
|
|
432
|
+
sections.push(`- ${depth}: ${count}`);
|
|
433
|
+
}
|
|
434
|
+
sections.push('');
|
|
435
|
+
sections.push('### Relationship Types');
|
|
436
|
+
for (const [type, count] of Object.entries(data.statistics.relationshipTypes)) {
|
|
437
|
+
sections.push(`- ${type}: ${count}`);
|
|
438
|
+
}
|
|
439
|
+
sections.push('');
|
|
440
|
+
sections.push('## Related Entities');
|
|
441
|
+
for (const entity of data.relatedEntities) {
|
|
442
|
+
sections.push(`### ${entity.title}`);
|
|
443
|
+
sections.push(`- **ID**: ${entity.id}`);
|
|
444
|
+
sections.push(`- **Type**: ${entity.type}`);
|
|
445
|
+
sections.push(`- **Confidence**: ${(entity.confidence * 100).toFixed(1)}%`);
|
|
446
|
+
sections.push(`- **Relevance**: ${(entity.relevance * 100).toFixed(1)}%`);
|
|
447
|
+
sections.push('');
|
|
448
|
+
sections.push(`**Description**: ${entity.description}`);
|
|
449
|
+
sections.push('');
|
|
450
|
+
}
|
|
451
|
+
sections.push('## Relationship Paths');
|
|
452
|
+
for (const path of data.relationshipPaths) {
|
|
453
|
+
sections.push(`### Depth ${path.depth} (${path.pathLength} entities)`);
|
|
454
|
+
sections.push('**Path**: ' + path.entities.join(' → '));
|
|
455
|
+
sections.push('');
|
|
456
|
+
sections.push('**Relationships**:');
|
|
457
|
+
for (const rel of path.relationshipChain) {
|
|
458
|
+
sections.push(`- ${rel.type} (strength: ${(rel.strength * 100).toFixed(1)}%)`);
|
|
459
|
+
}
|
|
460
|
+
sections.push('');
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
sections.push(`Status: ${data.status || 'unknown'}`);
|
|
465
|
+
sections.push('');
|
|
466
|
+
sections.push('```json');
|
|
467
|
+
sections.push(JSON.stringify(data, null, 2));
|
|
468
|
+
sections.push('```');
|
|
469
|
+
}
|
|
470
|
+
return sections.join('\n');
|
|
471
|
+
}
|
|
472
|
+
formatIntelligenceContent(data) {
|
|
473
|
+
const sections = [];
|
|
474
|
+
sections.push('# Memory Intelligence');
|
|
475
|
+
sections.push('');
|
|
476
|
+
if (data.status === 'success' && data.intelligence) {
|
|
477
|
+
const intel = data.intelligence;
|
|
478
|
+
sections.push('## Context Awareness');
|
|
479
|
+
sections.push('### Current Context');
|
|
480
|
+
sections.push(`- **Project Phase**: ${intel.contextAwareness.currentContext.projectPhase}`);
|
|
481
|
+
sections.push(`- **Business Domain**: ${intel.contextAwareness.currentContext.businessDomain}`);
|
|
482
|
+
sections.push(`- **Technical Stack**: ${intel.contextAwareness.currentContext.technicalStack.join(', ')}`);
|
|
483
|
+
sections.push('');
|
|
484
|
+
if (intel.contextAwareness.recentContextChanges &&
|
|
485
|
+
intel.contextAwareness.recentContextChanges.length > 0) {
|
|
486
|
+
sections.push('### Recent Context Changes');
|
|
487
|
+
for (const change of intel.contextAwareness.recentContextChanges) {
|
|
488
|
+
sections.push(`- ${change.timestamp}: ${change.description || 'Context updated'}`);
|
|
489
|
+
}
|
|
490
|
+
sections.push('');
|
|
491
|
+
}
|
|
492
|
+
sections.push('## Pattern Recognition');
|
|
493
|
+
sections.push(`- **Pattern Confidence**: ${(intel.patternRecognition.patternConfidence * 100).toFixed(1)}%`);
|
|
494
|
+
sections.push('');
|
|
495
|
+
if (intel.patternRecognition.discoveredPatterns &&
|
|
496
|
+
intel.patternRecognition.discoveredPatterns.length > 0) {
|
|
497
|
+
sections.push('### Discovered Patterns');
|
|
498
|
+
for (const pattern of intel.patternRecognition.discoveredPatterns) {
|
|
499
|
+
sections.push(`#### ${pattern.pattern}`);
|
|
500
|
+
sections.push(`- **Confidence**: ${(pattern.confidence * 100).toFixed(1)}%`);
|
|
501
|
+
sections.push(`- **Frequency**: ${pattern.frequency}`);
|
|
502
|
+
sections.push(`- **Applicability Score**: ${(pattern.applicabilityScore * 100).toFixed(1)}%`);
|
|
503
|
+
sections.push(`- **Contexts**: ${pattern.contexts.join(', ')}`);
|
|
504
|
+
sections.push('');
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
if (intel.patternRecognition.emergentBehaviors &&
|
|
508
|
+
intel.patternRecognition.emergentBehaviors.length > 0) {
|
|
509
|
+
sections.push('### Emergent Behaviors');
|
|
510
|
+
for (const behavior of intel.patternRecognition.emergentBehaviors) {
|
|
511
|
+
sections.push(`- ${behavior}`);
|
|
512
|
+
}
|
|
513
|
+
sections.push('');
|
|
514
|
+
}
|
|
515
|
+
sections.push('## Relationship Inference');
|
|
516
|
+
if (intel.relationshipInference.suggestedRelationships &&
|
|
517
|
+
intel.relationshipInference.suggestedRelationships.length > 0) {
|
|
518
|
+
sections.push('### Suggested Relationships');
|
|
519
|
+
for (const rel of intel.relationshipInference.suggestedRelationships) {
|
|
520
|
+
sections.push(`- ${rel.sourceId} → ${rel.targetId} (${rel.type})`);
|
|
521
|
+
sections.push(` - Confidence: ${(rel.confidence * 100).toFixed(1)}%`);
|
|
522
|
+
sections.push(` - Reason: ${rel.reason}`);
|
|
523
|
+
}
|
|
524
|
+
sections.push('');
|
|
525
|
+
}
|
|
526
|
+
if (intel.relationshipInference.weakConnections &&
|
|
527
|
+
intel.relationshipInference.weakConnections.length > 0) {
|
|
528
|
+
sections.push('### Weak Connections');
|
|
529
|
+
for (const conn of intel.relationshipInference.weakConnections) {
|
|
530
|
+
sections.push(`- ${conn.sourceId} ↔ ${conn.targetId} (strength: ${(conn.strength * 100).toFixed(1)}%)`);
|
|
531
|
+
}
|
|
532
|
+
sections.push('');
|
|
533
|
+
}
|
|
534
|
+
if (intel.relationshipInference.conflictDetection &&
|
|
535
|
+
intel.relationshipInference.conflictDetection.length > 0) {
|
|
536
|
+
sections.push('### Conflict Detection');
|
|
537
|
+
for (const conflict of intel.relationshipInference.conflictDetection) {
|
|
538
|
+
sections.push(`- ${conflict.description}`);
|
|
539
|
+
sections.push(` - Severity: ${conflict.severity}`);
|
|
540
|
+
}
|
|
541
|
+
sections.push('');
|
|
542
|
+
}
|
|
543
|
+
sections.push('## Adaptive Recommendations');
|
|
544
|
+
if (intel.adaptiveRecommendations.nextActions &&
|
|
545
|
+
intel.adaptiveRecommendations.nextActions.length > 0) {
|
|
546
|
+
sections.push('### Next Actions');
|
|
547
|
+
for (const action of intel.adaptiveRecommendations.nextActions) {
|
|
548
|
+
sections.push(`#### ${action.action}`);
|
|
549
|
+
sections.push(`- **Priority**: ${action.priority}`);
|
|
550
|
+
sections.push(`- **Confidence**: ${(action.confidence * 100).toFixed(1)}%`);
|
|
551
|
+
sections.push(`- **Reason**: ${action.reason}`);
|
|
552
|
+
sections.push('');
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
if (intel.adaptiveRecommendations.knowledgeGaps &&
|
|
556
|
+
intel.adaptiveRecommendations.knowledgeGaps.length > 0) {
|
|
557
|
+
sections.push('### Knowledge Gaps');
|
|
558
|
+
for (const gap of intel.adaptiveRecommendations.knowledgeGaps) {
|
|
559
|
+
sections.push(`- ${gap.description} (impact: ${gap.impact})`);
|
|
560
|
+
}
|
|
561
|
+
sections.push('');
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
sections.push(`Status: ${data.status || 'unknown'}`);
|
|
566
|
+
sections.push('');
|
|
567
|
+
sections.push('```json');
|
|
568
|
+
sections.push(JSON.stringify(data, null, 2));
|
|
569
|
+
sections.push('```');
|
|
570
|
+
}
|
|
571
|
+
return sections.join('\n');
|
|
572
|
+
}
|
|
573
|
+
formatLoadAdrsContent(data) {
|
|
574
|
+
const sections = [];
|
|
575
|
+
sections.push('# Load ADRs into Memory');
|
|
576
|
+
sections.push('');
|
|
577
|
+
if (data.status === 'success') {
|
|
578
|
+
sections.push(`✅ ${data.message}`);
|
|
579
|
+
sections.push('');
|
|
580
|
+
sections.push('## Summary');
|
|
581
|
+
sections.push(`- **Total ADRs**: ${data.summary.totalAdrs}`);
|
|
582
|
+
sections.push(`- **Entities Created**: ${data.summary.entitiesCreated}`);
|
|
583
|
+
sections.push(`- **Relationships Inferred**: ${data.summary.relationshipsInferred}`);
|
|
584
|
+
sections.push('');
|
|
585
|
+
sections.push('### Status Distribution');
|
|
586
|
+
for (const [status, count] of Object.entries(data.summary.statusDistribution)) {
|
|
587
|
+
sections.push(`- ${status}: ${count}`);
|
|
588
|
+
}
|
|
589
|
+
sections.push('');
|
|
590
|
+
if (data.summary.categoryDistribution) {
|
|
591
|
+
sections.push('### Category Distribution');
|
|
592
|
+
for (const [category, count] of Object.entries(data.summary.categoryDistribution)) {
|
|
593
|
+
sections.push(`- ${category}: ${count}`);
|
|
594
|
+
}
|
|
595
|
+
sections.push('');
|
|
596
|
+
}
|
|
597
|
+
sections.push('## Transformation Insights');
|
|
598
|
+
sections.push(`- **Average Confidence**: ${(data.transformation.averageConfidence * 100).toFixed(1)}%`);
|
|
599
|
+
sections.push(`- **Technical Stack**: ${data.transformation.technicalStackCoverage.join(', ')}`);
|
|
600
|
+
sections.push(`- **Business Domains**: ${data.transformation.businessDomains.join(', ')}`);
|
|
601
|
+
sections.push('');
|
|
602
|
+
sections.push('## Created Entities');
|
|
603
|
+
for (const entity of data.entities.slice(0, 10)) {
|
|
604
|
+
sections.push(`- **${entity.title}** (${entity.type})`);
|
|
605
|
+
sections.push(` - ID: ${entity.id}`);
|
|
606
|
+
sections.push(` - Confidence: ${(entity.confidence * 100).toFixed(1)}%`);
|
|
607
|
+
sections.push(` - Status: ${entity.status}`);
|
|
608
|
+
}
|
|
609
|
+
if (data.entities.length > 10) {
|
|
610
|
+
sections.push(`... and ${data.entities.length - 10} more`);
|
|
611
|
+
}
|
|
612
|
+
sections.push('');
|
|
613
|
+
sections.push('## Inferred Relationships');
|
|
614
|
+
for (const rel of data.relationships.slice(0, 10)) {
|
|
615
|
+
sections.push(`- **${rel.type}**: ${rel.sourceTitle} → ${rel.targetTitle}`);
|
|
616
|
+
sections.push(` - Strength: ${(rel.strength * 100).toFixed(1)}%`);
|
|
617
|
+
sections.push(` - Confidence: ${(rel.confidence * 100).toFixed(1)}%`);
|
|
618
|
+
}
|
|
619
|
+
if (data.relationships.length > 10) {
|
|
620
|
+
sections.push(`... and ${data.relationships.length - 10} more`);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
else if (data.status === 'no_adrs_found') {
|
|
624
|
+
sections.push(`⚠️ ${data.message}`);
|
|
625
|
+
sections.push('');
|
|
626
|
+
if (data.recommendations && data.recommendations.length > 0) {
|
|
627
|
+
sections.push('## Recommendations');
|
|
628
|
+
for (const rec of data.recommendations) {
|
|
629
|
+
sections.push(`- ${rec}`);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
else {
|
|
634
|
+
sections.push(`Status: ${data.status || 'unknown'}`);
|
|
635
|
+
sections.push('');
|
|
636
|
+
sections.push('```json');
|
|
637
|
+
sections.push(JSON.stringify(data, null, 2));
|
|
638
|
+
sections.push('```');
|
|
639
|
+
}
|
|
640
|
+
return sections.join('\n');
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Handle resource read request
|
|
644
|
+
*/
|
|
645
|
+
async read(uri) {
|
|
646
|
+
try {
|
|
647
|
+
this.logger.debug('Memory snapshots resource read', 'MemorySnapshotsResource', { uri });
|
|
648
|
+
// Check cache first
|
|
649
|
+
const cached = await this.cache.get(uri);
|
|
650
|
+
if (cached) {
|
|
651
|
+
this.logger.debug('Returning cached memory data', 'MemorySnapshotsResource', { uri });
|
|
652
|
+
return cached;
|
|
653
|
+
}
|
|
654
|
+
// Parse URI
|
|
655
|
+
const { operation, entityId } = this.parseUri(uri);
|
|
656
|
+
const queryParams = this.parseQueryParams(uri);
|
|
657
|
+
// Build tool parameters
|
|
658
|
+
const toolParams = this.buildToolParams(operation, entityId, queryParams);
|
|
659
|
+
// Execute memory loading tool
|
|
660
|
+
const toolResult = await this.memoryLoadingTool.execute(toolParams);
|
|
661
|
+
if (toolResult.isError || !toolResult.content || !toolResult.content[0]) {
|
|
662
|
+
throw new Error(toolResult.content?.[0]?.text || 'Tool execution failed');
|
|
663
|
+
}
|
|
664
|
+
// Extract and format data
|
|
665
|
+
const memoryData = this.extractMemoryData(toolResult.content[0].text);
|
|
666
|
+
const formattedContent = this.formatMemoryContent(operation, memoryData, queryParams);
|
|
667
|
+
const result = {
|
|
668
|
+
contents: [
|
|
669
|
+
{
|
|
670
|
+
uri,
|
|
671
|
+
mimeType: 'text/markdown',
|
|
672
|
+
text: formattedContent,
|
|
673
|
+
},
|
|
674
|
+
],
|
|
675
|
+
};
|
|
676
|
+
// Cache the result (TTL in seconds)
|
|
677
|
+
this.cache.set(uri, result, this.CACHE_TTL);
|
|
678
|
+
return result;
|
|
679
|
+
}
|
|
680
|
+
catch (error) {
|
|
681
|
+
this.logger.error('Memory snapshots resource read failed', 'MemorySnapshotsResource', error instanceof Error ? error : undefined, { uri, error });
|
|
682
|
+
// Return error as resource content
|
|
683
|
+
return {
|
|
684
|
+
contents: [
|
|
685
|
+
{
|
|
686
|
+
uri,
|
|
687
|
+
mimeType: 'text/markdown',
|
|
688
|
+
text: `# Memory Snapshots Error\n\n⚠️ Failed to read memory resource:\n\n\`\`\`\n${error instanceof Error ? error.message : String(error)}\n\`\`\``,
|
|
689
|
+
},
|
|
690
|
+
],
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* List available memory snapshot resources
|
|
696
|
+
*/
|
|
697
|
+
listTemplates() {
|
|
698
|
+
return [
|
|
699
|
+
{
|
|
700
|
+
uriTemplate: 'adr://memory-snapshots/current',
|
|
701
|
+
name: 'Current Memory Snapshot',
|
|
702
|
+
description: 'Current snapshot of the memory system with entities and relationships',
|
|
703
|
+
mimeType: 'text/markdown',
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
uriTemplate: 'adr://memory-snapshots/query?entityTypes={types}&tags={tags}&textQuery={query}',
|
|
707
|
+
name: 'Query Memory Entities',
|
|
708
|
+
description: 'Query memory entities with filters and search criteria',
|
|
709
|
+
mimeType: 'text/markdown',
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
uriTemplate: 'adr://memory-snapshots/entity/{entityId}',
|
|
713
|
+
name: 'Memory Entity Details',
|
|
714
|
+
description: 'Detailed information about a specific memory entity',
|
|
715
|
+
mimeType: 'text/markdown',
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
uriTemplate: 'adr://memory-snapshots/related/{entityId}?maxDepth={depth}',
|
|
719
|
+
name: 'Related Entities',
|
|
720
|
+
description: 'Find entities related to a specific entity with configurable depth',
|
|
721
|
+
mimeType: 'text/markdown',
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
uriTemplate: 'adr://memory-snapshots/intelligence',
|
|
725
|
+
name: 'Memory Intelligence',
|
|
726
|
+
description: 'Intelligence analysis including patterns, relationships, and recommendations',
|
|
727
|
+
mimeType: 'text/markdown',
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
uriTemplate: 'adr://memory-snapshots/load-adrs?forceReload={true|false}',
|
|
731
|
+
name: 'Load ADRs into Memory',
|
|
732
|
+
description: 'Load ADRs from the configured directory into the memory system',
|
|
733
|
+
mimeType: 'text/markdown',
|
|
734
|
+
},
|
|
735
|
+
];
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Generate memory snapshots resource for knowledge graph and learning system access.
|
|
740
|
+
*
|
|
741
|
+
* Provides access to the MCP server's intelligent memory system including project analyses,
|
|
742
|
+
* recommendations, deployments, and learned patterns. Supports temporal queries and
|
|
743
|
+
* contextual retrieval for AI-enhanced decision making.
|
|
744
|
+
*
|
|
745
|
+
* **Query Parameters:**
|
|
746
|
+
* - `type`: Snapshot type - "current" (latest), "historical" (time-based), "all" (complete)
|
|
747
|
+
* - `projectId`: Filter by project identifier
|
|
748
|
+
* - `since`: ISO timestamp for historical queries (e.g., "2025-10-01T00:00:00Z")
|
|
749
|
+
* - `limit`: Maximum number of snapshots to return (default: 10, max: 100)
|
|
750
|
+
*
|
|
751
|
+
* **Memory System Features:**
|
|
752
|
+
* - Project analysis history with patterns and predictions
|
|
753
|
+
* - Recommendation tracking with success metrics
|
|
754
|
+
* - Deployment history with trend analysis
|
|
755
|
+
* - Configuration changes and their impacts
|
|
756
|
+
* - Cross-project learning and insights
|
|
757
|
+
*
|
|
758
|
+
* @param _params - URL path parameters (currently unused, reserved for future routing)
|
|
759
|
+
* @param searchParams - URL query parameters controlling snapshot selection
|
|
760
|
+
*
|
|
761
|
+
* @returns Promise resolving to resource generation result containing:
|
|
762
|
+
* - data: Memory snapshots with metadata, timestamps, and relationships
|
|
763
|
+
* - contentType: "application/json"
|
|
764
|
+
* - lastModified: ISO timestamp of snapshot generation
|
|
765
|
+
* - cacheKey: Unique identifier for caching
|
|
766
|
+
* - ttl: Cache duration (60 seconds for real-time memory access)
|
|
767
|
+
* - etag: Entity tag for cache validation
|
|
768
|
+
*
|
|
769
|
+
* @throws {Error} When memory system access fails or query parameters invalid
|
|
770
|
+
*
|
|
771
|
+
* @example
|
|
772
|
+
* ```typescript
|
|
773
|
+
* // Get current memory snapshot
|
|
774
|
+
* const current = await generateMemorySnapshotsResource({}, new URLSearchParams());
|
|
775
|
+
* console.log(`Total memories: ${current.data.summary.total}`);
|
|
776
|
+
* console.log(`Recent analyses: ${current.data.recent.analyses.length}`);
|
|
777
|
+
*
|
|
778
|
+
* // Get historical snapshots since specific date
|
|
779
|
+
* const historical = await generateMemorySnapshotsResource(
|
|
780
|
+
* {},
|
|
781
|
+
* new URLSearchParams('type=historical&since=2025-10-01T00:00:00Z&limit=50')
|
|
782
|
+
* );
|
|
783
|
+
*
|
|
784
|
+
* // Filter by project
|
|
785
|
+
* const projectMemory = await generateMemorySnapshotsResource(
|
|
786
|
+
* {},
|
|
787
|
+
* new URLSearchParams('projectId=mcp-adr-analysis-server')
|
|
788
|
+
* );
|
|
789
|
+
*
|
|
790
|
+
* // Expected output structure:
|
|
791
|
+
* {
|
|
792
|
+
* data: {
|
|
793
|
+
* snapshot: {
|
|
794
|
+
* id: "snapshot-2025-10-12",
|
|
795
|
+
* timestamp: "2025-10-12T17:00:00.000Z",
|
|
796
|
+
* type: "current"
|
|
797
|
+
* },
|
|
798
|
+
* summary: {
|
|
799
|
+
* total: 150,
|
|
800
|
+
* byType: {
|
|
801
|
+
* analysis: 50,
|
|
802
|
+
* recommendation: 40,
|
|
803
|
+
* deployment: 30,
|
|
804
|
+
* configuration: 20,
|
|
805
|
+
* interaction: 10
|
|
806
|
+
* }
|
|
807
|
+
* },
|
|
808
|
+
* recent: {
|
|
809
|
+
* analyses: [...],
|
|
810
|
+
* recommendations: [...],
|
|
811
|
+
* deployments: [...]
|
|
812
|
+
* },
|
|
813
|
+
* insights: {
|
|
814
|
+
* patterns: ["Frequent deployment on Fridays", "High test coverage correlates with success"],
|
|
815
|
+
* predictions: ["Next deployment likely to succeed (95% confidence)"]
|
|
816
|
+
* }
|
|
817
|
+
* },
|
|
818
|
+
* contentType: "application/json",
|
|
819
|
+
* cacheKey: "memory-snapshots:current",
|
|
820
|
+
* ttl: 60
|
|
821
|
+
* }
|
|
822
|
+
* ```
|
|
823
|
+
*
|
|
824
|
+
* @since v2.0.0
|
|
825
|
+
* @see {@link MemorySnapshotsResource} for underlying memory access implementation
|
|
826
|
+
*/
|
|
827
|
+
export async function generateMemorySnapshotsResource(_params, searchParams) {
|
|
828
|
+
const resource = new MemorySnapshotsResource();
|
|
829
|
+
// Build URI with query parameters
|
|
830
|
+
let uri = 'adr://memory-snapshots/current';
|
|
831
|
+
if (searchParams && searchParams.toString()) {
|
|
832
|
+
uri += `?${searchParams.toString()}`;
|
|
833
|
+
}
|
|
834
|
+
const result = await resource.read(uri);
|
|
835
|
+
if (!result.contents || !result.contents[0]) {
|
|
836
|
+
throw new Error('Failed to generate memory snapshot');
|
|
837
|
+
}
|
|
838
|
+
return {
|
|
839
|
+
data: result.contents[0].text,
|
|
840
|
+
contentType: result.contents[0].mimeType,
|
|
841
|
+
lastModified: new Date().toISOString(),
|
|
842
|
+
cacheKey: `memory-snapshots-${searchParams?.toString() || 'current'}`,
|
|
843
|
+
ttl: 300, // 5 minutes
|
|
844
|
+
etag: `"memory-snapshots-${Date.now()}"`,
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
//# sourceMappingURL=memory-snapshots-resource.js.map
|