claude-conversation-memory-mcp 0.6.0 → 1.0.0
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/dist/ConversationMemory.d.ts +151 -10
- package/dist/ConversationMemory.d.ts.map +1 -1
- package/dist/ConversationMemory.js +127 -10
- package/dist/ConversationMemory.js.map +1 -1
- package/dist/cache/QueryCache.d.ts +215 -0
- package/dist/cache/QueryCache.d.ts.map +1 -0
- package/dist/cache/QueryCache.js +294 -0
- package/dist/cache/QueryCache.js.map +1 -0
- package/dist/parsers/ConversationParser.d.ts +62 -3
- package/dist/parsers/ConversationParser.d.ts.map +1 -1
- package/dist/parsers/ConversationParser.js +50 -3
- package/dist/parsers/ConversationParser.js.map +1 -1
- package/dist/parsers/DecisionExtractor.d.ts +61 -3
- package/dist/parsers/DecisionExtractor.d.ts.map +1 -1
- package/dist/parsers/DecisionExtractor.js +47 -3
- package/dist/parsers/DecisionExtractor.js.map +1 -1
- package/dist/parsers/GitIntegrator.d.ts +88 -3
- package/dist/parsers/GitIntegrator.d.ts.map +1 -1
- package/dist/parsers/GitIntegrator.js +68 -3
- package/dist/parsers/GitIntegrator.js.map +1 -1
- package/dist/parsers/MistakeExtractor.d.ts +62 -3
- package/dist/parsers/MistakeExtractor.d.ts.map +1 -1
- package/dist/parsers/MistakeExtractor.js +50 -3
- package/dist/parsers/MistakeExtractor.js.map +1 -1
- package/dist/parsers/RequirementsExtractor.d.ts +95 -4
- package/dist/parsers/RequirementsExtractor.d.ts.map +1 -1
- package/dist/parsers/RequirementsExtractor.js +73 -4
- package/dist/parsers/RequirementsExtractor.js.map +1 -1
- package/dist/storage/ConversationStorage.d.ts +271 -2
- package/dist/storage/ConversationStorage.d.ts.map +1 -1
- package/dist/storage/ConversationStorage.js +356 -7
- package/dist/storage/ConversationStorage.js.map +1 -1
- package/dist/tools/ToolHandlers.d.ts +525 -16
- package/dist/tools/ToolHandlers.d.ts.map +1 -1
- package/dist/tools/ToolHandlers.js +533 -24
- package/dist/tools/ToolHandlers.js.map +1 -1
- package/dist/utils/Logger.d.ts +67 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +119 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/constants.d.ts +75 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +105 -0
- package/dist/utils/constants.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,37 +1,128 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Requirements and Validations Extractor
|
|
3
|
-
*
|
|
2
|
+
* Requirements and Validations Extractor - Tracks constraints, dependencies, and testing context.
|
|
3
|
+
*
|
|
4
|
+
* This extractor analyzes conversation messages and tool executions to identify:
|
|
5
|
+
* - Requirements (dependencies, performance, compatibility, business constraints)
|
|
6
|
+
* - Validations (test runs, results, and performance data)
|
|
7
|
+
*
|
|
8
|
+
* Helps document:
|
|
9
|
+
* - What dependencies are required and why
|
|
10
|
+
* - Performance requirements and constraints
|
|
11
|
+
* - Compatibility requirements (versions, platforms)
|
|
12
|
+
* - Business rules and limitations
|
|
13
|
+
* - Test executions and their results
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const extractor = new RequirementsExtractor();
|
|
18
|
+
* const requirements = extractor.extractRequirements(messages);
|
|
19
|
+
* const validations = extractor.extractValidations(toolUses, toolResults, messages);
|
|
20
|
+
*
|
|
21
|
+
* console.log(`Found ${requirements.length} requirements`);
|
|
22
|
+
* console.log(`Found ${validations.length} test validations`);
|
|
23
|
+
* ```
|
|
4
24
|
*/
|
|
5
25
|
import type { Message, ToolUse, ToolResult } from "./ConversationParser.js";
|
|
26
|
+
/**
|
|
27
|
+
* Represents a requirement or constraint for the system.
|
|
28
|
+
*/
|
|
6
29
|
export interface Requirement {
|
|
30
|
+
/** Unique requirement identifier */
|
|
7
31
|
id: string;
|
|
32
|
+
/** Category of requirement */
|
|
8
33
|
type: "dependency" | "performance" | "compatibility" | "business";
|
|
34
|
+
/** Description of the requirement */
|
|
9
35
|
description: string;
|
|
36
|
+
/** Why this requirement exists */
|
|
10
37
|
rationale?: string;
|
|
38
|
+
/** Components affected by this requirement */
|
|
11
39
|
affects_components: string[];
|
|
40
|
+
/** Conversation where requirement was discussed */
|
|
12
41
|
conversation_id: string;
|
|
42
|
+
/** Message containing the requirement */
|
|
13
43
|
message_id: string;
|
|
44
|
+
/** When the requirement was documented */
|
|
14
45
|
timestamp: number;
|
|
15
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Represents a test validation or verification.
|
|
49
|
+
*/
|
|
16
50
|
export interface Validation {
|
|
51
|
+
/** Unique validation identifier */
|
|
17
52
|
id: string;
|
|
53
|
+
/** Conversation where test was run */
|
|
18
54
|
conversation_id: string;
|
|
55
|
+
/** Description of what was tested */
|
|
19
56
|
what_was_tested: string;
|
|
57
|
+
/** Command used to run the test */
|
|
20
58
|
test_command?: string;
|
|
59
|
+
/** Test result status */
|
|
21
60
|
result: "passed" | "failed" | "error";
|
|
61
|
+
/** Performance metrics from the test */
|
|
22
62
|
performance_data?: Record<string, unknown>;
|
|
63
|
+
/** Files that were tested */
|
|
23
64
|
files_tested: string[];
|
|
65
|
+
/** When the test was run */
|
|
24
66
|
timestamp: number;
|
|
25
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Extracts requirements and validations from conversation history.
|
|
70
|
+
*
|
|
71
|
+
* Analyzes messages for requirement patterns and tool executions for test results.
|
|
72
|
+
*/
|
|
26
73
|
export declare class RequirementsExtractor {
|
|
27
74
|
private readonly REQUIREMENT_PATTERNS;
|
|
28
75
|
private readonly TEST_PATTERNS;
|
|
29
76
|
/**
|
|
30
|
-
* Extract requirements from messages
|
|
77
|
+
* Extract requirements from conversation messages.
|
|
78
|
+
*
|
|
79
|
+
* Analyzes messages using pattern matching to identify four types of requirements:
|
|
80
|
+
* - Dependency: Required libraries, packages, modules
|
|
81
|
+
* - Performance: Speed, latency, throughput constraints
|
|
82
|
+
* - Compatibility: Version requirements, platform support
|
|
83
|
+
* - Business: Business rules, limitations, constraints
|
|
84
|
+
*
|
|
85
|
+
* @param messages - Array of conversation messages to analyze
|
|
86
|
+
* @returns Array of extracted Requirement objects
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const extractor = new RequirementsExtractor();
|
|
91
|
+
* const requirements = extractor.extractRequirements(messages);
|
|
92
|
+
*
|
|
93
|
+
* // Find all dependency requirements
|
|
94
|
+
* const deps = requirements.filter(r => r.type === 'dependency');
|
|
95
|
+
* deps.forEach(d => console.log(`${d.description} - ${d.rationale}`));
|
|
96
|
+
* ```
|
|
31
97
|
*/
|
|
32
98
|
extractRequirements(messages: Message[]): Requirement[];
|
|
33
99
|
/**
|
|
34
|
-
* Extract validations from tool
|
|
100
|
+
* Extract validations from tool executions.
|
|
101
|
+
*
|
|
102
|
+
* Analyzes Bash tool uses to identify test command executions and their results.
|
|
103
|
+
* Captures test runs including pass/fail status, performance data, and files tested.
|
|
104
|
+
*
|
|
105
|
+
* Recognized test commands:
|
|
106
|
+
* - npm/yarn/pnpm test
|
|
107
|
+
* - pytest
|
|
108
|
+
* - jest/mocha
|
|
109
|
+
* - cargo test (Rust)
|
|
110
|
+
* - go test (Go)
|
|
111
|
+
*
|
|
112
|
+
* @param toolUses - Array of tool invocations
|
|
113
|
+
* @param toolResults - Array of tool execution results
|
|
114
|
+
* @param messages - Array of conversation messages for context
|
|
115
|
+
* @returns Array of extracted Validation objects
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const extractor = new RequirementsExtractor();
|
|
120
|
+
* const validations = extractor.extractValidations(toolUses, toolResults, messages);
|
|
121
|
+
*
|
|
122
|
+
* // Find failed tests
|
|
123
|
+
* const failures = validations.filter(v => v.result === 'failed');
|
|
124
|
+
* console.log(`${failures.length} test failures found`);
|
|
125
|
+
* ```
|
|
35
126
|
*/
|
|
36
127
|
extractValidations(toolUses: ToolUse[], toolResults: ToolResult[], messages: Message[]): Validation[];
|
|
37
128
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequirementsExtractor.d.ts","sourceRoot":"","sources":["../../src/parsers/RequirementsExtractor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"RequirementsExtractor.d.ts","sourceRoot":"","sources":["../../src/parsers/RequirementsExtractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,IAAI,EAAE,YAAY,GAAG,aAAa,GAAG,eAAe,GAAG,UAAU,CAAC;IAClE,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,mDAAmD;IACnD,eAAe,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACtC,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,6BAA6B;IAC7B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,qBAAqB;IAEhC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAmBnC;IAGF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAQ5B;IAEF;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE;IA8BvD;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,kBAAkB,CAChB,QAAQ,EAAE,OAAO,EAAE,EACnB,WAAW,EAAE,UAAU,EAAE,EACzB,QAAQ,EAAE,OAAO,EAAE,GAClB,UAAU,EAAE;IAuCf;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgCxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAuBxB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA0BjC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA6B3B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA6B9B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAchC"}
|
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Requirements and Validations Extractor
|
|
3
|
-
*
|
|
2
|
+
* Requirements and Validations Extractor - Tracks constraints, dependencies, and testing context.
|
|
3
|
+
*
|
|
4
|
+
* This extractor analyzes conversation messages and tool executions to identify:
|
|
5
|
+
* - Requirements (dependencies, performance, compatibility, business constraints)
|
|
6
|
+
* - Validations (test runs, results, and performance data)
|
|
7
|
+
*
|
|
8
|
+
* Helps document:
|
|
9
|
+
* - What dependencies are required and why
|
|
10
|
+
* - Performance requirements and constraints
|
|
11
|
+
* - Compatibility requirements (versions, platforms)
|
|
12
|
+
* - Business rules and limitations
|
|
13
|
+
* - Test executions and their results
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const extractor = new RequirementsExtractor();
|
|
18
|
+
* const requirements = extractor.extractRequirements(messages);
|
|
19
|
+
* const validations = extractor.extractValidations(toolUses, toolResults, messages);
|
|
20
|
+
*
|
|
21
|
+
* console.log(`Found ${requirements.length} requirements`);
|
|
22
|
+
* console.log(`Found ${validations.length} test validations`);
|
|
23
|
+
* ```
|
|
4
24
|
*/
|
|
5
25
|
import { nanoid } from "nanoid";
|
|
26
|
+
/**
|
|
27
|
+
* Extracts requirements and validations from conversation history.
|
|
28
|
+
*
|
|
29
|
+
* Analyzes messages for requirement patterns and tool executions for test results.
|
|
30
|
+
*/
|
|
6
31
|
export class RequirementsExtractor {
|
|
7
32
|
// Requirement indicators
|
|
8
33
|
REQUIREMENT_PATTERNS = {
|
|
@@ -36,7 +61,26 @@ export class RequirementsExtractor {
|
|
|
36
61
|
/go\s+test/,
|
|
37
62
|
];
|
|
38
63
|
/**
|
|
39
|
-
* Extract requirements from messages
|
|
64
|
+
* Extract requirements from conversation messages.
|
|
65
|
+
*
|
|
66
|
+
* Analyzes messages using pattern matching to identify four types of requirements:
|
|
67
|
+
* - Dependency: Required libraries, packages, modules
|
|
68
|
+
* - Performance: Speed, latency, throughput constraints
|
|
69
|
+
* - Compatibility: Version requirements, platform support
|
|
70
|
+
* - Business: Business rules, limitations, constraints
|
|
71
|
+
*
|
|
72
|
+
* @param messages - Array of conversation messages to analyze
|
|
73
|
+
* @returns Array of extracted Requirement objects
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const extractor = new RequirementsExtractor();
|
|
78
|
+
* const requirements = extractor.extractRequirements(messages);
|
|
79
|
+
*
|
|
80
|
+
* // Find all dependency requirements
|
|
81
|
+
* const deps = requirements.filter(r => r.type === 'dependency');
|
|
82
|
+
* deps.forEach(d => console.log(`${d.description} - ${d.rationale}`));
|
|
83
|
+
* ```
|
|
40
84
|
*/
|
|
41
85
|
extractRequirements(messages) {
|
|
42
86
|
const requirements = [];
|
|
@@ -60,7 +104,32 @@ export class RequirementsExtractor {
|
|
|
60
104
|
return this.deduplicateRequirements(requirements);
|
|
61
105
|
}
|
|
62
106
|
/**
|
|
63
|
-
* Extract validations from tool
|
|
107
|
+
* Extract validations from tool executions.
|
|
108
|
+
*
|
|
109
|
+
* Analyzes Bash tool uses to identify test command executions and their results.
|
|
110
|
+
* Captures test runs including pass/fail status, performance data, and files tested.
|
|
111
|
+
*
|
|
112
|
+
* Recognized test commands:
|
|
113
|
+
* - npm/yarn/pnpm test
|
|
114
|
+
* - pytest
|
|
115
|
+
* - jest/mocha
|
|
116
|
+
* - cargo test (Rust)
|
|
117
|
+
* - go test (Go)
|
|
118
|
+
*
|
|
119
|
+
* @param toolUses - Array of tool invocations
|
|
120
|
+
* @param toolResults - Array of tool execution results
|
|
121
|
+
* @param messages - Array of conversation messages for context
|
|
122
|
+
* @returns Array of extracted Validation objects
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const extractor = new RequirementsExtractor();
|
|
127
|
+
* const validations = extractor.extractValidations(toolUses, toolResults, messages);
|
|
128
|
+
*
|
|
129
|
+
* // Find failed tests
|
|
130
|
+
* const failures = validations.filter(v => v.result === 'failed');
|
|
131
|
+
* console.log(`${failures.length} test failures found`);
|
|
132
|
+
* ```
|
|
64
133
|
*/
|
|
65
134
|
extractValidations(toolUses, toolResults, messages) {
|
|
66
135
|
const validations = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequirementsExtractor.js","sourceRoot":"","sources":["../../src/parsers/RequirementsExtractor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"RequirementsExtractor.js","sourceRoot":"","sources":["../../src/parsers/RequirementsExtractor.ts"],"names":[],"mappings":"AA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,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACK,uBAAuB,CAAC,YAA2B;QACzD,MAAM,MAAM,GAAkB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAE/B,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;YAC/B,MAAM,SAAS,GAAG,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YACpE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBACzB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Conversation Storage Layer
|
|
3
|
-
*
|
|
2
|
+
* Conversation Storage Layer - CRUD operations for all conversation-related data.
|
|
3
|
+
*
|
|
4
|
+
* This class provides the data access layer for the conversation-memory system.
|
|
5
|
+
* It handles storing and retrieving conversations, messages, tool uses, decisions,
|
|
6
|
+
* mistakes, requirements, and git commits.
|
|
7
|
+
*
|
|
8
|
+
* All store operations use transactions for atomicity and performance.
|
|
9
|
+
* All JSON fields are automatically serialized/deserialized.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const storage = new ConversationStorage(sqliteManager);
|
|
14
|
+
* await storage.storeConversations(conversations);
|
|
15
|
+
* const conv = storage.getConversation('conv-123');
|
|
16
|
+
* const timeline = storage.getFileTimeline('src/index.ts');
|
|
17
|
+
* ```
|
|
4
18
|
*/
|
|
5
19
|
import type { SQLiteManager } from "./SQLiteManager.js";
|
|
6
20
|
import type { Conversation, Message, ToolUse, ToolResult, FileEdit, ThinkingBlock } from "../parsers/ConversationParser.js";
|
|
@@ -8,30 +22,285 @@ import type { Decision } from "../parsers/DecisionExtractor.js";
|
|
|
8
22
|
import type { Mistake } from "../parsers/MistakeExtractor.js";
|
|
9
23
|
import type { GitCommit } from "../parsers/GitIntegrator.js";
|
|
10
24
|
import type { Requirement, Validation } from "../parsers/RequirementsExtractor.js";
|
|
25
|
+
import { type QueryCacheConfig, type CacheStats } from "../cache/QueryCache.js";
|
|
26
|
+
/**
|
|
27
|
+
* Data access layer for conversation memory storage.
|
|
28
|
+
*
|
|
29
|
+
* Provides CRUD operations for all conversation-related entities using SQLite.
|
|
30
|
+
* Supports optional caching for frequently accessed queries.
|
|
31
|
+
*/
|
|
11
32
|
export declare class ConversationStorage {
|
|
12
33
|
private db;
|
|
34
|
+
private cache;
|
|
35
|
+
/**
|
|
36
|
+
* Create a new ConversationStorage instance.
|
|
37
|
+
*
|
|
38
|
+
* @param db - SQLiteManager instance for database access
|
|
39
|
+
*/
|
|
13
40
|
constructor(db: SQLiteManager);
|
|
41
|
+
/**
|
|
42
|
+
* Enable query result caching.
|
|
43
|
+
*
|
|
44
|
+
* Caching improves performance for frequently accessed queries by storing
|
|
45
|
+
* results in memory. Cache is automatically invalidated when data changes.
|
|
46
|
+
*
|
|
47
|
+
* @param config - Cache configuration (maxSize and ttlMs)
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* storage.enableCache({ maxSize: 100, ttlMs: 300000 });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
enableCache(config: QueryCacheConfig): void;
|
|
55
|
+
/**
|
|
56
|
+
* Disable query result caching.
|
|
57
|
+
*
|
|
58
|
+
* Clears all cached data and stops caching new queries.
|
|
59
|
+
*/
|
|
60
|
+
disableCache(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Check if caching is enabled.
|
|
63
|
+
*
|
|
64
|
+
* @returns True if caching is enabled
|
|
65
|
+
*/
|
|
66
|
+
isCacheEnabled(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Clear all cached query results.
|
|
69
|
+
*
|
|
70
|
+
* Clears the cache but keeps caching enabled.
|
|
71
|
+
*/
|
|
72
|
+
clearCache(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Get cache statistics.
|
|
75
|
+
*
|
|
76
|
+
* Returns performance metrics including hits, misses, hit rate, and evictions.
|
|
77
|
+
*
|
|
78
|
+
* @returns Cache statistics or null if caching is disabled
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const stats = storage.getCacheStats();
|
|
83
|
+
* if (stats) {
|
|
84
|
+
* console.log(`Hit rate: ${(stats.hitRate * 100).toFixed(1)}%`);
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
getCacheStats(): CacheStats | null;
|
|
89
|
+
/**
|
|
90
|
+
* Store conversations in the database.
|
|
91
|
+
*
|
|
92
|
+
* Uses INSERT OR REPLACE to handle both new and updated conversations.
|
|
93
|
+
* All operations are performed in a single transaction for atomicity.
|
|
94
|
+
*
|
|
95
|
+
* @param conversations - Array of conversation objects to store
|
|
96
|
+
* @returns Promise that resolves when all conversations are stored
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* await storage.storeConversations([
|
|
101
|
+
* {
|
|
102
|
+
* id: 'conv-123',
|
|
103
|
+
* project_path: '/path/to/project',
|
|
104
|
+
* first_message_at: Date.now(),
|
|
105
|
+
* last_message_at: Date.now(),
|
|
106
|
+
* message_count: 42,
|
|
107
|
+
* git_branch: 'main',
|
|
108
|
+
* claude_version: '3.5',
|
|
109
|
+
* metadata: {},
|
|
110
|
+
* created_at: Date.now(),
|
|
111
|
+
* updated_at: Date.now()
|
|
112
|
+
* }
|
|
113
|
+
* ]);
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
14
116
|
storeConversations(conversations: Conversation[]): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Retrieve a single conversation by ID.
|
|
119
|
+
*
|
|
120
|
+
* @param id - Conversation ID to retrieve
|
|
121
|
+
* @returns Conversation object if found, null otherwise
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* const conv = storage.getConversation('conv-123');
|
|
126
|
+
* if (conv) {
|
|
127
|
+
* console.log(`${conv.message_count} messages on ${conv.git_branch}`);
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
15
131
|
getConversation(id: string): Conversation | null;
|
|
132
|
+
/**
|
|
133
|
+
* Store messages in the database.
|
|
134
|
+
*
|
|
135
|
+
* Stores all messages from conversations including content, metadata, and relationships.
|
|
136
|
+
* Uses INSERT OR REPLACE for idempotent storage.
|
|
137
|
+
*
|
|
138
|
+
* @param messages - Array of message objects to store
|
|
139
|
+
* @returns Promise that resolves when all messages are stored
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* await storage.storeMessages([
|
|
144
|
+
* {
|
|
145
|
+
* id: 'msg-123',
|
|
146
|
+
* conversation_id: 'conv-123',
|
|
147
|
+
* message_type: 'text',
|
|
148
|
+
* role: 'user',
|
|
149
|
+
* content: 'Hello',
|
|
150
|
+
* timestamp: Date.now(),
|
|
151
|
+
* is_sidechain: false,
|
|
152
|
+
* metadata: {}
|
|
153
|
+
* }
|
|
154
|
+
* ]);
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
16
157
|
storeMessages(messages: Message[]): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Store tool use records in the database.
|
|
160
|
+
*
|
|
161
|
+
* Records all tool invocations from assistant messages.
|
|
162
|
+
*
|
|
163
|
+
* @param toolUses - Array of tool use objects
|
|
164
|
+
* @returns Promise that resolves when stored
|
|
165
|
+
*/
|
|
17
166
|
storeToolUses(toolUses: ToolUse[]): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Store tool execution results in the database.
|
|
169
|
+
*
|
|
170
|
+
* Records the output/results from tool invocations.
|
|
171
|
+
*
|
|
172
|
+
* @param toolResults - Array of tool result objects
|
|
173
|
+
* @returns Promise that resolves when stored
|
|
174
|
+
*/
|
|
18
175
|
storeToolResults(toolResults: ToolResult[]): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Store file edit records in the database.
|
|
178
|
+
*
|
|
179
|
+
* Records all file modifications made during conversations.
|
|
180
|
+
*
|
|
181
|
+
* @param fileEdits - Array of file edit objects
|
|
182
|
+
* @returns Promise that resolves when stored
|
|
183
|
+
*/
|
|
19
184
|
storeFileEdits(fileEdits: FileEdit[]): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Retrieve all edits for a specific file.
|
|
187
|
+
*
|
|
188
|
+
* @param filePath - Path to the file
|
|
189
|
+
* @returns Array of file edits, ordered by timestamp (most recent first)
|
|
190
|
+
*/
|
|
20
191
|
getFileEdits(filePath: string): FileEdit[];
|
|
192
|
+
/**
|
|
193
|
+
* Store thinking blocks in the database.
|
|
194
|
+
*
|
|
195
|
+
* Thinking blocks contain Claude's internal reasoning. They can be large and
|
|
196
|
+
* are optionally indexed based on the includeThinking flag.
|
|
197
|
+
*
|
|
198
|
+
* @param blocks - Array of thinking block objects
|
|
199
|
+
* @returns Promise that resolves when stored
|
|
200
|
+
*/
|
|
21
201
|
storeThinkingBlocks(blocks: ThinkingBlock[]): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Store extracted decisions in the database.
|
|
204
|
+
*
|
|
205
|
+
* Decisions include architectural choices, technical decisions, and their rationale.
|
|
206
|
+
*
|
|
207
|
+
* @param decisions - Array of decision objects
|
|
208
|
+
* @returns Promise that resolves when stored
|
|
209
|
+
*/
|
|
22
210
|
storeDecisions(decisions: Decision[]): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Retrieve all decisions related to a specific file.
|
|
213
|
+
*
|
|
214
|
+
* @param filePath - Path to the file
|
|
215
|
+
* @returns Array of decisions that reference this file
|
|
216
|
+
* @internal
|
|
217
|
+
*/
|
|
23
218
|
getDecisionsForFile(filePath: string): Decision[];
|
|
219
|
+
/**
|
|
220
|
+
* Store git commit records linked to conversations.
|
|
221
|
+
*
|
|
222
|
+
* Links git commits to the conversations where they were made or discussed.
|
|
223
|
+
*
|
|
224
|
+
* @param commits - Array of git commit objects
|
|
225
|
+
* @returns Promise that resolves when stored
|
|
226
|
+
*/
|
|
24
227
|
storeGitCommits(commits: GitCommit[]): Promise<void>;
|
|
25
228
|
getCommitsForFile(filePath: string): GitCommit[];
|
|
229
|
+
/**
|
|
230
|
+
* Store extracted mistakes in the database.
|
|
231
|
+
*
|
|
232
|
+
* Mistakes include errors, bugs, and wrong approaches that were later corrected.
|
|
233
|
+
*
|
|
234
|
+
* @param mistakes - Array of mistake objects
|
|
235
|
+
* @returns Promise that resolves when stored
|
|
236
|
+
*/
|
|
26
237
|
storeMistakes(mistakes: Mistake[]): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Store extracted requirements in the database.
|
|
240
|
+
*
|
|
241
|
+
* Requirements include dependencies, constraints, and specifications for components.
|
|
242
|
+
*
|
|
243
|
+
* @param requirements - Array of requirement objects
|
|
244
|
+
* @returns Promise that resolves when stored
|
|
245
|
+
*/
|
|
27
246
|
storeRequirements(requirements: Requirement[]): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Store validation records in the database.
|
|
249
|
+
*
|
|
250
|
+
* Validations capture test results and performance data from conversations.
|
|
251
|
+
*
|
|
252
|
+
* @param validations - Array of validation objects
|
|
253
|
+
* @returns Promise that resolves when stored
|
|
254
|
+
*/
|
|
28
255
|
storeValidations(validations: Validation[]): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* Get the complete timeline of changes to a file.
|
|
258
|
+
*
|
|
259
|
+
* Combines file edits, git commits, and related decisions into a single timeline.
|
|
260
|
+
* This is a key method used by tools like checkBeforeModify and getFileEvolution.
|
|
261
|
+
*
|
|
262
|
+
* @param filePath - Path to the file
|
|
263
|
+
* @returns Object containing:
|
|
264
|
+
* - `file_path`: The file path queried
|
|
265
|
+
* - `edits`: All file edit records
|
|
266
|
+
* - `commits`: All git commits affecting this file
|
|
267
|
+
* - `decisions`: All decisions related to this file
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```typescript
|
|
271
|
+
* const timeline = storage.getFileTimeline('src/index.ts');
|
|
272
|
+
* console.log(`${timeline.edits.length} edits`);
|
|
273
|
+
* console.log(`${timeline.commits.length} commits`);
|
|
274
|
+
* console.log(`${timeline.decisions.length} decisions`);
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
29
277
|
getFileTimeline(filePath: string): {
|
|
30
278
|
file_path: string;
|
|
31
279
|
edits: FileEdit[];
|
|
32
280
|
commits: GitCommit[];
|
|
33
281
|
decisions: Decision[];
|
|
34
282
|
};
|
|
283
|
+
/**
|
|
284
|
+
* Get statistics about the indexed conversation data.
|
|
285
|
+
*
|
|
286
|
+
* Returns counts of all major entity types stored in the database.
|
|
287
|
+
* Used for displaying indexing results and system health checks.
|
|
288
|
+
*
|
|
289
|
+
* @returns Object containing counts for:
|
|
290
|
+
* - `conversations`: Total conversations indexed
|
|
291
|
+
* - `messages`: Total messages stored
|
|
292
|
+
* - `decisions`: Total decisions extracted
|
|
293
|
+
* - `mistakes`: Total mistakes documented
|
|
294
|
+
* - `git_commits`: Total git commits linked
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```typescript
|
|
298
|
+
* const stats = storage.getStats();
|
|
299
|
+
* console.log(`Indexed ${stats.conversations.count} conversations`);
|
|
300
|
+
* console.log(`Extracted ${stats.decisions.count} decisions`);
|
|
301
|
+
* console.log(`Linked ${stats.git_commits.count} commits`);
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
35
304
|
getStats(): {
|
|
36
305
|
conversations: {
|
|
37
306
|
count: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationStorage.d.ts","sourceRoot":"","sources":["../../src/storage/ConversationStorage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ConversationStorage.d.ts","sourceRoot":"","sources":["../../src/storage/ConversationStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACd,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAGnF,OAAO,EAAc,KAAK,gBAAgB,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE5F;;;;;GAKG;AACH,qBAAa,mBAAmB;IAQlB,OAAO,CAAC,EAAE;IAPtB,OAAO,CAAC,KAAK,CAA2B;IAExC;;;;OAIG;gBACiB,EAAE,EAAE,aAAa;IAIrC;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAI3C;;;;OAIG;IACH,YAAY,IAAI,IAAI;IAIpB;;;;OAIG;IACH,cAAc,IAAI,OAAO;IAIzB;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAOlB;;;;;;;;;;;;;;OAcG;IACH,aAAa,IAAI,UAAU,GAAG,IAAI;IAMlC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACG,kBAAkB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCtE;;;;;;;;;;;;;OAa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