~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
/** Async ownership contracts for competing progress status sources. */
import '@js/config/urls.js';
import '@js/services/api.js';
const RESEARCH_ID = 'progress-race-3299';
function deferred() {
let resolvePromise;
const promise = new Promise(resolve => {
resolvePromise = resolve;
});
return { promise, resolve: resolvePromise };
}
beforeEach(() => {
document.title = 'Research in progress';
document.body.innerHTML = `
<div role="progressbar" aria-valuenow="0">
<div id="progress-bar"></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: () => 'info',
};
window.socket = {
subscribeToResearch: vi.fn(),
onReconnect: vi.fn(),
isUsingPolling: vi.fn(() => false),
};
});
afterEach(() => {
vi.restoreAllMocks();
vi.unstubAllGlobals();
delete window.socket;
delete window.ResearchStates;
delete window.RESEARCH_STATUS;
delete window.progressComponent;
delete window.showNotification;
document.body.replaceChildren();
});
it('does not let the older bootstrap poll regress a newer terminal status', async () => {
vi.stubGlobal('URLBuilder', window.URLBuilder);
vi.stubGlobal('URLS', window.URLS);
vi.stubGlobal('ResearchStates', window.ResearchStates);
vi.stubGlobal('Notification', { permission: 'denied' });
vi.stubGlobal('URLValidator', {
safeAssign: vi.fn((element, property, value) => {
element.setAttribute(property, value);
}),
});
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: false }));
vi.spyOn(window.URLBuilder, 'extractResearchIdFromPattern')
.mockReturnValue(RESEARCH_ID);
const olderPoll = deferred();
const statusMock = vi.spyOn(window.api, 'getResearchStatus')
.mockImplementationOnce(() => olderPoll.promise)
.mockResolvedValueOnce({ status: 'completed', progress: 100 });
const intervalSpy = vi.spyOn(globalThis, 'setInterval');
await import('@js/components/progress.js');
document.dispatchEvent(new Event('DOMContentLoaded'));
await vi.waitFor(() => {
expect(document.getElementById('current-task').textContent)
.toBe('Research completed successfully');
});
expect(statusMock).toHaveBeenCalledTimes(2);
expect(document.getElementById('progress-bar').style.width).toBe('100%');
expect(document.getElementById('view-results-btn').style.display)
.toBe('inline-block');
expect(document.getElementById('cancel-research-btn').style.display)
.toBe('none');
olderPoll.resolve({
status: 'in_progress',
progress: 40,
current_task: 'Stale gathering step',
});
await olderPoll.promise;
await Promise.resolve();
expect(document.getElementById('progress-bar').style.width).toBe('100%');
expect(document.getElementById('current-task').textContent)
.toBe('Research completed successfully');
expect(document.title).toBe('Research (100%) - Local Deep Research');
expect(intervalSpy).not.toHaveBeenCalled();
});