~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
/** FastAPI failure-envelope coverage for progress-page bootstrap. */
import '@js/config/urls.js';
const RESEARCH_ID = 'progress-initial-error-envelope-3299';
function deferred() {
let resolvePromise;
const promise = new Promise(resolve => {
resolvePromise = resolve;
});
return { promise, resolve: resolvePromise };
}
async function flushPromises(turns = 8) {
for (let turn = 0; turn < turns; turn += 1) {
await Promise.resolve();
}
}
beforeEach(() => {
vi.useFakeTimers();
document.body.innerHTML = `
<div role="progressbar" aria-valuenow="0">
<div id="progress-bar" class="bg-primary"></div>
</div>
<div id="progress-percentage"></div>
<div id="status-text" class="ldr-status-indicator"></div>
<div id="current-task"></div>
<button id="cancel-research-btn"></button>
<a id="view-results-btn" style="display: none"></a>
`;
window.RESEARCH_STATUS = {
QUEUED: 'queued',
IN_PROGRESS: 'in_progress',
COMPLETED: 'completed',
FAILED: 'failed',
ERROR: 'error',
CANCELLED: 'cancelled',
};
window.ResearchStates = {
isTerminal: status => [
'completed',
'failed',
'error',
'cancelled',
].includes(status),
isCompleted: status => status === 'completed',
isFailed: status => ['failed', 'error'].includes(status),
isCancelled: status => status === 'cancelled',
isInProgress: status => status === 'in_progress',
formatStatus: status => status,
logLevel: () => 'error',
};
});
afterEach(() => {
vi.restoreAllMocks();
vi.unstubAllGlobals();
vi.clearAllTimers();
vi.useRealTimers();
delete window.api;
delete window.socket;
delete window.ResearchStates;
delete window.RESEARCH_STATUS;
delete window.progressComponent;
delete window.showNotification;
document.body.replaceChildren();
});
it('renders persisted FastAPI metadata.error_info detail for an initial failure', async () => {
vi.stubGlobal('URLBuilder', window.URLBuilder);
vi.stubGlobal('URLS', window.URLS);
vi.stubGlobal('ResearchStates', window.ResearchStates);
vi.stubGlobal('Notification', { permission: 'denied' });
vi.spyOn(window.URLBuilder, 'extractResearchIdFromPattern')
.mockReturnValue(RESEARCH_ID);
const olderPoll = deferred();
const getResearchStatus = vi.fn()
.mockImplementationOnce(() => olderPoll.promise)
.mockResolvedValueOnce({
status: 'failed',
progress: 37,
completed_at: null,
report_path: null,
metadata: {
error_info: {
type: 'connection',
message: 'Provider credentials rejected',
suggestion: 'Check the provider settings.',
},
},
});
window.api = { getResearchStatus };
await import('@js/components/progress.js');
document.dispatchEvent(new Event('DOMContentLoaded'));
await flushPromises();
expect(getResearchStatus).toHaveBeenCalledTimes(2);
expect(document.getElementById('current-task').textContent)
.toBe('Error: Provider credentials rejected');
expect(document.getElementById('current-task').textContent)
.not.toContain('Unknown error');
expect(document.getElementById('cancel-research-btn').style.display)
.toBe('none');
expect(document.getElementById('view-results-btn').textContent)
.toBe('View Error Report');
olderPoll.resolve({
status: 'in_progress',
progress: 12,
current_task: 'Stale provider setup',
});
await olderPoll.promise;
await flushPromises();
expect(document.getElementById('current-task').textContent)
.toBe('Error: Provider credentials rejected');
});