@monoes/memory 1.0.4 → 1.0.6
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 +72 -840
- package/dist/atomic-file.d.ts +17 -0
- package/dist/atomic-file.d.ts.map +1 -0
- package/dist/atomic-file.js +27 -0
- package/dist/atomic-file.js.map +1 -0
- package/dist/cache-manager.d.ts +0 -0
- package/dist/cache-manager.d.ts.map +1 -1
- package/dist/cache-manager.js +0 -0
- package/dist/cache-manager.js.map +1 -1
- package/dist/checkpointer.d.ts +13 -0
- package/dist/checkpointer.d.ts.map +1 -1
- package/dist/checkpointer.js +69 -6
- package/dist/checkpointer.js.map +1 -1
- package/dist/controller-registry.d.ts +2 -8
- package/dist/controller-registry.d.ts.map +1 -1
- package/dist/controller-registry.js +4 -49
- package/dist/controller-registry.js.map +1 -1
- package/dist/database-provider.d.ts +0 -0
- package/dist/database-provider.d.ts.map +0 -0
- package/dist/database-provider.js +0 -0
- package/dist/database-provider.js.map +1 -1
- package/dist/hnsw-index.d.ts +0 -0
- package/dist/hnsw-index.d.ts.map +1 -1
- package/dist/hnsw-index.js +0 -0
- package/dist/hnsw-index.js.map +1 -1
- package/dist/index.d.ts +0 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +1 -1
- package/dist/knowledge/document-chunker.d.ts +0 -0
- package/dist/knowledge/document-chunker.d.ts.map +0 -0
- package/dist/knowledge/document-chunker.js +0 -0
- package/dist/knowledge/document-chunker.js.map +1 -1
- package/dist/knowledge/index.d.ts +0 -0
- package/dist/knowledge/index.d.ts.map +0 -0
- package/dist/knowledge/index.js +0 -0
- package/dist/knowledge/index.js.map +0 -0
- package/dist/knowledge/knowledge-retriever.d.ts +0 -0
- package/dist/knowledge/knowledge-retriever.d.ts.map +1 -1
- package/dist/knowledge/knowledge-retriever.js +0 -0
- package/dist/knowledge/knowledge-retriever.js.map +1 -1
- package/dist/knowledge/knowledge-store.d.ts +0 -0
- package/dist/knowledge/knowledge-store.d.ts.map +1 -1
- package/dist/knowledge/knowledge-store.js +0 -0
- package/dist/knowledge/knowledge-store.js.map +0 -0
- package/dist/lancedb-backend.d.ts +5 -0
- package/dist/lancedb-backend.d.ts.map +1 -1
- package/dist/lancedb-backend.js +70 -12
- package/dist/lancedb-backend.js.map +1 -1
- package/dist/math-utils.d.ts +0 -0
- package/dist/math-utils.d.ts.map +0 -0
- package/dist/math-utils.js +0 -0
- package/dist/math-utils.js.map +0 -0
- package/dist/migration.d.ts +1 -0
- package/dist/migration.d.ts.map +1 -1
- package/dist/migration.js +50 -21
- package/dist/migration.js.map +1 -1
- package/dist/prompt-version-store.d.ts +0 -0
- package/dist/prompt-version-store.d.ts.map +1 -1
- package/dist/prompt-version-store.js +0 -0
- package/dist/prompt-version-store.js.map +0 -0
- package/dist/query-builder.d.ts +0 -0
- package/dist/query-builder.d.ts.map +1 -1
- package/dist/query-builder.js +0 -0
- package/dist/query-builder.js.map +1 -1
- package/dist/sqlite-backend.d.ts +0 -0
- package/dist/sqlite-backend.d.ts.map +1 -1
- package/dist/sqlite-backend.js +38 -9
- package/dist/sqlite-backend.js.map +1 -1
- package/dist/sqljs-backend.d.ts +1 -0
- package/dist/sqljs-backend.d.ts.map +1 -1
- package/dist/sqljs-backend.js +64 -13
- package/dist/sqljs-backend.js.map +1 -1
- package/dist/types/checkpoint.d.ts +0 -0
- package/dist/types/checkpoint.d.ts.map +0 -0
- package/dist/types/checkpoint.js +0 -0
- package/dist/types/checkpoint.js.map +0 -0
- package/dist/types.d.ts +1 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -0
- package/dist/types.js.map +1 -1
- package/package.json +12 -13
- package/dist/agent-memory-scope.d.ts +0 -131
- package/dist/agent-memory-scope.d.ts.map +0 -1
- package/dist/agent-memory-scope.js +0 -230
- package/dist/agent-memory-scope.js.map +0 -1
- package/dist/auto-memory-bridge.d.ts +0 -230
- package/dist/auto-memory-bridge.d.ts.map +0 -1
- package/dist/auto-memory-bridge.js +0 -736
- package/dist/auto-memory-bridge.js.map +0 -1
- package/dist/diskann-backend.d.ts +0 -126
- package/dist/diskann-backend.d.ts.map +0 -1
- package/dist/diskann-backend.js +0 -336
- package/dist/diskann-backend.js.map +0 -1
- package/dist/episodic-store.d.ts +0 -58
- package/dist/episodic-store.d.ts.map +0 -1
- package/dist/episodic-store.js +0 -160
- package/dist/episodic-store.js.map +0 -1
- package/dist/learning-bridge.d.ts +0 -180
- package/dist/learning-bridge.d.ts.map +0 -1
- package/dist/learning-bridge.js +0 -566
- package/dist/learning-bridge.js.map +0 -1
- package/dist/memory-graph.d.ts +0 -125
- package/dist/memory-graph.d.ts.map +0 -1
- package/dist/memory-graph.js +0 -429
- package/dist/memory-graph.js.map +0 -1
- package/dist/partitioned-hnsw.d.ts +0 -65
- package/dist/partitioned-hnsw.d.ts.map +0 -1
- package/dist/partitioned-hnsw.js +0 -209
- package/dist/partitioned-hnsw.js.map +0 -1
- package/dist/procedural/action-record.d.ts +0 -19
- package/dist/procedural/action-record.d.ts.map +0 -1
- package/dist/procedural/action-record.js +0 -51
- package/dist/procedural/action-record.js.map +0 -1
- package/dist/procedural/action-sequence-extractor.d.ts +0 -25
- package/dist/procedural/action-sequence-extractor.d.ts.map +0 -1
- package/dist/procedural/action-sequence-extractor.js +0 -91
- package/dist/procedural/action-sequence-extractor.js.map +0 -1
- package/dist/procedural/index.d.ts +0 -14
- package/dist/procedural/index.d.ts.map +0 -1
- package/dist/procedural/index.js +0 -13
- package/dist/procedural/index.js.map +0 -1
- package/dist/procedural/learned-skill.d.ts +0 -17
- package/dist/procedural/learned-skill.d.ts.map +0 -1
- package/dist/procedural/learned-skill.js +0 -73
- package/dist/procedural/learned-skill.js.map +0 -1
- package/dist/procedural/skill-registry.d.ts +0 -25
- package/dist/procedural/skill-registry.d.ts.map +0 -1
- package/dist/procedural/skill-registry.js +0 -56
- package/dist/procedural/skill-registry.js.map +0 -1
- package/dist/procedural/types.d.ts +0 -67
- package/dist/procedural/types.d.ts.map +0 -1
- package/dist/procedural/types.js +0 -15
- package/dist/procedural/types.js.map +0 -1
- package/dist/tier-manager.d.ts +0 -79
- package/dist/tier-manager.d.ts.map +0 -1
- package/dist/tier-manager.js +0 -173
- package/dist/tier-manager.js.map +0 -1
- package/dist/tiers/contextual.d.ts +0 -45
- package/dist/tiers/contextual.d.ts.map +0 -1
- package/dist/tiers/contextual.js +0 -109
- package/dist/tiers/contextual.js.map +0 -1
- package/dist/tiers/entity.d.ts +0 -46
- package/dist/tiers/entity.d.ts.map +0 -1
- package/dist/tiers/entity.js +0 -106
- package/dist/tiers/entity.js.map +0 -1
- package/dist/tiers/index.d.ts +0 -4
- package/dist/tiers/index.d.ts.map +0 -1
- package/dist/tiers/index.js +0 -4
- package/dist/tiers/index.js.map +0 -1
- package/dist/tiers/short-term.d.ts +0 -42
- package/dist/tiers/short-term.d.ts.map +0 -1
- package/dist/tiers/short-term.js +0 -90
- package/dist/tiers/short-term.js.map +0 -1
package/dist/partitioned-hnsw.js
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PartitionedHNSW — Timestamp-partitioned HNSW sub-indexes for temporal locality
|
|
3
|
-
*
|
|
4
|
-
* Partitions the HNSW vector index into time-bucket sub-indexes so that recent
|
|
5
|
-
* entries are searched first, dramatically reducing average search latency for
|
|
6
|
-
* workloads where recency correlates with relevance.
|
|
7
|
-
*
|
|
8
|
-
* Architecture:
|
|
9
|
-
* - Entries are routed to a bucket based on Math.floor(createdAt / bucketMs)
|
|
10
|
-
* - Each bucket owns an independent HNSWIndex (lazy-created)
|
|
11
|
-
* - Search merges results across buckets, sorted by recency then similarity
|
|
12
|
-
* - Old buckets can be evicted once they exceed maxBuckets
|
|
13
|
-
*
|
|
14
|
-
* Source: ICDE 2025 Timestamp-Partitioned HNSW
|
|
15
|
-
*
|
|
16
|
-
* @module v1/memory/partitioned-hnsw
|
|
17
|
-
*/
|
|
18
|
-
function cosineSim(a, b) {
|
|
19
|
-
if (a.length !== b.length || a.length === 0)
|
|
20
|
-
return 0;
|
|
21
|
-
let dot = 0;
|
|
22
|
-
for (let i = 0; i < a.length; i++)
|
|
23
|
-
dot += a[i] * b[i];
|
|
24
|
-
// Vectors are pre-normalised, so dot == cosine similarity
|
|
25
|
-
return dot;
|
|
26
|
-
}
|
|
27
|
-
function l2Norm(v) {
|
|
28
|
-
let sum = 0;
|
|
29
|
-
for (let i = 0; i < v.length; i++)
|
|
30
|
-
sum += v[i] * v[i];
|
|
31
|
-
const len = Math.sqrt(sum);
|
|
32
|
-
if (len === 0)
|
|
33
|
-
return v;
|
|
34
|
-
const out = new Float32Array(v.length);
|
|
35
|
-
for (let i = 0; i < v.length; i++)
|
|
36
|
-
out[i] = v[i] / len;
|
|
37
|
-
return out;
|
|
38
|
-
}
|
|
39
|
-
class TimeBucket {
|
|
40
|
-
entries = [];
|
|
41
|
-
_oldest = Infinity;
|
|
42
|
-
_newest = 0;
|
|
43
|
-
add(entry) {
|
|
44
|
-
const normVec = entry.embedding ? l2Norm(entry.embedding) : null;
|
|
45
|
-
this.entries.push({ entry, normVec });
|
|
46
|
-
if (entry.createdAt < this._oldest)
|
|
47
|
-
this._oldest = entry.createdAt;
|
|
48
|
-
if (entry.createdAt > this._newest)
|
|
49
|
-
this._newest = entry.createdAt;
|
|
50
|
-
}
|
|
51
|
-
remove(id) {
|
|
52
|
-
const idx = this.entries.findIndex(e => e.entry.id === id);
|
|
53
|
-
if (idx === -1)
|
|
54
|
-
return false;
|
|
55
|
-
const removed = this.entries.splice(idx, 1)[0];
|
|
56
|
-
// Recompute _oldest/_newest if the removed entry was an extremum
|
|
57
|
-
if (removed.entry.createdAt === this._oldest || removed.entry.createdAt === this._newest) {
|
|
58
|
-
this._oldest = Infinity;
|
|
59
|
-
this._newest = 0;
|
|
60
|
-
for (const e of this.entries) {
|
|
61
|
-
if (e.entry.createdAt < this._oldest)
|
|
62
|
-
this._oldest = e.entry.createdAt;
|
|
63
|
-
if (e.entry.createdAt > this._newest)
|
|
64
|
-
this._newest = e.entry.createdAt;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
/** Approximate k-NN by brute-force within the bucket (buckets are small). */
|
|
70
|
-
search(queryVec, limit, textQuery) {
|
|
71
|
-
const scored = this.entries.map(({ entry, normVec }) => {
|
|
72
|
-
let score = 0;
|
|
73
|
-
if (queryVec && normVec) {
|
|
74
|
-
score = cosineSim(queryVec, normVec);
|
|
75
|
-
}
|
|
76
|
-
else if (textQuery) {
|
|
77
|
-
// Keyword fallback: count overlapping terms
|
|
78
|
-
const terms = textQuery.toLowerCase().split(/\s+/);
|
|
79
|
-
const content = entry.content.toLowerCase();
|
|
80
|
-
const hits = terms.filter(t => content.includes(t)).length;
|
|
81
|
-
score = hits / Math.max(terms.length, 1);
|
|
82
|
-
}
|
|
83
|
-
return { entry, score };
|
|
84
|
-
});
|
|
85
|
-
scored.sort((a, b) => b.score - a.score);
|
|
86
|
-
return scored.slice(0, limit);
|
|
87
|
-
}
|
|
88
|
-
get size() { return this.entries.length; }
|
|
89
|
-
get oldest() { return this.entries.length ? this._oldest : Infinity; }
|
|
90
|
-
get newest() { return this.entries.length ? this._newest : 0; }
|
|
91
|
-
}
|
|
92
|
-
// ===== PartitionedHNSW =====
|
|
93
|
-
export class PartitionedHNSW {
|
|
94
|
-
bucketMs;
|
|
95
|
-
maxBuckets;
|
|
96
|
-
k;
|
|
97
|
-
/** bucketKey → TimeBucket, ordered newest-first via insertion order */
|
|
98
|
-
buckets = new Map();
|
|
99
|
-
constructor(config = {}) {
|
|
100
|
-
this.bucketMs = config.bucketMs ?? 60 * 60 * 1000; // 1 hour default
|
|
101
|
-
this.maxBuckets = config.maxBuckets ?? 48; // 48 hours default retention
|
|
102
|
-
this.k = config.k ?? 16;
|
|
103
|
-
}
|
|
104
|
-
/** Add a memory entry to its time-bucket. */
|
|
105
|
-
add(entry) {
|
|
106
|
-
const bucketKey = this.bucketKeyFor(entry.createdAt);
|
|
107
|
-
if (!this.buckets.has(bucketKey)) {
|
|
108
|
-
this.buckets.set(bucketKey, new TimeBucket());
|
|
109
|
-
this.evictOldBuckets();
|
|
110
|
-
// After eviction the bucket we just created may have been removed
|
|
111
|
-
// (entry predates the retention window) — discard it silently.
|
|
112
|
-
if (!this.buckets.has(bucketKey))
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
this.buckets.get(bucketKey).add(entry);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Search across partitions, newest buckets first.
|
|
119
|
-
* Stops early once `limit` results are collected or all buckets exhausted.
|
|
120
|
-
*
|
|
121
|
-
* @param queryEmbedding - optional query vector (cosine similarity)
|
|
122
|
-
* @param textQuery - optional keyword fallback
|
|
123
|
-
* @param limit - max results
|
|
124
|
-
* @param fromMs - optional lower bound on createdAt (temporal filter)
|
|
125
|
-
* @param toMs - optional upper bound on createdAt (temporal filter)
|
|
126
|
-
*/
|
|
127
|
-
search(queryEmbedding, textQuery, limit, fromMs, toMs) {
|
|
128
|
-
const normQuery = queryEmbedding ? l2Norm(queryEmbedding) : null;
|
|
129
|
-
// Collect buckets in descending (newest-first) order
|
|
130
|
-
const sortedKeys = [...this.buckets.keys()].sort((a, b) => b - a);
|
|
131
|
-
const candidates = [];
|
|
132
|
-
for (const key of sortedKeys) {
|
|
133
|
-
// Skip buckets entirely outside the temporal filter
|
|
134
|
-
const bucket = this.buckets.get(key);
|
|
135
|
-
if (fromMs !== undefined && bucket.newest < fromMs)
|
|
136
|
-
continue;
|
|
137
|
-
if (toMs !== undefined && bucket.oldest > toMs)
|
|
138
|
-
continue;
|
|
139
|
-
const hits = bucket.search(normQuery, Math.max(limit, this.k), textQuery);
|
|
140
|
-
for (const h of hits) {
|
|
141
|
-
if (fromMs !== undefined && h.entry.createdAt < fromMs)
|
|
142
|
-
continue;
|
|
143
|
-
if (toMs !== undefined && h.entry.createdAt > toMs)
|
|
144
|
-
continue;
|
|
145
|
-
candidates.push({ ...h, bucketKey: key });
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
// Sort by score desc, then by recency (bucketKey desc) as tiebreak
|
|
149
|
-
candidates.sort((a, b) => b.score - a.score || b.bucketKey - a.bucketKey);
|
|
150
|
-
const seen = new Set();
|
|
151
|
-
const results = [];
|
|
152
|
-
for (const { entry } of candidates) {
|
|
153
|
-
if (!seen.has(entry.id)) {
|
|
154
|
-
seen.add(entry.id);
|
|
155
|
-
results.push(entry);
|
|
156
|
-
}
|
|
157
|
-
if (results.length >= limit)
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
return results;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Remove an entry from its time-bucket by id and original createdAt timestamp.
|
|
164
|
-
* Returns true if the entry was found and removed, false otherwise.
|
|
165
|
-
*/
|
|
166
|
-
remove(id, createdAt) {
|
|
167
|
-
const bucketKey = this.bucketKeyFor(createdAt);
|
|
168
|
-
const bucket = this.buckets.get(bucketKey);
|
|
169
|
-
if (!bucket)
|
|
170
|
-
return false;
|
|
171
|
-
return bucket.remove(id);
|
|
172
|
-
}
|
|
173
|
-
/** Stats per bucket for observability. */
|
|
174
|
-
bucketStats() {
|
|
175
|
-
return [...this.buckets.entries()].map(([key, bucket]) => ({
|
|
176
|
-
bucketKey: key,
|
|
177
|
-
entryCount: bucket.size,
|
|
178
|
-
oldestMs: bucket.oldest,
|
|
179
|
-
newestMs: bucket.newest,
|
|
180
|
-
}));
|
|
181
|
-
}
|
|
182
|
-
get totalEntries() {
|
|
183
|
-
let n = 0;
|
|
184
|
-
for (const b of this.buckets.values())
|
|
185
|
-
n += b.size;
|
|
186
|
-
return n;
|
|
187
|
-
}
|
|
188
|
-
// ------------------------------------------------------------------
|
|
189
|
-
// Private helpers
|
|
190
|
-
// ------------------------------------------------------------------
|
|
191
|
-
bucketKeyFor(createdAt) {
|
|
192
|
-
return Math.floor(createdAt / this.bucketMs);
|
|
193
|
-
}
|
|
194
|
-
/** Evict the oldest bucket(s) when we exceed maxBuckets. */
|
|
195
|
-
evictOldBuckets() {
|
|
196
|
-
while (this.buckets.size > this.maxBuckets) {
|
|
197
|
-
// Find the smallest bucket key (oldest in time), not first in insertion order.
|
|
198
|
-
// Insertion order diverges from temporal order during bulk inserts or migrations.
|
|
199
|
-
let oldestKey;
|
|
200
|
-
for (const k of this.buckets.keys()) {
|
|
201
|
-
if (oldestKey === undefined || k < oldestKey)
|
|
202
|
-
oldestKey = k;
|
|
203
|
-
}
|
|
204
|
-
if (oldestKey !== undefined)
|
|
205
|
-
this.buckets.delete(oldestKey);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
//# sourceMappingURL=partitioned-hnsw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"partitioned-hnsw.js","sourceRoot":"","sources":["../src/partitioned-hnsw.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA+BH,SAAS,SAAS,CAAC,CAAe,EAAE,CAAe;IACjD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACtD,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,0DAA0D;IAC1D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,MAAM,CAAC,CAAe;IAC7B,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,IAAI,CAAC,CAAC,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,CAAC;YAClC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;gBACpC,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,GAAG,SAAS;oBAAE,SAAS,GAAG,CAAC,CAAC;YAC9D,CAAC;YACD,IAAI,SAAS,KAAK,SAAS;gBAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ActionRecordStore — JSONL-backed append-only store for action records.
|
|
3
|
-
*
|
|
4
|
-
* Part of Task 45 — Procedural Memory.
|
|
5
|
-
*/
|
|
6
|
-
import type { ActionRecord } from './types.js';
|
|
7
|
-
export declare class ActionRecordStore {
|
|
8
|
-
private filePath;
|
|
9
|
-
constructor(filePath: string);
|
|
10
|
-
/** Append a single action record to the JSONL file */
|
|
11
|
-
record(rec: ActionRecord): void;
|
|
12
|
-
/** Read all records from the JSONL file */
|
|
13
|
-
private readAll;
|
|
14
|
-
/** Query records by agent slug, optionally filtering by lookback days */
|
|
15
|
-
queryByAgentSlug(slug: string, lookbackDays?: number): ActionRecord[];
|
|
16
|
-
/** Get all records for a specific run, sorted by timestamp */
|
|
17
|
-
getRunSequence(runId: string): ActionRecord[];
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=action-record.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-record.d.ts","sourceRoot":"","sources":["../../src/procedural/action-record.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,MAAM;IAQ5B,sDAAsD;IACtD,MAAM,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI;IAI/B,2CAA2C;IAC3C,OAAO,CAAC,OAAO;IAOf,yEAAyE;IACzE,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE;IAarE,8DAA8D;IAC9D,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE;CAK9C"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ActionRecordStore — JSONL-backed append-only store for action records.
|
|
3
|
-
*
|
|
4
|
-
* Part of Task 45 — Procedural Memory.
|
|
5
|
-
*/
|
|
6
|
-
import { appendFileSync, readFileSync, existsSync, mkdirSync } from 'fs';
|
|
7
|
-
import { dirname } from 'path';
|
|
8
|
-
export class ActionRecordStore {
|
|
9
|
-
filePath;
|
|
10
|
-
constructor(filePath) {
|
|
11
|
-
this.filePath = filePath;
|
|
12
|
-
const dir = dirname(filePath);
|
|
13
|
-
if (!existsSync(dir)) {
|
|
14
|
-
mkdirSync(dir, { recursive: true });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/** Append a single action record to the JSONL file */
|
|
18
|
-
record(rec) {
|
|
19
|
-
appendFileSync(this.filePath, JSON.stringify(rec) + '\n', 'utf-8');
|
|
20
|
-
}
|
|
21
|
-
/** Read all records from the JSONL file */
|
|
22
|
-
readAll() {
|
|
23
|
-
if (!existsSync(this.filePath))
|
|
24
|
-
return [];
|
|
25
|
-
const content = readFileSync(this.filePath, 'utf-8').trim();
|
|
26
|
-
if (!content)
|
|
27
|
-
return [];
|
|
28
|
-
return content.split('\n').filter(Boolean).map((line) => JSON.parse(line));
|
|
29
|
-
}
|
|
30
|
-
/** Query records by agent slug, optionally filtering by lookback days */
|
|
31
|
-
queryByAgentSlug(slug, lookbackDays) {
|
|
32
|
-
const all = this.readAll();
|
|
33
|
-
const cutoff = lookbackDays
|
|
34
|
-
? new Date(Date.now() - lookbackDays * 24 * 60 * 60 * 1000).toISOString()
|
|
35
|
-
: undefined;
|
|
36
|
-
return all.filter((r) => {
|
|
37
|
-
if (r.agentSlug !== slug)
|
|
38
|
-
return false;
|
|
39
|
-
if (cutoff && r.timestamp < cutoff)
|
|
40
|
-
return false;
|
|
41
|
-
return true;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
/** Get all records for a specific run, sorted by timestamp */
|
|
45
|
-
getRunSequence(runId) {
|
|
46
|
-
return this.readAll()
|
|
47
|
-
.filter((r) => r.runId === runId)
|
|
48
|
-
.sort((a, b) => a.timestamp.localeCompare(b.timestamp));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=action-record.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-record.js","sourceRoot":"","sources":["../../src/procedural/action-record.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAAS;IAEzB,YAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,sDAAsD;IACtD,MAAM,CAAC,GAAiB;QACtB,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;IAED,2CAA2C;IACnC,OAAO;QACb,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC;YAAE,OAAO,EAAE,CA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
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ActionSequenceExtractor — Groups action records into repeatable skill candidates.
|
|
3
|
-
*
|
|
4
|
-
* Part of Task 45 — Procedural Memory.
|
|
5
|
-
*/
|
|
6
|
-
import type { ActionRecord, ExtractionConfig, ActionSequenceGroup } from './types.js';
|
|
7
|
-
export declare class ActionSequenceExtractor {
|
|
8
|
-
private config;
|
|
9
|
-
constructor(config?: Partial<ExtractionConfig>);
|
|
10
|
-
/**
|
|
11
|
-
* Build a fingerprint for a sequence of actions: tool names joined with " -> "
|
|
12
|
-
*/
|
|
13
|
-
private fingerprint;
|
|
14
|
-
/**
|
|
15
|
-
* Extract action sequence groups from a flat list of records.
|
|
16
|
-
*
|
|
17
|
-
* 1. Group records by agentSlug
|
|
18
|
-
* 2. Within each agent, group by runId to get per-run sequences
|
|
19
|
-
* 3. Fingerprint each run sequence (toolName chain)
|
|
20
|
-
* 4. Group runs with identical fingerprints
|
|
21
|
-
* 5. Filter by minSuccessCount, minAvgQualityScore, maxSequenceLength
|
|
22
|
-
*/
|
|
23
|
-
extract(allRecords: ActionRecord[]): ActionSequenceGroup[];
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=action-sequence-extractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-sequence-extractor.d.ts","sourceRoot":"","sources":["../../src/procedural/action-sequence-extractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtF,qBAAa,uBAAuB;IAClC,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,GAAE,OAAO,CAAC,gBAAgB,CAAM;IAIlD;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;;;;;;;OAQG;IACH,OAAO,CAAC,UAAU,EAAE,YAAY,EAAE,GAAG,mBAAmB,EAAE;CA6E3D"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ActionSequenceExtractor — Groups action records into repeatable skill candidates.
|
|
3
|
-
*
|
|
4
|
-
* Part of Task 45 — Procedural Memory.
|
|
5
|
-
*/
|
|
6
|
-
import { DEFAULT_EXTRACTION_CONFIG } from './types.js';
|
|
7
|
-
export class ActionSequenceExtractor {
|
|
8
|
-
config;
|
|
9
|
-
constructor(config = {}) {
|
|
10
|
-
this.config = { ...DEFAULT_EXTRACTION_CONFIG, ...config };
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Build a fingerprint for a sequence of actions: tool names joined with " -> "
|
|
14
|
-
*/
|
|
15
|
-
fingerprint(records) {
|
|
16
|
-
return records.map((r) => r.toolName).join(' -> ');
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Extract action sequence groups from a flat list of records.
|
|
20
|
-
*
|
|
21
|
-
* 1. Group records by agentSlug
|
|
22
|
-
* 2. Within each agent, group by runId to get per-run sequences
|
|
23
|
-
* 3. Fingerprint each run sequence (toolName chain)
|
|
24
|
-
* 4. Group runs with identical fingerprints
|
|
25
|
-
* 5. Filter by minSuccessCount, minAvgQualityScore, maxSequenceLength
|
|
26
|
-
*/
|
|
27
|
-
extract(allRecords) {
|
|
28
|
-
// Group by agentSlug
|
|
29
|
-
const byAgent = new Map();
|
|
30
|
-
for (const r of allRecords) {
|
|
31
|
-
const arr = byAgent.get(r.agentSlug) ?? [];
|
|
32
|
-
arr.push(r);
|
|
33
|
-
byAgent.set(r.agentSlug, arr);
|
|
34
|
-
}
|
|
35
|
-
const results = [];
|
|
36
|
-
for (const [agentSlug, records] of byAgent) {
|
|
37
|
-
// Group by runId
|
|
38
|
-
const byRun = new Map();
|
|
39
|
-
for (const r of records) {
|
|
40
|
-
const arr = byRun.get(r.runId) ?? [];
|
|
41
|
-
arr.push(r);
|
|
42
|
-
byRun.set(r.runId, arr);
|
|
43
|
-
}
|
|
44
|
-
// Sort each run's records by timestamp, compute fingerprint
|
|
45
|
-
const fingerprintGroups = new Map();
|
|
46
|
-
for (const [runId, runRecords] of byRun) {
|
|
47
|
-
const sorted = runRecords.sort((a, b) => a.timestamp.localeCompare(b.timestamp));
|
|
48
|
-
// Skip sequences that exceed max length
|
|
49
|
-
if (sorted.length > this.config.maxSequenceLength)
|
|
50
|
-
continue;
|
|
51
|
-
const fp = this.fingerprint(sorted);
|
|
52
|
-
const group = fingerprintGroups.get(fp) ?? { sequences: [], runIds: [] };
|
|
53
|
-
group.sequences.push(sorted);
|
|
54
|
-
group.runIds.push(runId);
|
|
55
|
-
fingerprintGroups.set(fp, group);
|
|
56
|
-
}
|
|
57
|
-
// Filter and build result groups
|
|
58
|
-
for (const [fp, group] of fingerprintGroups) {
|
|
59
|
-
// Only successful runs count
|
|
60
|
-
const successfulSequences = group.sequences.filter((seq) => seq.every((r) => r.outcome === 'success'));
|
|
61
|
-
const successCount = successfulSequences.length;
|
|
62
|
-
if (successCount < this.config.minSuccessCount)
|
|
63
|
-
continue;
|
|
64
|
-
// Compute average quality score across all records in successful sequences
|
|
65
|
-
const allQualityScores = [];
|
|
66
|
-
for (const seq of successfulSequences) {
|
|
67
|
-
for (const r of seq) {
|
|
68
|
-
if (r.qualityScore !== undefined) {
|
|
69
|
-
allQualityScores.push(r.qualityScore);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const avgQualityScore = allQualityScores.length > 0
|
|
74
|
-
? allQualityScores.reduce((a, b) => a + b, 0) / allQualityScores.length
|
|
75
|
-
: 0;
|
|
76
|
-
if (avgQualityScore < this.config.minAvgQualityScore)
|
|
77
|
-
continue;
|
|
78
|
-
results.push({
|
|
79
|
-
agentSlug,
|
|
80
|
-
fingerprint: fp,
|
|
81
|
-
sequences: successfulSequences,
|
|
82
|
-
successCount,
|
|
83
|
-
avgQualityScore,
|
|
84
|
-
runIds: group.runIds.filter((_, i) => group.sequences[i].every((r) => r.outcome === 'success')),
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return results;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=action-sequence-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-sequence-extractor.js","sourceRoot":"","sources":["../../src/procedural/action-sequence-extractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,OAAO,uBAAuB;IAC1B,MAAM,CAAmB;IAEjC,YAAY,SAAoC,EAAE;QAChD,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,yBAAyB,EAAE,GAAG,MAAM,EAAE,CAAC;IAC5D,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,OAAuB;QACzC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,UAA0B;QAChC,qBAAqB;QACrB,MAAM,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;QAClD,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YAC3C,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAChC,CAAC;QAED,MAAM,OAAO,GAA0B,EAAE,CAAC;QAE1C,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,OAAO,EAAE,CAAC;YAC3C,iBAAiB;YACjB,MAAM,KAAK,GAAG,IAAI,GAAG,EAA0B,CAAC;YAChD,KAAK,MAAM,CAAC,IA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,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Procedural Memory — Learn from Successful Executions
|
|
3
|
-
*
|
|
4
|
-
* Barrel export for Task 45.
|
|
5
|
-
*
|
|
6
|
-
* @module @monomind/memory/procedural
|
|
7
|
-
*/
|
|
8
|
-
export type { ActionOutcome, ActionRecord, ExtractionConfig, SkillTrigger, LearnedSkill, ActionSequenceGroup, } from './types.js';
|
|
9
|
-
export { DEFAULT_EXTRACTION_CONFIG } from './types.js';
|
|
10
|
-
export { ActionRecordStore } from './action-record.js';
|
|
11
|
-
export { ActionSequenceExtractor } from './action-sequence-extractor.js';
|
|
12
|
-
export { LearnedSkillSerializer } from './learned-skill.js';
|
|
13
|
-
export { SkillRegistry } from './skill-registry.js';
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/procedural/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/procedural/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Procedural Memory — Learn from Successful Executions
|
|
3
|
-
*
|
|
4
|
-
* Barrel export for Task 45.
|
|
5
|
-
*
|
|
6
|
-
* @module @monomind/memory/procedural
|
|
7
|
-
*/
|
|
8
|
-
export { DEFAULT_EXTRACTION_CONFIG } from './types.js';
|
|
9
|
-
export { ActionRecordStore } from './action-record.js';
|
|
10
|
-
export { ActionSequenceExtractor } from './action-sequence-extractor.js';
|
|
11
|
-
export { LearnedSkillSerializer } from './learned-skill.js';
|
|
12
|
-
export { SkillRegistry } from './skill-registry.js';
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/procedural/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LearnedSkillSerializer — Creates and serializes LearnedSkill objects.
|
|
3
|
-
*
|
|
4
|
-
* Part of Task 45 — Procedural Memory.
|
|
5
|
-
*/
|
|
6
|
-
import type { ActionRecord, LearnedSkill } from './types.js';
|
|
7
|
-
export declare class LearnedSkillSerializer {
|
|
8
|
-
/**
|
|
9
|
-
* Create a new LearnedSkill from extracted data.
|
|
10
|
-
*/
|
|
11
|
-
static create(name: string, agentSlug: string, triggerPattern: string, actionSequence: ActionRecord[], successCount: number, avgQualityScore: number, sourceRunIds: string[]): LearnedSkill;
|
|
12
|
-
/**
|
|
13
|
-
* Serialize a LearnedSkill to a markdown string with YAML frontmatter.
|
|
14
|
-
*/
|
|
15
|
-
static toMarkdown(skill: LearnedSkill): string;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=learned-skill.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"learned-skill.d.ts","sourceRoot":"","sources":["../../src/procedural/learned-skill.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE7D,qBAAa,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,YAAY,EAAE,EAC9B,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EAAE,GACrB,YAAY;IAqBf;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM;CAsC/C"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LearnedSkillSerializer — Creates and serializes LearnedSkill objects.
|
|
3
|
-
*
|
|
4
|
-
* Part of Task 45 — Procedural Memory.
|
|
5
|
-
*/
|
|
6
|
-
import { randomUUID } from 'crypto';
|
|
7
|
-
export class LearnedSkillSerializer {
|
|
8
|
-
/**
|
|
9
|
-
* Create a new LearnedSkill from extracted data.
|
|
10
|
-
*/
|
|
11
|
-
static create(name, agentSlug, triggerPattern, actionSequence, successCount, avgQualityScore, sourceRunIds) {
|
|
12
|
-
const now = new Date().toISOString();
|
|
13
|
-
return {
|
|
14
|
-
skillId: randomUUID(),
|
|
15
|
-
name,
|
|
16
|
-
agentSlug,
|
|
17
|
-
trigger: {
|
|
18
|
-
pattern: triggerPattern,
|
|
19
|
-
mode: 'exact',
|
|
20
|
-
minConfidence: 0.8,
|
|
21
|
-
},
|
|
22
|
-
actionSequence,
|
|
23
|
-
successCount,
|
|
24
|
-
avgQualityScore,
|
|
25
|
-
sourceRunIds,
|
|
26
|
-
createdAt: now,
|
|
27
|
-
lastUpdatedAt: now,
|
|
28
|
-
version: 1,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Serialize a LearnedSkill to a markdown string with YAML frontmatter.
|
|
33
|
-
*/
|
|
34
|
-
static toMarkdown(skill) {
|
|
35
|
-
const lines = [];
|
|
36
|
-
lines.push('---');
|
|
37
|
-
lines.push(`skill_id: ${skill.skillId}`);
|
|
38
|
-
lines.push(`name: ${skill.name}`);
|
|
39
|
-
lines.push(`agent_slug: ${skill.agentSlug}`);
|
|
40
|
-
lines.push(`success_count: ${skill.successCount}`);
|
|
41
|
-
lines.push(`avg_quality_score: ${skill.avgQualityScore}`);
|
|
42
|
-
lines.push(`version: ${skill.version}`);
|
|
43
|
-
lines.push(`created_at: ${skill.createdAt}`);
|
|
44
|
-
lines.push(`last_updated_at: ${skill.lastUpdatedAt}`);
|
|
45
|
-
lines.push(`source_run_ids: [${skill.sourceRunIds.join(', ')}]`);
|
|
46
|
-
lines.push('---');
|
|
47
|
-
lines.push('');
|
|
48
|
-
lines.push(`# ${skill.name}`);
|
|
49
|
-
lines.push('');
|
|
50
|
-
lines.push('## Trigger');
|
|
51
|
-
lines.push('');
|
|
52
|
-
lines.push(`- Pattern: \`${skill.trigger.pattern}\``);
|
|
53
|
-
lines.push(`- Mode: ${skill.trigger.mode}`);
|
|
54
|
-
lines.push(`- Min Confidence: ${skill.trigger.minConfidence}`);
|
|
55
|
-
lines.push('');
|
|
56
|
-
lines.push('## Action Sequence');
|
|
57
|
-
lines.push('');
|
|
58
|
-
for (let i = 0; i < skill.actionSequence.length; i++) {
|
|
59
|
-
const step = skill.actionSequence[i];
|
|
60
|
-
lines.push(`### Step ${i + 1}: ${step.toolName}`);
|
|
61
|
-
lines.push('');
|
|
62
|
-
lines.push(`- Tool: \`${step.toolName}\``);
|
|
63
|
-
lines.push(`- Outcome: ${step.outcome}`);
|
|
64
|
-
lines.push(`- Duration: ${step.durationMs}ms`);
|
|
65
|
-
if (step.qualityScore !== undefined) {
|
|
66
|
-
lines.push(`- Quality: ${step.qualityScore}`);
|
|
67
|
-
}
|
|
68
|
-
lines.push('');
|
|
69
|
-
}
|
|
70
|
-
return lines.join('\n');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=learned-skill.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"learned-skill.js","sourceRoot":"","sources":["../../src/procedural/learned-skill.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGpC,MAAM,OAAO,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,MAAM,CACX,IAAY,EACZ,SAAiB,EACjB,cAAsB,EACtB,cAA8B,EAC9B,YAAoB,EACpB,eAAuB,EACvB,YAAsB;QAEtB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrC,OAAO;YACL,OAAO,EAAE,UAAU,EAAE;YACrB,IAAI;YACJ,SAAS;YACT,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;gBACvB,IAAI,EAAE,OAAO;gBACb,aAAa,EAAE,GAAG;aACnB;YACD,cAAc;YACd,YAAY;YACZ,eAAe;YACf,YAAY;YACZ,SAAS,EAAE,GAAG;YACd,aAAa,EAAE,GAAG;YAClB,OAAO,EAAE,CAAC;SACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,KAAmB;QACnC,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACzC,KAAK,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QAC7C,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GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrD,MAAM,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAClD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;YAC3C,KAAK,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;YAC/C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;gBACpC,KAAK,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;YAChD,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SkillRegistry — JSONL-backed registry for learned skills.
|
|
3
|
-
*
|
|
4
|
-
* Part of Task 45 — Procedural Memory.
|
|
5
|
-
*/
|
|
6
|
-
import type { LearnedSkill } from './types.js';
|
|
7
|
-
export declare class SkillRegistry {
|
|
8
|
-
private filePath;
|
|
9
|
-
constructor(filePath: string);
|
|
10
|
-
/** Register a new learned skill */
|
|
11
|
-
register(skill: LearnedSkill): void;
|
|
12
|
-
/** List all registered skills */
|
|
13
|
-
list(): LearnedSkill[];
|
|
14
|
-
/** Get a skill by ID */
|
|
15
|
-
get(skillId: string): LearnedSkill | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Find a skill that matches the same fingerprint (agentSlug + tool sequence).
|
|
18
|
-
* Fingerprint = agentSlug + sorted tool names joined by " -> ".
|
|
19
|
-
*/
|
|
20
|
-
findByFingerprint(skill: LearnedSkill): LearnedSkill | undefined;
|
|
21
|
-
/** Update a skill by ID (rewrites the entire file) */
|
|
22
|
-
update(skillId: string, updated: LearnedSkill): void;
|
|
23
|
-
private buildFingerprint;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=skill-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-registry.d.ts","sourceRoot":"","sources":["../../src/procedural/skill-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,MAAM;IAQ5B,mCAAmC;IACnC,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAInC,iCAAiC;IACjC,IAAI,IAAI,YAAY,EAAE;IAOtB,wBAAwB;IACxB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAI9C;;;OAGG;IACH,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS;IAKhE,sDAAsD;IACtD,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IAQpD,OAAO,CAAC,gBAAgB;CAIzB"}
|