30b142d318
This commit fixes the session ID confusion identified in PR #475: PROBLEM: - Using contentSessionId (user's Claude Code session) for SDK resume was wrong - Memory agent conversation should persist across the entire user session - Each SDK call was starting fresh, losing memory agent continuity SOLUTION: 1. Semantic Renaming (clarity): - claudeSessionId → contentSessionId (user's observed session) - sdkSessionId → memorySessionId (memory agent's session for resume) - Database migration 17 renames columns accordingly 2. Memory Session ID Capture: - SDKAgent captures session_id from first SDK message - Persists to database via updateMemorySessionId() - SessionManager loads memorySessionId on session init 3. Resume Logic Fixed: - Only resume if memorySessionId captured from previous interaction - Enables memory agent continuity across user prompts Files changed: 33 (types, database, agents, hooks, routes) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { SessionStore } from '../../sqlite/SessionStore.js';
|
|
import { logger } from '../../../utils/logger.js';
|
|
|
|
/**
|
|
* Validates user prompt privacy for session operations
|
|
*
|
|
* Centralizes privacy checks to avoid duplicate validation logic across route handlers.
|
|
* If user prompt was entirely private (stripped to empty string), we skip processing.
|
|
*/
|
|
export class PrivacyCheckValidator {
|
|
/**
|
|
* Check if user prompt is public (not entirely private)
|
|
*
|
|
* @param store - SessionStore instance
|
|
* @param contentSessionId - Claude session ID
|
|
* @param promptNumber - Prompt number within session
|
|
* @param operationType - Type of operation being validated ('observation' or 'summarize')
|
|
* @returns User prompt text if public, null if private
|
|
*/
|
|
static checkUserPromptPrivacy(
|
|
store: SessionStore,
|
|
contentSessionId: string,
|
|
promptNumber: number,
|
|
operationType: 'observation' | 'summarize',
|
|
sessionDbId: number,
|
|
additionalContext?: Record<string, any>
|
|
): string | null {
|
|
const userPrompt = store.getUserPrompt(contentSessionId, promptNumber);
|
|
|
|
if (!userPrompt || userPrompt.trim() === '') {
|
|
logger.debug('HOOK', `Skipping ${operationType} - user prompt was entirely private`, {
|
|
sessionId: sessionDbId,
|
|
promptNumber,
|
|
...additionalContext
|
|
});
|
|
return null;
|
|
}
|
|
|
|
return userPrompt;
|
|
}
|
|
}
|