feat: Implement full-text search for user prompts

- Added functionality to save raw user prompts for full-text search in the newHook function.
- Introduced new search endpoint 'search_user_prompts' to retrieve user prompts using FTS5.
- Created UserPromptRow and UserPromptSearchResult types for handling user prompt data.
- Implemented searchUserPrompts method in SessionSearch class to perform FTS5 queries.
- Created user_prompts table with FTS5 support and necessary triggers for data synchronization.
- Updated SessionStore to include methods for saving user prompts and managing the new table.
This commit is contained in:
Alex Newman
2025-10-21 22:02:06 -04:00
parent a62887a6e0
commit 726f167ebf
12 changed files with 781 additions and 153 deletions
+4
View File
@@ -34,6 +34,10 @@ export async function newHook(input?: UserPromptSubmitInput): Promise<void> {
// Just save session_id for indexing - no validation, no state management
const sessionDbId = db.createSDKSession(session_id, project, prompt);
const promptNumber = db.incrementPromptCounter(sessionDbId);
// Save raw user prompt for full-text search
db.saveUserPrompt(session_id, promptNumber, prompt);
console.error(`[new-hook] Session ${sessionDbId}, prompt #${promptNumber}`);
// Get fixed port