@esparkman/pensieve 0.3.0 → 0.3.1
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/database.d.ts +2 -0
- package/dist/database.js +10 -0
- package/dist/index.js +31 -1
- package/package.json +1 -1
package/dist/database.d.ts
CHANGED
|
@@ -106,6 +106,8 @@ export declare class MemoryDatabase {
|
|
|
106
106
|
addDiscovery(discovery: Discovery): number;
|
|
107
107
|
searchDiscoveries(query: string): Discovery[];
|
|
108
108
|
getDiscoveriesByCategory(category: string): Discovery[];
|
|
109
|
+
getAllDiscoveries(): Discovery[];
|
|
110
|
+
getRecentDiscoveries(limit?: number): Discovery[];
|
|
109
111
|
upsertEntity(entity: Entity): void;
|
|
110
112
|
getEntity(name: string): Entity | undefined;
|
|
111
113
|
getAllEntities(): Entity[];
|
package/dist/database.js
CHANGED
|
@@ -343,6 +343,16 @@ export class MemoryDatabase {
|
|
|
343
343
|
SELECT * FROM discoveries WHERE category = ? ORDER BY name
|
|
344
344
|
`, [category]);
|
|
345
345
|
}
|
|
346
|
+
getAllDiscoveries() {
|
|
347
|
+
return this.queryAll(`
|
|
348
|
+
SELECT * FROM discoveries ORDER BY discovered_at DESC
|
|
349
|
+
`);
|
|
350
|
+
}
|
|
351
|
+
getRecentDiscoveries(limit = 10) {
|
|
352
|
+
return this.queryAll(`
|
|
353
|
+
SELECT * FROM discoveries ORDER BY discovered_at DESC LIMIT ?
|
|
354
|
+
`, [limit]);
|
|
355
|
+
}
|
|
346
356
|
// Entity methods
|
|
347
357
|
upsertEntity(entity) {
|
|
348
358
|
this.db.run(`
|
package/dist/index.js
CHANGED
|
@@ -322,6 +322,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
322
322
|
result = 'No preferences found.';
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
+
else if (type === 'discoveries') {
|
|
326
|
+
const discoveries = category ? db.getDiscoveriesByCategory(category) : db.getAllDiscoveries();
|
|
327
|
+
if (discoveries.length > 0) {
|
|
328
|
+
result = `## Discoveries${category ? ` (${category})` : ''}\n\n`;
|
|
329
|
+
discoveries.forEach(d => {
|
|
330
|
+
result += `- **${d.name}** [${d.category}]: ${d.description || 'No description'}${d.location ? ` (${d.location})` : ''}\n`;
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
result = 'No discoveries found.';
|
|
335
|
+
}
|
|
336
|
+
}
|
|
325
337
|
else if (type === 'questions') {
|
|
326
338
|
const questions = db.getOpenQuestions();
|
|
327
339
|
if (questions.length > 0) {
|
|
@@ -441,6 +453,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
441
453
|
});
|
|
442
454
|
result += '\n';
|
|
443
455
|
}
|
|
456
|
+
const discoveries = db.getRecentDiscoveries(5);
|
|
457
|
+
if (discoveries.length > 0) {
|
|
458
|
+
result += `### Recent Discoveries\n`;
|
|
459
|
+
discoveries.forEach(d => {
|
|
460
|
+
result += `- **${d.name}** [${d.category}]: ${d.description || 'No description'}${d.location ? ` (${d.location})` : ''}\n`;
|
|
461
|
+
});
|
|
462
|
+
result += '\n';
|
|
463
|
+
}
|
|
444
464
|
const questions = db.getOpenQuestions();
|
|
445
465
|
if (questions.length > 0) {
|
|
446
466
|
result += `### Open Questions\n`;
|
|
@@ -491,6 +511,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
491
511
|
case 'pensieve_status': {
|
|
492
512
|
const decisions = db.getRecentDecisions(100);
|
|
493
513
|
const prefs = db.getAllPreferences();
|
|
514
|
+
const discoveries = db.getAllDiscoveries();
|
|
494
515
|
const entities = db.getAllEntities();
|
|
495
516
|
const questions = db.getOpenQuestions();
|
|
496
517
|
const lastSession = db.getLastSession();
|
|
@@ -499,6 +520,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
499
520
|
result += `**Counts:**\n`;
|
|
500
521
|
result += `- Decisions: ${decisions.length}\n`;
|
|
501
522
|
result += `- Preferences: ${prefs.length}\n`;
|
|
523
|
+
result += `- Discoveries: ${discoveries.length}\n`;
|
|
502
524
|
result += `- Entities: ${entities.length}\n`;
|
|
503
525
|
result += `- Open Questions: ${questions.length}\n`;
|
|
504
526
|
result += `- Last Session: ${lastSession ? lastSession.started_at : 'None'}\n`;
|
|
@@ -575,8 +597,9 @@ function outputPriorContext() {
|
|
|
575
597
|
const lastSession = db.getLastSession();
|
|
576
598
|
const decisions = db.getRecentDecisions(5);
|
|
577
599
|
const prefs = db.getAllPreferences();
|
|
600
|
+
const discoveries = db.getRecentDiscoveries(5);
|
|
578
601
|
const questions = db.getOpenQuestions();
|
|
579
|
-
const hasContent = lastSession?.summary || decisions.length > 0 || prefs.length > 0 || questions.length > 0;
|
|
602
|
+
const hasContent = lastSession?.summary || decisions.length > 0 || prefs.length > 0 || discoveries.length > 0 || questions.length > 0;
|
|
580
603
|
if (!hasContent) {
|
|
581
604
|
console.error('🧙 Pensieve ready (no prior context yet)');
|
|
582
605
|
return;
|
|
@@ -615,6 +638,13 @@ function outputPriorContext() {
|
|
|
615
638
|
console.error(` • ${p.category}/${p.key}: ${p.value}`);
|
|
616
639
|
});
|
|
617
640
|
}
|
|
641
|
+
if (discoveries.length > 0) {
|
|
642
|
+
console.error('');
|
|
643
|
+
console.error('🔍 DISCOVERIES:');
|
|
644
|
+
discoveries.forEach(d => {
|
|
645
|
+
console.error(` • [${d.category}] ${d.name}${d.location ? ` at ${d.location}` : ''}`);
|
|
646
|
+
});
|
|
647
|
+
}
|
|
618
648
|
if (questions.length > 0) {
|
|
619
649
|
console.error('');
|
|
620
650
|
console.error('❓ OPEN QUESTIONS:');
|
package/package.json
CHANGED