Add query bar, maintenance panel, and heartbeat system
- Query bar with organized/grouped search results in portal - Maintenance panel UI for triggering and viewing maintenance status - Heartbeat service with periodic maintenance and dirty-tracking - Query organizer for grouping search results by tag/kind/parent - Slide-up animation for query panel
This commit is contained in:
@@ -25,6 +25,13 @@ function serializeEmbedding(embedding: number[]): Buffer {
|
||||
return Buffer.from(new Float32Array(embedding).buffer);
|
||||
}
|
||||
|
||||
function notifyDirty(): void {
|
||||
try {
|
||||
const { markDirty } = require('../server/heartbeat');
|
||||
markDirty();
|
||||
} catch {}
|
||||
}
|
||||
|
||||
export async function addNode(input: AddNodeInput): Promise<Node> {
|
||||
const db = getDb();
|
||||
const id = uuid();
|
||||
@@ -52,6 +59,7 @@ export async function addNode(input: AddNodeInput): Promise<Node> {
|
||||
insertTag.run(id, tag);
|
||||
}
|
||||
|
||||
notifyDirty();
|
||||
return {
|
||||
id, kind: input.kind, title: input.title, content, status: input.status,
|
||||
tags, metadata, embedding, createdAt: now, updatedAt: now, lastAccessedAt: now, isStale: false,
|
||||
@@ -149,6 +157,7 @@ export async function updateNode(id: string, input: UpdateNodeInput): Promise<No
|
||||
}
|
||||
}
|
||||
|
||||
notifyDirty();
|
||||
return getNode(id);
|
||||
}
|
||||
|
||||
@@ -159,6 +168,7 @@ export function removeNode(id: string, hard: boolean = false): boolean {
|
||||
return result.changes > 0;
|
||||
} else {
|
||||
const result = db.prepare('UPDATE nodes SET is_stale = 1, updated_at = ? WHERE id = ?').run(Date.now(), id);
|
||||
if (result.changes > 0) notifyDirty();
|
||||
return result.changes > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user