From 905007d71845513960d001e7257d8daf67a3c249 Mon Sep 17 00:00:00 2001 From: Levy Tate <78818969+iLevyTate@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:01:59 -0500 Subject: [PATCH 1/5] fix(security): close code-scanning findings in chat search, config override, MCP auth and the preload stripper - Chat search escapes the LIKE escape character, so a query with a backslash (C:\Users) matches the real text. - ConfigurationManager.override refuses __proto__, constructor and prototype path segments. - The MCP bearer regex starts the token at a non-space, so a header of spaces cannot backtrack. - The preload HTML stripper repeats until stable and accepts closing tags with spaces or junk before '>'. - platform.js uses fixed separator regexes; in-memory dedup keys use sha256; the e2e orphan cleanup runs without a shell. --- src/main/analysis/documentAnalysis.js | 2 +- src/main/services/ChatHistoryStore.js | 5 ++-- src/main/transports/mcp/auth.js | 4 ++- src/main/utils/llmOptimization.js | 2 +- src/preload/ipcSanitizer.js | 19 +++++++------ src/renderer/utils/platform.js | 14 +++++----- src/shared/config/ConfigurationManager.js | 8 ++++++ test/ChatHistoryStore.search.test.js | 33 +++++++++++++++++++++++ test/configurationManager.test.js | 15 +++++++++++ test/e2e/helpers/electronApp.js | 32 ++++++++++++++-------- test/ipcSanitizer.test.js | 18 +++++++++++++ test/unit/mcp/auth.test.js | 15 +++++++++++ 12 files changed, 137 insertions(+), 30 deletions(-) diff --git a/src/main/analysis/documentAnalysis.js b/src/main/analysis/documentAnalysis.js index 6ed4d877..62120eb7 100644 --- a/src/main/analysis/documentAnalysis.js +++ b/src/main/analysis/documentAnalysis.js @@ -1016,7 +1016,7 @@ async function analyzeDocumentStages(filePath, smartFolders = [], options = {}, ? extractedText.slice(0, 8192) + '\0' + extractedText.length : extractedText; const contentHash = crypto - .createHash('md5') + .createHash('sha256') .update(hashInput) .update(safeModelName) .digest('hex'); diff --git a/src/main/services/ChatHistoryStore.js b/src/main/services/ChatHistoryStore.js index 7f756104..a27abcce 100644 --- a/src/main/services/ChatHistoryStore.js +++ b/src/main/services/ChatHistoryStore.js @@ -709,8 +709,9 @@ class ChatHistoryStore { return { items: [], capped: false, capLimit: SEARCH_DECRYPT_SCAN_CAP, scannedCount: 0 }; } - // Escape LIKE special characters to prevent unintended wildcard matching - const escapedQuery = query.replace(/[%_]/g, '\\$&'); + // Escape LIKE special characters, and the ESCAPE character itself, so a + // query like "C:\Users" matches the backslash instead of escaping "U". + const escapedQuery = query.replace(/[\\%_]/g, '\\$&'); const pattern = `%${escapedQuery}%`; // Stage 1: fast SQL search on plain columns only. diff --git a/src/main/transports/mcp/auth.js b/src/main/transports/mcp/auth.js index 25dc8734..4c606271 100644 --- a/src/main/transports/mcp/auth.js +++ b/src/main/transports/mcp/auth.js @@ -22,7 +22,9 @@ function createAuthMiddleware(/** @type {any} */ getToken) { ) { const header = req.headers?.authorization || ''; if (Buffer.byteLength(header, 'utf8') > MAX_AUTH_VALUE_BYTES) return _deny(res); - const bearerMatch = /^Bearer\s+(.+)$/.exec(header); + // `\S` starts the token, so the space run and the token never overlap + // and a header of spaces can't make the match backtrack. + const bearerMatch = String(header).match(/^Bearer\s+(\S.*)$/); if (!bearerMatch) return _deny(res); const provided = bearerMatch[1]; const expected = getToken(); diff --git a/src/main/utils/llmOptimization.js b/src/main/utils/llmOptimization.js index a83f3875..b08563f8 100644 --- a/src/main/utils/llmOptimization.js +++ b/src/main/utils/llmOptimization.js @@ -55,7 +55,7 @@ class LLMRequestDeduplicator { * Generate a unique key for a request based on its inputs */ generateKey(/** @type {any} */ inputs) { - const hasher = crypto.createHash('sha1'); + const hasher = crypto.createHash('sha256'); // Handle different input types if (typeof inputs === 'string') { diff --git a/src/preload/ipcSanitizer.js b/src/preload/ipcSanitizer.js index 937dcd8b..a125d7e2 100644 --- a/src/preload/ipcSanitizer.js +++ b/src/preload/ipcSanitizer.js @@ -125,14 +125,17 @@ function createIpcSanitizer({ log }) { let cleaned = str; - // Remove dangerous executable tags (script, style, iframe) - cleaned = cleaned.replace(/)<[^<]*)*<\/script>/gi, ''); - cleaned = cleaned.replace(/]*>[\s\S]*$/gi, ''); - - cleaned = cleaned.replace(/)<[^<]*)*<\/style>/gi, ''); - cleaned = cleaned.replace(/]*>[\s\S]*$/gi, ''); - - cleaned = cleaned.replace(/)<[^<]*)*<\/iframe>/gi, ''); + // Remove dangerous executable tags (script, style, iframe). Closing tags + // may carry spaces or junk before ">" (``), as browsers accept. + // Repeat until nothing changes: removing one element can join the text + // around it into another (`ipt>`). + let previous; + do { + previous = cleaned; + cleaned = cleaned.replace(/<(script|style|iframe)\b[\s\S]*?<\/\1\b[^>]*>/gi, ''); + } while (cleaned !== previous); + // Then an unclosed script or style, to the end of the text. + cleaned = cleaned.replace(/<(script|style)\b[^>]*>[\s\S]*$/gi, ''); // IPC data is rendered through React JSX which auto-escapes, so entity encoding // is unnecessary. The previous code corrupted user text like "size < 10MB", diff --git a/src/renderer/utils/platform.js b/src/renderer/utils/platform.js index 20575591..435d60bb 100644 --- a/src/renderer/utils/platform.js +++ b/src/renderer/utils/platform.js @@ -23,6 +23,10 @@ export function getPathSeparator() { return isWindows ? '\\' : '/'; } +// The separator this platform doesn't use, and runs of the one it does. +const OTHER_SEPARATOR = isWindows ? /\//g : /\\/g; +const SEPARATOR_RUN = isWindows ? /\\+/g : /\/+/g; + /** * Join path segments using the platform-specific separator * Handles both forward and back slashes in input paths @@ -31,18 +35,17 @@ export function getPathSeparator() { */ export function joinPath(...segments) { const sep = getPathSeparator(); - const otherSep = isWindows ? '/' : '\\'; let result = segments .filter((s) => s && typeof s === 'string') - .map((s) => s.replace(new RegExp(`[${otherSep.replace('\\', '\\\\')}]`, 'g'), sep)) + .map((s) => s.replace(OTHER_SEPARATOR, sep)) .join(sep); // Preserve UNC path prefix (\\server\share) on Windows before collapsing duplicates if (isWindows && result.startsWith('\\\\')) { result = '\\\\' + result.slice(2).replace(/\\+/g, '\\'); } else { - result = result.replace(new RegExp(`[${sep.replace('\\', '\\\\')}]+`, 'g'), sep); + result = result.replace(SEPARATOR_RUN, sep); } return result; @@ -57,16 +60,15 @@ export function normalizePath(inputPath) { if (!inputPath || typeof inputPath !== 'string') return inputPath; const sep = getPathSeparator(); - const otherSep = isWindows ? '/' : '\\'; - let normalized = inputPath.replace(new RegExp(`[${otherSep.replace('\\', '\\\\')}]`, 'g'), sep); + let normalized = inputPath.replace(OTHER_SEPARATOR, sep); // Remove duplicate separators (but preserve UNC paths on Windows) if (isWindows && normalized.startsWith('\\\\')) { // UNC path - preserve leading \\, normalize the rest normalized = `\\\\${normalized.slice(2).replace(/\\+/g, '\\')}`; } else { - normalized = normalized.replace(new RegExp(`[${sep.replace('\\', '\\\\')}]+`, 'g'), sep); + normalized = normalized.replace(SEPARATOR_RUN, sep); } return normalized; diff --git a/src/shared/config/ConfigurationManager.js b/src/shared/config/ConfigurationManager.js index ba554249..cc816259 100644 --- a/src/shared/config/ConfigurationManager.js +++ b/src/shared/config/ConfigurationManager.js @@ -18,6 +18,10 @@ const { CONFIG_SCHEMA, SENSITIVE_KEYS, DEPRECATED_MAPPINGS } = require('./configSchema'); const { parseEnvValue, getEnvVar, validateValue } = require('./configValidation'); +// Path segments override() must never walk into or assign: they reach the +// object prototype instead of a config value. +const UNSAFE_PATH_KEYS = new Set(['__proto__', 'constructor', 'prototype']); + /** * Configuration Manager Class * Manages loading, validation, and access to configuration values. @@ -263,6 +267,10 @@ class ConfigurationManager { } const parts = path.split('.'); + if (parts.some((part) => UNSAFE_PATH_KEYS.has(part))) { + this._validationErrors.push({ path, value, reason: 'unsafe_path' }); + return; + } // Validate against schema if definition exists (coerce types but allow unrecognized paths) if (parts.length === 2) { diff --git a/test/ChatHistoryStore.search.test.js b/test/ChatHistoryStore.search.test.js index 46a5be86..1c369c18 100644 --- a/test/ChatHistoryStore.search.test.js +++ b/test/ChatHistoryStore.search.test.js @@ -445,3 +445,36 @@ describe('ChatHistoryStore — searchConversations after encryption rollout', () }); }); }); + +describe('ChatHistoryStore — LIKE pattern escaping', () => { + // The SQL stage runs `LIKE ? ESCAPE '\'`. The escape character itself has + // to be escaped too, or "C:\Users" turns "\U" into a literal "U" and a + // message with the real path no longer matches. + function patternFor(query) { + const fake = makeFakeDb(); + const prepare = fake.prepare.bind(fake); + /** @type {string[]} */ + const seen = []; + fake.prepare = (sql) => { + const statement = prepare(sql); + const all = statement.all; + statement.all = (...args) => { + if (String(sql).includes('LIKE ?')) seen.push(String(args[0])); + return all(...args); + }; + return statement; + }; + const store = buildStore({ conversations: [], messagesByConv: new Map() }); + store._db = fake; + store.searchConversations(query); + return seen[0]; + } + + test.each([ + ['a backslash', 'C:\\Users', '%C:\\\\Users%'], + ['LIKE wildcards', '50%_off', '%50\\%\\_off%'], + ['a trailing backslash', 'folder\\', '%folder\\\\%'] + ])('escapes %s', (_label, query, expected) => { + expect(patternFor(query)).toBe(expected); + }); +}); diff --git a/test/configurationManager.test.js b/test/configurationManager.test.js index 77a82f05..25374518 100644 --- a/test/configurationManager.test.js +++ b/test/configurationManager.test.js @@ -89,6 +89,21 @@ describe('ConfigurationManager', () => { ); }); + test.each(['__proto__.polluted', 'CUSTOM.__proto__.polluted', 'constructor.prototype.polluted'])( + 'override refuses the prototype path %s', + (path) => { + const mgr = new ConfigurationManager(); + mgr.load(); + + mgr.override(path, true); + + expect(/** @type {any} */ ({}).polluted).toBeUndefined(); + expect(mgr._validationErrors).toContainEqual( + expect.objectContaining({ path, reason: 'unsafe_path' }) + ); + } + ); + test('override writes unknown nested paths and reset restores defaults', () => { const mgr = new ConfigurationManager(); mgr.load(); diff --git a/test/e2e/helpers/electronApp.js b/test/e2e/helpers/electronApp.js index a39712df..817231ba 100644 --- a/test/e2e/helpers/electronApp.js +++ b/test/e2e/helpers/electronApp.js @@ -18,7 +18,7 @@ const { _electron: electron } = require('@playwright/test'); const path = require('path'); const fs = require('fs'); const os = require('os'); -const { execSync } = require('child_process'); +const { execFileSync } = require('child_process'); // Configuration const APP_ROOT = path.resolve(__dirname, '../../..'); @@ -206,20 +206,30 @@ function killOrphanStratoSortElectronProcesses() { // Match both the bundled (dist\main.js) and legacy (simple-main) entry // args, scoped to electron.exe spawned from THIS repo's node_modules so // unrelated Electron apps are never touched. + // Arguments go straight to the program, with no shell in between; the + // script uses single quotes only, so Node's argument quoting can't + // split it. const repoMarker = APP_ROOT.replace(/'/g, "''"); - execSync( - 'powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter \\"Name = \'electron.exe\'\\" | ' + - `Where-Object { $_.CommandLine -like '*${repoMarker}*' -and ($_.CommandLine -like '*dist*main.js*' -or $_.CommandLine -like '*simple-main*') } | ` + - 'ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"', + execFileSync( + 'powershell', + [ + '-NoProfile', + '-Command', + "Get-CimInstance Win32_Process -Filter 'Name = ''electron.exe''' | " + + `Where-Object { $_.CommandLine -like '*${repoMarker}*' -and ($_.CommandLine -like '*dist*main.js*' -or $_.CommandLine -like '*simple-main*') } | ` + + 'ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }' + ], { stdio: 'ignore', timeout: 8000 } ); } else { - execSync( - `pkill -f "electron.*(simple-main|${APP_ROOT.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*dist/main\\.js)" || true`, - { - stdio: 'ignore', - timeout: 5000 - } + // pkill exits 1 when nothing matched, which lands in the catch below. + execFileSync( + 'pkill', + [ + '-f', + `electron.*(simple-main|${APP_ROOT.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*dist/main\\.js)` + ], + { stdio: 'ignore', timeout: 5000 } ); } } catch { diff --git a/test/ipcSanitizer.test.js b/test/ipcSanitizer.test.js index 6c550848..236282cf 100644 --- a/test/ipcSanitizer.test.js +++ b/test/ipcSanitizer.test.js @@ -104,6 +104,24 @@ describe('ipcSanitizer', () => { expect(sanitized.query).toBe('What is in D:\\Docs?'); }); + test.each([ + ['a closing tag with a space', 'Hi there', 'Hi there'], + ['a closing tag with junk', 'Hi there', 'Hi there'], + [ + 'a tag rebuilt by stripping another', + 'Hi ipt>alert(1)!', + 'Hi !' + ], + ['an iframe with a spaced closing tag', 'ab', 'ab'], + ['an unclosed style', 'a

After

'; + const out = runTextExtraction({ type: 'html', payload: { text: html } }); + expect(out).toBe('Before After'); + }); + + test('a script end tag needs a word boundary, so does not end it', () => { + const html = '

A

B

'; + const out = runTextExtraction({ type: 'html', payload: { text: html } }); + expect(out).toBe('A B'); + }); + test('returns input verbatim on catastrophic HTML (falls through try/catch)', () => { // The worker's try/catch guarantees we always return a string even if // the input would otherwise blow up downstream regex engines. From 2d6bfda907275ba819b1b18af72b38cafe67208c Mon Sep 17 00:00:00 2001 From: Levy Tate <78818969+iLevyTate@users.noreply.github.com> Date: Sun, 15 Nov 2026 13:15:30 -0500 Subject: [PATCH 4/5] copy: plain wording across the app and Settings paths that exist - Remove em and en dashes from user-visible text in the renderer and in main-process messages that reach the UI. Number and date ranges read "X to Y". Lone placeholders for empty values stay. - Drop "Please" from error and toast messages, and cut filler ("Ask me anything", "streamlined", "with confidence"). Meaning, numbers and feature names are unchanged. - Point messages at Settings sections that exist: Model management for downloads, Default AI models for picking a model, Local AI engine when the engine is down, AI Provider for cloud providers. "Settings > Models", "Settings > AI" and "Settings > Advanced" did not exist. - Semantic IPC errors name the feature ("The search index isn't ready yet") instead of internal service names. - Text that code matches on ("Vector DB", "invalid characters", "Another batch operation is already in progress") keeps those phrases. - Log lines, prompts sent to the model, entity tables and code comments are unchanged. --- src/main/errors/AnalysisError.js | 21 +++---- src/main/errors/ErrorHandler.js | 16 ++--- src/main/errors/FileSystemError.js | 10 ++-- src/main/ipc/aiProvider.js | 4 +- src/main/ipc/analysisHistory.js | 2 +- src/main/ipc/files/batchOrganizeHandler.js | 2 +- src/main/ipc/ipcWrappers.js | 4 +- src/main/ipc/semantic.js | 25 +++++--- src/main/ipc/settings.js | 2 +- src/main/ipc/smartFolders.js | 4 +- src/main/ipc/undoRedo.js | 2 +- src/main/ipc/validationSchemas.js | 4 +- src/main/llamaUtils.js | 14 ++--- src/main/services/ChatService.js | 6 +- src/main/services/DegradationManager.js | 6 +- src/main/services/FolderMatchingService.js | 2 +- src/main/services/LlamaService.js | 6 +- src/main/services/ModelDownloadManager.js | 4 +- src/main/services/SearchService.js | 6 +- src/main/services/SmartFolderWatcher.js | 5 +- src/main/services/WhisperService.js | 2 +- src/main/services/ai/AIRouter.js | 6 +- .../services/triage/DownloadsTriageService.js | 6 +- .../services/triage/FastTriageClassifier.js | 6 +- src/main/simple-main.js | 4 +- src/renderer/components/AnalysisDetails.jsx | 2 +- src/renderer/components/ErrorBoundary.jsx | 8 +-- src/renderer/components/ModelSetupWizard.jsx | 8 +-- src/renderer/components/NavigationBar.jsx | 2 +- src/renderer/components/SettingsPanel.jsx | 10 ++-- src/renderer/components/UndoRedoSystem.jsx | 10 ++-- .../components/common/AIProviderBadge.jsx | 2 +- .../components/common/AIProviderIcon.jsx | 2 +- .../components/common/CloudAIConsentModal.jsx | 2 +- .../components/dashboard/DashboardView.jsx | 4 +- .../dashboard/KnowledgeStatsCard.jsx | 2 +- .../components/layout/DegradedStateBanner.jsx | 6 +- .../organize/DuplicateResolutionModal.jsx | 4 +- .../organize/OrganizePreviewModal.jsx | 4 +- .../components/organize/ReadyFileItem.jsx | 4 +- .../components/organize/TagClusterModal.jsx | 2 +- .../components/organize/TriageModal.jsx | 2 +- .../organize/UncategorizedActionsBar.jsx | 4 +- .../components/search/AtlasTabContent.jsx | 6 +- .../components/search/BridgeAnalysisModal.jsx | 2 +- src/renderer/components/search/ChatPanel.jsx | 3 +- .../components/search/ClusterNode.jsx | 6 +- .../components/search/ComparisonTable.jsx | 4 +- .../search/EmptyEmbeddingsBanner.jsx | 2 +- .../components/search/EmptySearchState.jsx | 2 +- .../components/search/GapAnalysisCard.jsx | 4 +- .../components/search/GraphTabContent.jsx | 13 +++-- src/renderer/components/search/GraphTour.jsx | 4 +- .../components/search/SimilarityEdge.jsx | 2 +- .../components/search/TimelineTabContent.jsx | 2 +- .../components/search/UnifiedSearchModal.jsx | 2 +- .../components/search/hooks/useChatTab.js | 10 ++-- .../components/search/hooks/useGraphTab.js | 5 +- .../components/search/hooks/useSearchTab.js | 4 +- .../search/utils/searchResultUtils.js | 4 +- .../settings/AIProviderConfigModal.jsx | 12 ++-- .../components/settings/AIProviderSection.jsx | 2 +- .../settings/AutoOrganizeSection.jsx | 14 ++--- .../settings/ChatPersonaSection.jsx | 12 ++-- .../settings/DefaultLocationsSection.jsx | 2 +- .../settings/DiagnosticsLogsSection.jsx | 2 +- .../settings/EmbeddingRebuildSection.jsx | 22 +++---- .../settings/LegalNoticesSection.jsx | 2 +- .../settings/LlamaConfigSection.jsx | 6 +- .../components/settings/McpServerSection.jsx | 2 +- .../settings/ModelManagementSection.jsx | 2 +- .../components/setup/AddSmartFolderModal.jsx | 16 ++--- .../setup/SmartFolderAIOverrideField.jsx | 2 +- .../components/setup/WatcherStatusLine.jsx | 2 +- .../components/triage/DownloadsTriageView.jsx | 20 +++---- src/renderer/components/ui/Modal.jsx | 2 +- src/renderer/index.js | 3 +- src/renderer/phases/CompletePhase.jsx | 4 +- src/renderer/phases/DiscoverPhase.jsx | 14 ++--- src/renderer/phases/OrganizePhase.jsx | 13 ++--- src/renderer/phases/SetupPhase.jsx | 10 ++-- src/renderer/phases/WelcomePhase.jsx | 7 +-- .../phases/discover/useFileHandlers.js | 8 +-- .../phases/organize/useOrganization.js | 6 +- src/renderer/services/ipc/electronApi.js | 2 +- src/renderer/services/ipc/smartFoldersIpc.js | 2 +- .../store/middleware/ipcMiddleware.js | 2 +- .../store/middleware/persistenceMiddleware.js | 8 +-- src/renderer/utils/errorMapping.js | 58 +++++++++---------- src/shared/smartFolderNameValidation.js | 2 +- src/shared/supportInfo.js | 2 +- test/AnalysisError.test.js | 2 +- test/ErrorHandler.extended.test.js | 8 +-- test/SearchService.dimensionMismatch.test.js | 6 +- test/components/AIProviderBadge.test.js | 4 +- ...artFolderModal.generateDescription.test.js | 2 +- .../LlamaConfigSection.healthBadge.test.js | 2 +- test/components/ModelSetupWizard.test.js | 2 +- test/components/OrganizePhase.test.js | 4 +- test/components/OrganizePreviewModal.test.js | 2 +- .../ReadyFileItem.suggestedNewFolder.test.js | 2 +- test/components/StatusBadge.test.js | 2 +- test/components/WelcomePhase.test.js | 6 +- .../dashboard/DashboardView.test.js | 4 +- .../dashboard/KnowledgeStatsCard.test.js | 4 +- test/e2e/settings/ai-provider.spec.js | 2 +- test/errorMapping.circuitOpen.test.js | 2 +- test/ipcServices.test.js | 2 +- test/llamaUtils.test.js | 2 +- .../search/useChatTab.scope.test.js | 2 +- test/searchUtils.test.js | 2 +- test/useOrganization.runOutcome.test.js | 4 +- 112 files changed, 321 insertions(+), 328 deletions(-) diff --git a/src/main/errors/AnalysisError.js b/src/main/errors/AnalysisError.js index aebe5649..1e009c5b 100644 --- a/src/main/errors/AnalysisError.js +++ b/src/main/errors/AnalysisError.js @@ -65,15 +65,16 @@ class AnalysisError extends Error { PDF_PROCESSING_FAILURE: "This PDF file couldn't be processed. It may be corrupted or password-protected.", IMAGE_ANALYSIS_FAILURE: - "This image couldn't be analyzed. Please check the file format and try again.", - MODEL_NOT_INSTALLED: `Missing AI model: ${this.metadata.requiredModel}. Please install it to continue.`, - AI_ENGINE_CONNECTION_FAILURE: 'AI engine unavailable. Check Settings > Models and try again.', - DOCUMENT_ANALYSIS_FAILURE: 'Failed to analyze this document. Please check the file format.', + "This image couldn't be analyzed. Check the file format and try again.", + MODEL_NOT_INSTALLED: `Missing AI model: ${this.metadata.requiredModel}. Install it to continue.`, + AI_ENGINE_CONNECTION_FAILURE: + 'AI engine unavailable. Check Settings → Local AI engine and try again.', + DOCUMENT_ANALYSIS_FAILURE: 'Failed to analyze this document. Check the file format.', PDF_NO_TEXT_CONTENT: 'This PDF appears to be image-based. Try using image analysis instead.', - MODEL_VERIFICATION_FAILED: 'AI model verification failed. Please check your model downloads.', - DEPENDENCY_MISSING: `System component missing: ${this.metadata.dependency}. Please reinstall the application.`, + MODEL_VERIFICATION_FAILED: 'AI model verification failed. Check your model downloads.', + DEPENDENCY_MISSING: `System component missing: ${this.metadata.dependency}. Reinstall the application.`, FILE_TYPE_UNSUPPORTED: `File type "${this.metadata.fileType}" is not supported for AI analysis.`, - FILE_TOO_LARGE: 'File is too large for processing. Please use a smaller file.', + FILE_TOO_LARGE: 'File is too large to process. Use a smaller file.', FILE_EMPTY: 'This file is empty, so there was nothing to analyze.', FILE_READ_ERROR: "This file couldn't be read. It may be locked, moved, or you may not have permission to access it.", @@ -97,8 +98,8 @@ class AnalysisError extends Error { getActionableSteps() { /** @type {Record} */ const actions = { - MODEL_NOT_INSTALLED: ['Open Settings > Models and download the missing model'], - AI_ENGINE_CONNECTION_FAILURE: ['Check Settings > Models', 'Restart the app'], + MODEL_NOT_INSTALLED: ['Open Settings → Model management and download the missing model'], + AI_ENGINE_CONNECTION_FAILURE: ['Check Settings → Local AI engine', 'Restart the app'], DEPENDENCY_MISSING: [ `Check that ${this.metadata.dependency} is installed correctly`, 'Restart the application', @@ -133,7 +134,7 @@ class ModelMissingError extends AnalysisError { constructor(modelName) { super('MODEL_NOT_INSTALLED', { requiredModel: modelName, - installCommand: `Download model in Settings > Models: ${modelName}`, + installCommand: `Download the model in Settings → Model management: ${modelName}`, category: 'model' }); } diff --git a/src/main/errors/ErrorHandler.js b/src/main/errors/ErrorHandler.js index 0fc67447..819e1134 100644 --- a/src/main/errors/ErrorHandler.js +++ b/src/main/errors/ErrorHandler.js @@ -225,7 +225,7 @@ class ErrorHandler { parseError(error) { const errorInfo = { type: ERROR_TYPES.UNKNOWN, - message: 'Something went wrong. Please try again.', + message: 'Something went wrong. Try again.', details: {}, stack: error?.stack }; @@ -286,11 +286,12 @@ class ErrorHandler { switch (resolvedCode) { case ERROR_CODES.LLAMA_MODEL_INCOMPATIBLE_CPU: errorInfo.message = - 'This build of the AI engine is not compatible with your CPU. Switch to the small Qwen 0.5B profile in Settings > Models.'; + 'This build of the AI engine is not compatible with your CPU. Switch to the small Qwen 0.5B profile in Settings → Default AI models.'; break; case ERROR_CODES.LLAMA_MODEL_NOT_FOUND: case ERROR_CODES.LLAMA_MODEL_PATH_MISMATCH: - errorInfo.message = 'AI model file is missing. Open Settings > Models to install it.'; + errorInfo.message = + 'AI model file is missing. Open Settings → Model management to install it.'; break; case ERROR_CODES.LLAMA_OOM: errorInfo.message = 'Out of memory. Try a smaller model or close other applications.'; @@ -301,14 +302,15 @@ class ErrorHandler { break; case ERROR_CODES.LLAMA_MODEL_LOAD_FAILED: errorInfo.message = - 'Could not load the AI model. Re-download it from Settings > Models.'; + 'Could not load the AI model. Re-download it from Settings → Model management.'; break; case ERROR_CODES.LLAMA_INFERENCE_FAILED: errorInfo.message = - 'AI inference failed. The prompt may be too long for this model — shorten the input or switch to a larger model.'; + 'AI inference failed. The prompt may be too long for this model. Shorten the input or switch to a larger model.'; break; default: - errorInfo.message = 'AI engine unavailable. Check Settings > Models and try again.'; + errorInfo.message = + 'AI engine unavailable. Check Settings → Local AI engine and try again.'; } } else if (isNetworkError(error)) { errorInfo.type = ERROR_TYPES.NETWORK_ERROR; @@ -316,7 +318,7 @@ class ErrorHandler { errorInfo.message = 'Request timed out. The AI model may be loading or your system is busy.'; } else { - errorInfo.message = 'A network-related error occurred. Please try again.'; + errorInfo.message = 'A network error occurred. Try again.'; } } else { // Keep original message if it's user-friendly, otherwise provide generic diff --git a/src/main/errors/FileSystemError.js b/src/main/errors/FileSystemError.js index 873c020d..fa26987a 100644 --- a/src/main/errors/FileSystemError.js +++ b/src/main/errors/FileSystemError.js @@ -213,7 +213,7 @@ class FileSystemError extends Error { [FILE_SYSTEM_ERROR_CODES.PERMISSION_DENIED]: 'You do not have permission to perform this action. Try running as administrator.', [FILE_SYSTEM_ERROR_CODES.WRITE_FAILED]: - 'Failed to save the file. Please check that the location is writable.', + 'Failed to save the file. Check that the location is writable.', [FILE_SYSTEM_ERROR_CODES.READ_FAILED]: 'Failed to read the file. It may be corrupted or inaccessible.', [FILE_SYSTEM_ERROR_CODES.DELETE_FAILED]: @@ -232,8 +232,7 @@ class FileSystemError extends Error { 'The folder is not empty. Remove its contents first.', [FILE_SYSTEM_ERROR_CODES.NOT_A_DIRECTORY]: 'Expected a folder but found a file.', [FILE_SYSTEM_ERROR_CODES.NOT_A_FILE]: 'Expected a file but found a folder.', - [FILE_SYSTEM_ERROR_CODES.DISK_FULL]: - 'Your disk is full. Please free up some space and try again.', + [FILE_SYSTEM_ERROR_CODES.DISK_FULL]: 'Your disk is full. Free up some space and try again.', [FILE_SYSTEM_ERROR_CODES.QUOTA_EXCEEDED]: 'Your storage quota has been exceeded.', [FILE_SYSTEM_ERROR_CODES.TOO_MANY_OPEN_FILES]: 'Too many files are open. Close some applications and try again.', @@ -252,8 +251,7 @@ class FileSystemError extends Error { 'File verification failed. The file may be corrupted.', [FILE_SYSTEM_ERROR_CODES.SIZE_MISMATCH]: 'File size verification failed. The copy may be incomplete.', - [FILE_SYSTEM_ERROR_CODES.PARTIAL_WRITE]: - 'Only part of the file was written. Please try again.', + [FILE_SYSTEM_ERROR_CODES.PARTIAL_WRITE]: 'Only part of the file was written. Try again.', [FILE_SYSTEM_ERROR_CODES.CORRUPTED_FILE]: 'The file appears to be corrupted and cannot be processed.', [FILE_SYSTEM_ERROR_CODES.WATCHER_FAILED]: 'Failed to monitor the folder for changes.', @@ -273,7 +271,7 @@ class FileSystemError extends Error { [FILE_SYSTEM_ERROR_CODES.UNKNOWN_ERROR]: 'An unexpected file system error occurred.' }; - return userMessages[this.code] || 'A file system error occurred. Please try again.'; + return userMessages[this.code] || 'A file system error occurred. Try again.'; } /** diff --git a/src/main/ipc/aiProvider.js b/src/main/ipc/aiProvider.js index 3915507f..905f39c5 100644 --- a/src/main/ipc/aiProvider.js +++ b/src/main/ipc/aiProvider.js @@ -66,7 +66,7 @@ const _SAFE_ERROR_MESSAGES = Object.freeze({ CONTENT_TOO_LONG: 'Request too large for the provider.', BUDGET_EXCEEDED: 'Monthly spend cap reached. Adjust the cap or wait until next month.', PROVIDER_DISABLED: 'This provider is not enabled.', - NO_PROVIDER_READY: 'No AI provider is ready. Configure one in Settings → AI.', + NO_PROVIDER_READY: 'No AI provider is ready. Configure one in Settings → AI Provider.', PROVIDER_FAILED: 'The provider returned an error. Try again or switch providers.', INVALID_RESPONSE: 'The provider returned an unexpected response.' }); @@ -368,7 +368,7 @@ function registerAiProviderIpc(servicesOrParams) { _router.on('folder-override-unavailable', (payload) => { const providerLabel = payload?.configuredProvider || 'cloud'; safeSendToMain(getMainWindow, IPC_EVENTS.NOTIFICATION, { - message: `Smart folder AI override (${providerLabel}) is unavailable — using local model.`, + message: `Smart folder AI override (${providerLabel}) is unavailable. Using the local model.`, severity: 'warning', duration: 8000, source: 'ai-provider', diff --git a/src/main/ipc/analysisHistory.js b/src/main/ipc/analysisHistory.js index 7912da92..bcb2478a 100644 --- a/src/main/ipc/analysisHistory.js +++ b/src/main/ipc/analysisHistory.js @@ -38,7 +38,7 @@ function _raiseAnalysisHistoryDegraded(detailContext) { severity: 'error', message: 'Analysis history is temporarily unavailable. Past results may not appear; ' + - 're-analyzing files will not help. Try restarting the app — if this persists, ' + + 're-analyzing files will not help. Try restarting the app. If this persists, ' + 'check the app log.', detail: detailContext }); diff --git a/src/main/ipc/files/batchOrganizeHandler.js b/src/main/ipc/files/batchOrganizeHandler.js index c4d44282..d5da7e33 100644 --- a/src/main/ipc/files/batchOrganizeHandler.js +++ b/src/main/ipc/files/batchOrganizeHandler.js @@ -572,7 +572,7 @@ async function handleBatchOrganize(params) { log.warn('[FILE-OPS] Could not acquire batch lock - another batch operation is in progress'); return { success: false, - error: 'Another batch operation is already in progress. Please wait for it to complete.', + error: 'Another batch operation is already in progress. Wait for it to finish.', errorCode: ERROR_CODES.BATCH_LOCK_TIMEOUT }; } diff --git a/src/main/ipc/ipcWrappers.js b/src/main/ipc/ipcWrappers.js index 305ca334..0d9d715e 100644 --- a/src/main/ipc/ipcWrappers.js +++ b/src/main/ipc/ipcWrappers.js @@ -182,7 +182,7 @@ function withVectorDbInit({ ensureInit, isInitRef, handler }) { } catch (e) { return { success: false, - error: 'Vector DB is not available yet. Please try again in a moment.', + error: 'Vector DB is not available yet. Try again in a moment.', code: e?.code || 'VECTOR_DB_UNAVAILABLE', unavailable: true }; @@ -191,7 +191,7 @@ function withVectorDbInit({ ensureInit, isInitRef, handler }) { if (!isInitRef()) { return { success: false, - error: 'Vector DB initialization pending. Please try again in a few seconds.', + error: 'Vector DB is still starting. Try again in a few seconds.', code: 'VECTOR_DB_PENDING', pending: true }; diff --git a/src/main/ipc/semantic.js b/src/main/ipc/semantic.js index e6b170b7..eb4f6b49 100644 --- a/src/main/ipc/semantic.js +++ b/src/main/ipc/semantic.js @@ -15,10 +15,17 @@ const getLlamaService = () => container.tryResolve(ServiceIds.LLAMA_SERVICE); const getUndoRedoService = () => container.tryResolve(ServiceIds.UNDO_REDO); const { getInstance: getAtlasService } = require('../services/AtlasProjectionService'); +/** @type {Record} */ +const SERVICE_LABELS = { + OramaVectorService: 'The search index', + ClusteringService: 'Clustering', + AtlasProjectionService: 'The Atlas view' +}; + /** @param {string} name */ const SERVICE_UNAVAILABLE = (name) => ({ success: false, - error: `${name} not available — service may still be initializing`, + error: `${SERVICE_LABELS[name] || 'This feature'} isn't ready yet. It may still be starting.`, errorCode: 'SERVICE_UNAVAILABLE' }); @@ -185,7 +192,7 @@ async function verifyEmbeddingModelAvailable(logger, preferredModel = null) { return { available: false, model: preferredModel || AI_DEFAULTS.EMBEDDING.MODEL, - error: 'LlamaService not available — AI engine may still be initializing' + error: "The AI engine isn't ready yet. It may still be starting." }; } const cfg = await llama.getConfig(); @@ -259,7 +266,7 @@ async function verifyEmbeddingModelAvailable(logger, preferredModel = null) { return { available: false, model, - error: `Embedding model "${model}" not downloaded. Download it in Settings > Models.`, + error: `Embedding model "${model}" not downloaded. Download it in Settings → Model management.`, availableModels: modelNames.slice(0, 10) }; } @@ -293,7 +300,7 @@ async function verifyReanalyzeModelsAvailable(logger) { textModel: AI_DEFAULTS.TEXT.MODEL, visionModel: AI_DEFAULTS.IMAGE.MODEL, embeddingModel: AI_DEFAULTS.EMBEDDING.MODEL, - error: 'LlamaService not available — AI engine may still be initializing' + error: "The AI engine isn't ready yet. It may still be starting." }; } const cfg = await llama.getConfig(); @@ -363,7 +370,7 @@ async function verifyReanalyzeModelsAvailable(logger) { available: false, model: textModel, modelType: 'text', - error: `Text model "${textModel}" not downloaded. Download it in Settings > Models.` + error: `Text model "${textModel}" not downloaded. Download it in Settings → Model management.` }; } } @@ -395,7 +402,7 @@ async function verifyReanalyzeModelsAvailable(logger) { available: false, model: visionModel, modelType: 'vision', - error: `Vision model "${visionModel}" not downloaded. Download it in Settings > Models.` + error: `Vision model "${visionModel}" not downloaded. Download it in Settings → Model management.` }; } } @@ -429,7 +436,7 @@ async function verifyReanalyzeModelsAvailable(logger) { available: false, model: embeddingModel, modelType: 'embedding', - error: `Embedding model "${embeddingModel}" not downloaded. Download it in Settings > Models.` + error: `Embedding model "${embeddingModel}" not downloaded. Download it in Settings → Model management.` }; } } @@ -2561,7 +2568,7 @@ async function handleFullRebuild( if (!llamaSvc) { return { success: false, - error: 'AI engine is not available. Please wait for startup to complete and try again.', + error: 'AI engine is not available yet. Wait for startup to finish and try again.', errorCode: 'SERVICE_NOT_READY' }; } @@ -4236,7 +4243,7 @@ function registerEmbeddingsIpc(servicesOrParams) { } catch (e) { return { success: false, - error: 'Vector DB is not available yet. Please try again in a moment.', + error: 'Vector DB is not available yet. Try again in a moment.', code: e?.code || 'VECTOR_DB_UNAVAILABLE', unavailable: true }; diff --git a/src/main/ipc/settings.js b/src/main/ipc/settings.js index 2cbfc8b1..7571b0bd 100644 --- a/src/main/ipc/settings.js +++ b/src/main/ipc/settings.js @@ -887,7 +887,7 @@ function registerSettingsIpc(servicesOrParams) { const { bytesRead } = await fileHandle.read(buffer, 0, stats.size, 0); const statsAfter = await fileHandle.stat(); if (statsAfter.size > MAX_IMPORT_SIZE || bytesRead > MAX_IMPORT_SIZE) { - throw new Error('Import file size changed during read. Please try again.'); + throw new Error('Import file size changed during read. Try again.'); } // Read and parse import file diff --git a/src/main/ipc/smartFolders.js b/src/main/ipc/smartFolders.js index bf3ce68f..c2f13e31 100644 --- a/src/main/ipc/smartFolders.js +++ b/src/main/ipc/smartFolders.js @@ -1585,7 +1585,7 @@ async function handleSmartFoldersEdit( if (illegalChars.test(updatedFolder.name)) { return { success: false, - error: 'Folder name contains invalid characters. Please avoid: < > : " | ? *', + error: 'Folder name contains invalid characters: < > : " | ? *', errorCode: ERROR_CODES.INVALID_FOLDER_NAME_CHARS }; } @@ -1727,7 +1727,7 @@ async function handleSmartFoldersEdit( if (renameFailure?.code === 'EEXIST') { return { success: false, - error: 'Destination directory now occupied — refusing overwrite', + error: 'Destination already exists. Nothing was overwritten.', errorCode: ERROR_CODES.RENAME_FAILED, details: renameFailure.message }; diff --git a/src/main/ipc/undoRedo.js b/src/main/ipc/undoRedo.js index 76b2fc4e..3a06f38f 100644 --- a/src/main/ipc/undoRedo.js +++ b/src/main/ipc/undoRedo.js @@ -53,7 +53,7 @@ function _raiseUndoRedoDegraded(detail) { subsystem: 'undo-redo', severity: 'error', message: - "Undo/redo isn't working — recent file moves can't be reversed from the toolbar. " + + "Undo/redo isn't working. Recent file moves can't be reversed from the toolbar. " + 'Avoid further destructive actions and restart the app to recover history.', detail }); diff --git a/src/main/ipc/validationSchemas.js b/src/main/ipc/validationSchemas.js index 5205492f..de2af5bc 100644 --- a/src/main/ipc/validationSchemas.js +++ b/src/main/ipc/validationSchemas.js @@ -306,7 +306,7 @@ if (!z) { if (data === undefined || data === null) return { data }; const n = typeof data === 'number' ? data : Number(data); if (!Number.isFinite(n) || n < 1 || n > 500) { - return { error: 'history limit must be a number 1–500' }; + return { error: 'History limit must be a number from 1 to 500' }; } return { data: n }; }), @@ -314,7 +314,7 @@ if (!z) { if (data === undefined || data === null) return { data: 50 }; const n = typeof data === 'number' ? data : Number(data); if (!Number.isFinite(n) || n < 1 || n > 200) { - return { error: 'undo history limit must be a number 1–200' }; + return { error: 'Undo history limit must be a number from 1 to 200' }; } return { data: Math.floor(n) }; }), diff --git a/src/main/llamaUtils.js b/src/main/llamaUtils.js index fc3635a2..2687ac0b 100644 --- a/src/main/llamaUtils.js +++ b/src/main/llamaUtils.js @@ -31,8 +31,8 @@ function _raiseLlamaConfigStale(/** @type {any} */ detail) { subsystem: 'ai-engine', severity: 'warning', message: - "Couldn't read AI model settings; using last known values. Open Settings → AI to verify " + - 'the active models — changes you made may not be applied until the settings file is readable.', + "Couldn't read AI model settings; using last known values. Open Settings → Default AI models to verify " + + 'the active models. Changes you made may not apply until the settings file can be read.', detail }); } catch { @@ -285,7 +285,7 @@ function raiseTextModelSubstitutedFlag(configuredModel, fallbackModel) { code: TEXT_MODEL_SUBSTITUTED_FLAG, subsystem: 'llama', severity: 'warning', - message: `Configured text model "${configuredModel}" is not installed. Analysis is using "${fallbackModel}" instead; pick a model in Settings → Models to clear this notice.`, + message: `Configured text model "${configuredModel}" is not installed. Analysis is using "${fallbackModel}" instead; pick a model in Settings → Default AI models to clear this notice.`, detail: { errorCode: ERROR_CODES.LLAMA_MODEL_AUTO_FALLBACK, type: 'text', @@ -317,7 +317,7 @@ async function ensureTextModelReadyForAnalysis() { if (!service) { return { ok: false, - error: 'AI engine unavailable. Check Settings > Models and try again.' + error: 'AI engine unavailable. Check Settings → Local AI engine and try again.' }; } @@ -327,7 +327,7 @@ async function ensureTextModelReadyForAnalysis() { } catch (err) { return { ok: false, - error: `AI engine failed to initialize: ${err?.message || String(err)}. Check Settings > Models.` + error: `AI engine failed to initialize: ${err?.message || String(err)}. Check Settings → Local AI engine.` }; } } @@ -352,7 +352,7 @@ async function ensureTextModelReadyForAnalysis() { } catch (err) { return { ok: false, - error: `Could not verify AI models: ${err?.message || String(err)}. Check Settings > Models.` + error: `Could not verify AI models: ${err?.message || String(err)}. Check Settings → Model management.` }; } @@ -407,7 +407,7 @@ async function ensureTextModelReadyForAnalysis() { } else { return { ok: false, - error: `Text model "${textModel}" not downloaded. Download it in Settings > Models.` + error: `Text model "${textModel}" not downloaded. Download it in Settings → Model management.` }; } } diff --git a/src/main/services/ChatService.js b/src/main/services/ChatService.js index 3a79dee5..7f0bc580 100644 --- a/src/main/services/ChatService.js +++ b/src/main/services/ChatService.js @@ -919,9 +919,7 @@ Now respond as JSON:`; this.chatHistoryStore.addMessage(memory.sessionId, { role: 'assistant', text: '', - modelAnswer: [ - { text: `Error: ${error.message || 'Response failed'}. Please try again.` } - ] + modelAnswer: [{ text: `Error: ${error.message || 'Response failed'}. Try again.` }] }); } } catch (saveErr) { @@ -971,7 +969,7 @@ Now respond as JSON:`; }) { if (!this.llamaService) { const err = new Error( - 'LLM model not loaded — open StratoSort and wait for the model to finish loading.' + "The AI model isn't loaded. Open StratoSort and wait for the model to finish loading." ); /** @type {any} */ (err).code = 'NO_MODEL'; throw err; diff --git a/src/main/services/DegradationManager.js b/src/main/services/DegradationManager.js index 108f46ad..21cd5356 100644 --- a/src/main/services/DegradationManager.js +++ b/src/main/services/DegradationManager.js @@ -212,7 +212,7 @@ class DegradationManager { return { action: 'redownload_model', - message: 'Model file may be corrupted. Please re-download.', + message: 'Model file may be corrupted. Download it again.', shouldNotifyUser: true, modelType: context.modelType }; @@ -245,7 +245,7 @@ class DegradationManager { if (message.includes('enospc') || message.includes('no space left')) { return { action: 'cleanup_disk', - message: 'Disk full. Please free up space.', + message: 'Disk full. Free up some space.', shouldNotifyUser: true }; } @@ -281,7 +281,7 @@ class DegradationManager { return { canRecover: false, action: 'download_models', - message: 'Please download required models to continue.' + message: 'Download the required models to continue.' }; } diff --git a/src/main/services/FolderMatchingService.js b/src/main/services/FolderMatchingService.js index b6ef7079..6a3a45c7 100644 --- a/src/main/services/FolderMatchingService.js +++ b/src/main/services/FolderMatchingService.js @@ -1120,7 +1120,7 @@ class FolderMatchingService { }); throw new Error( `Embedding dimension mismatch: expected ${expectedDim}, got ${vector?.length}. ` + - `Model "${model}" may have changed. Please rebuild your embedding index.` + `Model "${model}" may have changed. Rebuild your embedding index.` ); } diff --git a/src/main/services/LlamaService.js b/src/main/services/LlamaService.js index 573781c3..aa407ecc 100644 --- a/src/main/services/LlamaService.js +++ b/src/main/services/LlamaService.js @@ -1448,7 +1448,7 @@ class LlamaService extends EventEmitter { if (settings.llamaGpuLayers === 0) { logger.warn( '[LlamaService] GPU layers set to 0 in settings — AI inference will use CPU only. ' + - 'Set to -1 (auto) in Settings > AI Models for GPU acceleration.' + 'Set to -1 (auto) in Settings → Default AI models for GPU acceleration.' ); } } @@ -1818,7 +1818,7 @@ class LlamaService extends EventEmitter { } if (resolution.action === 'cleanup_disk') { const diskError = /** @type {Error & { code?: string }} */ ( - new Error(`Disk full, cannot load ${modelType} model. Please free up space.`) + new Error(`Disk full, cannot load ${modelType} model. Free up some space.`) ); diskError.code = ERROR_CODES.LLAMA_MODEL_LOAD_FAILED; throw diskError; @@ -2724,7 +2724,7 @@ class LlamaService extends EventEmitter { code: `llama.auto-fallback.${type}`, subsystem: 'llama', severity: 'warning', - message: `Configured ${type} model is missing; using default "${defaultModel}" instead. Reinstall the preferred model from Settings → Models.`, + message: `Configured ${type} model is missing; using default "${defaultModel}" instead. Reinstall the preferred model from Settings → Model management.`, detail: { errorCode: ERROR_CODES.LLAMA_MODEL_AUTO_FALLBACK, type, diff --git a/src/main/services/ModelDownloadManager.js b/src/main/services/ModelDownloadManager.js index bac3c66a..21c08979 100644 --- a/src/main/services/ModelDownloadManager.js +++ b/src/main/services/ModelDownloadManager.js @@ -928,7 +928,7 @@ class ModelDownloadManager { return { success: false, error: inUse - ? 'Model file is in use — it may be loaded by the AI engine. Switch the active model or restart the app, then try again.' + ? 'Model file is in use. The AI engine may have it loaded. Switch the active model or restart the app, then try again.' : `Could not delete model file: ${error.message}`, errorCode: error?.code || 'DELETE_FAILED' }; @@ -979,7 +979,7 @@ class ModelDownloadManager { const code = error?.code; /** @type {Record} */ const messageMap = { - ENOSPC: `Disk full — not enough free space to download ${filename}`, + ENOSPC: `Disk full: not enough free space to download ${filename}`, EACCES: `Permission denied writing ${filename} (check models directory permissions)`, EPERM: `Permission denied writing ${filename} (check models directory permissions)`, ENOENT: `Models directory missing while writing ${filename}`, diff --git a/src/main/services/SearchService.js b/src/main/services/SearchService.js index 2a2f3173..e35ba2fb 100644 --- a/src/main/services/SearchService.js +++ b/src/main/services/SearchService.js @@ -717,7 +717,7 @@ class SearchService { const errorMsg = `Embedding model changed. Your search index uses ${expectedDim}-dimension embeddings, ` + `but your current model produces ${vector.length}-dimension embeddings. ` + - `Please rebuild your search index to use the new model.`; + `Rebuild your search index to use the new model.`; logger.error('[SearchService] Embedding dimension mismatch - failing vector search', { collectionType, @@ -3389,7 +3389,7 @@ class SearchService { 'Failed to generate test embedding. The AI engine may be unavailable or the embedding model is missing.' }); diagnostics.recommendations.push( - 'Ensure the embedding model is downloaded and available in Settings > Models.' + 'Ensure the embedding model is downloaded and available in Settings → Model management.' ); } } catch (e) { @@ -3558,7 +3558,7 @@ class SearchService { message: `${label}: ${deadLetterCount} embeddings permanently failed (dead letter).` }); diagnostics.recommendations.push( - 'Review dead letter items in Settings > Advanced to identify recurring failures.' + 'Check Settings → Diagnostics → Troubleshooting logs to find what keeps failing.' ); } diff --git a/src/main/services/SmartFolderWatcher.js b/src/main/services/SmartFolderWatcher.js index 25e4e0ef..29721697 100644 --- a/src/main/services/SmartFolderWatcher.js +++ b/src/main/services/SmartFolderWatcher.js @@ -656,8 +656,7 @@ class SmartFolderWatcher { const folders = this.getSmartFolders(); if (!folders || folders.length === 0) { - const errorMsg = - 'No smart folders configured. Please add smart folders in the Setup phase first.'; + const errorMsg = 'No smart folders set up yet. Add them in the Setup phase first.'; logger.warn('[SMART-FOLDER-WATCHER] Start failed:', errorMsg); this._lastStartError = errorMsg; return false; @@ -666,7 +665,7 @@ class SmartFolderWatcher { const validPaths = await this._getValidFolderPaths(folders); if (validPaths.length === 0) { - const errorMsg = `All ${folders.length} smart folder path(s) are inaccessible. Please check that the folders exist and you have read permissions.`; + const errorMsg = `All ${folders.length} smart folder path(s) are inaccessible. Check that the folders exist and you have read permissions.`; logger.warn('[SMART-FOLDER-WATCHER] Start failed:', errorMsg); this._lastStartError = errorMsg; return false; diff --git a/src/main/services/WhisperService.js b/src/main/services/WhisperService.js index 74278b39..34d55e6a 100644 --- a/src/main/services/WhisperService.js +++ b/src/main/services/WhisperService.js @@ -200,7 +200,7 @@ function _ffmpegUnavailableMessage() { return `${base} Install ffmpeg via your package manager (e.g. \`apt install ffmpeg\` or \`dnf install ffmpeg\`). ${escapeHatch}`; } if (process.platform === 'darwin') { - return `${base} The bundled binary should ship with the app — reinstall, or install ffmpeg via Homebrew (\`brew install ffmpeg\`). ${escapeHatch}`; + return `${base} The app should include ffmpeg. Reinstall it, or install ffmpeg via Homebrew (\`brew install ffmpeg\`). ${escapeHatch}`; } return `${base} Run 'npm run setup:ffmpeg-runtime' (dev), reinstall the app, or install ffmpeg manually. ${escapeHatch}`; } diff --git a/src/main/services/ai/AIRouter.js b/src/main/services/ai/AIRouter.js index 02a3de3f..51c172f1 100644 --- a/src/main/services/ai/AIRouter.js +++ b/src/main/services/ai/AIRouter.js @@ -119,7 +119,7 @@ class AIRouter extends EventEmitter { // 5. Nothing works throw new AIProviderError( 'NO_PROVIDER_READY', - 'No AI provider is ready. Configure a provider in Settings → AI.' + 'No AI provider is ready. Configure a provider in Settings → AI Provider.' ); } @@ -132,7 +132,7 @@ class AIRouter extends EventEmitter { } throw new AIProviderError( 'NO_PROVIDER_READY', - 'No AI provider is ready. Configure a provider in Settings → AI.' + 'No AI provider is ready. Configure a provider in Settings → AI Provider.' ); } @@ -168,7 +168,7 @@ class AIRouter extends EventEmitter { if (!name) return 'no provider name configured'; if (!provider) return `provider "${name}" is not registered`; const cfg = settings.providers?.[name]; - if (!cfg?.enabled) return `provider "${name}" is disabled in Settings → AI`; + if (!cfg?.enabled) return `provider "${name}" is disabled in Settings → AI Provider`; if (!provider.ready()) { // The most common ready()=false cause for cloud providers is a missing // API key; surface that distinctly. diff --git a/src/main/services/triage/DownloadsTriageService.js b/src/main/services/triage/DownloadsTriageService.js index 810f96d1..2fd44a3d 100644 --- a/src/main/services/triage/DownloadsTriageService.js +++ b/src/main/services/triage/DownloadsTriageService.js @@ -861,7 +861,7 @@ class DownloadsTriageService { confidence: score, suggestedFolder: { id: top.id, name: top.name, path: top.path }, signal: 'deep-embedding', - why: `Possible match "${top.name || top.id}" (${Math.round(score * 100)}%) — review` + why: `Possible match "${top.name || top.id}" (${Math.round(score * 100)}%). Needs review.` }; } else { next = { @@ -1087,7 +1087,7 @@ class DownloadsTriageService { })); try { await undo.recordBatch(ACTION_TYPES.TRASH_BATCH, operations, { - summary: summary || { label: 'Downloads triage — Send to Trash' } + summary: summary || { label: 'Downloads triage: Send to Trash' } }); } catch (err) { undoUnavailable = true; @@ -1322,7 +1322,7 @@ class DownloadsTriageService { if (undo && typeof undo.recordBatch === 'function') { try { await undo.recordBatch(ACTION_TYPES.MOVE_BATCH, undoOps, { - summary: summary || { label: 'Downloads triage — Organize' } + summary: summary || { label: 'Downloads triage: Organize' } }); } catch (err) { moveUndoUnavailable = true; diff --git a/src/main/services/triage/FastTriageClassifier.js b/src/main/services/triage/FastTriageClassifier.js index 7f448e85..d0ef4a62 100644 --- a/src/main/services/triage/FastTriageClassifier.js +++ b/src/main/services/triage/FastTriageClassifier.js @@ -195,7 +195,7 @@ class FastTriageClassifier { bucket: BUCKET.EXCLUDED, signal: SIGNAL.TOO_RECENT, confidence: 1, - why: `Too recent (${hoursOld}h old — wait before triaging)` + why: `Too recent (${hoursOld}h old). Wait before triaging.` }; } @@ -256,7 +256,7 @@ class FastTriageClassifier { signal: SIGNAL.CACHED_EMBEDDING, confidence: score, suggestedFolder: { id: top.id, name: top.name, path: top.path }, - why: `Cached embedding suggests "${top.name || top.id}" (${confidencePercent(score)}%) — below confidence threshold` + why: `Cached embedding suggests "${top.name || top.id}" (${confidencePercent(score)}%), below the confidence threshold` }; } } @@ -291,7 +291,7 @@ class FastTriageClassifier { signal: SIGNAL.LEXICAL_MATCH, confidence: top.score, suggestedFolder: { id: top.id, name: top.name, path: top.path }, - why: `Weak keyword match to "${top.name}" — needs deeper scan to confirm` + why: `Weak keyword match to "${top.name}". Needs a deeper scan to confirm.` }; } } catch (err) { diff --git a/src/main/simple-main.js b/src/main/simple-main.js index 374694de..c1f909ee 100644 --- a/src/main/simple-main.js +++ b/src/main/simple-main.js @@ -1005,7 +1005,7 @@ function raiseCoordinatedStartupFailure(/** @type {any} */ error) { subsystem: 'startup', severity: 'error', message: - 'AI services did not fully start — analysis and semantic search may be unavailable. Restart StratoSort to retry.', + 'AI services did not fully start. Analysis and semantic search may be unavailable. Restart StratoSort to retry.', detail: { error: error || null } }); } catch (trackerErr) { @@ -1036,7 +1036,7 @@ function raiseCoordinatedStartupNotice(startupResult) { subsystem: 'startup', severity: 'warning', message: - 'AI services are still starting — analysis and semantic search will be ready shortly. ' + + 'AI services are still starting. Analysis and semantic search will be ready shortly. ' + 'A large library can take a few minutes; StratoSort keeps loading in the background.', detail: { error: startupResult.error || null } }); diff --git a/src/renderer/components/AnalysisDetails.jsx b/src/renderer/components/AnalysisDetails.jsx index 543854aa..b4c0006c 100644 --- a/src/renderer/components/AnalysisDetails.jsx +++ b/src/renderer/components/AnalysisDetails.jsx @@ -148,7 +148,7 @@ const AnalysisDetails = memo(function AnalysisDetails({ if (result?.success) { setExportStatus( result?.truncated - ? `Saved ${format.toUpperCase()} — long recording: transcript was truncated at 1,000 segments` + ? `Saved ${format.toUpperCase()}. Long recording, so the transcript was cut off at 1,000 segments.` : `Saved ${format.toUpperCase()}` ); } else if (!result?.canceled) { diff --git a/src/renderer/components/ErrorBoundary.jsx b/src/renderer/components/ErrorBoundary.jsx index 7cd0e5c3..d6b8eab9 100644 --- a/src/renderer/components/ErrorBoundary.jsx +++ b/src/renderer/components/ErrorBoundary.jsx @@ -306,7 +306,7 @@ class ErrorBoundaryCore extends React.Component { {needsRestart - ? 'StratoSort was updated while it was running. Please quit and reopen the app to finish updating — reloading won’t resolve this.' + ? 'StratoSort was updated while it was running. Quit and reopen the app to finish updating. Reloading won’t fix this.' : isChunk ? 'App assets failed to load. This usually happens after an update.' : 'The application encountered an unexpected error.'} @@ -316,7 +316,7 @@ class ErrorBoundaryCore extends React.Component { {errorCount > 2 && !needsRestart && (
- Multiple errors detected. Consider reloading the application. + Multiple errors detected. Try reloading the app.
)} @@ -355,7 +355,7 @@ class ErrorBoundaryCore extends React.Component { - If this problem persists, please check your settings or contact support. + If this keeps happening, check your settings or contact support. @@ -389,7 +389,7 @@ class ErrorBoundaryCore extends React.Component { {isChunk && ( {needsRestart - ? 'StratoSort was updated while running. Please quit and reopen the app to finish updating — reloading won’t help.' + ? 'StratoSort was updated while running. Quit and reopen the app to finish updating. Reloading won’t help.' : 'This looks like an app asset mismatch. Reloading usually fixes it after an update.'} )} diff --git a/src/renderer/components/ModelSetupWizard.jsx b/src/renderer/components/ModelSetupWizard.jsx index 1ff92616..6a5400b0 100644 --- a/src/renderer/components/ModelSetupWizard.jsx +++ b/src/renderer/components/ModelSetupWizard.jsx @@ -38,7 +38,7 @@ const STEP_TITLES = { downloading: 'Download', complete: 'Finish' }; -const DOWNLOADS_STOPPED_MESSAGE = 'Required model downloads stopped. Please retry downloads.'; +const DOWNLOADS_STOPPED_MESSAGE = 'Required model downloads stopped. Retry the downloads.'; // Main says "started" before the download is in its status list (it checks // disk space and any partial file first), so for this long after a request an // empty list does not mean the download stopped. @@ -48,7 +48,7 @@ const PROJECTOR_MISSING_MESSAGE = // The vision model is optional: when it does not install, setup can still // finish on the required models, and this warning says what is missing. const VISION_NOT_INSTALLED_MESSAGE = - 'The image analysis model is not installed, so images cannot be understood yet. Documents are analyzed as usual, and you can download it later from Settings.'; + 'The image analysis model is not installed, so images cannot be analyzed yet. Documents are analyzed as usual, and you can download it later from Settings.'; const CHECKING_STATUS_MESSAGES = [ 'Detecting available local models...', 'Checking active background downloads...', @@ -475,7 +475,7 @@ function ModelSetupWizardBody({ onComplete, onSkip, onDismiss, onStepChange }) { if (!hasLlamaApi) { if (!isMountedRef.current) return; applyFallbackSelection(); - setInitError('AI engine is still starting. Please try again in a moment.'); + setInitError('AI engine is still starting. Try again in a moment.'); setStep('select'); setIsRefreshing(false); return; @@ -657,7 +657,7 @@ function ModelSetupWizardBody({ onComplete, onSkip, onDismiss, onStepChange }) { if (step === 'checking' && !pendingEmbeddingSwitch) { const timer = setTimeout(() => { if (isMountedRef.current) { - setInitError('AI system check timed out. Please select models manually.'); + setInitError('AI system check timed out. Select models manually.'); setStep('select'); setIsRefreshing(false); } diff --git a/src/renderer/components/NavigationBar.jsx b/src/renderer/components/NavigationBar.jsx index 18e5abb9..59e69607 100644 --- a/src/renderer/components/NavigationBar.jsx +++ b/src/renderer/components/NavigationBar.jsx @@ -1087,7 +1087,7 @@ function NavigationBar() { ? executionStatus?.label ? `${executionStatus.label} Step navigation is paused until file moves finish.` : 'Step navigation is paused while undo/redo moves files.' - : 'Step navigation is paused. Please wait for the current operation to finish.'} + : 'Step navigation is paused until the current operation finishes.'}
)} diff --git a/src/renderer/components/SettingsPanel.jsx b/src/renderer/components/SettingsPanel.jsx index 7ec12437..4d77a366 100644 --- a/src/renderer/components/SettingsPanel.jsx +++ b/src/renderer/components/SettingsPanel.jsx @@ -1388,7 +1388,7 @@ const SettingsPanel = React.memo(function SettingsPanel() { title={`Save failed: ${lastSaveError}. Click to retry.`} >