~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
/**
* Source-pinning contract for the two /history/* call sites migrated to
* the shared JSON client (services/api.js).
*
* This PR's changelog promises that an expired session on the history
* routes redirects the user to sign-in. That is only true when every
* live history XHR negotiates JSON through fetchWithErrorHandling — a
* bare fetch is classified as a browser, gets the login page's HTML,
* and dies in response.json() with a SyntaxError instead.
*
* tests/web/test_content_negotiation_census.py proves the server side
* for all six /history/* XHR routes and services/api.test.js proves the
* wrapper itself; neither can see which page code actually calls them.
* This file pins the two page-side call sites the gate found still on
* bare fetch: the research-details loader (components/details.js) and
* the log panel's persisted-count fetch (components/logpanel.js).
*
* Mirrors the source-pinning style of settings-fetch-error-handling
* .test.js rather than booting the pages, so the pin cannot be
* satisfied by a test-only global.
*/
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
const COMPONENTS_DIR = resolve(
__dirname,
'../../../src/local_deep_research/web/static/js/components',
);
const DETAILS_SOURCE = readFileSync(
resolve(COMPONENTS_DIR, 'details.js'),
'utf8',
);
const LOGPANEL_SOURCE = readFileSync(
resolve(COMPONENTS_DIR, 'logpanel.js'),
'utf8',
);
describe('history JSON client migration', () => {
it('fetches research details through the shared JSON client', () => {
const handledCalls = DETAILS_SOURCE.match(
/window\.api\.fetchWithErrorHandling\(/g,
) || [];
expect(DETAILS_SOURCE)
.toContain('await window.api.fetchWithErrorHandling(detailsUrl)');
expect(DETAILS_SOURCE).not.toContain('fetch(detailsUrl)');
// The history route keeps its parsed-JSON client. Metrics use the
// Response-valued auth helper so their status handling stays local.
expect(handledCalls).toHaveLength(1);
expect(DETAILS_SOURCE).toContain(
'const metricsResponse = await safeFetchWithAuth('
+ 'URLBuilder.build(URLS.METRICS_API.RESEARCH, researchId));'
);
});
it('fetches the persisted log count through the shared JSON client', () => {
const handledCalls = LOGPANEL_SOURCE.match(
/window\.api\.fetchWithErrorHandling\(/g,
) || [];
expect(LOGPANEL_SOURCE)
.toContain('window.api.fetchWithErrorHandling(');
expect(LOGPANEL_SOURCE)
.toContain('URLBuilder.historyLogCount(researchId)');
expect(LOGPANEL_SOURCE)
.not.toContain('fetch(URLBuilder.historyLogCount');
// The count keeps its parsed-JSON client; diagnostic logs use the
// Response-valued auth helper and retain their own body handling.
expect(handledCalls).toHaveLength(1);
// Regex literal (not a string) so the pin cannot itself trip
// no-template-curly-in-string or no-useless-concat. The backticks
// and ${...} placeholders are part of the matched source.
expect(LOGPANEL_SOURCE).toMatch(
/await safeFetchWithAuth\(`\$\{url\}\$\{separator\}priority=diagnostic`\)/
);
});
});