~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
"""Static contracts for collection-details classic-script globals."""
import re
from pathlib import Path
import local_deep_research
_COLLECTION_DETAILS_JS = (
Path(local_deep_research.__file__).parent
/ "web"
/ "static"
/ "js"
/ "collection_details.js"
)
# ^-anchored, like test_notes_js_global_shadowing.py's _DECL_RE: only a
# top-level (column-0) declaration in a classic (non-module) script creates
# or shadows a global, so only those forms matter here. Kept as its own
# check -- rather than folded into that file's full base.html-shared-script
# sweep -- because the sweep's failure message enumerates every colliding
# name, while this one names the specific declaration (and its SyntaxError
# consequence) that delete_manager.js makes fatal on this page. The
# `showError` collision that used to keep this file out of that sweep is
# fixed (renamed to `showCollectionError`, #6585), so collection_details.js
# is now swept there too.
_LOCAL_FORMAT_BYTES_DECL = re.compile(
r"^(?:async\s+)?function\s+formatBytes\b"
r"|^(?:let|var|const)\s+formatBytes\b"
r"|^class\s+formatBytes\b",
re.MULTILINE,
)
# The call site should reach the shared global; tolerate whatever argument
# expression it's called with (e.g. `doc.file_size`, `doc.file_size || 0`).
_SHARED_FORMAT_BYTES_CALL = re.compile(r"window\.formatBytes\(")
def test_collection_details_does_not_shadow_shared_format_bytes():
"""collection_details.js must not declare its own top-level formatBytes.
deletion/delete_manager.js is loaded earlier on this same page
(collection_details.html) and declares a top-level `const formatBytes`
wrapping the shared window.formatBytes. Classic (non-module) scripts
loaded on one page share a global lexical scope for top-level
let/const/class/function declarations, so a second top-level
formatBytes declaration here -- in any of those forms -- is no longer
a harmless overwrite. It is a fatal
`SyntaxError: Identifier 'formatBytes' has already been declared`,
and this whole script fails to run, not just the duplicate name.
"""
source = _COLLECTION_DETAILS_JS.read_text(encoding="utf-8")
assert not _LOCAL_FORMAT_BYTES_DECL.search(source)
assert _SHARED_FORMAT_BYTES_CALL.search(source)