@miller-tech/uap 1.5.5 → 1.5.7
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/.tsbuildinfo +1 -1
- package/dist/benchmarks/benchmark.d.ts +53 -53
- package/dist/bin/cli.js +6 -0
- package/dist/bin/cli.js.map +1 -1
- package/dist/bin/llama-server-optimize.js +0 -0
- package/dist/bin/policy.js +0 -0
- package/dist/bin/tool-calls.js +0 -0
- package/dist/cli/dashboard.d.ts +1 -0
- package/dist/cli/dashboard.d.ts.map +1 -1
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/coordination/droid-validator.d.ts +1 -1
- package/dist/memory/active-context.d.ts +65 -0
- package/dist/memory/active-context.d.ts.map +1 -0
- package/dist/memory/active-context.js +126 -0
- package/dist/memory/active-context.js.map +1 -0
- package/dist/memory/dedup-detector.d.ts +57 -0
- package/dist/memory/dedup-detector.d.ts.map +1 -0
- package/dist/memory/dedup-detector.js +107 -0
- package/dist/memory/dedup-detector.js.map +1 -0
- package/dist/memory/dedup-memory.d.ts +89 -0
- package/dist/memory/dedup-memory.d.ts.map +1 -0
- package/dist/memory/dedup-memory.js +173 -0
- package/dist/memory/dedup-memory.js.map +1 -0
- package/dist/memory/merge-claude-md.d.ts +45 -0
- package/dist/memory/merge-claude-md.d.ts.map +1 -0
- package/dist/memory/merge-claude-md.js +118 -0
- package/dist/memory/merge-claude-md.js.map +1 -0
- package/dist/memory/patterns.d.ts +37 -0
- package/dist/memory/patterns.d.ts.map +1 -0
- package/dist/memory/patterns.js +81 -0
- package/dist/memory/patterns.js.map +1 -0
- package/dist/memory/semantic-edge-graph.d.ts +86 -0
- package/dist/memory/semantic-edge-graph.d.ts.map +1 -0
- package/dist/memory/semantic-edge-graph.js +168 -0
- package/dist/memory/semantic-edge-graph.js.map +1 -0
- package/dist/memory/semantic-retrieval.d.ts +70 -0
- package/dist/memory/semantic-retrieval.d.ts.map +1 -0
- package/dist/memory/semantic-retrieval.js +112 -0
- package/dist/memory/semantic-retrieval.js.map +1 -0
- package/dist/memory/smart-consolidator.d.ts +53 -0
- package/dist/memory/smart-consolidator.d.ts.map +1 -0
- package/dist/memory/smart-consolidator.js +144 -0
- package/dist/memory/smart-consolidator.js.map +1 -0
- package/dist/memory/view-memory.d.ts +80 -0
- package/dist/memory/view-memory.d.ts.map +1 -0
- package/dist/memory/view-memory.js +130 -0
- package/dist/memory/view-memory.js.map +1 -0
- package/dist/memory/wrapped-memory.d.ts +77 -0
- package/dist/memory/wrapped-memory.d.ts.map +1 -0
- package/dist/memory/wrapped-memory.js +127 -0
- package/dist/memory/wrapped-memory.js.map +1 -0
- package/dist/models/types.d.ts +57 -57
- package/dist/policies/schemas/policy.d.ts +18 -18
- package/dist/tasks/types.d.ts +23 -23
- package/dist/types/config.d.ts +416 -416
- package/dist/types/coordination.d.ts +22 -22
- package/dist/uap-droids-strict.d.ts +1 -1
- package/dist/utils/adaptive-cache.d.ts +67 -0
- package/dist/utils/adaptive-cache.d.ts.map +1 -0
- package/dist/utils/adaptive-cache.js +149 -0
- package/dist/utils/adaptive-cache.js.map +1 -0
- package/dist/utils/performance-monitor.d.ts +52 -0
- package/dist/utils/performance-monitor.d.ts.map +1 -0
- package/dist/utils/performance-monitor.js +103 -0
- package/dist/utils/performance-monitor.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-context.js","sourceRoot":"","sources":["../../src/memory/active-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,MAAM,cAAc,GAAwB;IAC1C,gBAAgB,EAAE,EAAE;IACpB,kBAAkB,EAAE,GAAG;IACvB,SAAS,EAAE,IAAI;IACf,gBAAgB,EAAE,EAAE;CACrB,CAAC;AAUF;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IACvB,MAAM,CAAsB;IAC5B,OAAO,GAA6B,IAAI,GAAG,EAAE,CAAC;IAEtD,YAAY,SAAuC,EAAE;QACnD,I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
|
+
export interface MemoryEntry {
|
|
7
|
+
id: string;
|
|
8
|
+
content: string;
|
|
9
|
+
type: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DuplicateResult {
|
|
13
|
+
primaryId: string;
|
|
14
|
+
duplicateIds: string[];
|
|
15
|
+
similarity: number;
|
|
16
|
+
}
|
|
17
|
+
export interface DedupDetectorConfig {
|
|
18
|
+
similarityThreshold: number;
|
|
19
|
+
minContentLength: number;
|
|
20
|
+
exactMatch: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Dedup Detector
|
|
24
|
+
* Detects duplicate content in memory entries
|
|
25
|
+
*/
|
|
26
|
+
export declare class DedupDetector {
|
|
27
|
+
private config;
|
|
28
|
+
constructor(config?: Partial<DedupDetectorConfig>);
|
|
29
|
+
/**
|
|
30
|
+
* Detect duplicates in a batch of entries
|
|
31
|
+
*/
|
|
32
|
+
detectDuplicates(entries: MemoryEntry[]): DuplicateResult[];
|
|
33
|
+
/**
|
|
34
|
+
* Check if two pieces of content are duplicates
|
|
35
|
+
*/
|
|
36
|
+
isDuplicate(content1: string, content2: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Compute similarity between two contents
|
|
39
|
+
*/
|
|
40
|
+
computeSimilarity(content1: string, content2: string): number;
|
|
41
|
+
/**
|
|
42
|
+
* Find the most similar entry to a query
|
|
43
|
+
*/
|
|
44
|
+
findMostSimilar(query: string, entries: MemoryEntry[]): {
|
|
45
|
+
id: string;
|
|
46
|
+
similarity: number;
|
|
47
|
+
} | null;
|
|
48
|
+
/**
|
|
49
|
+
* Get duplicate statistics
|
|
50
|
+
*/
|
|
51
|
+
getStats(entries: MemoryEntry[]): {
|
|
52
|
+
totalEntries: number;
|
|
53
|
+
duplicatesFound: number;
|
|
54
|
+
uniqueEntries: number;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=dedup-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|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
|
1
|
+
/**
|
|
2
|
+
* Dedup Detector Module for UAP
|
|
3
|
+
*
|
|
4
|
+
* Detects duplicate and near-duplicate content in memory entries.
|
|
5
|
+
*/
|
|
6
|
+
import { jaccardSimilarity } from '../utils/string-similarity.js';
|
|
7
|
+
const DEFAULT_CONFIG = {
|
|
8
|
+
similarityThreshold: 0.85,
|
|
9
|
+
minContentLength: 20,
|
|
10
|
+
exactMatch: true,
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Dedup Detector
|
|
14
|
+
* Detects duplicate content in memory entries
|
|
15
|
+
*/
|
|
16
|
+
export class DedupDetector {
|
|
17
|
+
config;
|
|
18
|
+
constructor(config = {}) {
|
|
19
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Detect duplicates in a batch of entries
|
|
23
|
+
*/
|
|
24
|
+
detectDuplicates(entries) {
|
|
25
|
+
const results = [];
|
|
26
|
+
const processed = new Set();
|
|
27
|
+
for (let i = 0; i < entries.length; i++) {
|
|
28
|
+
if (processed.has(entries[i].id))
|
|
29
|
+
continue;
|
|
30
|
+
const primary = entries[i];
|
|
31
|
+
const duplicates = [];
|
|
32
|
+
for (let j = i + 1; j < entries.length; j++) {
|
|
33
|
+
const other = entries[j];
|
|
34
|
+
if (this.isDuplicate(primary.content, other.content)) {
|
|
35
|
+
duplicates.push(other.id);
|
|
36
|
+
processed.add(other.id);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (duplicates.length > 0) {
|
|
40
|
+
const dupEntry = entries.find((e) => e.id === duplicates[0]);
|
|
41
|
+
results.push({
|
|
42
|
+
primaryId: primary.id,
|
|
43
|
+
duplicateIds: duplicates,
|
|
44
|
+
similarity: this.computeSimilarity(primary.content, dupEntry.content),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
processed.add(primary.id);
|
|
48
|
+
}
|
|
49
|
+
return results;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Check if two pieces of content are duplicates
|
|
53
|
+
*/
|
|
54
|
+
isDuplicate(content1, content2) {
|
|
55
|
+
// Exact match
|
|
56
|
+
if (this.config.exactMatch && content1 === content2) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
// Length check
|
|
60
|
+
if (content1.length < this.config.minContentLength ||
|
|
61
|
+
content2.length < this.config.minContentLength) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
// Similarity check
|
|
65
|
+
const similarity = jaccardSimilarity(content1, content2);
|
|
66
|
+
return similarity >= this.config.similarityThreshold;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Compute similarity between two contents
|
|
70
|
+
*/
|
|
71
|
+
computeSimilarity(content1, content2) {
|
|
72
|
+
return jaccardSimilarity(content1, content2);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Find the most similar entry to a query
|
|
76
|
+
*/
|
|
77
|
+
findMostSimilar(query, entries) {
|
|
78
|
+
let bestId = null;
|
|
79
|
+
let bestSimilarity = 0;
|
|
80
|
+
for (const entry of entries) {
|
|
81
|
+
const similarity = this.computeSimilarity(query, entry.content);
|
|
82
|
+
if (similarity > bestSimilarity) {
|
|
83
|
+
bestSimilarity = similarity;
|
|
84
|
+
bestId = entry.id;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return bestSimilarity >= this.config.similarityThreshold
|
|
88
|
+
? { id: bestId, similarity: bestSimilarity }
|
|
89
|
+
: null;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get duplicate statistics
|
|
93
|
+
*/
|
|
94
|
+
getStats(entries) {
|
|
95
|
+
const duplicates = this.detectDuplicates(entries);
|
|
96
|
+
let totalDuplicates = 0;
|
|
97
|
+
for (const dup of duplicates) {
|
|
98
|
+
totalDuplicates += dup.duplicateIds.length;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
totalEntries: entries.length,
|
|
102
|
+
duplicatesFound: totalDuplicates,
|
|
103
|
+
uniqueEntries: entries.length - totalDuplicates,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=dedup-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup-detector.js","sourceRoot":"","sources":["../../src/memory/dedup-detector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAqBlE,MAAM,cAAc,GAAwB;IAC1C,mBAAmB,EAAE,IAAI;IACzB,gBAAgB,EAAE,EAAE;IACpB,UAAU,EAAE,IAAI;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,aAAa;IAChB,MAAM,CAAsB;IAEpC,YAAY,SAAuC,EAAE;QACnD,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,gBAAgB,CAAC,OAAsB;QACrC,MAAM,OAAO,GAAsB,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;QAEpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAAE,SAAS;YAE3C,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC3B,MAAM,UAAU,GAAa,EAAE,CAAC;YAEhC,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;gBAEzB,IAAI,IAAI,CAAC,WAAW,CAAC,OA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Implements memory deduplication using content hashing and similarity detection.
|
|
5
|
+
* Prevents redundant memory entries and maintains memory efficiency.
|
|
6
|
+
*/
|
|
7
|
+
export interface MemoryEntry {
|
|
8
|
+
id: string;
|
|
9
|
+
content: string;
|
|
10
|
+
type: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
importance?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface DedupConfig {
|
|
15
|
+
similarityThreshold: number;
|
|
16
|
+
minContentLength: number;
|
|
17
|
+
hashAlgorithm: 'jaccard' | 'cosine' | 'exact';
|
|
18
|
+
maxSimilarityWindow: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Deduplicated Memory Manager
|
|
22
|
+
* Prevents duplicate memory entries through content hashing and similarity detection
|
|
23
|
+
*/
|
|
24
|
+
export declare class DeduplicatedMemory {
|
|
25
|
+
private config;
|
|
26
|
+
private memory;
|
|
27
|
+
private contentIndex;
|
|
28
|
+
constructor(config?: Partial<DedupConfig>);
|
|
29
|
+
/**
|
|
30
|
+
* Add a memory entry, checking for duplicates
|
|
31
|
+
*/
|
|
32
|
+
add(entry: MemoryEntry): {
|
|
33
|
+
id: string;
|
|
34
|
+
isNew: boolean;
|
|
35
|
+
duplicateOf?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Get a memory entry by ID
|
|
39
|
+
*/
|
|
40
|
+
get(id: string): MemoryEntry | null;
|
|
41
|
+
/**
|
|
42
|
+
* Update an existing entry
|
|
43
|
+
*/
|
|
44
|
+
update(id: string, content: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Delete a memory entry
|
|
47
|
+
*/
|
|
48
|
+
delete(id: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Get all entries
|
|
51
|
+
*/
|
|
52
|
+
getAll(): MemoryEntry[];
|
|
53
|
+
/**
|
|
54
|
+
* Query entries by content (returns most similar)
|
|
55
|
+
*/
|
|
56
|
+
query(query: string, limit?: number): Array<{
|
|
57
|
+
entry: MemoryEntry;
|
|
58
|
+
similarity: number;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Get statistics
|
|
62
|
+
*/
|
|
63
|
+
getStats(): {
|
|
64
|
+
totalEntries: number;
|
|
65
|
+
uniqueContent: number;
|
|
66
|
+
duplicatesPrevented: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Clear all memory
|
|
70
|
+
*/
|
|
71
|
+
clear(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Compute content hash (simple approach)
|
|
74
|
+
*/
|
|
75
|
+
private computeHash;
|
|
76
|
+
/**
|
|
77
|
+
* Compute similarity between two texts
|
|
78
|
+
*/
|
|
79
|
+
private computeSimilarity;
|
|
80
|
+
/**
|
|
81
|
+
* Find similar content in memory
|
|
82
|
+
*/
|
|
83
|
+
private findSimilarContent;
|
|
84
|
+
/**
|
|
85
|
+
* Update content index
|
|
86
|
+
*/
|
|
87
|
+
private updateIndex;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=dedup-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup-memory.d.ts","sourceRoot":"","sources":["../../src/memory/dedup-memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC9C,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AASD;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,YAAY,CAAoC;gBAE5C,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM;IAI7C;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE;IAkC7E;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAInC;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAgB5C;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAQ3B;;OAEG;IACH,MAAM,IAAI,WAAW,EAAE;IAIvB;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,KAAK,CAAC;QAAE,KAAK,EAAE,WAAW,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAc1F;;OAEG;IACH,QAAQ,IAAI;QACV,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,mBAAmB,EAAE,MAAM,CAAC;KAC7B;IAQD;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,OAAO,CAAC,WAAW;IAWnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;OAEG;IACH,OAAO,CAAC,WAAW;CAMpB"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deduplicated Memory Module for UAP
|
|
3
|
+
*
|
|
4
|
+
* Implements memory deduplication using content hashing and similarity detection.
|
|
5
|
+
* Prevents redundant memory entries and maintains memory efficiency.
|
|
6
|
+
*/
|
|
7
|
+
import { jaccardSimilarity } from '../utils/string-similarity.js';
|
|
8
|
+
const DEFAULT_CONFIG = {
|
|
9
|
+
similarityThreshold: 0.85,
|
|
10
|
+
minContentLength: 20,
|
|
11
|
+
hashAlgorithm: 'jaccard',
|
|
12
|
+
maxSimilarityWindow: 7,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Deduplicated Memory Manager
|
|
16
|
+
* Prevents duplicate memory entries through content hashing and similarity detection
|
|
17
|
+
*/
|
|
18
|
+
export class DeduplicatedMemory {
|
|
19
|
+
config;
|
|
20
|
+
memory = new Map();
|
|
21
|
+
contentIndex = new Map(); // hash -> [ids]
|
|
22
|
+
constructor(config = {}) {
|
|
23
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Add a memory entry, checking for duplicates
|
|
27
|
+
*/
|
|
28
|
+
add(entry) {
|
|
29
|
+
const hash = this.computeHash(entry.content);
|
|
30
|
+
// Check if exact duplicate exists
|
|
31
|
+
if (this.memory.has(hash)) {
|
|
32
|
+
return {
|
|
33
|
+
id: hash,
|
|
34
|
+
isNew: false,
|
|
35
|
+
duplicateOf: hash,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// Check for similar content
|
|
39
|
+
const similarId = this.findSimilarContent(entry.content);
|
|
40
|
+
if (similarId) {
|
|
41
|
+
return {
|
|
42
|
+
id: hash,
|
|
43
|
+
isNew: false,
|
|
44
|
+
duplicateOf: similarId,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// Add new entry
|
|
48
|
+
const fullEntry = {
|
|
49
|
+
...entry,
|
|
50
|
+
id: hash,
|
|
51
|
+
};
|
|
52
|
+
this.memory.set(hash, fullEntry);
|
|
53
|
+
this.updateIndex(hash, entry.content);
|
|
54
|
+
return { id: hash, isNew: true };
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get a memory entry by ID
|
|
58
|
+
*/
|
|
59
|
+
get(id) {
|
|
60
|
+
return this.memory.get(id) || null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Update an existing entry
|
|
64
|
+
*/
|
|
65
|
+
update(id, content) {
|
|
66
|
+
if (!this.memory.has(id)) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
const entry = this.memory.get(id);
|
|
70
|
+
entry.content = content;
|
|
71
|
+
entry.timestamp = new Date().toISOString();
|
|
72
|
+
// Update index
|
|
73
|
+
this.contentIndex.delete(entry.id);
|
|
74
|
+
this.updateIndex(id, content);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Delete a memory entry
|
|
79
|
+
*/
|
|
80
|
+
delete(id) {
|
|
81
|
+
const deleted = this.memory.delete(id);
|
|
82
|
+
if (deleted) {
|
|
83
|
+
this.contentIndex.delete(id);
|
|
84
|
+
}
|
|
85
|
+
return deleted;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get all entries
|
|
89
|
+
*/
|
|
90
|
+
getAll() {
|
|
91
|
+
return Array.from(this.memory.values());
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Query entries by content (returns most similar)
|
|
95
|
+
*/
|
|
96
|
+
query(query, limit = 5) {
|
|
97
|
+
const results = [];
|
|
98
|
+
for (const entry of this.memory.values()) {
|
|
99
|
+
const similarity = this.computeSimilarity(query, entry.content);
|
|
100
|
+
if (similarity > 0.5) {
|
|
101
|
+
results.push({ entry, similarity });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
results.sort((a, b) => b.similarity - a.similarity);
|
|
105
|
+
return results.slice(0, limit);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get statistics
|
|
109
|
+
*/
|
|
110
|
+
getStats() {
|
|
111
|
+
return {
|
|
112
|
+
totalEntries: this.memory.size,
|
|
113
|
+
uniqueContent: this.memory.size,
|
|
114
|
+
duplicatesPrevented: 0, // Would need to track separately
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Clear all memory
|
|
119
|
+
*/
|
|
120
|
+
clear() {
|
|
121
|
+
this.memory.clear();
|
|
122
|
+
this.contentIndex.clear();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Compute content hash (simple approach)
|
|
126
|
+
*/
|
|
127
|
+
computeHash(content) {
|
|
128
|
+
// Simple hash - in production, use a proper hashing algorithm
|
|
129
|
+
let hash = 0;
|
|
130
|
+
for (let i = 0; i < content.length; i++) {
|
|
131
|
+
const char = content.charCodeAt(i);
|
|
132
|
+
hash = (hash << 5) - hash + char;
|
|
133
|
+
hash = hash & hash; // Convert to 32bit integer
|
|
134
|
+
}
|
|
135
|
+
return `mem-${Math.abs(hash).toString(36)}-${Date.now()}`;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Compute similarity between two texts
|
|
139
|
+
*/
|
|
140
|
+
computeSimilarity(a, b) {
|
|
141
|
+
if (this.config.hashAlgorithm === 'exact') {
|
|
142
|
+
return a === b ? 1 : 0;
|
|
143
|
+
}
|
|
144
|
+
if (a.length < this.config.minContentLength || b.length < this.config.minContentLength) {
|
|
145
|
+
return 0;
|
|
146
|
+
}
|
|
147
|
+
return jaccardSimilarity(a, b);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Find similar content in memory
|
|
151
|
+
*/
|
|
152
|
+
findSimilarContent(content) {
|
|
153
|
+
for (const [id, entry] of this.memory) {
|
|
154
|
+
if (entry.id === id)
|
|
155
|
+
continue;
|
|
156
|
+
const similarity = this.computeSimilarity(content, entry.content);
|
|
157
|
+
if (similarity >= this.config.similarityThreshold) {
|
|
158
|
+
return id;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Update content index
|
|
165
|
+
*/
|
|
166
|
+
updateIndex(id, content) {
|
|
167
|
+
if (!this.contentIndex.has(id)) {
|
|
168
|
+
this.contentIndex.set(id, []);
|
|
169
|
+
}
|
|
170
|
+
this.contentIndex.get(id).push(content);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=dedup-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup-memory.js","sourceRoot":"","sources":["../../src/memory/dedup-memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAiBlE,MAAM,cAAc,GAAgB;IAClC,mBAAmB,EAAE,IAAI;IACzB,gBAAgB,EAAE,EAAE;IACpB,aAAa,EAAE,SAAS;IACxB,mBAAmB,EAAE,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACrB,MAAM,CAAc;IACpB,MAAM,GAA6B,IAAI,GAAG,EAAE,CAAC;IAC7C,YAAY,GAA0B,IAAI,GAAG,EAAE,CAAC,CAAC,gBAAgB;IAEzE,YAAY,SAA+B,EAAE;QAC3C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,KAAkB;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE7C,kCAAkC;QAClC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,OAAO;gBACL,EAAE,EAAE,IAAI;gBACR,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,IAAI;aAClB,CAAC;QACJ,CAAC;QAED,4BAA4B;QAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,SAAS,EAAE,CAAC;YACd,OAAO;gBACL,EAAE,EAAE,IAAI;gBACR,KAAK,EAAE,KAAK;gBACZ,WAA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C;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,EAAU,EAAE,OAAe;QAC7C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge Claude MD Module for UAP
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for merging multiple Claude.md knowledge files
|
|
5
|
+
* into a single consolidated document.
|
|
6
|
+
*/
|
|
7
|
+
export interface ClaudeMD {
|
|
8
|
+
title: string;
|
|
9
|
+
content: string;
|
|
10
|
+
sections: Section[];
|
|
11
|
+
metadata: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export interface Section {
|
|
14
|
+
heading: string;
|
|
15
|
+
level: number;
|
|
16
|
+
content: string;
|
|
17
|
+
children: Section[];
|
|
18
|
+
}
|
|
19
|
+
export interface MergeConfig {
|
|
20
|
+
deduplicate: boolean;
|
|
21
|
+
dedupThreshold: number;
|
|
22
|
+
prioritySections: string[];
|
|
23
|
+
maxSectionLength: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Merge multiple Claude.md files into one
|
|
27
|
+
*/
|
|
28
|
+
export declare function mergeClaudeMDs(files: Array<{
|
|
29
|
+
name: string;
|
|
30
|
+
content: string;
|
|
31
|
+
}>, config?: Partial<MergeConfig>): {
|
|
32
|
+
merged: string;
|
|
33
|
+
sections: Section[];
|
|
34
|
+
stats: MergeStats;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Merge stats interface
|
|
38
|
+
*/
|
|
39
|
+
export interface MergeStats {
|
|
40
|
+
filesProcessed: number;
|
|
41
|
+
totalSections: number;
|
|
42
|
+
duplicatesRemoved: number;
|
|
43
|
+
finalLength: number;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=merge-claude-md.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-claude-md.d.ts","sourceRoot":"","sources":["../../src/memory/merge-claude-md.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AASD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EAC/C,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAChC;IACD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC;CACnB,CAwDA;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge Claude MD Module for UAP
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for merging multiple Claude.md knowledge files
|
|
5
|
+
* into a single consolidated document.
|
|
6
|
+
*/
|
|
7
|
+
const DEFAULT_CONFIG = {
|
|
8
|
+
deduplicate: true,
|
|
9
|
+
dedupThreshold: 0.85,
|
|
10
|
+
prioritySections: ['Architecture', 'Setup', 'Configuration', 'Known Issues'],
|
|
11
|
+
maxSectionLength: 10000,
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Merge multiple Claude.md files into one
|
|
15
|
+
*/
|
|
16
|
+
export function mergeClaudeMDs(files, config = {}) {
|
|
17
|
+
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
18
|
+
const stats = {
|
|
19
|
+
filesProcessed: files.length,
|
|
20
|
+
totalSections: 0,
|
|
21
|
+
duplicatesRemoved: 0,
|
|
22
|
+
finalLength: 0,
|
|
23
|
+
};
|
|
24
|
+
if (files.length === 0) {
|
|
25
|
+
return {
|
|
26
|
+
merged: '',
|
|
27
|
+
sections: [],
|
|
28
|
+
stats,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// Parse all files
|
|
32
|
+
const parsedFiles = files.map((file) => ({
|
|
33
|
+
name: file.name,
|
|
34
|
+
sections: parseMarkdown(file.content),
|
|
35
|
+
}));
|
|
36
|
+
stats.totalSections = parsedFiles.reduce((sum, f) => sum + f.sections.length, 0);
|
|
37
|
+
// Merge sections with deduplication
|
|
38
|
+
const mergedSections = [];
|
|
39
|
+
const seenContents = new Set();
|
|
40
|
+
// Sort by priority
|
|
41
|
+
const sortedFiles = [...parsedFiles].sort((a, b) => {
|
|
42
|
+
const aPriority = countPrioritySections(a.sections, cfg.prioritySections);
|
|
43
|
+
const bPriority = countPrioritySections(b.sections, cfg.prioritySections);
|
|
44
|
+
return bPriority - aPriority;
|
|
45
|
+
});
|
|
46
|
+
for (const file of sortedFiles) {
|
|
47
|
+
for (const section of file.sections) {
|
|
48
|
+
if (!cfg.deduplicate || !seenContents.has(section.content)) {
|
|
49
|
+
mergedSections.push(section);
|
|
50
|
+
seenContents.add(section.content);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
stats.duplicatesRemoved++;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Build final document
|
|
58
|
+
const merged = buildDocument(mergedSections, files[0].name.replace('.md', ''));
|
|
59
|
+
stats.finalLength = merged.length;
|
|
60
|
+
return {
|
|
61
|
+
merged,
|
|
62
|
+
sections: mergedSections,
|
|
63
|
+
stats,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Parse markdown content into sections
|
|
68
|
+
*/
|
|
69
|
+
function parseMarkdown(content) {
|
|
70
|
+
const sections = [];
|
|
71
|
+
const lines = content.split('\n');
|
|
72
|
+
let currentSection = null;
|
|
73
|
+
for (const line of lines) {
|
|
74
|
+
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
75
|
+
if (headingMatch) {
|
|
76
|
+
// Save previous section
|
|
77
|
+
if (currentSection) {
|
|
78
|
+
sections.push(currentSection);
|
|
79
|
+
}
|
|
80
|
+
// Start new section
|
|
81
|
+
currentSection = {
|
|
82
|
+
heading: headingMatch[2].trim(),
|
|
83
|
+
level: headingMatch[1].length,
|
|
84
|
+
content: '',
|
|
85
|
+
children: [],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
else if (currentSection) {
|
|
89
|
+
// Accumulate section content
|
|
90
|
+
currentSection.content += line + '\n';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Don't forget the last section
|
|
94
|
+
if (currentSection) {
|
|
95
|
+
sections.push(currentSection);
|
|
96
|
+
}
|
|
97
|
+
return sections;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Count priority sections in a file
|
|
101
|
+
*/
|
|
102
|
+
function countPrioritySections(sections, prioritySections) {
|
|
103
|
+
return sections.filter((s) => prioritySections.some((p) => s.heading.includes(p))).length;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Build markdown document from sections
|
|
107
|
+
*/
|
|
108
|
+
function buildDocument(sections, title) {
|
|
109
|
+
const lines = [`# ${title}\n`];
|
|
110
|
+
for (const section of sections) {
|
|
111
|
+
lines.push(`#${' '.repeat(section.level - 1)} ${section.heading}`);
|
|
112
|
+
lines.push('');
|
|
113
|
+
lines.push(section.content.trim());
|
|
114
|
+
lines.push('');
|
|
115
|
+
}
|
|
116
|
+
return lines.join('\n').trim();
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=merge-claude-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-claude-md.js","sourceRoot":"","sources":["../../src/memory/merge-claude-md.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuBH,MAAM,cAAc,GAAgB;IAClC,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,CAAC;IAC5E,gBAAgB,EAAE,KAAK;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA+C,EAC/C,SAA+B,EAAE;IAMjC,MAAM,GAAG,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7C,MAAM,KAAK,GAAe;QACxB,cAAc,EAAE,KAAK,CAAC,MAAM;QAC5B,aAAa,EAAE,CAAC;QAChB,iBAAiB,EAAE,CAAC;QACpB,WAAW,EAAE,CAAC;KACf,CAAC;IAEF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO;YACL,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,EAAE;YACZ,KAAK;SACN,CAAC;IAC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,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAAC,QAAmB,EAAE,gBAA0B;IAC5E,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AACpG,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,QAAmB,EAAE,KAAa;IACvD,MAAM,KAAK,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;IAE/B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory Patterns Module for UAP
|
|
3
|
+
*
|
|
4
|
+
* Provides common memory patterns and utilities for agent memory management.
|
|
5
|
+
*/
|
|
6
|
+
export interface MemoryPattern {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
template: string;
|
|
11
|
+
variables: string[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Common memory patterns for agents
|
|
15
|
+
*/
|
|
16
|
+
export declare const MEMORY_PATTERNS: MemoryPattern[];
|
|
17
|
+
/**
|
|
18
|
+
* Fill in a pattern template with values
|
|
19
|
+
*/
|
|
20
|
+
export declare function fillPattern(pattern: MemoryPattern, values: Record<string, string>): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get a pattern by ID
|
|
23
|
+
*/
|
|
24
|
+
export declare function getPattern(id: string): MemoryPattern | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Search patterns by keywords
|
|
27
|
+
*/
|
|
28
|
+
export declare function searchPatterns(query: string): MemoryPattern[];
|
|
29
|
+
/**
|
|
30
|
+
* Get all pattern IDs
|
|
31
|
+
*/
|
|
32
|
+
export declare function getPatternIds(): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Create a new pattern
|
|
35
|
+
*/
|
|
36
|
+
export declare function createPattern(id: string, name: string, description: string, template: string, variables: string[]): MemoryPattern;
|
|
37
|
+
//# sourceMappingURL=patterns.d.ts.map
|