feat: Enhance JSON streaming parsing and UI updates

- Added a function to parse JSON streaming content in core-memory.js, extracting readable text from messages.
- Updated memory detail view to utilize the new parsing function for content and summary.
- Introduced an enableReview option in rules-manager.js, allowing users to toggle review functionality in rule creation.
- Simplified skill creation modal in skills-manager.js by removing generation type selection UI.
- Improved CLI executor to handle tool calls for file writing, ensuring proper output parsing.
- Adjusted CLI command tests to set timeout to 0 for immediate execution.
- Updated file watcher to implement a true debounce mechanism and added a pending queue status for UI updates.
- Enhanced watcher manager to handle queue changes and provide JSON output for better integration with TypeScript backend.
- Established TypeScript naming conventions documentation to standardize code style across the project.
This commit is contained in:
catlog22
2026-01-07 21:51:26 +08:00
parent e9fb7be85f
commit 05514631f2
19 changed files with 1346 additions and 173 deletions

View File

@@ -472,6 +472,65 @@ function handleNotification(data) {
}
break;
case 'CODEXLENS_WATCHER_UPDATE':
// Handle CodexLens watcher real-time updates (file changes detected)
if (typeof handleWatcherStatusUpdate === 'function') {
handleWatcherStatusUpdate(payload);
}
console.log('[CodexLens] Watcher update:', payload.events_processed, 'events');
break;
case 'CODEXLENS_WATCHER_QUEUE_UPDATE':
// Handle pending queue status updates
if (typeof updatePendingQueueUI === 'function') {
updatePendingQueueUI(payload.queue);
}
// Add activity log entries only for NEW files (not already logged)
if (payload.queue && payload.queue.files && payload.queue.files.length > 0) {
if (typeof addWatcherLogEntry === 'function') {
// Track logged files to avoid duplicates
window._watcherLoggedFiles = window._watcherLoggedFiles || new Set();
var newFiles = payload.queue.files.filter(function(f) {
return !window._watcherLoggedFiles.has(f);
});
// Only show first few new files to avoid spam
newFiles.slice(0, 5).forEach(function(fileName) {
window._watcherLoggedFiles.add(fileName);
addWatcherLogEntry('modified', fileName);
});
// Clear tracking when queue is empty (after flush)
if (payload.queue.file_count === 0) {
window._watcherLoggedFiles.clear();
}
}
}
console.log('[CodexLens] Queue update:', payload.queue?.file_count, 'files pending');
break;
case 'CODEXLENS_WATCHER_INDEX_COMPLETE':
// Handle index completion event
if (typeof updateLastIndexResult === 'function') {
updateLastIndexResult(payload.result);
}
// Clear logged files tracking after index completes
if (window._watcherLoggedFiles) {
window._watcherLoggedFiles.clear();
}
// Add activity log entry for index completion
if (typeof addWatcherLogEntry === 'function' && payload.result) {
var summary = 'Indexed ' + (payload.result.files_indexed || 0) + ' files';
addWatcherLogEntry('indexed', summary);
}
// Show toast notification
if (typeof showRefreshToast === 'function' && payload.result) {
var indexMsg = 'Indexed ' + (payload.result.files_indexed || 0) + ' files, ' +
(payload.result.symbols_added || 0) + ' symbols';
var toastType = (payload.result.errors && payload.result.errors.length > 0) ? 'warning' : 'success';
showRefreshToast(indexMsg, toastType);
}
console.log('[CodexLens] Index complete:', payload.result?.files_indexed, 'files indexed');
break;
default:
console.log('[WS] Unknown notification type:', type);
}