@pi-unipi/memory 0.1.10 → 0.1.12
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/embedding.ts +6 -7
- package/index.ts +10 -13
- package/package.json +1 -1
- package/storage.ts +13 -19
package/embedding.ts
CHANGED
|
@@ -79,8 +79,7 @@ export async function generateEmbedding(
|
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
if (!response.ok) {
|
|
82
|
-
|
|
83
|
-
console.warn(`[unipi/memory] Embedding API error ${response.status}: ${errText}`);
|
|
82
|
+
// Removed console.warn — embedding errors cause fallback to fuzzy search.
|
|
84
83
|
return null;
|
|
85
84
|
}
|
|
86
85
|
|
|
@@ -88,7 +87,7 @@ export async function generateEmbedding(
|
|
|
88
87
|
const values = data?.data?.[0]?.embedding;
|
|
89
88
|
|
|
90
89
|
if (!Array.isArray(values)) {
|
|
91
|
-
console.warn
|
|
90
|
+
// Removed console.warn — unexpected format causes fallback to fuzzy search.
|
|
92
91
|
return null;
|
|
93
92
|
}
|
|
94
93
|
|
|
@@ -102,9 +101,9 @@ export async function generateEmbedding(
|
|
|
102
101
|
return vec;
|
|
103
102
|
} catch (err: any) {
|
|
104
103
|
if (err?.name === "TimeoutError") {
|
|
105
|
-
console.warn
|
|
104
|
+
// Removed console.warn — timeout causes fallback to fuzzy search.
|
|
106
105
|
} else {
|
|
107
|
-
console.warn
|
|
106
|
+
// Removed console.warn — embedding error causes fallback to fuzzy search.
|
|
108
107
|
}
|
|
109
108
|
return null;
|
|
110
109
|
}
|
|
@@ -209,8 +208,8 @@ export async function reembedAllMemories(ctx: ExtensionCommandContext): Promise<
|
|
|
209
208
|
}
|
|
210
209
|
|
|
211
210
|
storage.close();
|
|
212
|
-
} catch (
|
|
213
|
-
|
|
211
|
+
} catch (_err) {
|
|
212
|
+
// Re-embedding failure — existing embeddings preserved.
|
|
214
213
|
}
|
|
215
214
|
}
|
|
216
215
|
|
package/index.ts
CHANGED
|
@@ -78,11 +78,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
78
78
|
|
|
79
79
|
// Sync any orphaned markdown files into the database
|
|
80
80
|
const synced = projectStorage.syncOrphanedFiles();
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
console.warn("[unipi/memory] Failed to initialize storage, running without memory:", (err as any)?.message ?? err);
|
|
81
|
+
// Removed console.warn — orphaned file sync is informational only.
|
|
82
|
+
// Visible via memory tool list or info-screen memory group.
|
|
83
|
+
} catch (_err) {
|
|
84
|
+
// Memory init failure — running without memory. Silent startup.
|
|
86
85
|
projectStorage = null;
|
|
87
86
|
}
|
|
88
87
|
|
|
@@ -113,7 +112,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
113
112
|
// Register info group
|
|
114
113
|
const registry = getInfoRegistry();
|
|
115
114
|
if (registry) {
|
|
116
|
-
console.debug("[memory] Registering info group");
|
|
117
115
|
registry.registerGroup({
|
|
118
116
|
id: "memory",
|
|
119
117
|
name: "Memory",
|
|
@@ -143,8 +141,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
143
141
|
try {
|
|
144
142
|
projectMemories = projectStorage.listAll();
|
|
145
143
|
allMemories = listAllProjects();
|
|
146
|
-
} catch (
|
|
147
|
-
|
|
144
|
+
} catch (_err) {
|
|
145
|
+
// Info panel data unavailable — shows empty values.
|
|
148
146
|
}
|
|
149
147
|
const uniqueProjects = [...new Set(allMemories.map((m) => m.project))];
|
|
150
148
|
|
|
@@ -175,14 +173,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
175
173
|
try {
|
|
176
174
|
projectCount = projectStorage?.listAll()?.length ?? 0;
|
|
177
175
|
projectCountAll = listAllProjects().length;
|
|
178
|
-
} catch (
|
|
179
|
-
|
|
176
|
+
} catch (_err) {
|
|
177
|
+
// Count unavailable — status bar shows 0.
|
|
180
178
|
}
|
|
181
179
|
const vecReady = isEmbeddingReady();
|
|
182
180
|
const vecIcon = vecReady ? "⚡" : "📝";
|
|
183
181
|
ctx.ui.setStatus(
|
|
184
182
|
"unipi-memory",
|
|
185
|
-
`${vecIcon}
|
|
183
|
+
`${vecIcon} mem ${projectCount}p/${projectCountAll}all${hasModelChanged() ? " ⚠" : ""}`
|
|
186
184
|
);
|
|
187
185
|
}
|
|
188
186
|
});
|
|
@@ -196,8 +194,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
196
194
|
let projectMemories: Array<{ id: string; title: string; type: string }> = [];
|
|
197
195
|
try {
|
|
198
196
|
projectMemories = projectStorage.listAll();
|
|
199
|
-
} catch (
|
|
200
|
-
console.warn("[unipi/memory] Failed to list memories for recall:", err);
|
|
197
|
+
} catch (_err) {
|
|
201
198
|
recallDone = true; // Skip recall on error
|
|
202
199
|
return;
|
|
203
200
|
}
|
package/package.json
CHANGED
package/storage.ts
CHANGED
|
@@ -222,9 +222,8 @@ export class MemoryStorage {
|
|
|
222
222
|
// Do NOT delete the DB: another session may have it open
|
|
223
223
|
// and deleting open files on WSL/Windows is unsafe.
|
|
224
224
|
const delayMs = 50 * Math.pow(2, attempt - 1); // 50, 100, 200, 400
|
|
225
|
-
console.warn
|
|
226
|
-
|
|
227
|
-
);
|
|
225
|
+
// Removed console.warn — transient retries are normal during concurrent access.
|
|
226
|
+
// Memory availability visible via info-screen memory group.
|
|
228
227
|
const end = Date.now() + delayMs;
|
|
229
228
|
while (Date.now() < end) { /* busy wait */ }
|
|
230
229
|
continue;
|
|
@@ -233,10 +232,7 @@ export class MemoryStorage {
|
|
|
233
232
|
// Either non-transient error, or retries exhausted.
|
|
234
233
|
// Log and throw — this session will run without memory.
|
|
235
234
|
if (isTransient) {
|
|
236
|
-
console.warn
|
|
237
|
-
"[unipi/memory] Could not open database after retries. " +
|
|
238
|
-
"Another session may have the DB locked. Memory unavailable this session."
|
|
239
|
-
);
|
|
235
|
+
// Removed console.warn — memory unavailable status visible via info-screen.
|
|
240
236
|
}
|
|
241
237
|
throw err;
|
|
242
238
|
}
|
|
@@ -256,8 +252,8 @@ export class MemoryStorage {
|
|
|
256
252
|
// Load sqlite-vec extension
|
|
257
253
|
try {
|
|
258
254
|
sqliteVec.load(this.db);
|
|
259
|
-
} catch (
|
|
260
|
-
|
|
255
|
+
} catch (_err) {
|
|
256
|
+
// sqlite-vec unavailable — fuzzy-only mode. Silent startup.
|
|
261
257
|
}
|
|
262
258
|
|
|
263
259
|
// Create tables
|
|
@@ -308,7 +304,7 @@ export class MemoryStorage {
|
|
|
308
304
|
try {
|
|
309
305
|
if (fs.existsSync(file)) {
|
|
310
306
|
fs.unlinkSync(file);
|
|
311
|
-
console.warn
|
|
307
|
+
// Removed console.warn — corrupted file cleanup is silent.
|
|
312
308
|
}
|
|
313
309
|
} catch {
|
|
314
310
|
// Ignore removal errors
|
|
@@ -401,8 +397,8 @@ export class MemoryStorage {
|
|
|
401
397
|
BigInt(this.idToRowid(record.id)),
|
|
402
398
|
Buffer.from(record.embedding.buffer)
|
|
403
399
|
);
|
|
404
|
-
} catch (
|
|
405
|
-
|
|
400
|
+
} catch (_err) {
|
|
401
|
+
// Vector insert failure — memory still searchable via text/FTS.
|
|
406
402
|
}
|
|
407
403
|
}
|
|
408
404
|
});
|
|
@@ -418,10 +414,8 @@ export class MemoryStorage {
|
|
|
418
414
|
fs.mkdirSync(dir, { recursive: true });
|
|
419
415
|
}
|
|
420
416
|
fs.writeFileSync(mdPath, mdContent, "utf-8");
|
|
421
|
-
} catch (
|
|
422
|
-
// DB write succeeded but file write failed —
|
|
423
|
-
// Memory is still in DB and searchable
|
|
424
|
-
console.warn("[unipi/memory] Failed to write markdown file:", err);
|
|
417
|
+
} catch (_err) {
|
|
418
|
+
// DB write succeeded but file write failed — memory still in DB and searchable.
|
|
425
419
|
}
|
|
426
420
|
}
|
|
427
421
|
|
|
@@ -474,9 +468,9 @@ export class MemoryStorage {
|
|
|
474
468
|
);
|
|
475
469
|
|
|
476
470
|
synced++;
|
|
477
|
-
console.warn
|
|
478
|
-
} catch (
|
|
479
|
-
|
|
471
|
+
// Removed console.warn — orphaned file sync is silent.
|
|
472
|
+
} catch (_err) {
|
|
473
|
+
// Sync failure — file remains as standalone markdown.
|
|
480
474
|
}
|
|
481
475
|
}
|
|
482
476
|
|