@cognitive-engine/memory 0.1.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/episode-extractor.d.ts +15 -0
- package/dist/episode-extractor.d.ts.map +1 -0
- package/dist/episode-extractor.js +67 -0
- package/dist/episode-extractor.js.map +1 -0
- package/dist/episodic-memory.d.ts +31 -0
- package/dist/episodic-memory.d.ts.map +1 -0
- package/dist/episodic-memory.js +238 -0
- package/dist/episodic-memory.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LlmProvider, EmbeddingProvider, Episode } from '@cognitive-engine/core';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts episodic memories from user messages using LLM analysis.
|
|
4
|
+
*/
|
|
5
|
+
export declare class EpisodeExtractor {
|
|
6
|
+
private readonly llm;
|
|
7
|
+
private readonly embedding;
|
|
8
|
+
constructor(llm: LlmProvider, embedding: EmbeddingProvider);
|
|
9
|
+
/**
|
|
10
|
+
* Analyze a message and extract an episode if present.
|
|
11
|
+
* Returns null if the message doesn't contain a personal episode.
|
|
12
|
+
*/
|
|
13
|
+
extract(userId: string, message: string, occurredAt?: Date): Promise<Episode | null>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=episode-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"episode-extractor.d.ts","sourceRoot":"","sources":["../src/episode-extractor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,OAAO,EACR,MAAM,wBAAwB,CAAA;AAoC/B;;GAEG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBADT,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,iBAAiB;IAG/C;;;OAGG;IACG,OAAO,CACX,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,IAAI,GAChB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CAsC3B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { uid } from '@cognitive-engine/core';
|
|
2
|
+
import { clamp } from '@cognitive-engine/math';
|
|
3
|
+
const EXTRACTION_PROMPT = `Analyze the following message and determine if it contains a personal episode (event, experience, story).
|
|
4
|
+
Respond ONLY with valid JSON (no markdown, no code blocks):
|
|
5
|
+
|
|
6
|
+
{
|
|
7
|
+
"hasEpisode": true/false,
|
|
8
|
+
"summary": "one-line summary",
|
|
9
|
+
"details": "key details",
|
|
10
|
+
"participants": ["person names"],
|
|
11
|
+
"location": "place or null",
|
|
12
|
+
"emotions": ["emotion labels"],
|
|
13
|
+
"emotionalValence": -1 to 1,
|
|
14
|
+
"emotionalIntensity": 0 to 1,
|
|
15
|
+
"category": "work|personal|health|relationship|finance|education|hobby|other",
|
|
16
|
+
"tags": ["relevant tags"],
|
|
17
|
+
"importance": 0 to 1
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
If the message is not a personal episode (greetings, questions, commands), set hasEpisode=false and leave other fields with defaults.`;
|
|
21
|
+
/**
|
|
22
|
+
* Extracts episodic memories from user messages using LLM analysis.
|
|
23
|
+
*/
|
|
24
|
+
export class EpisodeExtractor {
|
|
25
|
+
llm;
|
|
26
|
+
embedding;
|
|
27
|
+
constructor(llm, embedding) {
|
|
28
|
+
this.llm = llm;
|
|
29
|
+
this.embedding = embedding;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Analyze a message and extract an episode if present.
|
|
33
|
+
* Returns null if the message doesn't contain a personal episode.
|
|
34
|
+
*/
|
|
35
|
+
async extract(userId, message, occurredAt) {
|
|
36
|
+
const response = await this.llm.completeJson([
|
|
37
|
+
{ role: 'system', content: EXTRACTION_PROMPT },
|
|
38
|
+
{ role: 'user', content: message },
|
|
39
|
+
], { temperature: 0, maxTokens: 500 });
|
|
40
|
+
const result = response.parsed;
|
|
41
|
+
if (!result.hasEpisode)
|
|
42
|
+
return null;
|
|
43
|
+
const now = new Date();
|
|
44
|
+
const vector = await this.embedding.embed(`${result.summary}. ${result.details}`);
|
|
45
|
+
return {
|
|
46
|
+
id: uid('ep'),
|
|
47
|
+
userId,
|
|
48
|
+
summary: result.summary ?? '',
|
|
49
|
+
details: result.details ?? '',
|
|
50
|
+
participants: result.participants ?? [],
|
|
51
|
+
location: result.location,
|
|
52
|
+
occurredAt: occurredAt ?? now,
|
|
53
|
+
reportedAt: now,
|
|
54
|
+
emotionalValence: clamp(result.emotionalValence ?? 0, -1, 1),
|
|
55
|
+
emotionalIntensity: clamp(result.emotionalIntensity ?? 0, 0, 1),
|
|
56
|
+
emotions: result.emotions ?? [],
|
|
57
|
+
category: result.category ?? 'other',
|
|
58
|
+
tags: result.tags ?? [],
|
|
59
|
+
importance: clamp(result.importance ?? 0.5, 0, 1),
|
|
60
|
+
accessCount: 0,
|
|
61
|
+
decayFactor: 0.03,
|
|
62
|
+
embedding: vector,
|
|
63
|
+
createdAt: now,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=episode-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"episode-extractor.js","sourceRoot":"","sources":["../src/episode-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAA;AAM5C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAgB9C,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;sIAiB4G,CAAA;AAEtI;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAER;IACA;IAFnB,YACmB,GAAgB,EAChB,SAA4B;QAD5B,QAAG,GAAH,GAAG,CAAa;QAChB,c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B,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,OAAO;YACpC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;YACvB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YACjD,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,MAAM;YACjB,SAAS,EAAE,GAAG;SACf,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Store, EmbeddingProvider, Episode, EpisodeSearchResult, EpisodeQuery, EpisodicContext, ConsolidationResult, MemoryConfig } from '@cognitive-engine/core';
|
|
2
|
+
/**
|
|
3
|
+
* Episodic memory with semantic search, exponential decay, and consolidation.
|
|
4
|
+
*
|
|
5
|
+
* Uses embeddings + cosine similarity for relevance search.
|
|
6
|
+
* Combines relevance, recency, and importance for final scoring.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EpisodicMemory {
|
|
9
|
+
private readonly store;
|
|
10
|
+
private readonly embedding;
|
|
11
|
+
private readonly config;
|
|
12
|
+
constructor(store: Store, embedding: EmbeddingProvider, config?: MemoryConfig);
|
|
13
|
+
/** Store a new episode. */
|
|
14
|
+
storeEpisode(episode: Episode): Promise<void>;
|
|
15
|
+
/** Retrieve a specific episode by ID. */
|
|
16
|
+
get(episodeId: string): Promise<Episode | null>;
|
|
17
|
+
/** Search episodes with semantic + temporal scoring. */
|
|
18
|
+
search(query: EpisodeQuery): Promise<EpisodeSearchResult[]>;
|
|
19
|
+
/** Build episodic context for the reasoning layer. */
|
|
20
|
+
getContext(userId: string, currentQuery?: string): Promise<EpisodicContext>;
|
|
21
|
+
/**
|
|
22
|
+
* Consolidate memories: apply decay, delete forgotten episodes.
|
|
23
|
+
*/
|
|
24
|
+
consolidate(userId: string): Promise<ConsolidationResult>;
|
|
25
|
+
/** Mark an episode as accessed (boosts importance). */
|
|
26
|
+
recordAccess(episodeId: string): Promise<void>;
|
|
27
|
+
private fetchCandidates;
|
|
28
|
+
private computeRelevanceScores;
|
|
29
|
+
private detectEmotionalPattern;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=episodic-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"episodic-memory.d.ts","sourceRoot":"","sources":["../src/episodic-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,iBAAiB,EACjB,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,YAAY,EACb,MAAM,wBAAwB,CAAA;AA8B/B;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAG3C,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,iBAAiB,EAC5B,MAAM,GAAE,YAAiB;IAkB3B,2BAA2B;IACrB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,yCAAyC;IACnC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAIrD,wDAAwD;IAClD,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IA6CjE,sDAAsD;IAChD,UAAU,CACd,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,eAAe,CAAC;IA8B3B;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAqC/D,uDAAuD;IACjD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAYtC,eAAe;YA2Cf,sBAAsB;IAmBpC,OAAO,CAAC,sBAAsB;CA8B/B"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { cosineSimilarity, exponentialDecay } from '@cognitive-engine/math';
|
|
2
|
+
const COLLECTION = 'episodes';
|
|
3
|
+
const MS_PER_DAY = 1000 * 60 * 60 * 24;
|
|
4
|
+
const ACCESS_BOOST_PER_VIEW = 0.1;
|
|
5
|
+
const MAX_ACCESS_BOOST = 0.5;
|
|
6
|
+
const CONSOLIDATION_AGE_DAYS = 30;
|
|
7
|
+
const FORGOTTEN_THRESHOLD = 0.1;
|
|
8
|
+
const MIN_ACCESS_TO_KEEP = 2;
|
|
9
|
+
const CONSOLIDATION_DECAY_FACTOR = 0.01;
|
|
10
|
+
const DEFAULT_CONFIG = {
|
|
11
|
+
decayLambda: 0.03,
|
|
12
|
+
scoringWeights: { relevance: 0.4, recency: 0.3, importance: 0.3 },
|
|
13
|
+
similarityThreshold: 0.7,
|
|
14
|
+
categories: [],
|
|
15
|
+
maxRecentEpisodes: 5,
|
|
16
|
+
maxRelevantEpisodes: 3,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Episodic memory with semantic search, exponential decay, and consolidation.
|
|
20
|
+
*
|
|
21
|
+
* Uses embeddings + cosine similarity for relevance search.
|
|
22
|
+
* Combines relevance, recency, and importance for final scoring.
|
|
23
|
+
*/
|
|
24
|
+
export class EpisodicMemory {
|
|
25
|
+
store;
|
|
26
|
+
embedding;
|
|
27
|
+
config;
|
|
28
|
+
constructor(store, embedding, config = {}) {
|
|
29
|
+
this.store = store;
|
|
30
|
+
this.embedding = embedding;
|
|
31
|
+
this.config = {
|
|
32
|
+
decayLambda: config.decayLambda ?? DEFAULT_CONFIG.decayLambda,
|
|
33
|
+
scoringWeights: {
|
|
34
|
+
relevance: config.scoringWeights?.relevance ?? DEFAULT_CONFIG.scoringWeights.relevance,
|
|
35
|
+
recency: config.scoringWeights?.recency ?? DEFAULT_CONFIG.scoringWeights.recency,
|
|
36
|
+
importance: config.scoringWeights?.importance ?? DEFAULT_CONFIG.scoringWeights.importance,
|
|
37
|
+
},
|
|
38
|
+
similarityThreshold: config.similarityThreshold ?? DEFAULT_CONFIG.similarityThreshold,
|
|
39
|
+
categories: config.categories ?? DEFAULT_CONFIG.categories,
|
|
40
|
+
maxRecentEpisodes: config.maxRecentEpisodes ?? DEFAULT_CONFIG.maxRecentEpisodes,
|
|
41
|
+
maxRelevantEpisodes: config.maxRelevantEpisodes ?? DEFAULT_CONFIG.maxRelevantEpisodes,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Store a new episode. */
|
|
45
|
+
async storeEpisode(episode) {
|
|
46
|
+
await this.store.set(COLLECTION, episode.id, episode);
|
|
47
|
+
}
|
|
48
|
+
/** Retrieve a specific episode by ID. */
|
|
49
|
+
async get(episodeId) {
|
|
50
|
+
return this.store.get(COLLECTION, episodeId);
|
|
51
|
+
}
|
|
52
|
+
/** Search episodes with semantic + temporal scoring. */
|
|
53
|
+
async search(query) {
|
|
54
|
+
const now = Date.now();
|
|
55
|
+
const relevance = this.config.scoringWeights.relevance;
|
|
56
|
+
const recency = this.config.scoringWeights.recency;
|
|
57
|
+
const importance = this.config.scoringWeights.importance;
|
|
58
|
+
// Fetch candidate episodes
|
|
59
|
+
const candidates = await this.fetchCandidates(query);
|
|
60
|
+
// Compute relevance scores via embedding similarity
|
|
61
|
+
const relevanceScores = await this.computeRelevanceScores(query.query, candidates);
|
|
62
|
+
// Score and rank
|
|
63
|
+
const results = [];
|
|
64
|
+
for (const ep of candidates) {
|
|
65
|
+
const daysSince = (now - ep.occurredAt.getTime()) / MS_PER_DAY;
|
|
66
|
+
const recencyScore = exponentialDecay(daysSince, ep.decayFactor);
|
|
67
|
+
const relevanceScore = relevanceScores.get(ep.id) ?? 0.5;
|
|
68
|
+
const accessBoost = Math.min(ep.accessCount * ACCESS_BOOST_PER_VIEW, MAX_ACCESS_BOOST);
|
|
69
|
+
const importanceScore = Math.min(ep.importance + accessBoost, 1);
|
|
70
|
+
const combinedScore = relevanceScore * relevance +
|
|
71
|
+
recencyScore * recency +
|
|
72
|
+
importanceScore * importance;
|
|
73
|
+
// Skip "forgotten" episodes unless explicitly requested
|
|
74
|
+
if (!query.includeDecayed && recencyScore < 0.1)
|
|
75
|
+
continue;
|
|
76
|
+
results.push({
|
|
77
|
+
episode: ep,
|
|
78
|
+
relevanceScore,
|
|
79
|
+
recencyScore,
|
|
80
|
+
importanceScore,
|
|
81
|
+
combinedScore,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
results.sort((a, b) => b.combinedScore - a.combinedScore);
|
|
85
|
+
return results.slice(0, query.limit ?? this.config.maxRelevantEpisodes);
|
|
86
|
+
}
|
|
87
|
+
/** Build episodic context for the reasoning layer. */
|
|
88
|
+
async getContext(userId, currentQuery) {
|
|
89
|
+
// Recent episodes
|
|
90
|
+
const recentResults = await this.store.find(COLLECTION, {
|
|
91
|
+
where: { userId },
|
|
92
|
+
orderBy: { occurredAt: 'desc' },
|
|
93
|
+
limit: this.config.maxRecentEpisodes,
|
|
94
|
+
});
|
|
95
|
+
// Relevant episodes (semantic search)
|
|
96
|
+
let relevantEpisodes = [];
|
|
97
|
+
if (currentQuery) {
|
|
98
|
+
const searchResults = await this.search({
|
|
99
|
+
userId,
|
|
100
|
+
query: currentQuery,
|
|
101
|
+
limit: this.config.maxRelevantEpisodes,
|
|
102
|
+
});
|
|
103
|
+
relevantEpisodes = searchResults.map((r) => r.episode);
|
|
104
|
+
}
|
|
105
|
+
// Detect dominant emotional pattern
|
|
106
|
+
const allEpisodes = [...recentResults, ...relevantEpisodes];
|
|
107
|
+
const emotionalPattern = this.detectEmotionalPattern(allEpisodes);
|
|
108
|
+
return {
|
|
109
|
+
recentEpisodes: recentResults,
|
|
110
|
+
relevantEpisodes,
|
|
111
|
+
emotionalPattern,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Consolidate memories: apply decay, delete forgotten episodes.
|
|
116
|
+
*/
|
|
117
|
+
async consolidate(userId) {
|
|
118
|
+
const now = Date.now();
|
|
119
|
+
const episodes = await this.store.find(COLLECTION, {
|
|
120
|
+
where: { userId },
|
|
121
|
+
});
|
|
122
|
+
let decayedCount = 0;
|
|
123
|
+
let deletedCount = 0;
|
|
124
|
+
for (const ep of episodes) {
|
|
125
|
+
const daysSince = (now - ep.occurredAt.getTime()) / MS_PER_DAY;
|
|
126
|
+
if (daysSince < CONSOLIDATION_AGE_DAYS)
|
|
127
|
+
continue;
|
|
128
|
+
const newImportance = ep.importance * exponentialDecay(daysSince, ep.decayFactor * CONSOLIDATION_DECAY_FACTOR);
|
|
129
|
+
if (newImportance < FORGOTTEN_THRESHOLD && ep.accessCount < MIN_ACCESS_TO_KEEP) {
|
|
130
|
+
// Forget this episode
|
|
131
|
+
await this.store.delete(COLLECTION, ep.id);
|
|
132
|
+
deletedCount++;
|
|
133
|
+
}
|
|
134
|
+
else if (newImportance < ep.importance) {
|
|
135
|
+
// Decay importance
|
|
136
|
+
await this.store.set(COLLECTION, ep.id, {
|
|
137
|
+
...ep,
|
|
138
|
+
importance: newImportance,
|
|
139
|
+
});
|
|
140
|
+
decayedCount++;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
decayedCount,
|
|
145
|
+
deletedCount,
|
|
146
|
+
remainingCount: episodes.length - deletedCount,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/** Mark an episode as accessed (boosts importance). */
|
|
150
|
+
async recordAccess(episodeId) {
|
|
151
|
+
const ep = await this.store.get(COLLECTION, episodeId);
|
|
152
|
+
if (!ep)
|
|
153
|
+
return;
|
|
154
|
+
await this.store.set(COLLECTION, episodeId, {
|
|
155
|
+
...ep,
|
|
156
|
+
accessCount: ep.accessCount + 1,
|
|
157
|
+
lastAccessed: new Date(),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
// ── Private ──
|
|
161
|
+
async fetchCandidates(query) {
|
|
162
|
+
const where = { userId: query.userId };
|
|
163
|
+
if (query.categories && query.categories.length > 0) {
|
|
164
|
+
// Store doesn't support $in, filter post-fetch
|
|
165
|
+
}
|
|
166
|
+
const episodes = await this.store.find(COLLECTION, {
|
|
167
|
+
where,
|
|
168
|
+
orderBy: { occurredAt: 'desc' },
|
|
169
|
+
limit: (query.limit ?? this.config.maxRelevantEpisodes) * 3,
|
|
170
|
+
});
|
|
171
|
+
return episodes.filter((ep) => {
|
|
172
|
+
if (query.categories &&
|
|
173
|
+
query.categories.length > 0 &&
|
|
174
|
+
!query.categories.includes(ep.category)) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
if (query.emotions &&
|
|
178
|
+
query.emotions.length > 0 &&
|
|
179
|
+
!ep.emotions.some((e) => query.emotions.includes(e))) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
if (query.timeRange?.from && ep.occurredAt < query.timeRange.from) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
if (query.timeRange?.to && ep.occurredAt > query.timeRange.to) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
if (query.minImportance !== undefined &&
|
|
189
|
+
ep.importance < query.minImportance) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
return true;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
async computeRelevanceScores(queryText, episodes) {
|
|
196
|
+
const scores = new Map();
|
|
197
|
+
if (!queryText || episodes.length === 0)
|
|
198
|
+
return scores;
|
|
199
|
+
const queryVec = await this.embedding.embed(queryText);
|
|
200
|
+
for (const ep of episodes) {
|
|
201
|
+
if (ep.embedding && ep.embedding.length > 0) {
|
|
202
|
+
const similarity = cosineSimilarity(queryVec, ep.embedding);
|
|
203
|
+
scores.set(ep.id, Math.max(0, similarity));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return scores;
|
|
207
|
+
}
|
|
208
|
+
detectEmotionalPattern(episodes) {
|
|
209
|
+
if (episodes.length === 0)
|
|
210
|
+
return 'neutral';
|
|
211
|
+
const emotionCounts = new Map();
|
|
212
|
+
let totalValence = 0;
|
|
213
|
+
for (const ep of episodes) {
|
|
214
|
+
totalValence += ep.emotionalValence;
|
|
215
|
+
for (const emotion of ep.emotions) {
|
|
216
|
+
emotionCounts.set(emotion, (emotionCounts.get(emotion) ?? 0) + 1);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const avgValence = totalValence / episodes.length;
|
|
220
|
+
// Find dominant emotion
|
|
221
|
+
let dominantEmotion = 'neutral';
|
|
222
|
+
let maxCount = 0;
|
|
223
|
+
for (const [emotion, count] of emotionCounts) {
|
|
224
|
+
if (count > maxCount) {
|
|
225
|
+
maxCount = count;
|
|
226
|
+
dominantEmotion = emotion;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (avgValence > 0.3)
|
|
230
|
+
return `positive (${dominantEmotion})`;
|
|
231
|
+
if (avgValence < -0.3)
|
|
232
|
+
return `negative (${dominantEmotion})`;
|
|
233
|
+
if (dominantEmotion !== 'neutral')
|
|
234
|
+
return dominantEmotion;
|
|
235
|
+
return 'neutral';
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=episodic-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"episodic-memory.js","sourceRoot":"","sources":["../src/episodic-memory.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE3E,MAAM,UAAU,GAAG,UAAU,CAAA;AAC7B,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;AACtC,MAAM,qBAAqB,GAAG,GAAG,CAAA;AACjC,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAC5B,MAAM,sBAAsB,GAAG,EAAE,CAAA;AACjC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC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OAAO,EAAE,KAAK,CAAC,IAAI,aAAa,EAAE,CAAC;YAC7C,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;gBACrB,QAAQ,GAAG,KAAK,CAAA;gBAChB,eAAe,GAAG,OAAO,CAAA;YAC3B,CAAC;QACH,CAAC;QAED,IAAI,UAAU,GAAG,GAAG;YAAE,OAAO,aAAa,eAAe,GAAG,CAAA;QAC5D,IAAI,UAAU,GAAG,CAAC,GAAG;YAAE,OAAO,aAAa,eAAe,GAAG,CAAA;QAC7D,IAAI,eAAe,KAAK,SAAS;YAAE,OAAO,eAAe,CAAA;QACzD,OAAO,SAAS,CAAA;IAClB,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cognitive-engine/memory",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Episodic memory with decay, semantic search, and consolidation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"test:watch": "vitest",
|
|
21
|
+
"lint": "eslint src/",
|
|
22
|
+
"clean": "rm -rf dist"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@cognitive-engine/core": "*",
|
|
26
|
+
"@cognitive-engine/math": "*"
|
|
27
|
+
},
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"author": "Dmitry Zorin",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/medonomator/cognitive-engine.git",
|
|
33
|
+
"directory": "packages/memory"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/medonomator/cognitive-engine/tree/main/packages/memory",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
}
|
|
39
|
+
}
|