Merge remote-tracking branch 'upstream/main' into HEAD

This commit is contained in:
JerrettDavis
2026-10-24 04:23:19 -05:00
46 changed files with 14688 additions and 4198 deletions
+148 -3
View File
@@ -51,9 +51,105 @@ jobs:
wc -l requirements-prod.txt
- name: Audit dependencies (pip-audit)
uses: pypa/gh-action-pip-audit@v1.1.0
# The export is uv.lock's fully pinned set, overrides applied: audit it
# as is. pip must not re-resolve it (fastembed's pillow<13 cap would
# fail; see [tool.uv] override-dependencies), and the pip-audit action
# has no --disable-pip input, so pip-audit runs directly.
run: uvx pip-audit==2.10.1 -r requirements-prod.txt --no-deps --disable-pip
# ---- SCA: what `pip install headroom-ai[all]` gets ---------------------
# The job above audits uv.lock, which the release image also installs
# (overrides applied). pip ignores [tool.uv] and resolves the package
# metadata, where fastembed caps pillow <13: audit that set too. Its Pillow
# advisories fixed in 13 are accepted only because headroom/image/
# decoder_guard.py never decodes an image on Pillow <13, which the guard step
# proves on that same Pillow first. Any other finding fails the job.
# `uv pip compile` stands in for pip's resolver on Linux/Python 3.12, so it
# approximates, not reproduces, every user's install; on Python 3.10 pip
# also gets Pillow 12 (guarded) and filelock <4.2.1 (no fixed release there).
# It resolves live from PyPI, so a new upstream advisory would fail PRs that
# did not cause it: on pull requests it runs only when pyproject.toml changes;
# pushes to main and the weekly schedule always run it.
published-install-audit:
name: Dependency audit (pip install from package metadata)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
with:
inputs: requirements-prod.txt
fetch-depth: 0
- name: Run on this event?
id: gate
run: |
if [ "${{ github.event_name }}" != "pull_request" ] || \
git diff --name-only "${{ github.event.pull_request.base.sha }}" HEAD | grep -qx pyproject.toml; then
echo "run=true" >> "$GITHUB_OUTPUT"
else
echo "pyproject.toml unchanged in this PR; main and the weekly run cover it."
fi
- name: Set up Python
if: steps.gate.outputs.run == 'true'
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install uv
if: steps.gate.outputs.run == 'true'
uses: astral-sh/setup-uv@v10.3.0
- name: Resolve what pip installs from the package metadata
if: steps.gate.outputs.run == 'true'
run: |
uv --no-config pip compile pyproject.toml --extra all --python-version 3.12 \
--no-header --no-annotate -o published.txt
uv --no-config pip compile pyproject.toml --python-version 3.12 \
--no-header --no-annotate -o core.txt
grep -iE '^(pillow|fastembed)==' published.txt
- name: The decoder guard holds on that Pillow
if: steps.gate.outputs.run == 'true'
run: |
uv venv -p 3.12 .published
uv --no-config pip install -p .published -r core.txt \
"$(grep -i '^pillow==' published.txt)" pytest pytest-asyncio
.published/bin/python -m pytest -p no:cacheprovider tests/test_image_decoder_guard.py
PINNED="$(grep -i '^pillow==' published.txt | cut -d= -f3)" .published/bin/python - <<'PY'
import os
import PIL
from headroom.image.decoder_guard import FIXED_PILLOW_MAJOR, pillow_is_safe
# The guard reads the Pillow that is imported; it must be pip's pick.
assert PIL.__version__ == os.environ["PINNED"], (PIL.__version__, os.environ["PINNED"])
fixed = int(PIL.__version__.split(".")[0]) >= FIXED_PILLOW_MAJOR
assert pillow_is_safe() is fixed, (PIL.__version__, pillow_is_safe())
print("Pillow", PIL.__version__, "decodes images:", fixed)
PY
- name: Audit it (pip-audit)
if: steps.gate.outputs.run == 'true'
run: |
uvx pip-audit==2.10.1 -r published.txt --no-deps --disable-pip \
--format json -o audit.json || true
python - <<'PY'
import json
deps = json.load(open("audit.json"))["dependencies"]
findings = [(d["name"], d["version"], v) for d in deps for v in d.get("vulns", [])]
guarded = [
f for f in findings
# The guard turns off all decoding below Pillow 13, whatever the fix.
if f[0].lower() == "pillow" and int(f[1].split(".")[0]) < 13
]
for name, ver, v in findings:
note = " (guarded: decoder_guard)" if (name, ver, v) in guarded else ""
print(f"{name} {ver} {v['id']} fix {v['fix_versions']}{note}")
assert len(deps) > 50, "pip-audit produced no dependency list"
if len(findings) > len(guarded):
raise SystemExit("Unguarded advisories in the pip-installed set; see above.")
PY
# ---- SCA: Rust dependency advisories -----------------------------------
# `cargo audit` reads Cargo.lock only (no build, about a minute), so it runs
@@ -104,9 +200,58 @@ jobs:
- uses: actions/setup-node@v7
with:
node-version: ">=24.16.0 <25"
# A directory may hold npm-audit-exceptions.json for advisories in copies
# bundled inside a package, which overrides cannot replace. A listed
# advisory is accepted only at its listed path, only while the lock has
# that exact version there as a bundled copy, and only until `expires`.
# Any other finding fails, and so does an entry that no longer matches.
- name: Audit locked dependencies at every severity
working-directory: ${{ matrix.directory }}
run: npm audit --package-lock-only --audit-level=low
run: |
if [ ! -f npm-audit-exceptions.json ]; then
npm audit --package-lock-only --audit-level=low
exit
fi
npm audit --package-lock-only --audit-level=low || true
npm audit --package-lock-only --json > "$RUNNER_TEMP/audit.json" || true
python3 - "$RUNNER_TEMP/audit.json" <<'PY'
import datetime
import json
import sys
exceptions = json.load(open("npm-audit-exceptions.json"))
if datetime.date.today().isoformat() > exceptions["expires"]:
sys.exit(f"npm-audit-exceptions.json expired on {exceptions['expires']}: recheck upstream.")
allowed = exceptions["advisories"] # {advisory: {lock path: bundled version}}
locked = json.load(open("package-lock.json"))["packages"]
vulns = json.load(open(sys.argv[1])).get("vulnerabilities", {})
seen, unexpected = set(), []
for name, vuln in vulns.items():
for via in vuln["via"]:
if isinstance(via, str):
# Inherited: its advisories are checked on that package's
# own entry, which therefore has to be in the report.
if via not in vulns:
unexpected.append(f"{name} via {via} (no entry for {via})")
continue
advisory = via["url"].rsplit("/", 1)[-1]
for node in vuln["nodes"]:
entry = locked.get(node, {})
pinned = allowed.get(advisory, {}).get(node)
if pinned and entry.get("version") == pinned and entry.get("inBundle"):
seen.add((advisory, node))
else:
found = f"{entry.get('version')}{' bundled' if entry.get('inBundle') else ''}"
unexpected.append(f"{advisory} {node} {found} ({via['severity']})")
stale = [f"{a} {n}" for a, nodes in allowed.items() for n in nodes if (a, n) not in seen]
for line in unexpected:
print("NOT EXCEPTED:", line)
for line in stale:
print("STALE EXCEPTION (fixed? remove it):", line)
if unexpected or stale:
sys.exit(1)
print(f"Only excepted bundled advisories remain ({len(seen)}), until {exceptions['expires']}.")
PY
# ---- SAST: CodeQL static analysis ------------------------------------
codeql:
Generated
+10 -20
View File
@@ -1351,9 +1351,9 @@ dependencies = [
[[package]]
name = "ctutils"
version = "0.4.2"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e"
checksum = "38d28fb6aa7dd680b3ffd1a3e64e115c177bdba63c0ae7f9cd48129ff05c4fa0"
dependencies = [
"cmov",
]
@@ -2098,7 +2098,7 @@ dependencies = [
"tracing-subscriber",
"url",
"uuid",
"webpki-roots 1.0.9",
"webpki-roots",
"wiremock",
]
@@ -2298,7 +2298,7 @@ dependencies = [
"tokio",
"tokio-rustls",
"tower-service",
"webpki-roots 1.0.9",
"webpki-roots",
]
[[package]]
@@ -3835,7 +3835,7 @@ dependencies = [
"wasm-bindgen-futures",
"wasm-streams",
"web-sys",
"webpki-roots 1.0.9",
"webpki-roots",
]
[[package]]
@@ -3960,9 +3960,9 @@ dependencies = [
[[package]]
name = "rustls-webpki"
version = "0.103.15"
version = "0.103.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
dependencies = [
"aws-lc-rs",
"ring",
@@ -4642,7 +4642,6 @@ dependencies = [
"tokio",
"tokio-rustls",
"tungstenite 0.30.0",
"webpki-roots 0.26.11",
]
[[package]]
@@ -5084,7 +5083,7 @@ dependencies = [
"socks",
"ureq-proto",
"utf8-zero",
"webpki-roots 1.0.9",
"webpki-roots",
]
[[package]]
@@ -5314,18 +5313,9 @@ dependencies = [
[[package]]
name = "webpki-roots"
version = "0.26.11"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
"webpki-roots 1.0.9",
]
[[package]]
name = "webpki-roots"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a"
checksum = "1c1c8e20c8a38fc7d65abfe74eb7280e4aa667e8eec8bc84996d2874810748d9"
dependencies = [
"rustls-pki-types",
]
+6 -1
View File
@@ -51,11 +51,16 @@ COPY headroom/ headroom/
# `headroom proxy --backend`, including Bedrock temporary/SSO credentials.
# Those credentials require botocore (GH #1551), supplied by [bedrock].
ARG HEADROOM_EXTRAS=proxy,code,bedrock
# `uv pip install` ignores [tool.uv] override-dependencies (uv.lock only), so
# pass them explicitly: the image gets the security overrides the lock has
# (pillow 13 over fastembed's <13 cap). Python 3.10 has no tomllib: pip's
# vendored tomli reads the file there.
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/build/target \
uv pip install --system ".[${HEADROOM_EXTRAS}]"
python -c "exec('try: import tomllib\\nexcept ImportError: from pip._vendor import tomli as tomllib'); print('\\n'.join(tomllib.load(open('pyproject.toml', 'rb'))['tool']['uv']['override-dependencies']))" > /tmp/overrides.txt && \
uv pip install --system --overrides /tmp/overrides.txt ".[${HEADROOM_EXTRAS}]"
RUN --mount=type=bind,source=.,target=/context,readonly \
HEADROOM_BUILD_VERSION="${HEADROOM_BUILD_VERSION}" PYTHON_SITE_PACKAGES="${PYTHON_SITE_PACKAGES}" python - <<'PY'
+5 -2
View File
@@ -26,7 +26,10 @@ tracing-subscriber = { version = "0.3", features = ["json", "env-filter", "fmt"]
# roots (Zscaler, Netskope, ...) are installed in the OS store, never in
# Mozilla's list, so webpki alone rejects every re-signed upstream certificate.
reqwest = { version = "0.12", default-features = false, features = ["stream", "rustls-tls", "rustls-tls-native-roots", "http2"] }
tokio-tungstenite = { version = "0.30", default-features = false, features = ["connect", "rustls-tls-webpki-roots", "rustls-tls-native-roots"] }
# websocket.rs always supplies tls::websocket_tls_config(), which loads our
# direct webpki-roots 1.x dependency plus native/additive roots. Do not enable
# tungstenite's unused default webpki store: it pulls the obsolete 0.26 shim.
tokio-tungstenite = { version = "0.30", default-features = false, features = ["connect", "rustls-tls-native-roots"] }
clap = { workspace = true, features = ["derive", "env"] }
serde = { workspace = true }
serde_json = { workspace = true }
@@ -122,7 +125,7 @@ tokio-rustls = { version = "0.26", default-features = false, features = ["ring",
# is the generator rustls' own test-suite uses; dev-only, never shipped.
rcgen = { version = "0.14", default-features = false, features = ["ring", "pem"] }
reqwest = { version = "0.12", default-features = false, features = ["stream", "rustls-tls", "http2", "json"] }
tokio-tungstenite = { version = "0.30", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] }
tokio-tungstenite = { version = "0.30", default-features = false, features = ["connect", "rustls-tls-native-roots"] }
futures-util = "0.3"
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal", "net", "io-util", "time", "test-util", "process"] }
hyper = { version = "1", features = ["server", "http1", "http2"] }
+12 -12
View File
@@ -15,7 +15,7 @@
"fumadocs-typescript": "^5.5.1",
"fumadocs-ui": "16.17.1",
"lucide-react": "^1.48.0",
"next": "^16.4.0",
"next": "^16.4.3",
"react": "^19.3.0",
"react-dom": "^19.3.0",
"recharts": "^3.10.1",
@@ -193,23 +193,23 @@
"@mdx-js/mdx": ["@mdx-js/mdx@3.1.1", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdx": "^2.0.0", "acorn": "^8.0.0", "collapse-white-space": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "estree-util-scope": "^1.0.0", "estree-walker": "^3.0.0", "hast-util-to-jsx-runtime": "^2.0.0", "markdown-extensions": "^2.0.0", "recma-build-jsx": "^1.0.0", "recma-jsx": "^1.0.0", "recma-stringify": "^1.0.0", "rehype-recma": "^1.0.0", "remark-mdx": "^3.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.0.0", "source-map": "^0.7.0", "unified": "^11.0.0", "unist-util-position-from-estree": "^2.0.0", "unist-util-stringify-position": "^4.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, ""],
"@next/env": ["@next/env@16.4.0", "", {}, "sha512-pyLlT5oafGlX8X7xjgGNXz5dNIDSxREm+qD6i9VLSZiZFopA/XWl8NM/KPmLx/8EG/++c49iid3gNWSQW1+2dQ=="],
"@next/env": ["@next/env@16.4.3", "", {}, "sha512-a7tz1QCcWWkwC/rPJcPMJk/UNRu9CFhDd3OHYE5hddbJrs8BqRTalxI6GlKCWEGzRLHN+S/B7a4PAHCtm25aBQ=="],
"@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@16.4.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-yyZ+9MgViAKLLb5l1gPBGjRwnq3teNLb5Zx6JEw8LzNSTjlsnp+baUHFxTgl7PpjCmKf48VQfyipG1eBflb48Q=="],
"@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@16.4.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-4yq5EXBt+VDtAZwTyfijaFp5D2C5oz3Ikw5a2kiX2K9nw72vrZX2q5UuAlkPtUMO1tQz6JTKpaKWjS7OOefTDQ=="],
"@next/swc-darwin-x64": ["@next/swc-darwin-x64@16.4.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-RePEEejEj1Auf5s9qEcG0JbcDP3ceNUS/ofNX8AhxzgIjTVlZIHMatlp16YplcSMpsVo/ZMQHJTjbMYJznjGUg=="],
"@next/swc-darwin-x64": ["@next/swc-darwin-x64@16.4.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-1Rvkn/LUhnEF8WxnRkOrqGhbwXui1bkWFxONKIbN+r7C+9KHDSZ+iUoj4CzymVMWUyZIyx9szcb9+kbKhD500A=="],
"@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.4.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-HhsyCqd+NpmvDDVY/LqkAN24f+QVvXh3ie+PfcwKinWL2Mu826JymQxJXGjAIfmJ4VlHjp4Pe/nZtXtUoEMAqw=="],
"@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.4.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-dCKpXErGg3abUM6t5JTJV/ottVBTStJB5lRJTbgdUdQaQ+jNHiK56Hsc0YAEg/rinSh42hYG3HWiYmEMdilnxg=="],
"@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.4.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-sN9Pf+Zh+RpZAOmbR7d8KAA8T61CVhawtbEJ2Bk6QrRzx6Z/6haaF4UiwBzytM96GRRRWZh9/WALIEO3npMamA=="],
"@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.4.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-WwYbhWkhYBvBtib1K4W0kL8MW2snBD2A5b3SN4vPpqalZbZs5+bQ1yzAdepVoOqrFfEW3dmREy4Zs1MrWcrFbw=="],
"@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.4.0", "", { "os": "linux", "cpu": "x64" }, "sha512-D5M5xLWQVd1CvR+L7BickM1weRfmM41x3L1NWcnKY/oyJJqr1qwaCgmu3dMAhLBOMdZwSuDCRV6DJRRpiUkbDQ=="],
"@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.4.3", "", { "os": "linux", "cpu": "x64" }, "sha512-QymWvfUwDEC5/lpJOsxX5VAbyoR2D13+2Jsjz4be7gT4LPqEgdpkeLIR/HFfCLgKzoMhpJbp6I/JnogyNZHcaA=="],
"@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.4.0", "", { "os": "linux", "cpu": "x64" }, "sha512-8d5WLS6a9YalqpOgXdlbvonFu+sIgjA+CO6tGzetrpPVcUL56foa7B7664h41rAlbLi5fJwK4vWji3zf4QDy+w=="],
"@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.4.3", "", { "os": "linux", "cpu": "x64" }, "sha512-Vmjd9D7DpA4Vv3cUlr82QWgJD/BQZmns801vtC5VWHg6jCIA4a5vMKpQnfrM2pyCrp2eV0ENdUg4PlN3bAc2Yw=="],
"@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@16.4.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-sQuOIiW3snb48UwrBcDMvFA/u03qtw2LeuSIxFIQ9AJuW9UG/4Ddsfo+eV73PnZwBhyncMtsKVh7PrzMol2/fA=="],
"@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@16.4.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-lG1pPdPLk7gTyGb00n5JIMLdBJgjb+UEhSdZvFbhUMg0DyC6z4B7RnpSKF9VCd4imkLObVbXOFA0kFCpw7yFow=="],
"@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@16.4.0", "", { "os": "win32", "cpu": "x64" }, "sha512-6/33lCuxpdHUy27RegyGM/5uTpF7YZd3UR4D0gpkOA/tWY5YR7msbQjqPgCZmSmxrrTLGCXYA4A8vT2H5DPGTQ=="],
"@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@16.4.3", "", { "os": "win32", "cpu": "x64" }, "sha512-NmQC9RkJdnPXRaMxtkCzobB3teVjqF33oSOnwDfi+XYGWWYpt+xlGK3mtktSKLbdjwaWbJu2OkkMiRFGUUncKg=="],
"@radix-ui/number": ["@radix-ui/number@1.1.3", "", {}, "sha512-Road2bidD0uu/1BGDOWNdPI06g0lIRy6IF9GZcIrDK2KGItfor8IQwQa+yM2ERgHM1MmHxaxpTzk0/Jp42lNfA=="],
@@ -781,7 +781,7 @@
"nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="],
"next": ["next@16.4.0", "", { "dependencies": { "@next/env": "16.4.0", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", "postcss": "8.5.23", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.4.0", "@next/swc-darwin-x64": "16.4.0", "@next/swc-linux-arm64-gnu": "16.4.0", "@next/swc-linux-arm64-musl": "16.4.0", "@next/swc-linux-x64-gnu": "16.4.0", "@next/swc-linux-x64-musl": "16.4.0", "@next/swc-win32-arm64-msvc": "16.4.0", "@next/swc-win32-x64-msvc": "16.4.0", "sharp": "^0.35.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-N2C+9q89Z/oLrsepSRS4jRMtwmUZAoZuAHU0e9T6+sAB5DdhADmrnOW+zjYijlrYFmVfmQhGVGy9eMFoB7UgKg=="],
"next": ["next@16.4.3", "", { "dependencies": { "@next/env": "16.4.3", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", "postcss": "8.5.23", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.4.3", "@next/swc-darwin-x64": "16.4.3", "@next/swc-linux-arm64-gnu": "16.4.3", "@next/swc-linux-arm64-musl": "16.4.3", "@next/swc-linux-x64-gnu": "16.4.3", "@next/swc-linux-x64-musl": "16.4.3", "@next/swc-win32-arm64-msvc": "16.4.3", "@next/swc-win32-x64-msvc": "16.4.3", "sharp": "^0.35.5" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-OqxKTGi9u80FydydsMNYNjnuje9Au+kvHlt2GZ//ftdpDHm1dxKqAaENoOOTX5wKzn+9vaKUNIfZeyZUuLhCnA=="],
"next-themes": ["next-themes@0.4.6", "", { "peerDependencies": { "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, ""],
@@ -955,7 +955,7 @@
"zbsearch": ["zbsearch@4.0.1", "", {}, "sha512-lmnEEnb93QQcNv7qARDr7jBVPxYdZbZ9XdZ0dbZ0qaOvGne4jJMW4fjwPfVaUKQXv3FNWvGbDwRDgyaSb1pc8w=="],
"zod": ["zod@4.6.5", "", {}, "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q=="],
"zod": ["zod@4.6.7", "", {}, "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg=="],
"zwitch": ["zwitch@2.0.4", "", {}, ""],
+47 -47
View File
@@ -19,7 +19,7 @@
"fumadocs-typescript": "^5.5.1",
"fumadocs-ui": "16.17.1",
"lucide-react": "^1.48.0",
"next": "^16.4.0",
"next": "^16.4.3",
"react": "^19.3.0",
"react-dom": "^19.3.0",
"recharts": "^3.10.1",
@@ -1347,15 +1347,15 @@
}
},
"node_modules/@next/env": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.0.tgz",
"integrity": "sha512-pyLlT5oafGlX8X7xjgGNXz5dNIDSxREm+qD6i9VLSZiZFopA/XWl8NM/KPmLx/8EG/++c49iid3gNWSQW1+2dQ==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.3.tgz",
"integrity": "sha512-a7tz1QCcWWkwC/rPJcPMJk/UNRu9CFhDd3OHYE5hddbJrs8BqRTalxI6GlKCWEGzRLHN+S/B7a4PAHCtm25aBQ==",
"license": "MIT"
},
"node_modules/@next/swc-darwin-arm64": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.0.tgz",
"integrity": "sha512-yyZ+9MgViAKLLb5l1gPBGjRwnq3teNLb5Zx6JEw8LzNSTjlsnp+baUHFxTgl7PpjCmKf48VQfyipG1eBflb48Q==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.3.tgz",
"integrity": "sha512-4yq5EXBt+VDtAZwTyfijaFp5D2C5oz3Ikw5a2kiX2K9nw72vrZX2q5UuAlkPtUMO1tQz6JTKpaKWjS7OOefTDQ==",
"cpu": [
"arm64"
],
@@ -1369,9 +1369,9 @@
}
},
"node_modules/@next/swc-darwin-x64": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.0.tgz",
"integrity": "sha512-RePEEejEj1Auf5s9qEcG0JbcDP3ceNUS/ofNX8AhxzgIjTVlZIHMatlp16YplcSMpsVo/ZMQHJTjbMYJznjGUg==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.3.tgz",
"integrity": "sha512-1Rvkn/LUhnEF8WxnRkOrqGhbwXui1bkWFxONKIbN+r7C+9KHDSZ+iUoj4CzymVMWUyZIyx9szcb9+kbKhD500A==",
"cpu": [
"x64"
],
@@ -1385,9 +1385,9 @@
}
},
"node_modules/@next/swc-linux-arm64-gnu": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.0.tgz",
"integrity": "sha512-HhsyCqd+NpmvDDVY/LqkAN24f+QVvXh3ie+PfcwKinWL2Mu826JymQxJXGjAIfmJ4VlHjp4Pe/nZtXtUoEMAqw==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.3.tgz",
"integrity": "sha512-dCKpXErGg3abUM6t5JTJV/ottVBTStJB5lRJTbgdUdQaQ+jNHiK56Hsc0YAEg/rinSh42hYG3HWiYmEMdilnxg==",
"cpu": [
"arm64"
],
@@ -1404,9 +1404,9 @@
}
},
"node_modules/@next/swc-linux-arm64-musl": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.0.tgz",
"integrity": "sha512-sN9Pf+Zh+RpZAOmbR7d8KAA8T61CVhawtbEJ2Bk6QrRzx6Z/6haaF4UiwBzytM96GRRRWZh9/WALIEO3npMamA==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.3.tgz",
"integrity": "sha512-WwYbhWkhYBvBtib1K4W0kL8MW2snBD2A5b3SN4vPpqalZbZs5+bQ1yzAdepVoOqrFfEW3dmREy4Zs1MrWcrFbw==",
"cpu": [
"arm64"
],
@@ -1423,9 +1423,9 @@
}
},
"node_modules/@next/swc-linux-x64-gnu": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.0.tgz",
"integrity": "sha512-D5M5xLWQVd1CvR+L7BickM1weRfmM41x3L1NWcnKY/oyJJqr1qwaCgmu3dMAhLBOMdZwSuDCRV6DJRRpiUkbDQ==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.3.tgz",
"integrity": "sha512-QymWvfUwDEC5/lpJOsxX5VAbyoR2D13+2Jsjz4be7gT4LPqEgdpkeLIR/HFfCLgKzoMhpJbp6I/JnogyNZHcaA==",
"cpu": [
"x64"
],
@@ -1442,9 +1442,9 @@
}
},
"node_modules/@next/swc-linux-x64-musl": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.0.tgz",
"integrity": "sha512-8d5WLS6a9YalqpOgXdlbvonFu+sIgjA+CO6tGzetrpPVcUL56foa7B7664h41rAlbLi5fJwK4vWji3zf4QDy+w==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.3.tgz",
"integrity": "sha512-Vmjd9D7DpA4Vv3cUlr82QWgJD/BQZmns801vtC5VWHg6jCIA4a5vMKpQnfrM2pyCrp2eV0ENdUg4PlN3bAc2Yw==",
"cpu": [
"x64"
],
@@ -1461,9 +1461,9 @@
}
},
"node_modules/@next/swc-win32-arm64-msvc": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.0.tgz",
"integrity": "sha512-sQuOIiW3snb48UwrBcDMvFA/u03qtw2LeuSIxFIQ9AJuW9UG/4Ddsfo+eV73PnZwBhyncMtsKVh7PrzMol2/fA==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.3.tgz",
"integrity": "sha512-lG1pPdPLk7gTyGb00n5JIMLdBJgjb+UEhSdZvFbhUMg0DyC6z4B7RnpSKF9VCd4imkLObVbXOFA0kFCpw7yFow==",
"cpu": [
"arm64"
],
@@ -1477,9 +1477,9 @@
}
},
"node_modules/@next/swc-win32-x64-msvc": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.0.tgz",
"integrity": "sha512-6/33lCuxpdHUy27RegyGM/5uTpF7YZd3UR4D0gpkOA/tWY5YR7msbQjqPgCZmSmxrrTLGCXYA4A8vT2H5DPGTQ==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.3.tgz",
"integrity": "sha512-NmQC9RkJdnPXRaMxtkCzobB3teVjqF33oSOnwDfi+XYGWWYpt+xlGK3mtktSKLbdjwaWbJu2OkkMiRFGUUncKg==",
"cpu": [
"x64"
],
@@ -5976,12 +5976,12 @@
}
},
"node_modules/next": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/next/-/next-16.4.0.tgz",
"integrity": "sha512-N2C+9q89Z/oLrsepSRS4jRMtwmUZAoZuAHU0e9T6+sAB5DdhADmrnOW+zjYijlrYFmVfmQhGVGy9eMFoB7UgKg==",
"version": "16.4.3",
"resolved": "https://registry.npmjs.org/next/-/next-16.4.3.tgz",
"integrity": "sha512-OqxKTGi9u80FydydsMNYNjnuje9Au+kvHlt2GZ//ftdpDHm1dxKqAaENoOOTX5wKzn+9vaKUNIfZeyZUuLhCnA==",
"license": "MIT",
"dependencies": {
"@next/env": "16.4.0",
"@next/env": "16.4.3",
"@swc/helpers": "0.5.23",
"baseline-browser-mapping": "^2.9.19",
"caniuse-lite": "^1.0.30001579",
@@ -5995,15 +5995,15 @@
"node": ">=20.9.0"
},
"optionalDependencies": {
"@next/swc-darwin-arm64": "16.4.0",
"@next/swc-darwin-x64": "16.4.0",
"@next/swc-linux-arm64-gnu": "16.4.0",
"@next/swc-linux-arm64-musl": "16.4.0",
"@next/swc-linux-x64-gnu": "16.4.0",
"@next/swc-linux-x64-musl": "16.4.0",
"@next/swc-win32-arm64-msvc": "16.4.0",
"@next/swc-win32-x64-msvc": "16.4.0",
"sharp": "^0.35.4"
"@next/swc-darwin-arm64": "16.4.3",
"@next/swc-darwin-x64": "16.4.3",
"@next/swc-linux-arm64-gnu": "16.4.3",
"@next/swc-linux-arm64-musl": "16.4.3",
"@next/swc-linux-x64-gnu": "16.4.3",
"@next/swc-linux-x64-musl": "16.4.3",
"@next/swc-win32-arm64-msvc": "16.4.3",
"@next/swc-win32-x64-msvc": "16.4.3",
"sharp": "^0.35.5"
},
"peerDependencies": {
"@opentelemetry/api": "^1.1.0",
@@ -6849,9 +6849,9 @@
}
},
"node_modules/undici": {
"version": "7.29.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.29.1.tgz",
"integrity": "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==",
"version": "7.30.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz",
"integrity": "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==",
"dev": true,
"license": "MIT",
"engines": {
@@ -7149,9 +7149,9 @@
}
},
"node_modules/zod": {
"version": "4.6.5",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.5.tgz",
"integrity": "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
+1 -1
View File
@@ -23,7 +23,7 @@
"fumadocs-typescript": "^5.5.1",
"fumadocs-ui": "16.17.1",
"lucide-react": "^1.48.0",
"next": "^16.4.0",
"next": "^16.4.3",
"react": "^19.3.0",
"react-dom": "^19.3.0",
"recharts": "^3.10.1",
+1 -1
View File
@@ -69,7 +69,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# OpenClaw 2026.9.3 requires Node >=24.16.0 (or >=26.1.0). Install the
# OpenClaw 2026.10.6 requires Node >=24.22.1 <25 (or >=26.12.1). Install the
# Node 24 LTS line alongside Python 3.11. Also install git for packages
# that clone at install time.
RUN apt-get update && \
+15
View File
@@ -0,0 +1,15 @@
{
"expires": "2026-11-15",
"reason": "E2E harness only, never shipped in the wheel or SDK. npm 12.2.1 bundles undici 6.29.0 and ip-address 10.7.2; bundled copies ignore overrides and no newer npm release is available. OpenClaw is updated to 2026.10.6 and uses fixed Undici 8.12.3, so no OpenClaw path is excepted. Recheck npm upstream and remove these exact-path exceptions by the existing expiry.",
"advisories": {
"GHSA-4qv8-2p9j-2685": {
"node_modules/npm/node_modules/undici": "6.29.0"
},
"GHSA-xjj6-f33q-929c": {
"node_modules/npm/node_modules/undici": "6.29.0"
},
"GHSA-rxp7-6hxx-x8q5": {
"node_modules/npm/node_modules/ip-address": "10.7.2"
}
}
}
+302 -274
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -5,10 +5,14 @@
"description": "Locked CLI dependencies for the Docker wrap E2E harness",
"dependencies": {
"@openai/codex": "0.162.1",
"openclaw": "2026.10.2"
"openclaw": "2026.10.6"
},
"overrides": {
"@modelcontextprotocol/sdk": "1.32.1",
"npm": "12.2.1"
"npm": "12.2.1",
"zod": "4.6.6",
"openclaw": {
"undici": "8.12.3"
}
}
}
+6 -1
View File
@@ -49,13 +49,18 @@ class CompressionStoreBackend(Protocol):
"""
...
def set(self, hash_key: str, entry: CompressionEntry) -> None:
def set(self, hash_key: str, entry: CompressionEntry) -> bool | None:
"""Store an entry with the given hash key.
Args:
hash_key: The unique hash identifying the entry.
entry: The CompressionEntry to store.
Returns:
``False`` when a backend that absorbs its errors did not store it
(``CompressionStore.store`` then raises ``StorageError``);
``None`` (or ``True``) otherwise.
Note:
Overwrites any existing entry with the same key.
"""
+117
View File
@@ -0,0 +1,117 @@
"""Redis storage backend for CompressionStore: one CCR store for every replica.
A ``<<ccr:hash>>`` marker points at an original kept by whichever replica
compressed it; behind a gateway that spreads requests across replicas, the
retrieval can land anywhere. With ``HEADROOM_CCR_BACKEND=redis`` and
``HEADROOM_REDIS_URL``, every replica reads and writes one store.
Each entry is one key, ``<prefix>:ccr:<hash>``, holding the entry as JSON and
expiring when the entry does (``created_at + ttl``). A Redis error is a miss
(see :mod:`headroom.cache.redis_client`): a retrieval then fails as it would for
an expired entry, and compression never waits on Redis.
"""
from __future__ import annotations
import json
import time
from dataclasses import asdict, fields
from typing import TYPE_CHECKING, Any
from ..redis_client import Guard, connect, key_prefix
if TYPE_CHECKING:
from ..compression_store import CompressionEntry
class RedisBackend:
"""CCR entries in Redis, shared by every replica that points at it."""
#: Redis expires each entry with its TTL: CompressionStore neither caps nor
#: sweeps this store (a per-replica cap would evict other replicas' entries).
expires_entries = True
def __init__(self, url: str, client: Any = None) -> None:
self._client = client if client is not None else connect(url, setting="HEADROOM_REDIS_URL")
self._prefix = f"{key_prefix()}:ccr:"
self._guard = Guard("CCR store")
def _key(self, hash_key: str) -> str:
return self._prefix + hash_key
def get(self, hash_key: str) -> CompressionEntry | None:
raw = self._guard.call("read", lambda: self._client.get(self._key(hash_key)), None)
return None if raw is None else _decode(raw)
def set(self, hash_key: str, entry: CompressionEntry) -> bool:
"""Whether Redis took the entry (an error is logged, not raised)."""
remaining_ms = int((entry.created_at + entry.ttl - time.time()) * 1000)
if remaining_ms <= 0:
return False
blob = json.dumps(asdict(entry))
return bool(
self._guard.call(
"write", lambda: self._client.set(self._key(hash_key), blob, px=remaining_ms), None
)
)
def delete(self, hash_key: str) -> bool:
return bool(self._guard.call("delete", lambda: self._client.delete(self._key(hash_key)), 0))
def exists(self, hash_key: str) -> bool:
return bool(self._guard.call("read", lambda: self._client.exists(self._key(hash_key)), 0))
def clear(self) -> None:
keys = self._scan()
if keys:
self._guard.call("delete", lambda: self._client.delete(*keys), 0)
def count(self) -> int:
return len(self._scan())
def keys(self) -> list[str]:
return [k[len(self._prefix) :] for k in self._scan()]
def items(self) -> list[tuple[str, CompressionEntry]]:
out = []
for hash_key in self.keys():
entry = self.get(hash_key)
if entry is not None:
out.append((hash_key, entry))
return out
def purge_expired(self, now: float | None = None) -> int:
"""Redis has already dropped them."""
return 0
def get_stats(self) -> dict[str, Any]:
return {"backend_type": "redis", "entry_count": self.count()}
def _scan(self) -> list[str]:
def scan() -> list[str]:
return [
k.decode() if isinstance(k, bytes) else k
for k in self._client.scan_iter(match=_glob_escape(self._prefix) + "*", count=500)
]
return self._guard.call("scan", scan, [])
def _decode(raw: Any) -> CompressionEntry | None:
"""An entry from its JSON, or ``None`` when it is not one (a miss)."""
from ..compression_store import CompressionEntry
try:
data = json.loads(raw)
known = {f.name for f in fields(CompressionEntry)}
entry = CompressionEntry(**{k: v for k, v in data.items() if k in known})
except (ValueError, TypeError, AttributeError):
return None
texts_ok = isinstance(entry.original_content, str) and isinstance(entry.compressed_content, str)
times_ok = isinstance(entry.created_at, (int, float)) and isinstance(entry.ttl, int)
return entry if texts_ok and times_ok else None
def _glob_escape(text: str) -> str:
"""``text`` matched literally in a SCAN pattern."""
return "".join("\\" + c if c in "*?[]\\" else c for c in text)
+89 -8
View File
@@ -43,6 +43,7 @@ from contextvars import ContextVar
from dataclasses import asdict, dataclass, field, replace
from typing import TYPE_CHECKING, Any
from ..exceptions import StorageError
from ..log_safety import describe_exception, safe_id
if TYPE_CHECKING:
@@ -279,6 +280,14 @@ class CompressionStore:
self._heap_rebuild_threshold = 0.5
external_revision = getattr(self._backend, "external_revision", None)
self._backend_revision_reader = external_revision if callable(external_revision) else None
# A backend that expires entries itself and is shared by replicas
# (Redis) is bounded by TTL, not by this process's max_entries: counting
# it on every store would scan the shared keyspace, and evicting would
# remove other replicas' live entries.
self._backend_expires_entries = bool(getattr(self._backend, "expires_entries", False))
# A shared store's totals, as this process contributed them since it
# started: [original tokens stored, compressed tokens stored, retrievals].
self._own_totals = [0, 0, 0]
self._backend_revision = self._read_backend_revision()
@property
@@ -329,6 +338,11 @@ class CompressionStore:
Returns:
Hash key for retrieving this content.
Raises:
StorageError: The backend did not keep the entry (a shared store
refused the write or was unreachable). No hash is issued for
it: the caller must keep the original rather than emit a marker.
"""
# Generate hash from original content. Default: SHA-256[:24] of the
# original. When the caller provides `explicit_hash`, use it
@@ -424,7 +438,8 @@ class CompressionStore:
# turn a marker is re-encountered, so duplicate stores are common.
existing = self._backend.get(hash_key)
if existing is None:
self._evict_if_needed()
if not self._backend_expires_entries:
self._evict_if_needed()
else:
# Hash already present. Different content means a true (extremely
# rare with SHA256[:24]) collision; same content is a duplicate
@@ -445,7 +460,18 @@ class CompressionStore:
# Mark old heap entry as stale since we're replacing it.
self._mark_heap_entries_stale()
self._backend.set(hash_key, entry)
if self._backend.set(hash_key, entry) is False:
# Only a backend that absorbs its errors (Redis) returns False;
# it has logged why. A hash here would be a marker that never
# resolves, and producers drop the original once they hold one.
raise StorageError(
f"CCR store did not keep hash={hash_key}; keep the original content"
)
if self._backend_expires_entries:
if existing is None:
self._own_totals[0] += entry.original_tokens
self._own_totals[1] += entry.compressed_tokens
return hash_key # no local index: Redis expires it
# MEDIUM FIX #16: Add to eviction heap for O(log n) eviction
heapq.heappush(self._eviction_heap, (entry.created_at, hash_key))
heapq.heappush(
@@ -485,8 +511,13 @@ class CompressionStore:
# Track access for feedback
entry.record_access(query)
# Update the backend with the modified entry
self._backend.set(hash_key, entry)
# Update the backend with the modified entry. Not a shared store:
# writing the whole entry back per read races other replicas and
# resends the original; retrieval events below stay per process.
if self._backend_expires_entries:
self._own_totals[2] += 1
else:
self._backend.set(hash_key, entry)
# Log retrieval event
if self._enable_feedback:
@@ -654,6 +685,25 @@ class CompressionStore:
def get_stats(self) -> dict[str, Any]:
"""Get store statistics for monitoring."""
if self._backend_expires_entries:
# Totals over the store would read every replica's entries (a GET
# each) under the lock retrievals take: a shared store reports the
# entry count across replicas, and the totals this replica added
# since it started ("totals_scope").
backend_stats = self._backend.get_stats()
with self._lock:
original, compressed, retrievals = self._own_totals
return {
"entry_count": backend_stats["entry_count"],
"max_entries": self._max_entries,
"default_ttl_seconds": self._default_ttl,
"total_original_tokens": original,
"total_compressed_tokens": compressed,
"total_retrievals": retrievals,
"totals_scope": "this_replica",
"event_count": len(self._retrieval_events),
"backend": backend_stats,
}
with self._lock:
# Clean expired entries
self._clean_expired()
@@ -704,10 +754,15 @@ class CompressionStore:
return ComponentStats(
name="compression_store",
entry_count=self._backend.count(),
entry_count=backend_stats.get("entry_count", 0)
if self._backend_expires_entries
else self._backend.count(),
size_bytes=bytes_used,
budget_bytes=None, # No budget set yet
hits=sum(1 for _, e in self._backend.items() if e.retrieval_count > 0),
# A shared store would be read whole to count these.
hits=0
if self._backend_expires_entries
else sum(1 for _, e in self._backend.items() if e.retrieval_count > 0),
misses=0, # CompressionStore doesn't track misses directly
evictions=0, # Would need to track this separately
)
@@ -868,6 +923,8 @@ class CompressionStore:
def _mark_heap_entries_stale(self) -> None:
"""Record lazy tuples invalidated by deleting or replacing an entry."""
if self._backend_expires_entries:
return # no index kept for a self-expiring backend
self._stale_heap_entries += 1
self._stale_expiration_heap_entries += 1
@@ -892,6 +949,8 @@ class CompressionStore:
def _rebuild_heap_if_needed(self) -> None:
"""Rebuild both indexes when either stale ratio reaches the threshold."""
if self._backend_expires_entries:
return # rebuilding would scan the shared store
heap_size = len(self._eviction_heap)
expiration_heap_size = len(self._expiration_heap)
stale_ratio = self._stale_heap_entries / heap_size if heap_size else 0
@@ -1155,8 +1214,10 @@ def _create_default_ccr_backend() -> CompressionStoreBackend | None:
Default (env unset or "sqlite"): SQLiteBackend at workspace_dir()/ccr_store.db
— restart-safe and shared across worker processes, which the
session-scale 30-minute TTL assumes.
"memory" opts back into the in-process dict. Other values load
adapters via setuptools entry point 'headroom.ccr_backend'.
"memory" opts back into the in-process dict. "redis" shares one store
across replicas (HEADROOM_REDIS_URL; headroom.cache.backends.redis) unless a
plugin registers that name. Other values load adapters via setuptools entry
point 'headroom.ccr_backend'.
Returns None to use InMemoryBackend.
Stateless mode (``--stateless`` / ``HEADROOM_STATELESS``) never opens the
@@ -1171,6 +1232,13 @@ def _create_default_ccr_backend() -> CompressionStoreBackend | None:
from ..paths import persistence_allowed
backend_type = (os.environ.get("HEADROOM_CCR_BACKEND") or "").strip().lower()
session_store = os.environ.get("HEADROOM_COMPRESS_SESSION_STORE", "").strip()
if not backend_type and session_store:
# Replicas sharing compress sessions share the CCR store too: a marker
# in a replayed transcript must resolve on whichever replica serves it.
from .backends.redis import RedisBackend
return RedisBackend(session_store)
if backend_type == "memory":
return None
if not backend_type or backend_type == "sqlite":
@@ -1193,6 +1261,19 @@ def _create_default_ccr_backend() -> CompressionStoreBackend | None:
all_eps = entry_points(group="headroom.ccr_backend")
ep = next((e for e in all_eps if e.name == backend_type), None)
if ep is None and backend_type == "redis":
# Built in: one store for every replica behind a gateway. A plugin
# registered as "redis" still wins, above.
from .backends.redis import RedisBackend
url = os.environ.get("HEADROOM_REDIS_URL", "").strip() or session_store
if not url:
logger.error(
"HEADROOM_CCR_BACKEND=redis needs HEADROOM_REDIS_URL; using the "
"in-process store, so a marker resolves only on the replica that made it"
)
return None
return RedisBackend(url)
if ep is None:
logger.warning(
"HEADROOM_CCR_BACKEND=%s but no entry point headroom.ccr_backend[%s]",
+74 -23
View File
@@ -1206,6 +1206,11 @@ class PrefixCacheTracker:
# builds the manager.
self.restored_from_disk = False
self.restored_maturation_state: dict[str, Any] | None = None
# Shared-store state (headroom.cache.shared_sessions): the write token
# this tracker matches ("" when never shared) and the digests of the
# messages known to be stored with it.
self.shared_token = ""
self.shared_digests: frozenset[str] = frozenset()
# Stats
self._busts_avoided: int = 0
@@ -1509,16 +1514,20 @@ class PrefixCacheTracker:
def is_expired_for_cache_ttl(self, cache_ttl_seconds: int | None) -> bool:
"""Check expiry including the longest configured or observed cache lifetime."""
return (time.time() - self._last_activity) > self.retention_seconds(cache_ttl_seconds)
def retention_seconds(self, cache_ttl_seconds: int | None = None) -> float:
"""How long this tracker is kept after its last activity: the session
TTL, or the longest configured or observed cache lifetime plus a margin."""
observed_ttl = max(
self._cache_ttl_seconds or 0,
self.config.cache_ttl_seconds or 0,
cache_ttl_seconds or 0,
)
retention = max(
return max(
self.config.session_ttl_seconds,
observed_ttl + _CACHE_TTL_CLEANUP_MARGIN_SECONDS if observed_ttl else 0,
)
return (time.time() - self._last_activity) > retention
def observe_cache_ttl(self, cache_ttl_seconds: int | None) -> None:
"""Remember the longest provider cache lifetime observed for this lineage."""
@@ -2144,6 +2153,14 @@ class SessionTrackerStore:
pairs mostly repeat the same messages, so this keeps the file near one
copy of each conversation instead of up to eleven.
"""
meta, table = self._tracker_parts(key, tracker, session_id)
return f'{{"meta":{json.dumps(meta)},"messages":[{",".join(table)}]}}'
def _tracker_parts(
self, key: str, tracker: PrefixCacheTracker, session_id: str | None
) -> tuple[dict[str, Any], list[str]]:
"""A tracker as its metadata, whose message lists are indexes into the
table, and the table: each distinct message once, as JSON."""
index: dict[str, int] = {}
memo: dict[int, list[int]] = {}
@@ -2172,7 +2189,7 @@ class SessionTrackerStore:
"history": [[ref(snap), t] for snap, t in self._lineage_history.get(key, ())],
"maturation": None if maturation is None else maturation.export_state(),
}
return f'{{"meta":{json.dumps(meta)},"messages":[{",".join(index)}]}}'
return meta, list(index)
def load_state(self, path: str) -> int:
"""Resume the trackers :meth:`save_state` wrote, before serving.
@@ -2213,6 +2230,58 @@ class SessionTrackerStore:
)
return restored
def _decode_tracker(self, entry: Any, now: float) -> PrefixCacheTracker | None:
"""One :meth:`_encode_tracker` entry as a tracker marked restored, or
``None`` when it has expired. Raises on a malformed entry."""
meta, table = entry["meta"], entry["messages"]
tracker = PrefixCacheTracker(str(meta["provider"]), self._default_config)
tracker._last_activity = float(meta["last_activity"])
tracker.observe_cache_ttl(meta["cache_ttl"])
# NaN or a future stamp would never expire.
if tracker.is_expired or not tracker._last_activity <= now:
return None
(
tracker._turn_number,
tracker._cached_token_count,
tracker._cached_message_count,
tracker._last_original_messages,
tracker._last_forwarded_messages,
) = _decode_turn_state(table, meta["state"])
tracker._turn_states = {int(t): _decode_turn_state(table, s) for t, s in meta["turns"]}
tracker.restored_from_disk = True
if meta["maturation"] is not None:
from headroom.transforms.read_maturation import ReadMaturationManager
tracker.restored_maturation_state = ReadMaturationManager.validate_state(
meta["maturation"]
)
return tracker
def encode_shared(
self, key: str, tracker: PrefixCacheTracker
) -> tuple[dict[str, Any], list[str]]:
"""``tracker`` for another process (headroom.cache.shared_sessions): its
metadata and its message table, each distinct message once, as JSON.
Raises when its messages are not JSON."""
return self._tracker_parts(key, tracker, None)
def decode_shared(self, meta: Any, messages: list[Any]) -> PrefixCacheTracker | None:
"""The tracker :meth:`encode_shared` described, marked restored so its
next turn seeds the compression cache from it; ``None`` when it has
expired. Raises on malformed input. Does not install it."""
if not isinstance(meta, dict):
raise ValueError("tracker metadata is not an object")
now = time.time()
# Written on another host: a clock ahead of ours is not a future stamp.
meta = {**meta, "last_activity": min(float(meta["last_activity"]), now)}
return self._decode_tracker({"meta": meta, "messages": messages}, now)
def install(self, key: str, tracker: PrefixCacheTracker) -> None:
"""Make ``tracker`` the one under ``key``. Call on the event loop, or
from a worker thread only for a key already present (replacing a value
does not resize the dict the loop may be iterating)."""
self._trackers[key] = tracker
def _decode_state(self, data: Any) -> int:
"""Validate the whole file first, then install it; a bad file installs nothing."""
from headroom.cache.compression_store import CompressionEntry, get_compression_store
@@ -2228,27 +2297,9 @@ class SessionTrackerStore:
# Oldest first, so each family keeps its lineages in creation order.
for entry in reversed(data["trackers"]):
meta, table = entry["meta"], entry["messages"]
tracker = PrefixCacheTracker(str(meta["provider"]), self._default_config)
tracker._last_activity = float(meta["last_activity"])
tracker.observe_cache_ttl(meta["cache_ttl"])
# NaN or a future stamp would never expire.
if tracker.is_expired or not tracker._last_activity <= now:
tracker = self._decode_tracker(entry, now)
if tracker is None:
continue
(
tracker._turn_number,
tracker._cached_token_count,
tracker._cached_message_count,
tracker._last_original_messages,
tracker._last_forwarded_messages,
) = _decode_turn_state(table, meta["state"])
tracker._turn_states = {int(t): _decode_turn_state(table, s) for t, s in meta["turns"]}
tracker.restored_from_disk = True
if meta["maturation"] is not None:
from headroom.transforms.read_maturation import ReadMaturationManager
tracker.restored_maturation_state = ReadMaturationManager.validate_state(
meta["maturation"]
)
key = str(meta["key"])
trackers[key] = tracker
history = deque(
+121
View File
@@ -0,0 +1,121 @@
"""Redis connections for state that several Headroom replicas share.
The CCR store (``HEADROOM_CCR_BACKEND=redis``) and shared ``/v1/compress``
sessions keep their keys under ``HEADROOM_REDIS_KEY_PREFIX`` (default
``headroom``), so two deployments can share one Redis without sharing state.
Redis holds tool output and transcripts verbatim: it must be private to the
deployment, with authentication and TLS (``rediss://``). Plain ``redis://`` to a
host other than this machine is accepted with a warning.
Shared state is an optimisation of a request, never a condition for it: a Redis
error is a miss, logged when it starts and when Redis is back, and Redis is not
asked again for :data:`BACKOFF_SECONDS` after a connection failure, so an outage
costs requests nothing but the sharing.
"""
from __future__ import annotations
import logging
import os
import re
import threading
import time
from collections.abc import Callable
from typing import Any, TypeVar
from urllib.parse import urlsplit
from headroom.exceptions import ConfigurationError
logger = logging.getLogger(__name__)
PREFIX_ENV = "HEADROOM_REDIS_KEY_PREFIX"
#: Seconds Redis is skipped after a connection error.
BACKOFF_SECONDS = 5.0
#: Seconds a command may take. Commands carry small values (an entry, a few
#: messages), so a slow one is an outage, not a large transfer.
TIMEOUT_SECONDS = 1.0
T = TypeVar("T")
def key_prefix() -> str:
return os.environ.get(PREFIX_ENV, "").strip() or "headroom"
def connect(url: str, *, setting: str) -> Any:
"""A client for ``url``. Raises :class:`ConfigurationError`, naming
``setting``, when the URL is not Redis or the client is not installed.
Does not connect: an unreachable Redis does not stop startup."""
scheme = urlsplit(url).scheme
if scheme not in ("redis", "rediss", "unix"):
raise ConfigurationError(f"{setting} must be a redis://, rediss:// or unix:// URL")
try:
import redis
except ImportError as exc:
raise ConfigurationError(
f"{setting} names Redis but the client is not installed: "
"pip install 'headroom-ai[redis]'"
) from exc
from headroom.proxy.loopback_guard import is_loopback_host
host = urlsplit(url).hostname
if scheme == "redis" and not is_loopback_host(host):
logger.warning(
"%s: plain redis:// to %s; Redis will hold tool output and transcripts, "
"so use rediss:// with authentication on a private network",
setting,
host,
)
return redis.Redis.from_url(
url, socket_timeout=TIMEOUT_SECONDS, socket_connect_timeout=TIMEOUT_SECONDS
)
class Guard:
"""Runs Redis calls for one feature: an error is a miss, logged when that
kind of call (``what``: read, write, ...) starts failing and when it works
again; after a connection error Redis is skipped for :data:`BACKOFF_SECONDS`.
Tracking each kind apart keeps a Redis that serves reads but refuses writes
(``maxmemory`` with ``noeviction``) from logging on every request."""
def __init__(self, feature: str) -> None:
import redis
self._feature = feature
self._errors: tuple[type[BaseException], ...] = (redis.RedisError,)
self._connection_errors = (redis.ConnectionError, redis.TimeoutError)
self._lock = threading.Lock()
self._skip_until = 0.0
self._failing: set[str] = set()
def call(self, what: str, fn: Callable[[], T], default: T) -> T:
if time.monotonic() < self._skip_until:
return default
try:
result = fn()
except self._errors as exc:
with self._lock:
if isinstance(exc, self._connection_errors):
self._skip_until = time.monotonic() + BACKOFF_SECONDS
if what not in self._failing:
self._failing.add(what)
logger.warning(
"%s: Redis %s failed (%s: %s); carrying on without shared state",
self._feature,
what,
type(exc).__name__,
_redact(str(exc)),
)
return default
if what in self._failing:
with self._lock:
if what in self._failing:
self._failing.discard(what)
logger.info("%s: Redis %s works again", self._feature, what)
return result
def _redact(message: str) -> str:
"""``message`` with any URL credentials (``//user:password@``) masked."""
return re.sub(r"//[^/@\s]*@", "//***@", message)
+159
View File
@@ -0,0 +1,159 @@
"""SQLite tier behind the content router's in-memory compression cache.
The router keeps recent results in a byte-budgeted LRU; this file holds the rest,
so an entry the budget evicted comes back from disk instead of being compressed
again (which costs a Kompress pass and can give different bytes, rewriting a
cached prompt prefix). It also survives a restart and is shared by worker
processes (WAL), like the CCR store; WAL needs a local filesystem.
Each router reads and writes under its own namespace (a digest of its config and
the headroom version), so routers configured differently, or a restart with
other settings, never serve each other's output. Results carrying a CCR marker
are not written here: their originals live in the CCR store, on its own clock.
The file holds compressed tool output, so it follows the CCR store's rules:
owner-only, ``workspace_dir()/compression_cache.db`` (``HEADROOM_COMPRESSION_CACHE_PATH``
to move it), expired rows deleted on open, never opened in stateless mode, and
``HEADROOM_COMPRESSION_CACHE_DISK=0`` keeps the cache in memory only. A database
error is a miss, never a failed request.
"""
from __future__ import annotations
import logging
import os
import sqlite3
import threading
import time
from pathlib import Path
from ..fileperms import connect_private_sqlite
logger = logging.getLogger(__name__)
_SCHEMA = """
CREATE TABLE IF NOT EXISTS results (
k TEXT PRIMARY KEY,
text TEXT NOT NULL,
ratio REAL NOT NULL,
strategy TEXT NOT NULL,
expires REAL NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_results_expires ON results (expires);
"""
#: Expired rows are deleted every this many writes, and on open.
_PURGE_EVERY = 1000
class ResultStore:
"""Compressed results by key; an entry expires ``ttl_seconds`` after it was
last read or written. Thread-safe; several processes may share the file."""
def __init__(self, path: Path, ttl_seconds: float) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
self._path = path
self._ttl = ttl_seconds
self._lock = threading.Lock()
self._writes = 0
self._warned = False
self._db = connect_private_sqlite(
path, what="compression cache", check_same_thread=False, isolation_level=None
)
self._db.execute("PRAGMA busy_timeout=5000")
self._db.execute("PRAGMA journal_mode=WAL")
self._db.execute("PRAGMA synchronous=NORMAL")
self._db.executescript(_SCHEMA)
# Sessions that ended while the proxy was down go now.
self._db.execute("DELETE FROM results WHERE expires <= ?", (time.time(),))
def get(self, key: str) -> tuple[str, float, str] | None:
now = time.time()
try:
with self._lock:
row = self._db.execute(
"SELECT text, ratio, strategy, expires FROM results "
"WHERE k = ? AND expires > ?",
(key, now),
).fetchone()
# Keep what a live session still reads; refresh at most every half ttl.
if row is not None and row[3] - now < self._ttl / 2:
self._db.execute(
"UPDATE results SET expires = ? WHERE k = ?", (now + self._ttl, key)
)
except sqlite3.Error as exc:
self._failed("read", exc)
return None
return None if row is None else (row[0], row[1], row[2])
def put(self, key: str, text: str, ratio: float, strategy: str) -> None:
now = time.time()
try:
with self._lock:
self._db.execute(
"INSERT OR REPLACE INTO results (k, text, ratio, strategy, expires) "
"VALUES (?, ?, ?, ?, ?)",
(key, text, ratio, strategy, now + self._ttl),
)
self._writes += 1
if self._writes % _PURGE_EVERY == 0:
self._db.execute("DELETE FROM results WHERE expires <= ?", (now,))
except sqlite3.Error as exc:
self._failed("write", exc)
def touch(self, key: str) -> None:
"""Keep ``key`` for another ttl (it is in use from memory)."""
self._run("UPDATE results SET expires = ? WHERE k = ?", (time.time() + self._ttl, key))
def delete(self, key: str) -> None:
self._run("DELETE FROM results WHERE k = ?", (key,))
def clear_prefix(self, prefix: str) -> None:
"""Delete every row whose key starts with ``prefix`` (a router's namespace)."""
self._run("DELETE FROM results WHERE substr(k, 1, ?) = ?", (len(prefix), prefix))
def _run(self, sql: str, args: tuple[object, ...]) -> None:
try:
with self._lock:
self._db.execute(sql, args)
except sqlite3.Error as exc:
self._failed("write", exc)
def _failed(self, what: str, exc: sqlite3.Error) -> None:
if not self._warned:
self._warned = True
logger.warning(
"compression cache: %s of %s failed (%s); treating it as a miss. "
"Check the disk, or set HEADROOM_COMPRESSION_CACHE_DISK=0.",
what,
self._path,
exc,
)
def open_result_store(ttl_seconds: float) -> ResultStore | None:
"""The disk tier, or ``None`` (memory only) in stateless mode, with
``HEADROOM_COMPRESSION_CACHE_DISK=0``, or when the file cannot be opened."""
from ..paths import persistence_allowed, workspace_dir
if os.environ.get("HEADROOM_COMPRESSION_CACHE_DISK", "1").strip().lower() in (
"0",
"false",
"no",
"off",
):
return None
if not persistence_allowed("compression result cache (compression_cache.db)"):
return None
configured = os.environ.get("HEADROOM_COMPRESSION_CACHE_PATH", "").strip()
path = Path(configured).expanduser() if configured else workspace_dir() / "compression_cache.db"
try:
return ResultStore(path, ttl_seconds)
except (OSError, sqlite3.Error) as exc:
logger.warning(
"compression cache: cannot open %s (%s); keeping results in memory only. "
"Set HEADROOM_COMPRESSION_CACHE_PATH to a writable file or "
"HEADROOM_COMPRESSION_CACHE_DISK=0.",
path,
exc,
)
return None
+276
View File
@@ -0,0 +1,276 @@
"""Session-aware ``/v1/compress`` state shared by several Headroom replicas.
A compress session's state is its prefix tracker: the transcript it was last
given and the one it returned, which every later turn must replay byte for byte
so the provider's prompt cache holds. In memory, only the replica that served
the last turn has it, so a gateway running several replicas must pin each
session to one (``session_affinity``).
With ``HEADROOM_COMPRESS_SESSION_STORE=redis://...`` every replica also keeps
each session in Redis, and any replica can serve its next turn. Per session:
* ``<prefix>:session:{<digest>}:msgs``, a hash of message digest to message
JSON. The original and returned transcripts mostly share messages, and each
turn mostly repeats the last one's, so each message is stored once and a turn
writes only the messages Redis does not have yet: what the turn added, and
any message whose bytes changed (a moved cache marker, an edit, a compaction);
* ``<prefix>:session:{<digest>}:meta``, the tracker's counters and its
transcripts as lists of digests (``m``), and a write token (``t``).
Before a turn a replica reads the token (one small ``HGET``). When another
replica has written since, it reads the metadata and only the messages it does
not already hold, and the turn seeds its compression cache from that tracker as
after a restart (:func:`~headroom.cache.prefix_tracker.seed_restored_compression_cache`).
After the turn it writes the new messages, then the metadata if the token is
still the one it read and every message it references is stored, checked in
one script (compare-and-set): a random token, so a lost key or a failover
cannot leave a replica believing stale state is current. A missing key
resets the replica, whose next write stores the session whole again. Fetched
messages are checked against their digests. Both keys expire with the tracker.
A Redis error never fails a turn (:mod:`headroom.cache.redis_client`): the
replica serves from its own memory, as without the store. CCR originals behind
the markers in these transcripts live in the shared CCR store, which this
setting selects too unless ``HEADROOM_CCR_BACKEND`` names another. Requires the
``redis`` extra.
"""
from __future__ import annotations
import functools
import hashlib
import json
import logging
import os
import uuid
from typing import TYPE_CHECKING, Any
from .redis_client import Guard, connect, key_prefix
if TYPE_CHECKING:
from .prefix_tracker import PrefixCacheTracker, SessionTrackerStore
logger = logging.getLogger(__name__)
STORE_ENV = "HEADROOM_COMPRESS_SESSION_STORE"
#: Messages per HSET/HMGET, so no single command carries a whole transcript.
_CHUNK = 256
# Install ARGV[2] as the token and ARGV[3] as the metadata if the token is still
# ARGV[1] ("" when the key must not exist) and the messages hash (KEYS[2]) holds
# every message the metadata references (ARGV[5:], including those this write
# just sent: Redis can evict the hash between those writes and this script).
# 1 on success, 0 when another replica wrote first, 2 when the messages hash
# lost one.
_CAS = """
local t = redis.call('HGET', KEYS[1], 't') or ''
if t ~= ARGV[1] then return 0 end
for i = 5, #ARGV do
if redis.call('HEXISTS', KEYS[2], ARGV[i]) == 0 then return 2 end
end
redis.call('HSET', KEYS[1], 't', ARGV[2], 'm', ARGV[3])
redis.call('PEXPIRE', KEYS[1], ARGV[4])
return 1
"""
_FAILED = object()
class SharedSessions:
"""Compress-session trackers in Redis, beside the in-memory store."""
def __init__(self, client: Any) -> None:
self._client = client
self._cas = client.register_script(_CAS)
self._guard = Guard("compress sessions")
self._prefix = f"{key_prefix()}:session:"
def fetch(
self, store: SessionTrackerStore, key: str, local: PrefixCacheTracker | None
) -> PrefixCacheTracker | None:
"""The session's tracker when another replica wrote a newer one than
``local``, decoded but not installed; else ``None``."""
meta_key, msgs_key = self._keys(key)
token = self._guard.call("read", lambda: self._client.hget(meta_key, "t"), _FAILED)
if token is _FAILED:
return None
if token is None:
if local is not None: # lost or expired: the next write stores it whole
local.shared_token, local.shared_digests = "", frozenset()
return None
try:
if local is not None and _text(token) == local.shared_token:
return None
except UnicodeDecodeError:
return self._drop(local, meta_key, msgs_key)
row = self._guard.call("read", lambda: self._client.hmget(meta_key, "t", "m"), None)
if row is None:
return None
if row[0] is None: # expired between the two reads
return None
try:
token = _text(row[0])
except UnicodeDecodeError:
return self._drop(local, meta_key, msgs_key)
try:
meta = json.loads(_text(row[1]))
digests = meta.pop("table")
if not isinstance(digests, list) or not all(isinstance(d, str) for d in digests):
raise ValueError("table is not a list of digests")
except (TypeError, ValueError, KeyError, AttributeError, IndexError):
return self._unusable(local, token, "metadata", meta_key)
held = self._held(store, key, local)
missing = [d for d in dict.fromkeys(digests) if d not in held]
for start in range(0, len(missing), _CHUNK):
part = missing[start : start + _CHUNK]
values = self._guard.call(
"read", functools.partial(self._client.hmget, msgs_key, part), None
)
if values is None:
return None
for digest, value in zip(part, values, strict=True):
try:
text = None if value is None else _text(value)
except UnicodeDecodeError:
text = None
if text is None or _digest(text) != digest:
return self._unusable(local, token, "messages", msgs_key)
held[digest] = text
try:
tracker = store.decode_shared(meta, [json.loads(held[d]) for d in digests])
except (TypeError, ValueError, KeyError, AttributeError, OverflowError):
return self._unusable(local, token, "metadata", meta_key)
if tracker is None:
logger.info("compress sessions: shared state for %s has expired", meta_key)
return None
tracker.shared_token, tracker.shared_digests = token, frozenset(digests)
return tracker
@staticmethod
def _unusable(
local: PrefixCacheTracker | None, token: str, what: str, name: str
) -> PrefixCacheTracker | None:
"""Shared state this replica cannot use (evicted, corrupt or altered):
keep its own, and claim the current token with no messages known to be
stored, so its next write replaces the session whole."""
logger.warning("compress sessions: unusable %s in %s; this replica rewrites it", what, name)
if local is not None:
local.shared_token, local.shared_digests = token, frozenset()
return None
def _drop(
self, local: PrefixCacheTracker | None, meta_key: str, msgs_key: str
) -> PrefixCacheTracker | None:
"""A token that is not text cannot be claimed: delete the session, so
the next write stores it whole."""
logger.warning("compress sessions: corrupt token in %s; deleting the session", meta_key)
self._guard.call("write", lambda: self._client.delete(meta_key, msgs_key), 0)
if local is not None:
local.shared_token, local.shared_digests = "", frozenset()
return None
def publish(self, store: SessionTrackerStore, key: str, tracker: PrefixCacheTracker) -> None:
"""Write the messages Redis lacks, then the metadata unless another
replica wrote since ``tracker`` was read."""
try:
meta, table = store.encode_shared(key, tracker)
except (TypeError, ValueError) as exc: # messages that are not JSON
logger.debug("compress sessions: tracker not shareable (%s)", exc)
return
digests = [_digest(m) for m in table]
meta["table"] = digests
meta_json = json.dumps(meta)
ttl_ms = max(1000, int(tracker.retention_seconds() * 1000))
meta_key, msgs_key = self._keys(key)
referenced = sorted(set(digests))
def write(known: frozenset[str]) -> tuple[int, str]:
new = [(d, m) for d, m in zip(digests, table, strict=True) if d not in known]
token = uuid.uuid4().hex
pipe = self._client.pipeline(transaction=False)
for start in range(0, len(new), _CHUNK):
pipe.hset(msgs_key, mapping=dict(new[start : start + _CHUNK]))
pipe.pexpire(msgs_key, ttl_ms)
pipe.execute()
args = [tracker.shared_token, token, meta_json, ttl_ms, *referenced]
return int(self._cas(keys=[meta_key, msgs_key], args=args)), token
result = self._guard.call("write", lambda: write(tracker.shared_digests), None)
if result is not None and result[0] == 2:
# The messages hash lost entries (evicted on its own): store it whole.
result = self._guard.call("write", lambda: write(frozenset()), None)
if result is None:
return
written, token = result
if written == 1:
tracker.shared_token, tracker.shared_digests = token, frozenset(digests)
self._prune(msgs_key, set(digests))
elif written == 2:
# Evicted again during the whole rewrite: publish nothing, so no
# replica takes a session it cannot replay; the next turn retries.
logger.warning("compress sessions: messages of %s evicted while writing", meta_key)
elif written == 0:
# Two replicas ran turns of one session at once, which the caller's
# contract excludes; the next turn takes the state that won.
logger.warning("compress sessions: another replica wrote %s first", meta_key)
def _prune(self, msgs_key: str, referenced: set[str]) -> None:
"""Drop messages no transcript references (moved markers, edits,
compactions) once they outnumber the referenced ones."""
size = self._guard.call("write", lambda: int(self._client.hlen(msgs_key)), 0)
if size <= 2 * len(referenced):
return
def prune() -> None:
stale = [k for k in map(_text, self._client.hkeys(msgs_key)) if k not in referenced]
for start in range(0, len(stale), _CHUNK):
self._client.hdel(msgs_key, *stale[start : start + _CHUNK])
self._guard.call("write", prune, None)
def _keys(self, key: str) -> tuple[str, str]:
# One hash tag: the compare-and-set script names both keys, which Redis
# Cluster allows only within one slot.
base = f"{self._prefix}{{{hashlib.blake2b(key.encode(), digest_size=16).hexdigest()}}}"
return f"{base}:meta", f"{base}:msgs"
@staticmethod
def _held(
store: SessionTrackerStore, key: str, local: PrefixCacheTracker | None
) -> dict[str, str]:
"""The messages this replica already holds for the session, by digest."""
if local is None:
return {}
try:
_, table = store.encode_shared(key, local)
except (TypeError, ValueError):
return {}
return {_digest(m): m for m in table}
def _digest(message_json: str) -> str:
return hashlib.blake2b(message_json.encode(), digest_size=16).hexdigest()
def _text(value: Any) -> str:
return value.decode() if isinstance(value, bytes) else str(value)
def open_shared_sessions() -> SharedSessions | None:
"""The shared store ``HEADROOM_COMPRESS_SESSION_STORE`` names, or ``None``.
Raises :class:`~headroom.exceptions.ConfigurationError` when it is set but
unusable, so a replica meant to share sessions never starts without it."""
url = os.environ.get(STORE_ENV, "").strip()
if not url:
return None
client = connect(url, setting=STORE_ENV)
ccr = (os.environ.get("HEADROOM_CCR_BACKEND") or "").strip().lower()
if ccr not in ("", "redis"):
logger.warning(
"%s is set but HEADROOM_CCR_BACKEND=%s: CCR markers in a session's "
"transcript resolve only on the replica that made them",
STORE_ENV,
ccr,
)
return SharedSessions(client)
+41 -20
View File
@@ -36,6 +36,7 @@ from typing import TYPE_CHECKING, Any
from headroom import paths as _paths
from headroom import savings_ledger
from headroom.cache.compression_store import format_retrieval_miss_detail
from headroom.exceptions import StorageError
from headroom.log_safety import describe_exception, redact_url, safe_id
from headroom.telemetry import session as telemetry_session
@@ -460,16 +461,31 @@ class HeadroomMCPServer:
# Store original in local store for later retrieval
store = self._get_local_store()
hash_key = store.store(
original=content,
compressed=compressed_content
if isinstance(compressed_content, str)
else json.dumps(compressed_content),
original_tokens=input_tokens,
compressed_tokens=output_tokens,
compression_strategy="mcp_compress",
ttl=MCP_SESSION_TTL,
)
try:
hash_key = store.store(
original=content,
compressed=compressed_content
if isinstance(compressed_content, str)
else json.dumps(compressed_content),
original_tokens=input_tokens,
compressed_tokens=output_tokens,
compression_strategy="mcp_compress",
ttl=MCP_SESSION_TTL,
)
except StorageError as e:
# No stored original: hand back the content itself, which also
# keeps out any marker the pipeline put in the compressed text.
logger.warning("headroom_compress: returning the original, CCR store refused it: %s", e)
return {
"compressed": content,
"hash": None,
"original_tokens": input_tokens,
"compressed_tokens": input_tokens,
"tokens_saved": 0,
"savings_percent": 0,
"transforms": [],
"note": "Not compressed: the CCR store could not keep the original.",
}
# Track stats
strategy = (
@@ -1085,16 +1101,21 @@ class HeadroomMCPServer:
# Fresh read: store in CCR and cache the hash
store = self._get_local_store()
token_estimate = self._estimate_tokens(content)
ccr_hash = store.store(
original=content,
compressed=f"[File: {path.name}, {line_count} lines]",
original_tokens=token_estimate,
compressed_tokens=5,
tool_name="headroom_read",
ttl=MCP_SESSION_TTL,
)
self._file_cache[str_path] = (content_hash, ccr_hash, line_count, token_estimate)
try:
ccr_hash = store.store(
original=content,
compressed=f"[File: {path.name}, {line_count} lines]",
original_tokens=token_estimate,
compressed_tokens=5,
tool_name="headroom_read",
ttl=MCP_SESSION_TTL,
)
except StorageError as e:
# The full content is returned below either way; without a stored
# original, a re-read must not answer with a hash.
logger.warning("headroom_read: not cached, the CCR store refused it: %s", e)
else:
self._file_cache[str_path] = (content_hash, ccr_hash, line_count, token_estimate)
# Return full content with line numbers (like Claude Code's Read tool)
numbered_lines = []
+2 -1
View File
@@ -36,6 +36,7 @@ if TYPE_CHECKING:
# Import the enum from the dependency-free module so importing the compressor
# does not eagerly import trained_router (and thus torch/transformers) — that
# eager import crashed on Python 3.13+ (#2513).
from .decoder_guard import pillow_is_safe
from .image_types import ImageMemo, Technique
logger = logging.getLogger(__name__)
@@ -702,7 +703,7 @@ class ImageCompressor:
Returns:
Messages with compressed images
"""
if not self.has_images(messages):
if not self.has_images(messages) or not pillow_is_safe():
return messages
# Step 1: Tile-boundary optimization (always safe, pure math)
+39
View File
@@ -0,0 +1,39 @@
"""Never decode untrusted images with a Pillow that has known decoder bugs.
Pillow 13.0.0 is the only fix for ten decoder CVEs on untrusted images
(CVE-2026-112395, -112895 and others). uv.lock and the release image take 13, but the published
package metadata cannot require it: fastembed caps ``pillow<13``, so
``pip install headroom-ai[all]`` resolves 12.x, and Python 3.10 has no Pillow 13
at all. On those installs Headroom forwards images unchanged instead of opening
them. Remove this once fastembed allows Pillow 13 and the image extra requires it.
"""
from __future__ import annotations
import functools
import logging
logger = logging.getLogger(__name__)
FIXED_PILLOW_MAJOR = 13
@functools.cache
def pillow_is_safe() -> bool:
"""True when the imported Pillow has the decoder fixes; warns once if not."""
try:
import PIL
except ImportError:
return False # Nothing can decode; the image paths already skip.
installed = PIL.__version__
if int(installed.split(".")[0]) >= FIXED_PILLOW_MAJOR:
return True
logger.warning(
"Headroom will not decode images: Pillow %s has decoder vulnerabilities "
"fixed only in Pillow %d, so images are forwarded unchanged and not "
"compressed. Install pillow>=%d (Python 3.11+) to turn image compression on.",
installed,
FIXED_PILLOW_MAJOR,
FIXED_PILLOW_MAJOR,
)
return False
File diff suppressed because it is too large Load Diff
+53 -3
View File
@@ -10701,9 +10701,6 @@ class OpenAIHandlerMixin:
session_tracker = self.session_tracker_store.get_or_create(
_session_key, _tracker_provider
)
from headroom.cache.prefix_tracker import seed_restored_compression_cache
seed_restored_compression_cache(session_tracker, comp_cache)
# A claimed turn prepares its executor-side work here (tokenizer,
# hooks, scope binding) — CPU-bound parts run inside the closures
@@ -10764,6 +10761,21 @@ class OpenAIHandlerMixin:
"(a previous turn for this session is still running)"
)
try:
nonlocal session_tracker
from headroom.cache.prefix_tracker import seed_restored_compression_cache
shared = self.shared_compress_sessions
if shared is not None:
# Another replica may have served this session's last
# turn: take its tracker when it is newer than ours.
newer = shared.fetch(
self.session_tracker_store, _session_key, session_tracker
)
if newer is not None:
# The key is present (get_or_create above).
self.session_tracker_store.install(_session_key, newer)
session_tracker = newer
seed_restored_compression_cache(session_tracker, comp_cache)
prev_original = session_tracker.get_last_original_messages()
prev_returned = session_tracker.get_last_forwarded_messages()
prep = prepare_turn(
@@ -10838,6 +10850,8 @@ class OpenAIHandlerMixin:
# return time because whatever we hand back IS what the
# caller sends upstream.
session_tracker.record_returned(messages, final)
if shared is not None:
shared.publish(self.session_tracker_store, _session_key, session_tracker)
info = {
"id": session_id,
"frozen_message_count": session_frozen,
@@ -11149,6 +11163,40 @@ class OpenAIHandlerMixin:
# from here.
_session_key = f"compress\x00{session_id}"
tracker = self.session_tracker_store.peek(_session_key)
shared = self.shared_compress_sessions
if shared is not None:
# The session's last turn may have run on another replica. Fetched
# under the turn lock (a local turn in flight must finish first),
# installed here on the loop: the key may be new to this store.
_local = tracker
_lock_cache = self._peek_compression_cache(_session_key)
def _fetch():
lock = _lock_cache.session_turn_lock if _lock_cache is not None else None
if lock is not None and not lock.acquire(
timeout=_SESSION_TURN_LOCK_TIMEOUT_SECONDS
):
return None
try:
return shared.fetch(self.session_tracker_store, _session_key, _local)
finally:
if lock is not None:
lock.release()
try:
newer = await self._run_compression_in_executor(
_fetch, timeout=COMPRESSION_TIMEOUT_SECONDS
)
except TimeoutError:
newer = None # answer from this replica's state, as without the store
if newer is not None:
current = self.session_tracker_store.peek(_session_key)
if current is _local:
self.session_tracker_store.install(_session_key, newer)
tracker = newer
else:
# A local turn installed a tracker meanwhile: it is newer.
tracker = current
if tracker is None:
return self._compress_usage_unknown_session(session_id)
# No create, no LRU bump: the cache is only needed for its turn lock.
@@ -11195,6 +11243,8 @@ class OpenAIHandlerMixin:
messages=last_returned,
original_messages=tracker.get_last_original_messages(),
)
if shared is not None:
shared.publish(self.session_tracker_store, _session_key, tracker)
return tracker.get_frozen_message_count()
finally:
if lock is not None:
+12
View File
@@ -1040,6 +1040,10 @@ class HeadroomProxy(
# Runs BEFORE the disable_kompress override below so that flag stays
# authoritative for turning Kompress off.
_apply_compressor_selection(router_config, config.compressors)
# The proxy is long-lived: keep compression results it has no memory
# budget for in a SQLite file instead of compressing them again
# (headroom.cache.result_store; off in stateless mode).
router_config.result_cache_disk = True
# External (non-built-in) `headroom.compressor` selections are ignored by
# `_apply_compressor_selection` (they have no enable_* flag). Thread them
# to the router here so it can route matching blocks through them; None
@@ -1203,6 +1207,11 @@ class HeadroomProxy(
session_ttl_seconds=config.prefix_freeze_session_ttl,
)
)
# Session-aware /v1/compress state in Redis, so any replica serves any
# turn (HEADROOM_COMPRESS_SESSION_STORE); None keeps it in memory.
from headroom.cache.shared_sessions import open_shared_sessions
self.shared_compress_sessions = open_shared_sessions()
# Set by startup() when HEADROOM_PREFIX_STATE_FILE opts in.
self._prefix_state_file: str | None = None
@@ -5378,6 +5387,9 @@ def create_app(config: ProxyConfig | None = None) -> FastAPI:
"original_tokens_cached": compression_stats.get("total_original_tokens", 0),
"compressed_tokens_cached": compression_stats.get("total_compressed_tokens", 0),
"ccr_retrievals": compression_stats.get("total_retrievals", 0),
# "this_replica" with a shared store: the token and retrieval
# counts are this process's since it started, not the store's.
"totals_scope": compression_stats.get("totals_scope", "store"),
},
"compression_cache": compression_cache_stats,
# Per-language AST compression pauses. Empty on a healthy install;
+3 -1
View File
@@ -403,7 +403,9 @@ class BaseTokenizer(ABC):
source = image_data.get("source", {})
img_bytes = source.get("bytes", b"")
if isinstance(img_bytes, bytes | bytearray) and len(img_bytes) > 0:
from headroom.image.decoder_guard import pillow_is_safe
if isinstance(img_bytes, bytes | bytearray) and len(img_bytes) > 0 and pillow_is_safe():
try:
import io
+6 -3
View File
@@ -13,14 +13,15 @@ from ..tokenizer import Tokenizer
logger = logging.getLogger(__name__)
def persist_rust_ccr_entry(original: str, compressed: str, cache_key: str, *, source: str) -> None:
def persist_rust_ccr_entry(original: str, compressed: str, cache_key: str, *, source: str) -> bool:
"""Store a Rust-emitted CCR entry in the production ``CompressionStore``.
The Rust search/diff/log compressors emit a retrieval marker but keep the
original only in their in-memory test store. This writes it through to the
long-lived Python store so the marker resolves. Failures are logged at
warning level with ``source`` (the compressor name): a store hiccup must not
break the response, just degrade retrieval.
break the response. Returns whether the store kept it; when it did not, the
caller returns the input unchanged rather than a marker that points nowhere.
"""
try:
from ..cache.compression_store import get_compression_store
@@ -32,13 +33,14 @@ def persist_rust_ccr_entry(original: str, compressed: str, cache_key: str, *, so
safe_id(e),
)
logger.debug("CCR store import failure detail: %s", describe_exception(e))
return
return False
try:
store: Any = get_compression_store()
# The Rust-emitted marker embeds MD5(original)[:24], but store() has
# defaulted to SHA-256(original)[:24] since PR #395. Pass the marker's
# key explicitly so retrieving the marker hash finds the entry (#816).
store.store(original, compressed, explicit_hash=cache_key)
return True
except Exception as e:
# Store backends can echo the payload in errors. The WARNING names only
# the exception type; the DEBUG record has types and code locations, or
@@ -50,6 +52,7 @@ def persist_rust_ccr_entry(original: str, compressed: str, cache_key: str, *, so
cache_key,
)
logger.debug("CCR store write failure detail: %s", describe_exception(e))
return False
class Transform(ABC):
+326 -70
View File
@@ -45,12 +45,13 @@ import re
import sys
import threading
import time
from collections import OrderedDict
from collections.abc import Callable
from concurrent.futures import ThreadPoolExecutor
from contextvars import ContextVar, copy_context
from dataclasses import dataclass, field, replace
from enum import Enum
from typing import Any
from typing import TYPE_CHECKING, Any
from ..config import (
DEFAULT_BYTE_EXACT_EXCLUDE_TOOLS,
@@ -97,6 +98,9 @@ from .lossless_provider import (
from .mixed_content import ContentSection, mixed_content_indicators
from .relevance_split import build_relevance_query, plan_relevance_split, segment
if TYPE_CHECKING:
from ..cache.result_store import ResultStore
logger = logging.getLogger(__name__)
_extract_json_block = _mixed_content._extract_json_block
@@ -1558,21 +1562,95 @@ def _netcost_message_tokens(message: dict[str, Any], tokenizer: Tokenizer) -> in
return count_content_blocks(content, tokenizer.count_text)
class CompressionCache:
"""Two-tier compression cache with TTL. Thread-safe.
#: Default memory budget of the router's compression cache, in MB
#: (``HEADROOM_COMPRESSION_CACHE_MB``).
DEFAULT_COMPRESSION_CACHE_MB = 64
#: Bytes a cache entry costs beyond its text (key, tuple, dict slot).
_CACHE_ENTRY_OVERHEAD = 256
#: How long a compression result is kept after it was last used. Results are
#: mostly one session's tool output, and nothing signals a session's end; a
#: session idle past the provider's longest prompt-cache TTL (Anthropic: 1 h)
#: has no cached prefix left to protect, so compressing it again on resume
#: costs only the compression.
RESULT_TTL_SECONDS = 75 * 60
#: Skip-tier entries kept per MB of budget (each is a key and a timestamp).
_SKIP_ENTRIES_PER_MB = 2000
Tier 1 (skip set): content hashes that won't compress — instant skip,
near-zero memory (just ints in a set).
def _compression_cache_budget_bytes() -> int:
raw = os.environ.get("HEADROOM_COMPRESSION_CACHE_MB", "").strip()
try:
mb = float(raw) if raw else DEFAULT_COMPRESSION_CACHE_MB
except ValueError:
mb = math.nan
if not math.isfinite(mb) or mb <= 0:
logger.warning(
"HEADROOM_COMPRESSION_CACHE_MB=%r is not a positive number of MB; using %d",
raw,
DEFAULT_COMPRESSION_CACHE_MB,
)
mb = DEFAULT_COMPRESSION_CACHE_MB
return max(1, int(mb * 1024 * 1024))
def content_cache_key(content: str, target_ratio: float | None, gated: bool = False) -> str:
"""The compression cache's key for ``content``: a digest, the same in every
process, so the disk tier (and replicas sharing it) can use it. The runtime
target ratio is part of it (a different ratio is a different result), and so
is the reversibility gate tool output passes (#1307)."""
h = hashlib.blake2b(digest_size=16)
h.update(f"{target_ratio!r}|{int(gated)}|".encode())
h.update(content.encode("utf-8", "surrogatepass"))
return h.hexdigest()
def _config_namespace(config: Any) -> str:
"""A prefix for this router's keys in the shared disk tier: a digest of its
config and the headroom version. The proxy may run routers configured
differently (per-provider Kompress overrides), and a restart may change
settings; neither may serve output the other made."""
from dataclasses import asdict
from .. import __version__
def stable(value: Any) -> Any:
# Sets repr in hash-seed order, which differs per process.
if isinstance(value, (set, frozenset)):
return sorted(map(stable, value), key=repr)
if isinstance(value, dict):
return sorted((repr(k), stable(v)) for k, v in value.items())
if isinstance(value, (list, tuple)):
return [stable(v) for v in value]
return value
# The router also reads compressor settings from the environment (e.g.
# HEADROOM_LOSSLESS_THEN_LOSSY) into instance state outside its config;
# every HEADROOM_* setting is part of the digest, so changing any of them
# starts a fresh namespace rather than serving output made under another.
settings = sorted((k, v) for k, v in os.environ.items() if k.startswith("HEADROOM_"))
h = hashlib.blake2b(digest_size=8)
h.update(f"{__version__}|{stable(asdict(config))!r}|{settings!r}".encode())
return h.hexdigest() + ":"
class CompressionCache:
"""Two-tier compression cache with idle expiry and a memory budget. Thread-safe.
Tier 1 (skip set): content keys that won't compress — instant skip.
Tier 2 (result cache): compressed results for content that DID compress —
reuse the compressed text on subsequent requests.
Entries expire after TTL (default 30min). No max-entries cap — TTL is the
natural bound. Memory grows proportional to compressible content × TTL,
which is bounded by session duration.
Memory is bounded: results are kept in least-recently-used order within
``max_bytes`` (``HEADROOM_COMPRESSION_CACHE_MB``, default 64; results only),
the skip set within a matching entry count. A result expires ``ttl_seconds``
after it was last used (a session idle that long has no cached prefix to
protect). A result carrying a CCR marker expires ``marker_ttl_seconds`` after
it was made instead, with the CCR original it points to.
Uses in-process dict for ultra-fast lookups (~100ns). Could be backed
by memcached/Redis for multi-process deployments.
With a ``store`` (the proxy's :class:`~headroom.cache.result_store.ResultStore`),
marker-free results are also written to disk under ``namespace`` and an
entry the budget evicted is read back from there instead of compressed again.
Thread safety: a ``threading.Lock`` guards all read-modify-write
operations. The ``apply()`` path runs compression inside a
@@ -1581,28 +1659,63 @@ class CompressionCache:
wasteful) and metrics counters would drift.
"""
def __init__(self, ttl_seconds: int = 1800):
def __init__(
self,
ttl_seconds: int = RESULT_TTL_SECONDS,
max_bytes: int | None = None,
store: ResultStore | None = None,
namespace: str = "",
marker_ttl_seconds: int | None = None,
):
import threading
# Tier 2: compressed results {hash: (text, ratio, strategy, timestamp)}
self._results: dict[int, tuple[str, float, str, float]] = {}
# Tier 1: hashes of content that won't compress {hash: timestamp}
self._skip: dict[int, float] = {}
from ..cache.compression_store import _get_env_default_ttl_seconds
# Tier 2: {key: (text, ratio, strategy, stamp, disk_touched, has_marker)},
# least recently used first. ``stamp`` is the last use, or the creation
# time for a result with a CCR marker.
self._results: OrderedDict[str, tuple[str, float, str, float, float, bool]] = OrderedDict()
self._bytes = 0
# Tier 1: {key: marked_at}, oldest first.
self._skip: OrderedDict[str, float] = OrderedDict()
self._max_bytes = max_bytes if max_bytes is not None else _compression_cache_budget_bytes()
self._max_skip = max(1000, self._max_bytes // (1024 * 1024) * _SKIP_ENTRIES_PER_MB)
self._store = store
# A namespace of its own, so clear() never reaches other caches' rows.
self._namespace = namespace or ("cache:" if store is not None else "")
# {key: sequence numbers of the get()s reading it from disk}. put(),
# move_to_skip() and clear() drop the key, so a read that raced one of
# them is not admitted over the newer state; an admitted read drops
# the earlier ones, which may hold an older row (another worker can
# write the shared store between them).
self._disk_reads: dict[str, set[int]] = {}
self._read_seq = 0
# Callbacks invoked (outside the lock) whenever ``clear()`` runs, so
# sibling state keyed by the same content hashes (e.g. the router's
# sibling state keyed by the same content keys (e.g. the router's
# frozen-verdict store) can be reset in lock-step with the cache.
self._on_clear: list[Any] = []
self._ttl_seconds = ttl_seconds
self._marker_ttl_seconds = (
marker_ttl_seconds if marker_ttl_seconds is not None else _get_env_default_ttl_seconds()
)
# Metrics
self._hits = 0
self._disk_hits = 0
self._misses = 0
self._skip_hits = 0
self._evictions = 0
self._total_lookup_ns = 0
self._lookup_count = 0
self._lock = threading.Lock()
# Orders put()'s disk writes, so an older result cannot overwrite or
# delete the disk row of a newer one for the same key.
self._disk_lock = threading.Lock()
# Serializes get()'s disk reads (only memory misses read the disk), so
# a read numbered later also fetched later and saw a row at least as
# new. Order: _disk_read_lock, then _lock, then the store's lock.
self._disk_read_lock = threading.Lock()
def get(self, key: int) -> tuple[str, float, str] | None:
def get(self, key: str) -> tuple[str, float, str] | None:
"""Get cached compression result. Thread-safe.
Returns (compressed_text, ratio, strategy) or None if not found/expired.
@@ -1610,23 +1723,83 @@ class CompressionCache:
"""
t0 = time.perf_counter_ns()
with self._lock:
entry = self._results.get(key)
if entry is not None:
compressed, ratio, strategy, created_at = entry
if (time.monotonic() - created_at) < self._ttl_seconds:
self._hits += 1
self._total_lookup_ns += time.perf_counter_ns() - t0
self._lookup_count += 1
return (compressed, ratio, strategy)
hit = self._memory_hit_locked(key, t0)
if hit is not None:
return hit
if self._store is None:
self._misses += 1
self._record_lookup(t0)
return None
with self._disk_read_lock:
with self._lock:
# A put() or another read may have admitted it meanwhile.
hit = self._memory_hit_locked(key, t0)
if hit is not None:
return hit
self._read_seq += 1
seq = self._read_seq
self._disk_reads.setdefault(key, set()).add(seq)
found = self._store.get(self._namespace + key)
with self._lock:
readers = self._disk_reads.get(key)
if readers is not None and seq in readers:
later = {s for s in readers if s > seq}
if later:
self._disk_reads[key] = later
else:
del self._results[key]
self._evictions += 1
self._misses += 1
self._total_lookup_ns += time.perf_counter_ns() - t0
self._lookup_count += 1
return None
del self._disk_reads[key]
if found is not None:
self._admit_locked(key, *found)
self._disk_hits += 1
else:
# A write for this key, or a later read's admission, landed
# during the read; the newest result is the one in memory, if any.
found = self._memory_hit_locked(key, t0)
if found is not None:
return found
if found is None:
self._misses += 1
self._record_lookup(t0)
return found
def is_skipped(self, key: int) -> bool:
def _memory_hit_locked(self, key: str, t0: int) -> tuple[str, float, str] | None:
"""Serve ``key`` from memory if present and unexpired; drop it if expired.
Every memory read in get() goes through here, so each applies the same
lifetime contract (marker TTL, idle refresh, disk touch). Caller holds _lock.
"""
entry = self._results.get(key)
if entry is None:
return None
compressed, ratio, strategy, stamp, disk_touched, has_marker = entry
now = time.monotonic()
ttl = self._marker_ttl_seconds if has_marker else self._ttl_seconds
if (now - stamp) >= ttl:
self._drop_locked(key)
self._evictions += 1
return None
touch_disk = False
if not has_marker:
# A hit keeps the entry for another ttl: expiry counts idle time.
# The disk copy too, at most every half ttl, so the budget evicting
# it later cannot lose it mid-session.
touch_disk = self._store is not None and (now - disk_touched >= ttl / 2)
self._results[key] = (
compressed,
ratio,
strategy,
now,
now if touch_disk else disk_touched,
False,
)
self._results.move_to_end(key)
self._hits += 1
self._record_lookup(t0)
if touch_disk and self._store is not None:
self._store.touch(self._namespace + key)
return (compressed, ratio, strategy)
def is_skipped(self, key: str) -> bool:
"""Check if content is known non-compressible (Tier 1). Thread-safe."""
with self._lock:
ts = self._skip.get(key)
@@ -1634,27 +1807,73 @@ class CompressionCache:
if (time.monotonic() - ts) < self._ttl_seconds:
self._skip_hits += 1
return True
else:
del self._skip[key]
self._evictions += 1
del self._skip[key]
self._evictions += 1
return False
def put(self, key: int, compressed: str, ratio: float, strategy: str) -> None:
def put(self, key: str, compressed: str, ratio: float, strategy: str) -> None:
"""Store a compressed result (Tier 2). Thread-safe."""
with self._lock:
self._results[key] = (compressed, ratio, strategy, time.monotonic())
self._disk_reads.pop(key, None)
has_marker = self._admit_locked(key, compressed, ratio, strategy)
if self._store is None:
return
with self._disk_lock:
with self._lock:
current = self._results.get(key)
if current is not None and current[0] != compressed:
return # a later put() replaced it; its disk write wins
if has_marker:
# Never kept on disk; nor may an earlier marker-free result for
# this key come back from there once this one leaves memory.
self._store.delete(self._namespace + key)
else:
self._store.put(self._namespace + key, compressed, ratio, strategy)
def mark_skip(self, key: int) -> None:
def mark_skip(self, key: str) -> None:
"""Mark content as non-compressible (Tier 1). Thread-safe."""
with self._lock:
self._skip[key] = time.monotonic()
self._skip_locked(key)
def move_to_skip(self, key: int) -> None:
def move_to_skip(self, key: str) -> None:
"""Move a result to skip set (threshold tightened, no longer qualifies).
Thread-safe."""
with self._lock:
self._results.pop(key, None)
self._skip[key] = time.monotonic()
self._disk_reads.pop(key, None)
self._drop_locked(key)
self._skip_locked(key)
if self._store is not None:
self._store.delete(self._namespace + key)
def _admit_locked(self, key: str, compressed: str, ratio: float, strategy: str) -> bool:
"""Add a result, evicting least recently used ones over budget; returns
whether it carries a CCR marker."""
self._drop_locked(key)
now = time.monotonic()
has_marker = CCR_RETRIEVAL_MARKER_RE.search(compressed) is not None
self._results[key] = (compressed, ratio, strategy, now, now, has_marker)
self._bytes += sys.getsizeof(compressed) + _CACHE_ENTRY_OVERHEAD
# Least recently used first; the entry just added always stays.
while self._bytes > self._max_bytes and len(self._results) > 1:
self._drop_locked(next(iter(self._results)))
self._evictions += 1
return has_marker
def _drop_locked(self, key: str) -> None:
entry = self._results.pop(key, None)
if entry is not None:
self._bytes -= sys.getsizeof(entry[0]) + _CACHE_ENTRY_OVERHEAD
def _skip_locked(self, key: str) -> None:
self._skip.pop(key, None)
self._skip[key] = time.monotonic()
while len(self._skip) > self._max_skip:
self._skip.popitem(last=False)
self._evictions += 1
def _record_lookup(self, t0: int) -> None:
self._total_lookup_ns += time.perf_counter_ns() - t0
self._lookup_count += 1
@property
def size(self) -> int:
@@ -1672,10 +1891,13 @@ class CompressionCache:
avg_ns = self._total_lookup_ns / self._lookup_count if self._lookup_count else 0
return {
"cache_hits": self._hits,
"cache_disk_hits": self._disk_hits,
"cache_skip_hits": self._skip_hits,
"cache_misses": self._misses,
"cache_evictions": self._evictions,
"cache_size": len(self._results),
"cache_bytes": self._bytes,
"cache_max_bytes": self._max_bytes,
"cache_skip_size": len(self._skip),
"cache_avg_lookup_ns": avg_ns,
}
@@ -1683,17 +1905,24 @@ class CompressionCache:
def register_on_clear(self, callback: Any) -> None:
"""Register a callback fired (outside the lock) on every ``clear()``.
Lets state keyed by the same content hashes — e.g. the router's
Lets state keyed by the same content keys — e.g. the router's
``_frozen_verdicts`` store — be reset together with the cache so it
cannot outlive the results/skip tiers it shadows.
"""
self._on_clear.append(callback)
def clear(self) -> None:
"""Clear all entries (e.g., on session end). Thread-safe."""
"""Clear all entries, including this router's rows on disk (other
workers with the same config share them). Thread-safe."""
with self._lock:
self._results.clear()
self._bytes = 0
self._skip.clear()
self._disk_reads.clear()
# Under the lock, so no disk read can start before the rows are
# gone and bring a cleared result back into memory.
if self._store is not None:
self._store.clear_prefix(self._namespace)
# Fire callbacks outside the lock to avoid cross-lock ordering issues.
for callback in self._on_clear:
callback()
@@ -1945,6 +2174,12 @@ class ContentRouterConfig:
# emits a `<<ccr:…>>` / `Retrieve …` retrieval marker. SmartCrusher is
# additionally forced marker-free via smart_crusher_lossless_only.
lossless: bool = False
# Back the compression cache with a SQLite file (see
# headroom.cache.result_store) so results its memory budget evicts, or a
# restart loses, come back without compressing again. The proxy turns it on;
# library callers keep the cache in memory unless they ask.
result_cache_disk: bool = False
# Cross-turn (whole-conversation) verbatim de-dup. Replaces a contiguous span
# in a later tool output that already appeared verbatim in an earlier tool
# output with an in-context pointer. Prefix-monotonic (cache-safe) and
@@ -2455,7 +2690,12 @@ class ContentRouter(Transform):
# are not gated. Now backed by the #3486 ContextVar state — see
# the ``_runtime_compression_policy`` property below.
self._cache = CompressionCache()
store = None
if self.config.result_cache_disk:
from ..cache.result_store import open_result_store
store = open_result_store(ttl_seconds=RESULT_TTL_SECONDS)
self._cache = CompressionCache(store=store, namespace=_config_namespace(self.config))
# Cache-churn fix (HEADROOM_FREEZE_BLOCK_DECISION, default off):
# freeze each block's compress-vs-passthrough verdict on first
@@ -2473,7 +2713,7 @@ class ContentRouter(Transform):
# the parallel compression pass writes verdicts from worker threads, so
# we match that posture with a dedicated lock rather than relying on
# GIL atomicity (which would not protect the read-then-evict sequence).
self._frozen_verdicts: dict[int, bool] = {}
self._frozen_verdicts: dict[str, bool] = {}
# The store is process-wide (one router per pipeline, shared by every
# session), so the cap must scale with the number of CONCURRENT
# sessions, not one user's workload: at org scale (many users behind
@@ -2636,7 +2876,7 @@ class ContentRouter(Transform):
f"preserved_chars~={preserved} (cache bust avoided)"
)
def _record_frozen_verdict(self, content_key: int, verdict: bool) -> None:
def _record_frozen_verdict(self, content_key: str, verdict: bool) -> None:
"""Record a frozen verdict (thread-safe, bounded FIFO eviction).
Caps the store at ``_frozen_verdicts_max`` entries, evicting the
@@ -2653,7 +2893,7 @@ class ContentRouter(Transform):
del self._frozen_verdicts[oldest]
self._frozen_verdicts[content_key] = verdict
def _get_frozen_verdict(self, content_key: int) -> bool | None:
def _get_frozen_verdict(self, content_key: str) -> bool | None:
"""Read a frozen verdict (thread-safe). Returns None if absent."""
with self._frozen_lock:
return self._frozen_verdicts.get(content_key)
@@ -3691,8 +3931,15 @@ class ContentRouter(Transform):
# Count with the router's OWN estimator, not the compressor's self-report.
compressed_tokens = _estimate_tokens(compressed)
# Persist the hash -> original recovery map the SAME way SmartCrusher
# mirrors its markers, so a later /v1/retrieve resolves each hash.
self._persist_external_recoverable(out.recoverable, name, context)
# mirrors its markers, so a later /v1/retrieve resolves each hash. A
# hash the store did not take points nowhere: fall back instead.
if not self._persist_external_recoverable(out.recoverable, name, context):
logger.warning(
"external compressor %r: CCR store did not keep its originals; "
"falling back to built-in",
name,
)
return None
if out.warnings:
logger.debug(
"external compressor %r warnings: %s", name, "; ".join(map(str, out.warnings))
@@ -3705,29 +3952,33 @@ class ContentRouter(Transform):
def _persist_external_recoverable(
self, recoverable: dict[str, str], name: str, context: str
) -> None:
) -> bool:
"""Mirror an external compressor's hash -> original map into the CCR store.
Mirrors SmartCrusher's ``_mirror_single_hash_to_python_store``: each
entry is stored under its own hash via ``explicit_hash`` so a
``/v1/retrieve/{hash}`` lookup returns the original. Best-effort — a
store failure or a non-hex hash is logged and never breaks the request
(the compressed block is still returned; only that entry is unretrievable).
``/v1/retrieve/{hash}`` lookup returns the original. Returns whether
every entry was stored (True without a store module, as SmartCrusher):
on False the caller discards the compressed block, whose markers would
point nowhere. Failures are logged and never break the request.
"""
if not recoverable:
return
return True
try:
from ..cache.compression_store import get_compression_store
store = get_compression_store()
except Exception as exc: # noqa: BLE001 - CCR store optional/stripped builds
except ImportError as exc: # stripped builds ship no CCR store
logger.debug("external compressor %r: CCR store unavailable (%s)", name, exc)
return
return True
try:
store = get_compression_store()
except Exception as exc: # noqa: BLE001 - never break the request
logger.debug("external compressor %r: CCR store unavailable (%s)", name, exc)
return False
strategy_label = f"external:{name}"
for ccr_hash, original in recoverable.items():
if not isinstance(ccr_hash, str) or not isinstance(original, str):
logger.debug("external compressor %r: skipping non-str recoverable entry", name)
continue
logger.debug("external compressor %r: non-str recoverable entry", name)
return False
try:
store.store(
original=original,
@@ -3747,8 +3998,11 @@ class ContentRouter(Transform):
name,
ccr_hash,
)
return False
except Exception as exc: # noqa: BLE001 - defensive; never break the request
logger.debug("external compressor %r: store.store raised (%s)", name, exc)
return False
return True
def _registry_compress(
self,
@@ -6136,7 +6390,7 @@ class ContentRouter(Transform):
# enforce_reversibility, precomputed_detection). The detection is the one
# already computed in the routing loop below, threaded through so a
# cache-miss message is not re-detected inside compress().
_PendingTask = tuple[int, str, str, float, int, bool, "DetectionResult | None"]
_PendingTask = tuple[int, str, str, float, str, bool, "DetectionResult | None"]
pending_tasks: list[_PendingTask] = []
# #856 P2b (flag-gated, default off): net-cost frozen-floor unlock.
@@ -6476,13 +6730,13 @@ class ContentRouter(Transform):
# Tier 2 (result): known compresses → reuse compressed text.
# Key on the runtime target_ratio too: the same content compressed at
# a different ratio is a different result, so it must not alias.
content_key = hash((content, getattr(self, "_runtime_target_ratio", None)))
# Tool ground truth is gated against lossy-unrecoverable results below
# (#1307). Partition its cache namespace so a gated tool entry is never
# served from — or poisons — an ungated entry for byte-identical content.
enforce_reversibility = role == "tool"
if enforce_reversibility:
content_key = hash((content_key, True))
content_key = content_cache_key(
content, getattr(self, "_runtime_target_ratio", None), gated=enforce_reversibility
)
# Tier 1: skip set — instant rejection
if self._cache.is_skipped(content_key):
@@ -7546,7 +7800,9 @@ class ContentRouter(Transform):
# Two-tier compression cache → shared helper
compressed_content, was_compressed = self._compress_block_content(
content=tool_text,
content_key=hash((tool_text, getattr(self, "_runtime_target_ratio", None))),
content_key=content_cache_key(
tool_text, getattr(self, "_runtime_target_ratio", None)
),
context=block_context,
bias=bias,
min_ratio=min_ratio,
@@ -7616,8 +7872,8 @@ class ContentRouter(Transform):
# Two-tier compression cache → shared helper
compressed_content, _was_compressed = self._compress_block_content(
content=text_content,
content_key=hash(
(text_content, getattr(self, "_runtime_target_ratio", None))
content_key=content_cache_key(
text_content, getattr(self, "_runtime_target_ratio", None)
),
context=context,
bias=1.0,
@@ -7649,7 +7905,7 @@ class ContentRouter(Transform):
def _compress_block_content(
self,
content: str,
content_key: int,
content_key: str,
context: str,
bias: float,
min_ratio: float,
@@ -7670,7 +7926,7 @@ class ContentRouter(Transform):
Args:
content: The string content to compress.
content_key: Pre-computed ``hash(content)`` for cache lookups.
content_key: Pre-computed :func:`content_cache_key` for cache lookups.
context: User/query context for relevance-aware compression.
bias: Compression bias multiplier (tool-specific or 1.0).
min_ratio: Adaptive minimum compression ratio threshold.
+11 -1
View File
@@ -113,7 +113,17 @@ class DiffCompressor:
# call. Without this, every diff CCR marker emitted in
# production is dangling — the regression fixed in the
# audit-cleanup PR.
persist_rust_ccr_entry(content, r.compressed, cache_key, source="diff")
if not persist_rust_ccr_entry(content, r.compressed, cache_key, source="diff"):
return DiffCompressionResult( # unstored original: no marker
compressed=content,
original_line_count=r.original_line_count,
compressed_line_count=r.original_line_count,
files_affected=r.files_affected,
additions=r.additions,
deletions=r.deletions,
hunks_kept=r.hunks_kept + r.hunks_removed,
hunks_removed=0,
)
return DiffCompressionResult(
compressed=r.compressed,
original_line_count=r.original_line_count,
+11 -2
View File
@@ -199,8 +199,17 @@ class LogCompressor:
del context
rust_result = self._rust.compress(content, bias)
cache_key: str | None = rust_result.cache_key
if cache_key is not None:
persist_rust_ccr_entry(content, rust_result.compressed, cache_key, source="log")
if cache_key is not None and not persist_rust_ccr_entry(
content, rust_result.compressed, cache_key, source="log"
):
return LogCompressionResult( # unstored original: no marker
compressed=content,
original=content,
original_line_count=rust_result.original_line_count,
compressed_line_count=rust_result.original_line_count,
format_detected=_format_from_str(rust_result.format_detected),
compression_ratio=1.0,
)
stats_dict = {k: int(v) for k, v in cast("dict[str, int]", rust_result.stats).items()}
return LogCompressionResult(
+3 -1
View File
@@ -475,7 +475,8 @@ class ReadLifecycleManager:
return False, content, None
# Best-effort CCR persistence (mirrors read_maturation.py): a store
# failure must not break compress().
# failure must not break compress(), and keeps the Read verbatim — a
# marker would point at an original nobody stored.
ccr_hash = hashlib.sha256(content.encode()).hexdigest()[:24]
if self.store is not None:
try:
@@ -493,6 +494,7 @@ class ReadLifecycleManager:
classification.tool_call_id,
e,
)
return False, content, None
file_display = classification.file_path or "unknown"
+3
View File
@@ -412,7 +412,10 @@ class ReadMaturationManager:
compression_strategy="read_maturation",
)
except Exception as e: # noqa: BLE001 - storage failure must not break the request
# Keep it verbatim (a marker would point at nothing); a later
# request matures it once the store takes it.
logger.warning("read_maturation: CCR store failed for %s: %s", tc_id, e)
return None, False
file_display = file_path or "unknown"
# NOTE: "Retrieve original: hash=" is load-bearing (marker-
+15 -6
View File
@@ -171,12 +171,21 @@ class SearchCompressor:
) -> SearchCompressionResult:
rust_result = self._rust.compress(content, context, bias)
cache_key: str | None = rust_result.cache_key
if cache_key is not None:
# Mirror the original Python: persist to the production CCR
# store. The Rust crate already wrote to its in-memory test
# store; promote that to the long-lived Python store so the
# marker remains retrievable beyond the request lifecycle.
persist_rust_ccr_entry(content, rust_result.compressed, cache_key, source="search")
# Mirror the original Python: persist to the production CCR
# store. The Rust crate already wrote to its in-memory test
# store; promote that to the long-lived Python store so the
# marker remains retrievable beyond the request lifecycle.
if cache_key is not None and not persist_rust_ccr_entry(
content, rust_result.compressed, cache_key, source="search"
):
return SearchCompressionResult( # unstored original: no marker
compressed=content,
original=content,
original_match_count=rust_result.original_match_count,
compressed_match_count=rust_result.original_match_count,
files_affected=rust_result.files_affected,
compression_ratio=1.0,
)
summaries = dict(cast("dict[str, str]", rust_result.summaries))
return SearchCompressionResult(
+66 -61
View File
@@ -515,6 +515,7 @@ class SmartCrusher(Transform):
# (``{...} {...} {...}``) rather than a real array. The Rust crusher
# only compresses JSON arrays, so normalize that shape first —
# otherwise it passes through at 0% compression (#1741).
given = content
normalized = normalize_concatenated_json(content)
if normalized is not None:
content = normalized
@@ -524,6 +525,17 @@ class SmartCrusher(Transform):
else self._build_rust(bool(lossless_only))
)
r = rust.crush(content, query, bias)
# Bridge any CCR markers emitted by the Rust crusher into the
# Python compression_store so /v1/retrieve resolves them; a marker
# the store did not take points nowhere, so keep the input instead.
# See `_mirror_ccr_to_python_store` for full rationale.
if not self._mirror_ccr_to_python_store(
rendered=r.compressed,
strategy=r.strategy,
query_context=query,
tool_name=None,
):
return CrushResult(compressed=given, original=given, was_modified=False)
# Re-attach the TOIN learning loop. The retired Python class
# recorded compressions into TOIN inline; the Rust port doesn't
# know about TOIN, and `ContentRouter._record_to_toin` skips
@@ -544,15 +556,6 @@ class SmartCrusher(Transform):
query_context=query,
tool_name=None,
)
# Bridge any CCR markers emitted by the Rust crusher into the
# Python compression_store so /v1/retrieve resolves them.
# See `_mirror_ccr_to_python_store` for full rationale.
self._mirror_ccr_to_python_store(
rendered=r.compressed,
strategy=r.strategy,
query_context=query,
tool_name=None,
)
return CrushResult(
compressed=r.compressed,
original=r.original,
@@ -794,9 +797,10 @@ class SmartCrusher(Transform):
# already stashed the canonical in its own store. Mirror that
# entry into the Python compression_store keyed by the same
# 12-char SHA-256 hash so /v1/retrieve resolves it.
mirrored = True
ccr_hash = result.get("ccr_hash")
if ccr_hash:
self._mirror_single_hash_to_python_store(
mirrored = self._mirror_single_hash_to_python_store(
ccr_hash,
strategy=str(result.get("strategy_info") or "smart_crusher_row_drop"),
query_context=query,
@@ -804,22 +808,20 @@ class SmartCrusher(Transform):
)
# Opaque-blob substitutions inside the kept items also produce
# markers. Walk the rendered shape to bridge those too.
kept_json = result.get("items")
if isinstance(kept_json, str) and "<<ccr:" in kept_json:
self._mirror_ccr_markers_in_text(
kept_json,
strategy=str(result.get("strategy_info") or "smart_crusher"),
query_context=query,
tool_name=None,
)
compacted = result.get("compacted")
if isinstance(compacted, str) and "<<ccr:" in compacted:
self._mirror_ccr_markers_in_text(
compacted,
strategy=str(result.get("strategy_info") or "smart_crusher"),
query_context=query,
tool_name=None,
)
strategy = str(result.get("strategy_info") or "smart_crusher")
for rendered in (result.get("items"), result.get("compacted")):
if mirrored and isinstance(rendered, str):
mirrored = self._mirror_ccr_to_python_store(rendered, strategy, query, None)
if not mirrored:
# A marker the store did not take points nowhere: keep the input.
return {
"items": items_json,
"ccr_hash": None,
"dropped_summary": "",
"strategy_info": "passthrough",
"compacted": None,
"compaction_kind": None,
}
return result
def compact_document_json(self, doc_json: str) -> str:
@@ -836,13 +838,8 @@ class SmartCrusher(Transform):
result: str = self._rust.compact_document_json(doc_json)
# Mirror any opaque-blob markers the walker emitted into the
# Python store so /v1/retrieve resolves them.
if "<<ccr:" in result:
self._mirror_ccr_markers_in_text(
result,
strategy="smart_crusher_compact_document",
query_context="",
tool_name=None,
)
if not self._mirror_ccr_to_python_store(result, "smart_crusher_compact_document", "", None):
return doc_json # a marker the store did not take points nowhere
return result
def ccr_get(self, hash_key: str) -> str | None:
@@ -890,6 +887,17 @@ class SmartCrusher(Transform):
crushed, was_modified, info = self._apply_audit_safe_protection_to_content(
protected, content, crushed, was_modified, info
)
# Bridge any CCR markers (row-drop sentinels or opaque-blob
# substitutions) emitted by the Rust crusher into the Python
# compression_store so /v1/retrieve resolves them; a marker the
# store did not take points nowhere, so keep the input instead.
if not self._mirror_ccr_to_python_store(
rendered=crushed,
strategy=info or "smart_crusher",
query_context=query_context,
tool_name=tool_name,
):
return content, False, "passthrough"
# Same passthrough filter as `crush()` — re-canonicalization of
# JSON whitespace can flip `was_modified=True` even when the
# `info` field reports `passthrough` and no compression happened.
@@ -901,15 +909,6 @@ class SmartCrusher(Transform):
query_context=query_context,
tool_name=tool_name,
)
# Bridge any CCR markers (row-drop sentinels or opaque-blob
# substitutions) emitted by the Rust crusher into the Python
# compression_store so /v1/retrieve resolves them.
self._mirror_ccr_to_python_store(
rendered=crushed,
strategy=info or "smart_crusher",
query_context=query_context,
tool_name=tool_name,
)
return crushed, was_modified, info
def _record_to_toin(
@@ -1026,10 +1025,11 @@ class SmartCrusher(Transform):
# `compression_store.store(..., explicit_hash=hash)` so the Python
# store is keyed by the exact hash that's in the prompt marker.
#
# Best-effort by design: a missing compression_store import (e.g.
# in a stripped CLI build) or a transient store error must NOT
# break compression itself. Compression has already succeeded; the
# bridge just makes /v1/retrieve work. Errors log at debug.
# A missing compression_store import (a stripped CLI build) or a
# marker whose hash the Rust store does not hold is not a failure. A
# store error is: the mirror returns False and the caller keeps the
# input uncompressed, since a marker nobody stored never resolves on
# another replica. Store errors log at warning; nothing raises.
def _mirror_ccr_to_python_store(
self,
@@ -1037,9 +1037,10 @@ class SmartCrusher(Transform):
strategy: str,
query_context: str,
tool_name: str | None,
) -> None:
) -> bool:
"""Walk `rendered` for any `<<ccr:HASH ...>>` markers and mirror
each into the Python `compression_store`.
each into the Python `compression_store`. Returns whether every
marker's original was stored (True when there is none).
`rendered` may be a JSON string (the standard SmartCrusher
output format) or arbitrary text. We try the structured walk
@@ -1047,8 +1048,8 @@ class SmartCrusher(Transform):
"""
# Cheap pre-filter — most outputs have no marker at all.
if "<<ccr:" not in rendered:
return
self._mirror_ccr_markers_in_text(
return True
return self._mirror_ccr_markers_in_text(
rendered,
strategy=strategy,
query_context=query_context,
@@ -1061,9 +1062,9 @@ class SmartCrusher(Transform):
strategy: str,
query_context: str,
tool_name: str | None,
) -> None:
) -> bool:
"""Find every distinct `<<ccr:HASH...>>` hash in `rendered` and
mirror Rust→Python store for each.
mirror Rust→Python store for each; whether all were stored.
Tries JSON-tree walk first (structured, handles nested shapes);
falls back to a token scan if `rendered` isn't valid JSON.
@@ -1080,15 +1081,15 @@ class SmartCrusher(Transform):
# always re-serializes via `python_safe_json_dumps`). Fall
# through to a string-token scan so we still bridge.
self._collect_ccr_hashes_from_string(rendered, hashes)
if not hashes:
return
for h in hashes:
return all(
self._mirror_single_hash_to_python_store(
h,
strategy=strategy,
query_context=query_context,
tool_name=tool_name,
)
for h in hashes
)
@staticmethod
def _collect_ccr_hashes(value: Any, sink: set[str]) -> None:
@@ -1147,9 +1148,10 @@ class SmartCrusher(Transform):
strategy: str,
query_context: str,
tool_name: str | None,
) -> None:
) -> bool:
"""Mirror a single Rust-stored CCR entry into the Python
compression_store, keyed by `ccr_hash`. Best-effort.
compression_store, keyed by `ccr_hash`. False when the store did
not take it; True when stored or there is nothing to mirror.
"""
canonical = self._rust.ccr_get(ccr_hash)
if canonical is None:
@@ -1161,19 +1163,19 @@ class SmartCrusher(Transform):
"CCR mirror: hash %s not in Rust store (skipped)",
ccr_hash,
)
return
return True
try:
from ..cache.compression_store import get_compression_store
except ImportError:
# Stripped build without the compression_store module.
# Mirror is a no-op; Rust side still serves the data.
logger.debug("CCR mirror: compression_store module unavailable")
return
return True
try:
store = get_compression_store()
except Exception as e: # pragma: no cover - defensive
logger.debug("CCR mirror: cannot get compression_store (%s)", e)
return
logger.warning("CCR mirror: cannot get compression_store (%s)", safe_id(e))
return False
# The TTL on the Python store defaults to 30 minutes — same as
# the Rust store's `DEFAULT_TTL` (see crates/headroom-core/src/
# ccr/mod.rs). No need to override.
@@ -1191,6 +1193,7 @@ class SmartCrusher(Transform):
compression_strategy=strategy,
explicit_hash=ccr_hash,
)
return True
except ValueError:
# explicit_hash validation failed — the marker had a
# malformed hash (shouldn't happen in practice).
@@ -1198,12 +1201,14 @@ class SmartCrusher(Transform):
"CCR mirror: invalid hash %r from rendered marker",
ccr_hash,
)
return False
except Exception as e:
# Store backends can echo the payload in errors, so no level logs it;
# describe_exception keeps only types and code locations.
logger.warning("CCR mirror: store write failed (%s) for hash %s", safe_id(e), ccr_hash)
if logger.isEnabledFor(logging.DEBUG):
logger.debug("CCR mirror store failure detail: %s", describe_exception(e))
return False
def _extract_context_from_messages(self, messages: list[dict[str, Any]]) -> str:
"""Build a query string from the last 5 user messages + recent
+19 -19
View File
@@ -1462,13 +1462,13 @@
}
},
"node_modules/@opencode-ai/plugin": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/@opencode-ai/plugin/-/plugin-1.19.0.tgz",
"integrity": "sha512-DgtiRekVKeHIQuDD7OndZrQlJ+V8pK/cUuksfB+OPTekmLD8beYT+zX8gMax94s9xhKxEGFhSunjr3V1rkCDEA==",
"version": "1.19.4",
"resolved": "https://registry.npmjs.org/@opencode-ai/plugin/-/plugin-1.19.4.tgz",
"integrity": "sha512-VN71q/OmfggxIhiDbuzYDYmZcQMsNyVSw1o91e7LD6WUn/9jx4usI9ZpoPbC5p/Prpo/Umzpd+38+EuLoKRr+A==",
"license": "MIT",
"dependencies": {
"@ai-sdk/provider": "3.0.8",
"@opencode-ai/sdk": "1.19.0",
"@opencode-ai/sdk": "1.19.4",
"effect": "4.0.0-beta.83",
"zod": "4.1.8"
},
@@ -1490,9 +1490,9 @@
}
},
"node_modules/@opencode-ai/sdk": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/@opencode-ai/sdk/-/sdk-1.19.0.tgz",
"integrity": "sha512-lDFYTD6qxzq1mfwxF6Kq1DAs6rEwF4xoZ2I3G1sB7hAZ8Yb28JurtSmmcK7ZzZ8Z4qBUYbZimHJ6DM4JFq5amw==",
"version": "1.19.4",
"resolved": "https://registry.npmjs.org/@opencode-ai/sdk/-/sdk-1.19.4.tgz",
"integrity": "sha512-3Wuc4t8gEuWKHbX1Na9oDK6PgOveid70l4Ks5RCjRIo2RcP8FQN3NS6Mg3XWc2+WiUfpfrmvBWlh5u1zeQfDQw==",
"license": "MIT",
"dependencies": {
"cross-spawn": "7.0.6"
@@ -1745,9 +1745,9 @@
"license": "MIT"
},
"node_modules/@opencode/util/node_modules/undici": {
"version": "8.11.2",
"resolved": "https://registry.npmjs.org/undici/-/undici-8.11.2.tgz",
"integrity": "sha512-u4UB2/IrKdU6lFxumHmmo1a3fCQO5tzQllRorfoRS63txhrB7xTpSn1PftwC4qEHkOaqP95fCWW4lJzwErwzhQ==",
"version": "8.12.3",
"resolved": "https://registry.npmjs.org/undici/-/undici-8.12.3.tgz",
"integrity": "sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -6492,9 +6492,9 @@
}
},
"node_modules/toml": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/toml/-/toml-4.3.0.tgz",
"integrity": "sha512-lVb8X9BsPVuH0M4BKeS91tXAmJvCjQ5UIyAbQFaxkKGyUFK2RPkhwaFSQH8vbpl1d23eu/IBH+dwVMHWaq9A5A==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/toml/-/toml-5.0.1.tgz",
"integrity": "sha512-EqYNA/YvUNndrA2B3O2ojzLQoTQrBxeZ9UIjQwk8t10oe6n7dwclBwd9IdZQTOKwe6vWX+AXtl6IntXRbepdxQ==",
"license": "MIT",
"engines": {
"node": ">=20"
@@ -6624,9 +6624,9 @@
"license": "MIT"
},
"node_modules/undici": {
"version": "6.29.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.0.tgz",
"integrity": "sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg==",
"version": "6.29.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz",
"integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==",
"dev": true,
"license": "MIT",
"engines": {
@@ -7076,9 +7076,9 @@
}
},
"node_modules/zod": {
"version": "4.1.8",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.1.8.tgz",
"integrity": "sha512-5R1P+WwQqmmMIEACyzSvo4JXHY5WiAFHRMg+zBZKgKS+Q1viRa0C1hmUKtHltoIFKtIdki3pRxkmpP74jnNYHQ==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
+3 -1
View File
@@ -46,7 +46,9 @@
"vitest": "^5.0.0"
},
"overrides": {
"esbuild": "^0.28.1"
"esbuild": "^0.28.1",
"zod": "^4.6.6",
"toml": "^5.0.1"
},
"license": "Apache-2.0"
}
+29 -1
View File
@@ -78,6 +78,13 @@ dependencies = [
# and pip upgrades an older copy. Same platform marker as huggingface-hub's
# own hf-xet requirement, so it never installs where hf-xet would not.
"hf-xet>=1.6.0; platform_machine == 'AMD64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'",
# Not imported directly: litellm, huggingface-hub and torch use it.
# CVE-2026-112907/112913/112940 are fixed in 4.2.1, but litellm 1.106 caps
# filelock <4, so without this floor pip picks that litellm and 3.32.7;
# with it pip takes litellm 1.103.7 (uv.lock has 1.101.0). Declared here so
# the floor reaches pip installs. 4.2 needs Python 3.11, so pip on 3.10
# still gets an affected filelock.
"filelock>=4.2.1; python_version >= '3.11'",
]
[project.optional-dependencies]
@@ -195,7 +202,7 @@ relevance = [
# `headroom/image/compressor.py` adapts both API shapes at runtime via
# a try/except cascade. See issue #372 for context.
image = [
"pillow>=12.3.0", # PYSEC-2026-2253/2254/2255/2256/2257 fixes (decompression-bomb + cmd-injection)
"pillow>=12.3.0", # PYSEC-2026-2253..2257; uv.lock takes 13.0.0 (see override-dependencies)
"sentencepiece>=0.1.99", # Required by SigLIP tokenizer (SiglipTokenizer)
# Python 3.6–3.12: keep the proven ORT-bundled package directly.
# ~15 MB ONNX models auto-downloaded on first use.
@@ -293,6 +300,11 @@ bedrock = [
"boto3>=1.41.0",
"botocore[crt]>=1.41.0",
]
# State shared across replicas: CCR store (HEADROOM_CCR_BACKEND=redis) and
# session-aware /v1/compress (HEADROOM_COMPRESS_SESSION_STORE=redis://...).
redis = [
"redis>=5.0.0",
]
# HTML content extraction
html = [
"trafilatura>=1.6.0",
@@ -325,6 +337,7 @@ dev = [
"sentence-transformers>=2.2.0,<7.0",
"numpy>=1.24.0",
"openpyxl>=3.1.0", # exercises spreadsheet_ingest (.xlsx) in the test suite
"fakeredis[lua]>=2.20.0", # Redis-backed shared state, without a Redis server
"xlrd>=2.0.1", # exercises spreadsheet_ingest (.xls) in the test suite
"xlwt>=1.3.0", # writes the legacy .xls fixtures for spreadsheet_ingest tests
# test_upstream_guard builds a self-signed cert to prove the pinned connection
@@ -424,6 +437,21 @@ constraint-dependencies = [
# then breaks CI on every public runner that can't reach the mirror.
# Declaring the index in pyproject.toml makes the project authoritative
# regardless of who runs `uv lock`.
# fastembed (0.9.0, latest) caps pillow <13, but Pillow 13.0.0 is the only fix
# for ten decoder CVEs on untrusted images (CVE-2026-112395, -112895 and
# others), which headroom.image opens. fastembed imports PIL only for its image models;
# Headroom uses its text models. Checked: fastembed text embedding and
# Headroom's image tests pass on Pillow 13. This applies to uv.lock (CI,
# release images, uv installs); the package metadata keeps pillow>=12.3.0 so
# `pip install headroom-ai[all]` still resolves against fastembed's cap; on
# that Pillow, headroom/image/decoder_guard.py forwards images undecoded.
# Drop this override once fastembed allows Pillow 13.
# Pillow 13 needs Python 3.11; on 3.10 no fixed release exists.
override-dependencies = [
"pillow>=13.0.0; python_version >= '3.11'",
"pillow>=12.3.0,<13; python_version < '3.11'",
]
[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple/"
+6 -6
View File
@@ -2631,9 +2631,9 @@
"license": "MIT"
},
"node_modules/undici": {
"version": "7.29.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.29.1.tgz",
"integrity": "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==",
"version": "7.30.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz",
"integrity": "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==",
"dev": true,
"license": "MIT",
"engines": {
@@ -2843,9 +2843,9 @@
}
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"dev": true,
"license": "MIT",
"peer": true,
+6 -1
View File
@@ -80,7 +80,7 @@ def _skip_proxy_port_preflight_unless_exercised(
@pytest.fixture(autouse=True)
def _scrub_developer_headroom_env(monkeypatch, tmp_path):
def _scrub_developer_headroom_env(monkeypatch, tmp_path, tmp_path_factory):
for key in list(os.environ):
if key.startswith("HEADROOM_"):
monkeypatch.delenv(key, raising=False)
@@ -89,6 +89,11 @@ def _scrub_developer_headroom_env(monkeypatch, tmp_path):
# test its own store so proxy/CLI startup cannot load developer settings and
# saves cannot rewrite them. Tests of path precedence can override this.
monkeypatch.setenv("HEADROOM_SETTINGS_PATH", str(tmp_path / "headroom-settings.json"))
# The proxy's compression cache keeps results on disk; never in the
# developer's ~/.headroom, never shared between tests, and not in tmp_path,
# which tests assert stays empty when nothing is persisted.
cache_dir = tmp_path_factory.mktemp("compression-cache")
monkeypatch.setenv("HEADROOM_COMPRESSION_CACHE_PATH", str(cache_dir / "compression_cache.db"))
# The scrub also deletes the HEADROOM_HARD_WATCHDOG_SECS=0 opt-out CI sets
# (#3845), so every test that enters the proxy lifespan armed the 90s
# production watchdog inside pytest; it hard-exits the process with code 1
+472
View File
@@ -0,0 +1,472 @@
"""One CCR store for every replica: HEADROOM_CCR_BACKEND=redis.
Behind a gateway that spreads requests across replicas, the retrieval of a
<<ccr:hash>> marker can land on a replica other than the one that compressed.
"""
from __future__ import annotations
import json
import pytest
fakeredis = pytest.importorskip("fakeredis")
from headroom.cache.backends.redis import RedisBackend # noqa: E402
from headroom.cache.compression_store import ( # noqa: E402
CompressionStore,
_create_default_ccr_backend,
)
from headroom.exceptions import StorageError # noqa: E402
@pytest.fixture
def server():
return fakeredis.FakeServer()
def _replica(server) -> CompressionStore:
backend = RedisBackend("redis://localhost", client=fakeredis.FakeRedis(server=server))
return CompressionStore(backend=backend)
def test_a_marker_made_on_one_replica_is_retrieved_on_another(server):
hash_key = _replica(server).store("the full original output " * 50, "short")
entry = _replica(server).retrieve(hash_key)
assert entry is not None and entry.original_content.startswith("the full original output")
def test_an_entry_expires_in_redis_when_it_expires(server):
store = _replica(server)
hash_key = store.store("original " * 40, "short", ttl=60)
ttl_ms = fakeredis.FakeRedis(server=server).pttl(f"headroom:ccr:{hash_key}")
assert 0 < ttl_ms <= 60_000
def test_deployments_with_different_prefixes_do_not_share(server, monkeypatch):
hash_key = _replica(server).store("original " * 40, "short")
monkeypatch.setenv("HEADROOM_REDIS_KEY_PREFIX", "staging")
assert _replica(server).retrieve(hash_key) is None
def test_redis_down_is_a_miss_and_issues_no_hash(monkeypatch):
import redis
class Down(fakeredis.FakeRedis):
def execute_command(self, *args, **kwargs):
raise redis.ConnectionError("connection refused")
store = CompressionStore(backend=RedisBackend("redis://localhost", client=Down()))
with pytest.raises(StorageError):
store.store("original " * 40, "short")
assert store.retrieve("abc123def456") is None
def test_a_corrupt_entry_is_a_miss(server):
store = _replica(server)
fakeredis.FakeRedis(server=server).set("headroom:ccr:abc123def456", "not json")
assert store.retrieve("abc123def456") is None
def test_the_env_selects_the_redis_backend(monkeypatch):
monkeypatch.setenv("HEADROOM_CCR_BACKEND", "redis")
monkeypatch.setenv("HEADROOM_REDIS_URL", "redis://127.0.0.1:6399/0")
assert isinstance(_create_default_ccr_backend(), RedisBackend)
def test_a_url_that_is_not_redis_falls_back_to_the_local_store(monkeypatch):
monkeypatch.setenv("HEADROOM_CCR_BACKEND", "redis")
monkeypatch.setenv("HEADROOM_REDIS_URL", "memcached://cache:11211")
assert _create_default_ccr_backend() is None
def test_redis_is_skipped_for_a_while_after_a_connection_error():
import redis
calls = []
class Down(fakeredis.FakeRedis):
def execute_command(self, *args, **kwargs):
calls.append(args[0])
raise redis.ConnectionError("connection refused")
backend = RedisBackend("redis://localhost", client=Down())
for _ in range(5):
backend.get("abc123def456")
assert len(calls) == 1 # one failure, then back-off
def test_storing_never_scans_the_shared_keyspace(server, monkeypatch):
# A per-replica cap would count (SCAN) the whole store on every write and
# evict other replicas' live entries; Redis expires entries by TTL.
store = _replica(server)
store._max_entries = 2
monkeypatch.setattr(RedisBackend, "_scan", lambda self: pytest.fail("scanned"))
hashes = [store.store(f"original {i} " * 40, f"short {i}") for i in range(5)]
# Re-stores (a marker met again every turn) and retrievals neither.
for _ in range(300):
store.store("original 0 " * 40, "short 0")
assert all(store.retrieve(h) is not None for h in hashes)
assert not store._eviction_heap and not store._expiration_heap # nothing grows
def test_a_redis_that_reads_but_refuses_writes_logs_once(caplog):
import redis
class Full(fakeredis.FakeRedis):
def set(self, *args, **kwargs):
raise redis.ResponseError("OOM command not allowed")
store = CompressionStore(backend=RedisBackend("redis://localhost", client=Full()))
with caplog.at_level("INFO", logger="headroom.cache.redis_client"):
for i in range(5):
with pytest.raises(StorageError):
store.store(f"original {i} " * 40, "short")
store.retrieve("abc123def456")
messages = [r.getMessage() for r in caplog.records]
assert sum("failed" in m for m in messages) == 1
assert not any("works again" in m for m in messages)
def test_a_prefix_with_glob_characters_matches_only_itself(server, monkeypatch):
_replica(server).store("ours " * 40, "short")
monkeypatch.setenv("HEADROOM_REDIS_KEY_PREFIX", "head*")
assert RedisBackend("redis://localhost", client=fakeredis.FakeRedis(server=server)).count() == 0
def test_stats_and_retrieval_never_read_or_rewrite_whole_entries(server, monkeypatch):
store = _replica(server)
hashes = [
store.store(f"original {i} " * 40, f"short {i}", original_tokens=80, compressed_tokens=2)
for i in range(5)
]
reads, writes = [], []
monkeypatch.setattr(fakeredis.FakeRedis, "get", lambda self, k: reads.append(k))
stats = store.get_stats()
assert stats["entry_count"] == 5 and not reads
# Numeric totals (/stats contract): what this replica stored and retrieved.
assert (stats["total_original_tokens"], stats["total_retrievals"]) == (400, 0)
monkeypatch.undo()
monkeypatch.setattr(fakeredis.FakeRedis, "set", lambda self, *a, **kw: writes.append(a))
assert store.retrieve(hashes[0]) is not None
assert not writes
assert store.get_stats()["total_retrievals"] == 1
def test_credentials_in_a_redis_error_are_not_logged(caplog):
import redis
class Refusing(fakeredis.FakeRedis):
def get(self, *args, **kwargs):
raise redis.ConnectionError("cannot reach redis://app:s3cret@cache:6379/0")
backend = RedisBackend("redis://localhost", client=Refusing())
with caplog.at_level("WARNING", logger="headroom.cache.redis_client"):
assert backend.get("abc") is None
assert "s3cret" not in caplog.text and "//***@cache" in caplog.text
def test_a_write_redis_refuses_adds_no_tokens(caplog):
import redis
class Full(fakeredis.FakeRedis):
def set(self, *args, **kwargs):
raise redis.ResponseError("OOM command not allowed")
store = CompressionStore(backend=RedisBackend("redis://localhost", client=Full()))
with pytest.raises(StorageError):
store.store("original " * 40, "short", original_tokens=80, compressed_tokens=2)
stats = store.get_stats()
assert (stats["total_original_tokens"], stats["totals_scope"]) == (0, "this_replica")
# --- A producer never advertises an original Redis did not take -------------
_CONFIG = "[server]\n" + "".join(
f"# comment line {i} describing port_{i}\nport_{i} = {8000 + i}\n" for i in range(30)
)
class _Flaky(fakeredis.FakeRedis):
"""A Redis that refuses writes (``oom``) or cannot be reached (``down``)."""
outage: str | None = None
def execute_command(self, *args, **kwargs):
import redis
if self.outage == "down":
raise redis.ConnectionError("connection refused")
if self.outage == "oom" and args[0] == "SET":
raise redis.ResponseError("OOM command not allowed")
return super().execute_command(*args, **kwargs)
@pytest.fixture
def flaky_store(server, monkeypatch):
from headroom.cache import compression_store, redis_client
monkeypatch.setattr(redis_client, "BACKOFF_SECONDS", 0.0) # recovery is immediate
client = _Flaky(server=server)
store = CompressionStore(backend=RedisBackend("redis://localhost", client=client))
# Global too: executor threads (the MCP tools) and startup do not see the
# request-scoped store.
monkeypatch.setattr(compression_store, "_compression_store", store)
compression_store.set_request_compression_store(store)
yield store, client
compression_store.clear_request_compression_store()
def _marker_hash(text: str) -> str | None:
import re
found = re.search(r"hash=([0-9a-f]{24})", text)
return found.group(1) if found else None
@pytest.mark.parametrize("outage", ["oom", "down"])
def test_config_elision_keeps_the_original_while_redis_fails_then_resumes(flaky_store, outage):
from headroom.transforms.config_compressor import ConfigCompressor
store, client = flaky_store
client.outage = outage
failed = ConfigCompressor().compress(_CONFIG)
assert failed.compressed == _CONFIG and failed.ccr_hash is None and failed.lines_elided == 0
client.outage = None
resumed = ConfigCompressor().compress(_CONFIG)
assert resumed.lines_elided == 30
entry = store.retrieve(_marker_hash(resumed.compressed))
assert entry is not None and entry.original_content == _CONFIG
@pytest.mark.parametrize("outage", ["oom", "down"])
def test_read_maturation_keeps_the_read_while_redis_fails_then_resumes(flaky_store, outage):
from headroom.config import ReadMaturationConfig
from headroom.transforms.read_maturation import ReadMaturationManager
store, client = flaky_store
content = " 1\tdef foo():\n 2\t return 42\n" * 60
messages = [
{"role": "user", "content": "look"},
{
"role": "assistant",
"content": [
{"type": "tool_use", "id": "r1", "name": "Read", "input": {"file_path": "/x.py"}}
],
},
{
"role": "user",
"content": [{"type": "tool_result", "tool_use_id": "r1", "content": content}],
},
*[{"role": "assistant", "content": [{"type": "text", "text": "t"}]} for _ in range(5)],
]
manager = ReadMaturationManager(
ReadMaturationConfig(enabled=True, quiesce_turns=5), compression_store=store
)
client.outage = outage
assert manager.apply(messages).messages[2]["content"][0]["content"] == content
client.outage = None
matured = manager.apply(messages).messages[2]["content"][0]["content"]
entry = store.retrieve(_marker_hash(matured))
assert entry is not None and entry.original_content == content
@pytest.mark.parametrize("outage", ["oom", "down"])
def test_read_lifecycle_keeps_a_stale_read_while_redis_fails(flaky_store, outage):
from headroom.config import ReadLifecycleConfig
from headroom.transforms.read_lifecycle import ReadLifecycleManager
store, client = flaky_store
content = "x = 1\n" * 200
def call(tc_id, name, args):
fn = {"name": name, "arguments": json.dumps(args)}
return {"role": "assistant", "content": None, "tool_calls": [{"id": tc_id, "function": fn}]}
messages = [
call("r1", "Read", {"file_path": "/a.py"}),
{"role": "tool", "tool_call_id": "r1", "content": content},
call("e1", "Edit", {"file_path": "/a.py", "old_string": "x", "new_string": "y"}),
{"role": "tool", "tool_call_id": "e1", "content": "ok"},
]
manager = ReadLifecycleManager(ReadLifecycleConfig(enabled=True), compression_store=store)
client.outage = outage
assert manager.apply(messages).messages[1]["content"] == content
client.outage = None
entry = store.retrieve(_marker_hash(manager.apply(messages).messages[1]["content"]))
assert entry is not None and entry.original_content == content
@pytest.mark.parametrize("outage", ["oom", "down"])
def test_rust_log_compression_keeps_the_log_while_redis_fails(flaky_store, outage):
pytest.importorskip("headroom._core")
from headroom.transforms.log_compressor import LogCompressor, LogCompressorConfig
store, client = flaky_store
log = "\n".join(["npm WARN deprecated x"] * 30 + ["npm ERR! something broke"] * 5)
compressor = LogCompressor(LogCompressorConfig(enable_ccr=True, min_lines_for_ccr=3))
client.outage = outage
failed = compressor.compress(log)
assert failed.compressed == log and failed.cache_key is None
client.outage = None
resumed = compressor.compress(log)
assert resumed.cache_key is not None
assert store.retrieve(resumed.cache_key).original_content == log
def test_mcp_read_returns_the_file_and_caches_no_hash_while_redis_is_down(flaky_store, tmp_path):
import asyncio
from tests._mcp_stub import import_module_with_mcp_stub
mcp_server = import_module_with_mcp_stub("headroom.ccr.mcp_server")
store, client = flaky_store
path = tmp_path / "a.py"
source = "x = 1\n" * 50
path.write_bytes(source.encode()) # exact bytes: write_text would emit CRLF on Windows
server = mcp_server.HeadroomMCPServer(check_proxy=False)
client.outage = "down"
response = asyncio.run(server._handle_read({"file_path": str(path)}))
assert "x = 1" in response[0].kwargs["text"] and not server._file_cache
client.outage = None
asyncio.run(server._handle_read({"file_path": str(path)}))
(_, ccr_hash, _, _) = next(iter(server._file_cache.values()))
assert store.retrieve(ccr_hash).original_content == source
@pytest.mark.parametrize("outage", ["oom", "down"])
def test_mcp_compress_returns_the_original_while_redis_fails_then_resumes(flaky_store, outage):
import asyncio
from tests._mcp_stub import import_module_with_mcp_stub
mcp_server = import_module_with_mcp_stub("headroom.ccr.mcp_server")
store, client = flaky_store
content = json.dumps([{"id": i, "status": "ok", "tag": "alpha"} for i in range(60)])
server = mcp_server.HeadroomMCPServer(check_proxy=False)
def compress() -> dict:
response = asyncio.run(server._handle_compress({"content": content}))
return json.loads(response[0].kwargs["text"])
client.outage = outage
failed = compress()
assert (failed["compressed"], failed["hash"], failed["tokens_saved"]) == (content, None, 0)
client.outage = None
resumed = compress()
assert resumed["compressed"] != content
assert store.retrieve(resumed["hash"]).original_content == content
@pytest.mark.parametrize("outage", ["oom", "down"])
def test_proxy_starts_when_redis_fails_restoring_prefix_state(
server, flaky_store, outage, monkeypatch, tmp_path
):
pytest.importorskip("fastapi")
import contextvars
from fastapi.testclient import TestClient
from headroom.cache.prefix_tracker import PREFIX_STATE_FILE_ENV, SessionTrackerStore
from headroom.proxy.server import ProxyConfig, create_app
from tests.test_anthropic_fork_lineage_cache import _send
store, client = flaky_store
hash_key = store.store(json.dumps(list(range(400))), "[0, 1]", ttl=900)
saved = SessionTrackerStore()
text = f"[400 items compressed to 2. Retrieve more: hash={hash_key}]"
contextvars.Context().run(_send, saved, [{"role": "user", "content": text}])
path = tmp_path / "prefix-state.json"
assert saved.save_state(str(path)) == 1
fakeredis.FakeRedis(server=server).flushall() # Redis lost it; only the state file has it
monkeypatch.setenv(PREFIX_STATE_FILE_ENV, str(path))
def start() -> int:
config = ProxyConfig(optimize=False, rate_limit_enabled=False, cost_tracking_enabled=False)
with TestClient(create_app(config)) as app_client:
return app_client.app.state.proxy.session_tracker_store.active_sessions
client.outage = outage
# load_state treats the failed import like a bad file: the proxy starts and
# installs no tracker, so none replays a marker whose original is gone.
assert start() == 0
def _router(**config):
from headroom.transforms.content_router import ContentRouter, ContentRouterConfig
return ContentRouter(ContentRouterConfig(enable_kompress=False, **config))
@pytest.mark.parametrize("outage", ["oom", "down"])
def test_smart_crusher_row_drop_keeps_the_rows_while_redis_fails_then_resumes(
flaky_store, outage, monkeypatch
):
pytest.importorskip("headroom._core")
import re
monkeypatch.setenv("HEADROOM_DETECT_BACKEND", "python")
store, client = flaky_store
rows = [{"id": i, "status": "ok", "tag": "alpha"} for i in range(60)]
router = _router(smart_crusher_with_compaction=False) # the row-drop path
client.outage = outage
assert "<<ccr:" not in router.compress(json.dumps(rows)).compressed
client.outage = None
resumed = router.compress(json.dumps(rows)).compressed
entry = store.retrieve(re.search(r"<<ccr:([0-9a-f]+)", resumed).group(1))
assert entry is not None and json.loads(entry.original_content) == rows
@pytest.mark.parametrize("outage", ["oom", "down"])
def test_external_compressor_output_is_dropped_while_redis_fails_then_resumes(
flaky_store, outage, monkeypatch
):
import hashlib
from headroom.transforms.compressor_registry import CompressorDescriptor, CompressOutput
monkeypatch.setenv("HEADROOM_DETECT_BACKEND", "python")
store, client = flaky_store
class External:
descriptor = CompressorDescriptor(
name="ext_json",
content_types=["application/json"],
lossless=False,
cost_tier="fast",
recoverable=True,
)
def compress(self, inp):
digest = hashlib.sha256(inp.content.encode()).hexdigest()[:24]
return CompressOutput(
content=f"[external <<ccr:{digest}>>]",
tokens_before=len(inp.content.split()),
tokens_after=2,
lossless=False,
markers=[],
recoverable={digest: inp.content},
warnings=[],
)
content = json.dumps([{"id": i, "note": f"descriptive field {i} " * 3} for i in range(40)])
router = _router(active_external_compressors=["ext_json"])
router.compressor_registry.register(External(), replace=True)
router._active_external_compressors = router._resolve_active_external_compressors()
client.outage = outage
failed = router.compress(content)
assert "external:ext_json" not in failed.strategy_chain
assert "<<ccr:" not in failed.compressed
client.outage = None
resumed = router.compress(content)
assert "external:ext_json" in resumed.strategy_chain
digest = hashlib.sha256(content.encode()).hexdigest()[:24]
assert store.retrieve(digest).original_content == content
+1 -1
View File
@@ -50,7 +50,7 @@ def test_persist_warning_rejects_malformed_exception_names(monkeypatch, caplog,
monkeypatch.delenv("HEADROOM_DEBUG_DUMP", raising=False)
monkeypatch.setattr(compression_store, "get_compression_store", lambda: BrokenStore())
with caplog.at_level(level, logger=base.logger.name):
assert persist_rust_ccr_entry("original", "compressed", "a" * 24, source="diff") is None
assert persist_rust_ccr_entry("original", "compressed", "a" * 24, source="diff") is False
assert len([record for record in caplog.records if record.levelno == logging.WARNING]) == 1
for record in caplog.records:
rendered = logging.Formatter().format(record)
+342
View File
@@ -0,0 +1,342 @@
"""Session-aware /v1/compress served by several replicas sharing Redis.
A gateway without sticky sessions sends each turn to any replica. With
HEADROOM_COMPRESS_SESSION_STORE set, a replica that did not serve the last turn
takes the session's state from Redis, freezes the prefix the caller already
forwarded, and returns it byte for byte.
"""
from __future__ import annotations
import json
import pytest
pytest.importorskip("fastapi")
fakeredis = pytest.importorskip("fakeredis")
pytest.importorskip("lupa")
from fastapi.testclient import TestClient # noqa: E402
from headroom.cache import shared_sessions # noqa: E402
from headroom.cache.backends.redis import RedisBackend # noqa: E402
from headroom.cache.compression_store import _create_default_ccr_backend # noqa: E402
from headroom.exceptions import ConfigurationError # noqa: E402
from headroom.proxy.server import ProxyConfig, create_app # noqa: E402
from tests.test_compress_session_mode import _big_tool_history, _compress # noqa: E402
@pytest.fixture
def redis_server(monkeypatch):
import redis
server = fakeredis.FakeServer()
monkeypatch.setenv(shared_sessions.STORE_ENV, "redis://127.0.0.1:6399/0")
monkeypatch.setenv("HEADROOM_CCR_BACKEND", "memory") # CCR sharing is tested on its own
monkeypatch.setattr(
redis.Redis,
"from_url",
classmethod(lambda cls, *a, **k: fakeredis.FakeRedis(server=server)),
)
return fakeredis.FakeRedis(server=server)
def _replica() -> TestClient:
config = ProxyConfig(
optimize=True,
cache_enabled=False,
rate_limit_enabled=False,
cost_tracking_enabled=False,
log_requests=False,
image_optimize=False,
)
return TestClient(create_app(config), base_url="http://127.0.0.1", client=("127.0.0.1", 1))
def _second_tool_result() -> list[dict]:
rows = [
{"id": i, "path": f"src/mod_{i}.py", "line": i * 3, "hit": "x" * 200} for i in range(150)
]
return [
{
"role": "assistant",
"content": None,
"tool_calls": [
{"id": "c2", "type": "function", "function": {"name": "grep", "arguments": "{}"}}
],
},
{"role": "tool", "tool_call_id": "c2", "content": json.dumps(rows)},
]
def test_any_replica_serves_the_next_turn_byte_for_byte(redis_server):
history = _big_tool_history()
with _replica() as a, _replica() as b:
turn1 = _compress(a, history, session_id="conv")
assert turn1["messages"][2]["content"] != history[2]["content"] # compressed
# Turn 2 on B adds a second tool result, compressed by B.
history2 = history + _second_tool_result()
turn2 = _compress(b, history2, session_id="conv")
assert turn2["messages"][: len(turn1["messages"])] == turn1["messages"]
assert turn2["session"]["frozen_message_count"] >= len(turn1["messages"])
assert turn2["messages"][4]["content"] != history2[4]["content"]
# Back on A, which last saw turn 1: only B's state has B's bytes.
history3 = history2 + [{"role": "user", "content": "again"}]
turn3 = _compress(a, history3, session_id="conv")
assert turn3["messages"][: len(turn2["messages"])] == turn2["messages"]
assert turn3["session"]["frozen_message_count"] >= len(turn2["messages"])
def test_without_the_store_a_new_replica_starts_cold(monkeypatch):
# What the store fixes: B never saw the compressed tool result, so it does
# not freeze it and compresses it again.
monkeypatch.delenv(shared_sessions.STORE_ENV, raising=False)
history = _big_tool_history()
with _replica() as a, _replica() as b:
turn1 = _compress(a, history, session_id="conv")
turn2 = _compress(b, history + [{"role": "user", "content": "x"}], session_id="conv")
assert turn2["session"]["frozen_message_count"] < len(turn1["messages"])
def test_a_turn_writes_only_the_messages_redis_lacks(redis_server):
history = _big_tool_history()
with _replica() as a:
_compress(a, history, session_id="conv-delta")
(msgs_key,) = redis_server.keys("headroom:session:*:msgs")
before = set(redis_server.hkeys(msgs_key))
import redis
written: list[int] = []
real_hset = redis.client.Pipeline.hset
def counting_hset(self, name, *args, mapping=None, **kwargs):
written.append(len(mapping or {}))
return real_hset(self, name, *args, mapping=mapping, **kwargs)
redis.client.Pipeline.hset = counting_hset
try:
_compress(
a, history + [{"role": "user", "content": "one more"}], session_id="conv-delta"
)
finally:
redis.client.Pipeline.hset = real_hset
after = set(redis_server.hkeys(msgs_key))
# The new user message, and at most the few whose cache marker moved.
assert 1 <= sum(written) <= 3 < len(before)
assert before <= after
def test_a_lost_key_is_stored_whole_again(redis_server):
history = _big_tool_history()
with _replica() as a, _replica() as b:
_compress(a, history, session_id="conv-lost")
redis_server.flushall()
turn2 = _compress(a, history + [{"role": "user", "content": "y"}], session_id="conv-lost")
assert redis_server.keys("headroom:session:*:meta")
# And another replica is warm from it.
turn3 = _compress(
b,
history + [{"role": "user", "content": "y"}, {"role": "user", "content": "z"}],
session_id="conv-lost",
)
assert turn3["messages"][: len(turn2["messages"])] == turn2["messages"]
assert turn3["session"]["frozen_message_count"] >= len(turn2["messages"])
def test_the_usage_relay_reaches_and_publishes_a_session_served_elsewhere(redis_server):
with _replica() as a, _replica() as b:
_compress(a, _big_tool_history(), session_id="conv-usage")
(meta_key,) = redis_server.keys("headroom:session:*:meta")
token = redis_server.hget(meta_key, "t")
resp = b.post(
"/v1/usage",
json={
"session_id": "conv-usage",
"usage": {"cache_read_input_tokens": 0, "cache_creation_input_tokens": 50_000},
},
)
assert resp.status_code == 200, resp.text
assert redis_server.hget(meta_key, "t") != token # B published its update
def test_a_redis_outage_or_corrupt_state_never_fails_a_turn(redis_server, monkeypatch):
import redis
history = _big_tool_history()
with _replica() as a, _replica() as b:
turn1 = _compress(a, history, session_id="conv-down")
(meta_key,) = redis_server.keys("headroom:session:*:meta")
redis_server.hset(meta_key, "m", "{not json")
turn2 = _compress(b, history + [{"role": "user", "content": "y"}], session_id="conv-down")
assert turn2["messages"][0] == turn1["messages"][0]
def down(*args, **kwargs):
raise redis.ConnectionError("connection refused")
monkeypatch.setattr(fakeredis.FakeRedis, "execute_command", down)
turn3 = _compress(a, history + [{"role": "user", "content": "z"}], session_id="conv-down")
assert turn3["messages"][: len(turn1["messages"])] == turn1["messages"]
def test_sharing_sessions_shares_the_ccr_store_too(monkeypatch):
monkeypatch.setenv(shared_sessions.STORE_ENV, "redis://127.0.0.1:6399/0")
monkeypatch.delenv("HEADROOM_CCR_BACKEND", raising=False)
assert isinstance(_create_default_ccr_backend(), RedisBackend)
def test_a_store_url_that_is_not_redis_stops_startup(monkeypatch):
monkeypatch.setenv(shared_sessions.STORE_ENV, "memcached://cache:11211")
with pytest.raises(ConfigurationError, match="redis://"):
shared_sessions.open_shared_sessions()
def _meta_key(redis_server):
(meta_key,) = redis_server.keys("headroom:session:*:meta")
return meta_key
def test_messages_evicted_on_their_own_are_stored_whole_again(redis_server):
history = _big_tool_history()
with _replica() as a, _replica() as b:
_compress(a, history, session_id="conv-evict")
meta_key = _meta_key(redis_server)
redis_server.delete(meta_key.replace(b":meta", b":msgs")) # maxmemory took one key
history2 = history + [{"role": "user", "content": "y"}]
turn2 = _compress(a, history2, session_id="conv-evict")
turn3 = _compress(b, history2 + [{"role": "user", "content": "z"}], session_id="conv-evict")
assert turn3["session"]["frozen_message_count"] >= len(turn2["messages"])
def test_corrupt_state_is_rewritten_by_the_next_replica_to_write(redis_server):
history = _big_tool_history()
with _replica() as a, _replica() as b, _replica() as c:
_compress(a, history, session_id="conv-corrupt")
redis_server.hset(_meta_key(redis_server), "m", "{not json")
history2 = history + [{"role": "user", "content": "y"}]
turn2 = _compress(b, history2, session_id="conv-corrupt") # repairs it
turn3 = _compress(
c, history2 + [{"role": "user", "content": "z"}], session_id="conv-corrupt"
)
assert turn3["messages"][: len(turn2["messages"])] == turn2["messages"]
assert turn3["session"]["frozen_message_count"] >= len(turn2["messages"])
def test_messages_no_transcript_references_are_pruned(redis_server):
history = _big_tool_history()
with _replica() as a:
_compress(a, history, session_id="conv-prune")
msgs_key = _meta_key(redis_server).replace(b":meta", b":msgs")
redis_server.hset(msgs_key, mapping={f"stale{i}": "{}" for i in range(50)})
_compress(a, history + [{"role": "user", "content": "y"}], session_id="conv-prune")
assert not any(k.startswith(b"stale") for k in redis_server.hkeys(msgs_key))
def test_a_writer_whose_clock_runs_ahead_is_still_trusted(redis_server):
history = _big_tool_history()
with _replica() as a, _replica() as b:
turn1 = _compress(a, history, session_id="conv-skew")
meta_key = _meta_key(redis_server)
meta = json.loads(redis_server.hget(meta_key, "m"))
meta["last_activity"] += 30 # A's clock is 30 s ahead of B's
redis_server.hset(meta_key, "m", json.dumps(meta))
turn2 = _compress(b, history + [{"role": "user", "content": "y"}], session_id="conv-skew")
assert turn2["session"]["frozen_message_count"] >= len(turn1["messages"])
def test_a_lost_message_is_noticed_even_beside_unreferenced_ones(redis_server):
history = _big_tool_history()
with _replica() as a, _replica() as b:
_compress(a, history, session_id="conv-masked")
msgs_key = _meta_key(redis_server).replace(b":meta", b":msgs")
# Old variants left behind outnumber the one referenced message lost.
redis_server.hset(msgs_key, mapping={f"old{i}": "{}" for i in range(5)})
redis_server.hdel(msgs_key, redis_server.hkeys(msgs_key)[0])
history2 = history + [{"role": "user", "content": "y"}]
turn2 = _compress(a, history2, session_id="conv-masked")
turn3 = _compress(
b, history2 + [{"role": "user", "content": "z"}], session_id="conv-masked"
)
assert turn3["session"]["frozen_message_count"] >= len(turn2["messages"])
def test_a_corrupt_token_never_fails_a_turn_and_is_replaced(redis_server):
history = _big_tool_history()
with _replica() as a, _replica() as b:
_compress(a, history, session_id="conv-token")
redis_server.hset(_meta_key(redis_server), "t", b"\xff")
history2 = history + [{"role": "user", "content": "y"}]
turn2 = _compress(b, history2, session_id="conv-token")
turn3 = _compress(a, history2 + [{"role": "user", "content": "z"}], session_id="conv-token")
assert turn3["session"]["frozen_message_count"] >= len(turn2["messages"])
@pytest.fixture
def evict_before_cas(monkeypatch):
"""Delete the messages hash just before the next ``times`` compare-and-set
scripts run, as maxmemory might between the message writes and the script."""
budget = {"times": 0}
real_init = shared_sessions.SharedSessions.__init__
def init(self, client):
real_init(self, client)
cas = self._cas
def evicting_cas(keys, args):
if budget["times"]:
budget["times"] -= 1
client.delete(keys[1])
return cas(keys=keys, args=args)
self._cas = evicting_cas
monkeypatch.setattr(shared_sessions.SharedSessions, "__init__", init)
return budget
def test_eviction_before_the_first_publish_is_never_acknowledged(redis_server, evict_before_cas):
history = _big_tool_history()
with _replica() as a, _replica() as b:
evict_before_cas["times"] = 1
turn1 = _compress(a, history, session_id="conv-evict-first")
turn2 = _compress(
b, history + [{"role": "user", "content": "y"}], session_id="conv-evict-first"
)
assert turn2["messages"][: len(turn1["messages"])] == turn1["messages"]
assert turn2["session"]["frozen_message_count"] >= len(turn1["messages"])
@pytest.mark.parametrize("corrupt", [False, True], ids=["delta", "whole-rewrite"])
def test_eviction_before_a_later_publish_is_never_acknowledged(
redis_server, evict_before_cas, corrupt
):
history = _big_tool_history()
with _replica() as a, _replica() as b, _replica() as c:
_compress(a, history, session_id="conv-evict-later")
if corrupt: # B then rewrites the session whole, assuming no message stored
redis_server.hset(_meta_key(redis_server), "m", "{not json")
history2 = history + [{"role": "user", "content": "y"}]
evict_before_cas["times"] = 1
turn2 = _compress(b, history2, session_id="conv-evict-later")
turn3 = _compress(
c, history2 + [{"role": "user", "content": "z"}], session_id="conv-evict-later"
)
assert turn3["messages"][: len(turn2["messages"])] == turn2["messages"]
assert turn3["session"]["frozen_message_count"] >= len(turn2["messages"])
def test_a_session_whose_messages_keep_vanishing_is_not_published(redis_server, evict_before_cas):
history = _big_tool_history()
with _replica() as a, _replica() as b:
evict_before_cas["times"] = 2 # the write and its whole rewrite
_compress(a, history, session_id="conv-evict-twice")
assert not redis_server.keys("headroom:session:*:meta")
# Once Redis keeps the messages again, the next turn publishes it whole.
history2 = history + [{"role": "user", "content": "y"}]
turn2 = _compress(a, history2, session_id="conv-evict-twice")
turn3 = _compress(
b, history2 + [{"role": "user", "content": "z"}], session_id="conv-evict-twice"
)
assert turn3["session"]["frozen_message_count"] >= len(turn2["messages"])
+39
View File
@@ -0,0 +1,39 @@
"""Security overrides reach every install the project controls.
fastembed caps pillow <13 while the decoder fixes are only in 13, so uv.lock
takes 13 through [tool.uv] override-dependencies. A lock refresh, or a build
step that installs from package metadata, would silently drop it.
"""
from __future__ import annotations
import re
from pathlib import Path
try:
import tomllib
except ModuleNotFoundError: # Python 3.10
import tomli as tomllib # type: ignore[no-redef]
ROOT = Path(__file__).resolve().parents[1]
def _overrides() -> list[str]:
with open(ROOT / "pyproject.toml", "rb") as f:
return tomllib.load(f)["tool"]["uv"]["override-dependencies"]
def test_the_lock_takes_the_fixed_pillow_on_supported_pythons():
with open(ROOT / "uv.lock", "rb") as f:
versions = [p["version"] for p in tomllib.load(f)["package"] if p["name"] == "pillow"]
assert any(int(v.split(".")[0]) >= 13 for v in versions), versions
assert any(o.startswith("pillow>=13") for o in _overrides())
def test_the_image_build_applies_the_overrides():
# `uv pip install` ignores [tool.uv] override-dependencies; the Dockerfile
# must pass them, or the image installs pillow 12 under fastembed's cap.
dockerfile = (ROOT / "Dockerfile").read_text()
install = re.search(r"uv pip install --system (.*)", dockerfile)
assert install and "--overrides" in install.group(1)
assert "override-dependencies" in dockerfile
+89
View File
@@ -0,0 +1,89 @@
"""An install with an affected Pillow never decodes an untrusted image.
`pip install headroom-ai[all]` resolves Pillow 12 under fastembed's <13 cap, and
Python 3.10 has no Pillow 13. Those installs must forward images unchanged.
"""
from __future__ import annotations
import base64
import io
import logging
import pytest
pytest.importorskip("PIL")
import PIL # noqa: E402
from PIL import Image # noqa: E402
from headroom.image import ImageCompressor, decoder_guard # noqa: E402
from headroom.tokenizers.base import BaseTokenizer # noqa: E402
def _png() -> bytes:
buf = io.BytesIO()
Image.new("RGB", (64, 64)).save(buf, format="PNG")
return buf.getvalue()
_PNG_BYTES = _png()
_PNG = base64.b64encode(_PNG_BYTES).decode()
@pytest.fixture
def pillow_version(monkeypatch):
def use(installed: str) -> None:
monkeypatch.setattr(PIL, "__version__", installed)
decoder_guard.pillow_is_safe.cache_clear()
yield use
decoder_guard.pillow_is_safe.cache_clear()
@pytest.fixture
def image_opens(monkeypatch):
opened: list[object] = []
real_open = Image.open
monkeypatch.setattr(Image, "open", lambda *a, **k: opened.append(a) or real_open(*a, **k))
return opened
def _messages() -> list[dict]:
return [
{
"role": "user",
"content": [
{"type": "text", "text": "What does this show?"},
{
"type": "image",
"source": {"type": "base64", "media_type": "image/png", "data": _PNG},
},
],
}
]
def test_an_affected_pillow_forwards_images_without_opening_them(
pillow_version, image_opens, caplog
):
pillow_version("12.3.0")
messages = _messages()
with caplog.at_level(logging.WARNING, logger=decoder_guard.__name__):
assert ImageCompressor().compress(messages, provider="anthropic") is messages
assert ImageCompressor().compress(_messages(), provider="anthropic") == _messages()
tokens = BaseTokenizer._estimate_image_tokens({"source": {"bytes": _PNG_BYTES}})
assert image_opens == []
assert tokens > 0
assert len(caplog.records) == 1 # once per process, not per image
assert "Pillow 12.3.0" in caplog.records[0].getMessage()
def test_a_fixed_pillow_still_decodes(pillow_version, image_opens):
pillow_version("13.0.0")
BaseTokenizer._estimate_image_tokens({"source": {"bytes": _PNG_BYTES}})
assert image_opens
+6 -4
View File
@@ -281,15 +281,17 @@ def test_recoverable_map_is_retrievable(_memory_ccr):
assert entry.compression_strategy == "external:ext_json"
def test_non_hex_recoverable_hash_is_skipped_without_breaking(_memory_ccr):
# A malformed (non-hex) recovery hash must not break the request; the block
# is still compressed, only that entry is not retrievable.
def test_non_hex_recoverable_hash_falls_back_to_builtin(_memory_ccr):
# A malformed (non-hex) recovery hash must not break the request; the store
# cannot keep that entry, so the external output (whose marker would point
# nowhere) is discarded and the built-in path runs.
comp = _RecordingExternal(name="ext_json", content_types=("application/json",), bad_hash=True)
router = _router_with_external(comp, ["ext_json"])
result = router.compress(_JSON_ARRAY)
assert "external:ext_json" in result.strategy_chain
assert "external:ext_json" not in result.strategy_chain
assert "external-compressed" not in result.compressed
assert get_compression_store().retrieve("zznothex") is None
+382
View File
@@ -0,0 +1,382 @@
"""The content router's compression cache stays within its memory budget."""
from __future__ import annotations
import subprocess
import sys
import threading
from headroom.cache.result_store import ResultStore, open_result_store
from headroom.transforms.content_router import (
CompressionCache,
ContentRouter,
ContentRouterConfig,
content_cache_key,
)
def test_results_stay_within_the_memory_budget_least_recently_used_first():
cache = CompressionCache(max_bytes=10_000)
for i in range(100):
cache.put(f"k{i}", "x" * 1000, 0.5, "kompress")
cache.get("k0") # k0 stays recently used
assert cache.stats["cache_bytes"] <= 10_000
assert cache.get("k0") is not None
assert cache.get("k1") is None # evicted, not kept forever
def test_an_evicted_result_comes_back_from_disk_unchanged(tmp_path):
cache = CompressionCache(max_bytes=3_000, store=ResultStore(tmp_path / "c.db", 1800))
cache.put("first", "compressed once", 0.4, "kompress")
for i in range(10):
cache.put(f"k{i}", "y" * 1000, 0.5, "kompress")
# Out of memory, but read back: no second compression, same bytes.
assert cache.get("first") == ("compressed once", 0.4, "kompress")
assert cache.stats["cache_disk_hits"] == 1
def test_the_skip_set_is_bounded_too():
cache = CompressionCache(max_bytes=1024 * 1024)
for i in range(50_000):
cache.mark_skip(f"s{i}")
assert cache.skip_size <= 2000
assert cache.is_skipped("s49999")
def test_keys_are_the_same_in_every_process():
code = (
"from headroom.transforms.content_router import content_cache_key;"
"print(content_cache_key('same text', 0.5, gated=True))"
)
other = subprocess.run(
[sys.executable, "-c", code], capture_output=True, text=True, check=True
).stdout.strip()
assert other == content_cache_key("same text", 0.5, gated=True)
assert content_cache_key("same text", 0.5) != other # gated tool output kept apart
def test_stateless_mode_writes_no_cache_file(tmp_path, monkeypatch):
monkeypatch.setenv("HEADROOM_WORKSPACE_DIR", str(tmp_path))
monkeypatch.setenv("HEADROOM_STATELESS", "1")
assert open_result_store(1800) is None
assert not (tmp_path / "compression_cache.db").exists()
def test_a_result_in_use_is_kept_and_an_idle_one_is_dropped(tmp_path, monkeypatch):
# Nothing signals a session's end: a result expires once unused for the
# ttl, from memory and from disk, while a session still reading it keeps it.
import time as time_module
clock = [1000.0]
monkeypatch.setattr(time_module, "monotonic", lambda: clock[0])
monkeypatch.setattr(time_module, "time", lambda: clock[0])
store = ResultStore(tmp_path / "c.db", ttl_seconds=100)
cache = CompressionCache(ttl_seconds=100, store=store)
cache.put("live", "kept", 0.5, "kompress")
cache.put("idle", "dropped", 0.5, "kompress")
for _ in range(5): # 'live' is read every 60 s, for 300 s
clock[0] += 60
assert cache.get("live") is not None
assert cache.get("idle") is None
assert store.get(cache._namespace + "idle") is None
assert store.get(cache._namespace + "live") == ("kept", 0.5, "kompress")
def test_routers_configured_differently_never_share_output(tmp_path, monkeypatch):
# The proxy can run two routers (per-provider Kompress overrides), and a
# restart can change settings; both read the same file.
monkeypatch.setenv("HEADROOM_COMPRESSION_CACHE_PATH", str(tmp_path / "c.db"))
lossy = ContentRouter(ContentRouterConfig(result_cache_disk=True))
lossless = ContentRouter(ContentRouterConfig(result_cache_disk=True, lossless=True))
lossy._cache.put("k", "lossy output", 0.3, "kompress")
assert lossless._cache.get("k") is None
same = ContentRouter(ContentRouterConfig(result_cache_disk=True))
assert same._cache.get("k") == ("lossy output", 0.3, "kompress")
def test_the_namespace_is_the_same_in_every_process():
code = (
"from headroom.transforms.content_router import ContentRouterConfig, _config_namespace;"
"print(_config_namespace(ContentRouterConfig()))"
)
seen = {
subprocess.run(
[sys.executable, "-c", code],
capture_output=True,
text=True,
check=True,
env={**__import__("os").environ, "PYTHONHASHSEED": seed},
).stdout.strip()
for seed in ("1", "2")
}
assert len(seen) == 1
def test_a_broken_database_is_a_miss_not_a_failed_request(tmp_path):
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(store=store)
store._db.close()
cache.put("k", "text", 0.5, "kompress") # no raise
cache.clear()
assert cache.get("k") is None
def test_a_result_pointing_at_a_ccr_original_is_not_kept_on_disk(tmp_path):
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(store=store)
cache.put("k", "first lines <<ccr:0123456789abcdef>>", 0.2, "x")
assert store.get(cache._namespace + "k") is None
def test_a_nonfinite_budget_falls_back_instead_of_stopping_startup(monkeypatch):
for raw in ("nan", "inf", "-5"):
monkeypatch.setenv("HEADROOM_COMPRESSION_CACHE_MB", raw)
assert CompressionCache().stats["cache_max_bytes"] == 64 * 1024 * 1024
def test_a_changed_compressor_setting_does_not_reuse_old_results(tmp_path, monkeypatch):
# Settings the router reads from the environment, outside its config.
monkeypatch.setenv("HEADROOM_COMPRESSION_CACHE_PATH", str(tmp_path / "c.db"))
before = ContentRouter(ContentRouterConfig(result_cache_disk=True))
before._cache.put("k", "made under the old setting", 0.3, "kompress")
monkeypatch.setenv("HEADROOM_LOSSLESS_THEN_LOSSY", "1")
after = ContentRouter(ContentRouterConfig(result_cache_disk=True))
assert after._cache.get("k") is None
def test_a_marker_result_replacing_a_plain_one_removes_it_from_disk(tmp_path):
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(max_bytes=4_000, store=store)
cache.put("k", "plain result", 0.5, "kompress")
cache.put("k", "first lines <<ccr:0123456789abcdef>>", 0.2, "x")
for i in range(10): # push "k" out of memory
cache.put(f"filler{i}", "f" * 1000, 0.5, "kompress")
assert cache.get("k") is None
def test_clear_also_clears_the_routers_rows_on_disk(tmp_path):
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(store=store, namespace="ns1:")
other = CompressionCache(store=store, namespace="ns2:")
cache.put("k", "value", 0.5, "kompress")
other.put("k", "theirs", 0.5, "kompress")
cache.clear()
assert cache.get("k") is None
assert store.get("ns2:k") == ("theirs", 0.5, "kompress")
def test_an_older_put_never_undoes_a_newer_ones_disk_row(tmp_path):
# A marker put admitted first but reaching the disk after a newer plain
# put must not delete the plain result's row.
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(store=store)
class NewerPutRunsFirst:
def __init__(self) -> None:
self._lock, self._pending = threading.Lock(), True
def __enter__(self):
if self._pending: # between the marker's admit and its disk step
self._pending = False
cache.put("k", "plain output", 0.5, "text")
self._lock.acquire()
def __exit__(self, *exc):
self._lock.release()
cache._disk_lock = NewerPutRunsFirst()
cache.put("k", "<<ccr:0123456789abcdef 3_rows_offloaded>>", 0.5, "text")
assert store.get(cache._namespace + "k")[0] == "plain output"
def test_a_cache_without_a_namespace_clears_only_its_own_rows(tmp_path):
store = ResultStore(tmp_path / "c.db", 1800)
mine = CompressionCache(store=store)
other = CompressionCache(store=store, namespace="router-b:")
mine.put("a", "result a", 0.5, "text")
other.put("b", "result b", 0.5, "text")
mine.clear()
assert store.get("router-b:b") is not None
def test_a_disk_read_in_flight_never_replaces_a_newer_put(tmp_path):
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(max_bytes=600, store=store)
cache.put("k", "old", 0.5, "text")
cache.put("other", "z" * 300, 0.5, "text") # evicts k from memory
read_done, release = threading.Event(), threading.Event()
real_get = store.get
def paused_get(key):
found = real_get(key)
store.get = real_get # pause only the first read
read_done.set()
assert release.wait(5)
return found
store.get = paused_get
results = []
reader = threading.Thread(target=lambda: results.append(cache.get("k")))
reader.start()
assert read_done.wait(5) # the read has "old" in hand
cache.put("k", "new", 0.5, "text")
release.set()
reader.join(5)
assert results == [("new", 0.5, "text")]
assert cache.get("k") == ("new", 0.5, "text")
assert store.get(cache._namespace + "k")[0] == "new"
def test_a_disk_read_during_clear_never_restores_a_cleared_result(tmp_path):
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(max_bytes=600, store=store)
cache.put("k", "old", 0.5, "text")
cache.put("other", "z" * 300, 0.5, "text") # evicts k from memory
deleting, release = threading.Event(), threading.Event()
real_clear_prefix = store.clear_prefix
def paused_clear_prefix(prefix):
deleting.set()
assert release.wait(5)
real_clear_prefix(prefix)
store.clear_prefix = paused_clear_prefix
clearer = threading.Thread(target=cache.clear)
clearer.start()
assert deleting.wait(5) # memory cleared, disk row not yet deleted
reader = threading.Thread(target=cache.get, args=("k",))
reader.start()
reader.join(0.5) # finishes here unless clear() still holds it off
release.set()
clearer.join(5)
reader.join(5)
assert store.get(cache._namespace + "k") is None
assert cache.get("k") is None
class PauseAfterFetch:
"""Stands in for a cache's ``_disk_read_lock``: the first ``pauses`` reads
stop after their fetch, outside the lock and before admission."""
def __init__(self, pauses: int) -> None:
self._lock = threading.Lock()
self.fetched = [threading.Event() for _ in range(pauses)]
self.release = [threading.Event() for _ in range(pauses)]
self._exits = 0
def __enter__(self):
self._lock.acquire()
def __exit__(self, *exc):
i, self._exits = self._exits, self._exits + 1
self._lock.release()
if i < len(self.fetched):
self.fetched[i].set()
assert self.release[i].wait(5)
def test_concurrent_disk_reads_of_one_key_each_return_the_result(tmp_path):
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(max_bytes=600, store=store)
cache.put("k", "kept", 0.5, "text")
cache.put("other", "z" * 300, 0.5, "text") # evicts k from memory
reads = cache._disk_read_lock = PauseAfterFetch(2)
results: dict[str, object] = {}
first = threading.Thread(target=lambda: results.update(first=cache.get("k")))
second = threading.Thread(target=lambda: results.update(second=cache.get("k")))
first.start()
assert reads.fetched[0].wait(5)
second.start()
assert reads.fetched[1].wait(5) # both reads in flight; the first finishes first
reads.release[0].set()
first.join(5)
reads.release[1].set()
second.join(5)
assert results == {"first": ("kept", 0.5, "text"), "second": ("kept", 0.5, "text")}
def test_an_older_disk_read_never_replaces_a_later_reads_result(tmp_path):
# Two workers share one store: a read that fetched earlier holds an older
# row than one that fetched after the other worker's put.
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(max_bytes=600, store=store)
other_worker = CompressionCache(store=store)
cache.put("k", "old", 0.5, "text")
cache.put("other", "z" * 300, 0.5, "text") # evicts k from memory
reads = cache._disk_read_lock = PauseAfterFetch(1)
results = []
reader = threading.Thread(target=lambda: results.append(cache.get("k")))
reader.start()
assert reads.fetched[0].wait(5) # the first read has "old" in hand
other_worker.put("k", "new", 0.5, "text")
assert cache.get("k") == ("new", 0.5, "text") # a later read admits "new"
reads.release[0].set()
reader.join(5)
assert results == [("new", 0.5, "text")]
assert cache.get("k") == ("new", 0.5, "text")
def test_a_read_that_fetches_later_is_never_outranked_by_an_older_row(tmp_path):
# Read A is numbered before read B but fetches after another worker's
# put: what A fetched is the newest row and must be what memory keeps.
store = ResultStore(tmp_path / "c.db", 1800)
cache = CompressionCache(max_bytes=600, store=store)
other_worker = CompressionCache(store=store)
cache.put("k", "old", 0.5, "text")
cache.put("other", "z" * 300, 0.5, "text") # evicts k from memory
fetching, release = threading.Event(), threading.Event()
real_get = store.get
def paused_get(key):
store.get = real_get # pause only the first read, before it fetches
fetching.set()
assert release.wait(5)
return real_get(key)
store.get = paused_get
results = []
first = threading.Thread(target=lambda: results.append(cache.get("k")))
first.start()
assert fetching.wait(5) # A is numbered; its fetch has not run
second = threading.Thread(target=cache.get, args=("k",))
second.start()
second.join(0.5) # B reads "old" here unless A's read holds it off
other_worker.put("k", "new", 0.5, "text")
release.set()
first.join(5)
second.join(5)
assert results == [("new", 0.5, "text")]
assert cache.get("k") == ("new", 0.5, "text")
assert store.get(cache._namespace + "k")[0] == "new"
def test_a_result_that_expires_while_a_read_waits_is_not_returned(tmp_path, monkeypatch):
# get() misses memory, then waits for the disk-read lock; a marker result
# admitted meanwhile expires before the wait ends. Its second look at
# memory must apply the same lifetime as the first, not return it.
import time as time_module
clock = [1000.0]
monkeypatch.setattr(time_module, "monotonic", lambda: clock[0])
cache = CompressionCache(store=ResultStore(tmp_path / "c.db", 1800), marker_ttl_seconds=1)
waiting, real = threading.Event(), cache._disk_read_lock
class SignalsWait:
def __enter__(self):
waiting.set()
return real.__enter__()
def __exit__(self, *exc):
return real.__exit__(*exc)
cache._disk_read_lock = SignalsWait()
results = []
with real:
reader = threading.Thread(target=lambda: results.append(cache.get("k")))
reader.start()
assert waiting.wait(5)
cache.put("k", "head <<ccr:0123456789abcdef>>", 0.2, "x")
clock[0] += 2
reader.join(5)
assert results == [None]
assert cache.get("k") is None
Generated
+469 -63
View File
@@ -33,6 +33,10 @@ constraints = [
{ name = "setuptools", specifier = ">=83.0.0" },
{ name = "transformers", specifier = ">=5.5.0" },
]
overrides = [
{ name = "pillow", marker = "python_full_version < '3.11'", specifier = ">=12.3.0,<13" },
{ name = "pillow", marker = "python_full_version >= '3.11'", specifier = ">=13.0.0" },
]
[[package]]
name = "accelerate"
@@ -42,7 +46,8 @@ dependencies = [
{ name = "huggingface-hub" },
{ name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "numpy", version = "2.4.1", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "psutil" },
{ name = "pyyaml" },
{ name = "safetensors" },
@@ -62,7 +67,8 @@ dependencies = [
{ name = "gitpython" },
{ name = "h11" },
{ name = "httpx", extra = ["http2"] },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "pydantic" },
{ name = "pydantic-settings" },
{ name = "python-dotenv" },
@@ -404,7 +410,8 @@ source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "jsonref" },
{ name = "opentelemetry-api" },
{ name = "pillow" },
{ name = "pillow", version = "12.3.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "pillow", version = "13.0.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "protobuf" },
{ name = "pydantic" },
{ name = "typing-extensions" },
@@ -515,11 +522,11 @@ crt = [
[[package]]
name = "certifi"
version = "2026.1.4"
version = "2026.10.19"
source = { registry = "https://pypi.org/simple/" }
sdist = { url = "https://files.pythonhosted.org/packages/e0/2d/a891ca51311197f6ad14a7ef42e2399f36cf2f9bd44752b3dc4eab60fdc5/certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120", size = 154268, upload-time = "2026-01-04T02:42:41.825Z" }
sdist = { url = "https://files.pythonhosted.org/packages/a6/bd/1436c50cc46699de0230fbaacc1d1de7bfec413176099949e9d5112e88f2/certifi-2026.10.19.tar.gz", hash = "sha256:035c1e85572b141bf1c3a3eff0e33a8eb74917522f2559075ff8d2fea780a1ae", size = 137598, upload-time = "2026-10-20T02:24:16.604Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e6/ad/3cc14f097111b4de0040c83a525973216457bbeeb63739ef1ed275c1c021/certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c", size = 152900, upload-time = "2026-01-04T02:42:40.15Z" },
{ url = "https://files.pythonhosted.org/packages/c4/51/29046e48f693c54e5b7412216d447a1d8362c9653148d98c02cdf65fa733/certifi-2026.10.19-py3-none-any.whl", hash = "sha256:42d35340cc5b9ba78e818ddbff0c5b1c2b779de448a340fd1b989f5fa8670e1b", size = 136464, upload-time = "2026-10-20T02:24:15.072Z" },
]
[[package]]
@@ -1007,14 +1014,16 @@ version = "5.0.1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "dill" },
{ name = "filelock" },
{ name = "filelock", version = "4.1.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "filelock", version = "4.2.4", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "fsspec", extra = ["http"] },
{ name = "httpx" },
{ name = "huggingface-hub" },
{ name = "multiprocess" },
{ name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "numpy", version = "2.4.1", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "pandas", version = "2.3.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "pandas", version = "3.0.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "pyarrow" },
@@ -1056,11 +1065,41 @@ wheels = [
name = "distlib"
version = "0.4.0"
source = { registry = "https://pypi.org/simple/" }
resolution-markers = [
"python_full_version < '3.11'",
]
sdist = { url = "https://files.pythonhosted.org/packages/96/8e/709914eb2b5749865801041647dc7f4e6d00b549cfe88b65ca192995f07c/distlib-0.4.0.tar.gz", hash = "sha256:feec40075be03a04501a973d81f633735b4b69f98b05450592310c0f401a4e0d", size = 614605, upload-time = "2025-07-17T16:52:00.465Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/33/6b/e0547afaf41bf2c42e52430072fa5658766e3d65bd4b03a563d1b6336f57/distlib-0.4.0-py2.py3-none-any.whl", hash = "sha256:9659f7d87e46584a30b5780e43ac7a2143098441670ff0a49d5f9034c54a6c16", size = 469047, upload-time = "2025-07-17T16:51:58.613Z" },
]
[[package]]
name = "distlib"
version = "0.4.4"
source = { registry = "https://pypi.org/simple/" }
resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'win32'",
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"(python_full_version >= '3.14' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version >= '3.14' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.13.*' and sys_platform == 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.13.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.13.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.12.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.12.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.12.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.11.*' and sys_platform == 'win32'",
"python_full_version == '3.11.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.11.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.11.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
]
sdist = { url = "https://files.pythonhosted.org/packages/68/bc/d36966de7304047a1001a7559fbf266c464bb5d8cc85464536ef8c9bcc32/distlib-0.4.4.tar.gz", hash = "sha256:ca4175b4ac7f71223cc30ed7248c45d2b38c2439d8ee6e498ab67ed63cf3508d", size = 621304, upload-time = "2026-10-16T13:56:34.203Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/c1/2b/238f02a4927fa2e27aa995371d240a468b52e42eae44a678434aff736b38/distlib-0.4.4-py2.py3-none-any.whl", hash = "sha256:cf09d55b1e85a89576b036aeb71550bfd68320f3f21761ca329eadadad918638", size = 472099, upload-time = "2026-10-16T13:56:32.053Z" },
]
[[package]]
name = "distro"
version = "1.9.0"
@@ -1100,6 +1139,25 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" },
]
[[package]]
name = "fakeredis"
version = "2.40.0"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "redis" },
{ name = "sortedcontainers" },
{ name = "typing-extensions", marker = "python_full_version < '3.11'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/61/d0/8cbd1339c2a606a0ceda74e1a181248d372bb2c66bc6cf9d954871839ff9/fakeredis-2.40.0.tar.gz", hash = "sha256:16eb05a3e97c37a033c73d1da7e885eb2aa47ba7604cc377144339efa2780a02", size = 332674, upload-time = "2026-10-14T12:46:01.851Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/c7/e4/6919d3653d72c53d1fb22c97ceb6fa3664cad302994e90ee52279f7eb394/fakeredis-2.40.0-py3-none-any.whl", hash = "sha256:b155ef2442134372eb1cc5664cf5638ccbe0a6dde9d1942153708e2782f315c9", size = 204148, upload-time = "2026-10-14T12:46:00.014Z" },
]
[package.optional-dependencies]
lua = [
{ name = "lupa" },
]
[[package]]
name = "fastapi"
version = "0.136.3"
@@ -1128,7 +1186,8 @@ dependencies = [
{ name = "numpy", version = "2.4.1", source = { registry = "https://pypi.org/simple/" }, marker = "(python_full_version >= '3.11' and python_full_version < '3.14') or (python_full_version >= '3.11' and platform_machine != 'x86_64') or (python_full_version >= '3.11' and sys_platform != 'darwin')" },
{ name = "onnxruntime", version = "1.23.2", source = { registry = "https://pypi.org/simple/" }, marker = "(python_full_version < '3.11' and platform_machine != 'x86_64') or (python_full_version < '3.11' and sys_platform != 'darwin') or (platform_machine == 'x86_64' and sys_platform == 'darwin')" },
{ name = "onnxruntime", version = "1.26.0", source = { registry = "https://pypi.org/simple/" }, marker = "(python_full_version >= '3.11' and platform_machine != 'x86_64') or (python_full_version >= '3.11' and sys_platform != 'darwin')" },
{ name = "pillow" },
{ name = "pillow", version = "12.3.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "pillow", version = "13.0.0", source = { registry = "https://pypi.org/simple/" }, marker = "(python_full_version >= '3.11' and python_full_version < '3.14') or (python_full_version >= '3.11' and platform_machine != 'x86_64') or (python_full_version >= '3.11' and sys_platform != 'darwin')" },
{ name = "py-rust-stemmers" },
{ name = "requests" },
{ name = "tokenizers" },
@@ -1204,11 +1263,41 @@ wheels = [
[[package]]
name = "filelock"
version = "3.32.7"
version = "4.1.0"
source = { registry = "https://pypi.org/simple/" }
sdist = { url = "https://files.pythonhosted.org/packages/0f/59/e19834834cb01a32febfbb0f8a23a9088088f5d45991824ff2bc3b5e8acb/filelock-3.32.7.tar.gz", hash = "sha256:37b8a3d9811b0f9aef7e5ec5c71bb320de52df51e6ca9bcd6f5ad81187660da7", size = 225154, upload-time = "2026-09-16T00:24:20.907Z" }
resolution-markers = [
"python_full_version < '3.11'",
]
sdist = { url = "https://files.pythonhosted.org/packages/4c/58/6fd434bec86eff7c38a3168454cb132b762b2bea9b3ac094101a2f7bc32a/filelock-4.1.0.tar.gz", hash = "sha256:ad7f724afef953e731b1cc39bcd3a09166d72ed7fcdf29e6e88b1c3235c6715d", size = 561277, upload-time = "2026-10-09T19:57:20.34Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/15/df/31098c5aeb4d966b553641472bd55fcf5fdfac953549894b8a765ba44e91/filelock-3.32.7-py3-none-any.whl", hash = "sha256:65ff0d0190ea42038b32bda4b77834fb05be2cad4c5b9b01aa4dfb3614536e52", size = 100157, upload-time = "2026-09-16T00:24:19.543Z" },
{ url = "https://files.pythonhosted.org/packages/ee/86/032133892a5de43b5a98200b01aadcad68cc255e274a762f08b8a76d2912/filelock-4.1.0-py3-none-any.whl", hash = "sha256:2ce9818e3e2d8f284c1a964414447ef148d42a5fd5e2a477a7118e574b293ec1", size = 133003, upload-time = "2026-10-09T19:57:18.716Z" },
]
[[package]]
name = "filelock"
version = "4.2.4"
source = { registry = "https://pypi.org/simple/" }
resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'win32'",
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"(python_full_version >= '3.14' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version >= '3.14' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.13.*' and sys_platform == 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.13.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.13.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.12.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.12.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.12.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.11.*' and sys_platform == 'win32'",
"python_full_version == '3.11.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.11.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.11.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
]
sdist = { url = "https://files.pythonhosted.org/packages/d8/28/3893324bcadf8f89b1616637468d766af3f625008c0735bf704fdfa86617/filelock-4.2.4.tar.gz", hash = "sha256:c6d8663535e1650ee430507b4ffbac7b464dd64b7647ea0112a9f406499d163d", size = 652444, upload-time = "2026-10-19T01:57:51.001Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e0/1b/5e74289a1878e666bb4b65fe5805a04cafcac2aa5f519ef1ead67ef91c56/filelock-4.2.4-py3-none-any.whl", hash = "sha256:301241438c57936ef93f4243a94f2559022268bfcf9b375a9a72eb0f8db8358e", size = 162475, upload-time = "2026-10-19T01:57:49.419Z" },
]
[[package]]
@@ -1510,7 +1599,8 @@ name = "gunicorn"
version = "26.0.0"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/6d/b7/a4a3f632f823e432ce6bc65f62961b7980c898c77f075a2f7118cb3846fe/gunicorn-26.0.0.tar.gz", hash = "sha256:ca9346f85e3a4aeeb64d491045c16b9a35647abd37ea15efe53080eb8b090baf", size = 727286, upload-time = "2026-05-05T06:38:25.529Z" }
wheels = [
@@ -1546,6 +1636,7 @@ source = { editable = "." }
dependencies = [
{ name = "ast-grep-cli" },
{ name = "click" },
{ name = "filelock", version = "4.2.4", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "hf-xet", marker = "platform_machine == 'AMD64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'" },
{ name = "litellm" },
{ name = "opentelemetry-api" },
@@ -1581,7 +1672,8 @@ all = [
{ name = "opentelemetry-exporter-otlp-proto-http" },
{ name = "opentelemetry-sdk" },
{ name = "orjson", marker = "platform_python_implementation != 'PyPy'" },
{ name = "pillow" },
{ name = "pillow", version = "12.3.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "pillow", version = "13.0.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "rapidocr", marker = "(python_full_version >= '3.13' and platform_machine != 'x86_64') or (python_full_version == '3.13.*' and platform_machine == 'x86_64' and sys_platform == 'darwin') or (python_full_version >= '3.13' and sys_platform != 'darwin')" },
{ name = "rapidocr-onnxruntime", marker = "python_full_version < '3.13'" },
{ name = "scikit-learn", version = "1.7.2", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
@@ -1618,6 +1710,7 @@ code = [
dev = [
{ name = "anthropic" },
{ name = "cryptography" },
{ name = "fakeredis", extra = ["lua"] },
{ name = "fastapi" },
{ name = "hnswlib" },
{ name = "httpx", extra = ["http2", "socks"] },
@@ -1660,7 +1753,8 @@ html = [
image = [
{ name = "onnxruntime", version = "1.23.2", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version == '3.13.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'" },
{ name = "onnxruntime", version = "1.26.0", source = { registry = "https://pypi.org/simple/" }, marker = "(python_full_version >= '3.13' and platform_machine != 'x86_64') or (python_full_version >= '3.13' and sys_platform != 'darwin')" },
{ name = "pillow" },
{ name = "pillow", version = "12.3.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "pillow", version = "13.0.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "rapidocr", marker = "(python_full_version >= '3.13' and platform_machine != 'x86_64') or (python_full_version == '3.13.*' and platform_machine == 'x86_64' and sys_platform == 'darwin') or (python_full_version >= '3.13' and sys_platform != 'darwin')" },
{ name = "rapidocr-onnxruntime", marker = "python_full_version < '3.13'" },
{ name = "sentencepiece" },
@@ -1735,6 +1829,9 @@ pytorch-mps = [
{ name = "sentence-transformers", marker = "sys_platform == 'darwin'" },
{ name = "torch", marker = "sys_platform == 'darwin'" },
]
redis = [
{ name = "redis" },
]
relevance = [
{ name = "fastembed", marker = "python_full_version < '3.14' or platform_machine != 'x86_64' or sys_platform != 'darwin'" },
{ name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
@@ -1811,9 +1908,11 @@ requires-dist = [
{ name = "cryptography", marker = "extra == 'dev'", specifier = ">=50.0.0" },
{ name = "datasets", marker = "extra == 'evals'", specifier = ">=5.0.1" },
{ name = "datasets", marker = "extra == 'voice-train'", specifier = ">=5.0.1" },
{ name = "fakeredis", extras = ["lua"], marker = "extra == 'dev'", specifier = ">=2.20.0" },
{ name = "fastapi", marker = "extra == 'dev'", specifier = ">=0.100.0" },
{ name = "fastapi", marker = "extra == 'proxy'", specifier = ">=0.100.0" },
{ name = "fastembed", marker = "(python_full_version < '3.14' and extra == 'relevance') or (platform_machine != 'x86_64' and extra == 'relevance') or (sys_platform != 'darwin' and extra == 'relevance')", specifier = ">=0.6.0" },
{ name = "filelock", marker = "python_full_version >= '3.11'", specifier = ">=4.2.1" },
{ name = "gunicorn", marker = "sys_platform != 'win32' and extra == 'proxy-prod'", specifier = ">=21.0.0" },
{ name = "headroom-ai", extras = ["proxy"], marker = "extra == 'proxy-prod'" },
{ name = "headroom-ai", extras = ["proxy", "code", "ml", "memory", "relevance", "image", "reports", "otel", "evals", "voice", "html", "mcp", "spreadsheet"], marker = "extra == 'all'" },
@@ -1871,6 +1970,7 @@ requires-dist = [
{ name = "qdrant-client", marker = "extra == 'memory-stack'", specifier = ">=1.9.0,<2.0" },
{ name = "rapidocr", marker = "(python_full_version == '3.13.*' and platform_machine == 'x86_64' and sys_platform == 'darwin' and extra == 'image') or (python_full_version >= '3.13' and platform_machine != 'x86_64' and extra == 'image') or (python_full_version >= '3.13' and sys_platform != 'darwin' and extra == 'image')", specifier = ">=3.0,<4" },
{ name = "rapidocr-onnxruntime", marker = "python_full_version < '3.13' and extra == 'image'", specifier = ">=1.4.0,<2" },
{ name = "redis", marker = "extra == 'redis'", specifier = ">=5.0.0" },
{ name = "respx", marker = "extra == 'dev'", specifier = ">=0.20.0" },
{ name = "rich", specifier = ">=13.0.0" },
{ name = "ruff", marker = "extra == 'dev'", specifier = "==0.17.0" },
@@ -1909,7 +2009,7 @@ requires-dist = [
{ name = "xlwt", marker = "extra == 'dev'", specifier = ">=1.3.0" },
{ name = "zstandard", marker = "extra == 'proxy'", specifier = ">=0.20.0" },
]
provides-extras = ["proxy", "proxy-prod", "code", "ml", "memory", "vector", "memory-stack", "pytorch-mps", "relevance", "image", "reports", "spreadsheet", "otel", "anyllm", "langchain", "langgraph", "agno", "strands", "autogen", "mcp", "voice", "voice-train", "evals", "bedrock", "html", "dev", "all", "sandbox"]
provides-extras = ["proxy", "proxy-prod", "code", "ml", "memory", "vector", "memory-stack", "pytorch-mps", "relevance", "image", "reports", "spreadsheet", "otel", "anyllm", "langchain", "langgraph", "agno", "strands", "autogen", "mcp", "voice", "voice-train", "evals", "bedrock", "redis", "html", "dev", "all", "sandbox"]
[[package]]
name = "hf-xet"
@@ -2020,11 +2120,13 @@ name = "huggingface-hub"
version = "1.16.1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "filelock" },
{ name = "filelock", version = "4.1.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "filelock", version = "4.2.4", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "fsspec" },
{ name = "hf-xet", marker = "platform_machine == 'AMD64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'" },
{ name = "httpx" },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "pyyaml" },
{ name = "tqdm" },
{ name = "typer" },
@@ -2300,7 +2402,8 @@ dependencies = [
{ name = "jsonpatch" },
{ name = "langchain-protocol" },
{ name = "langsmith" },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "pydantic" },
{ name = "pyyaml" },
{ name = "tenacity" },
@@ -2419,7 +2522,8 @@ dependencies = [
{ name = "distro" },
{ name = "httpx" },
{ name = "orjson", marker = "platform_python_implementation != 'PyPy'" },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "pydantic" },
{ name = "requests" },
{ name = "requests-toolbelt" },
@@ -2552,6 +2656,69 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/0c/29/0348de65b8cc732daa3e33e67806420b2ae89bdce2b04af740289c5c6c8c/loguru-0.7.3-py3-none-any.whl", hash = "sha256:31a33c10c8e1e10422bfd431aeb5d351c7cf7fa671e3c4df004162264b28220c", size = 61595, upload-time = "2024-12-06T11:20:54.538Z" },
]
[[package]]
name = "lupa"
version = "2.8"
source = { registry = "https://pypi.org/simple/" }
sdist = { url = "https://files.pythonhosted.org/packages/c3/a6/0f869fbb07c393f15473b1eefefb7b5bec162fb7481803d040ed4dc46002/lupa-2.8.tar.gz", hash = "sha256:d8022641b9ec8ecf2c5ecbe9f47e5a70e0b87c4b5ae921b92cb02a638e0acd08", size = 6156370, upload-time = "2026-04-15T20:08:30.534Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/09/21/9be4516ddd22f8eadba336d9ba065d17d79108465ae1b7f71424ab99b9d0/lupa-2.8-cp310-abi3-win32.whl", hash = "sha256:c2a5fd15dc62374e1661a55f01744c9ec1c56f291ba4a0749d3af2174556e78f", size = 1594887, upload-time = "2026-04-15T20:05:23.377Z" },
{ url = "https://files.pythonhosted.org/packages/2d/99/1557c9685d7034d9ce8dd2b54c40a26d6deb7c67c1fdb5c801abd1a02c3f/lupa-2.8-cp310-abi3-win_arm64.whl", hash = "sha256:9e304fb1c50cf23fd8882afbe1aa87525ef8a72667bcab3b37b2bbb2bc542269", size = 1371742, upload-time = "2026-04-15T20:05:27.417Z" },
{ url = "https://files.pythonhosted.org/packages/1c/34/05ce4745b191633f90ff1ab50f1a19a37da282bb0a41fb500d9157fc9b8f/lupa-2.8-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:97bd01e90b8031e56a5fd5bb70605aea09f1dba675c1140308a52780f93d06f1", size = 1202714, upload-time = "2026-04-15T20:05:31.088Z" },
{ url = "https://files.pythonhosted.org/packages/7d/d2/f70fdbeec2d4c69ee6a469e6cddde9635fff4af4e13fb652e6a1229eef51/lupa-2.8-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0b5ebe1a13c45767919c86750b84fe2da9f6288b6f3cea4ce7660bb2abc9d921", size = 1857453, upload-time = "2026-04-15T20:05:34.611Z" },
{ url = "https://files.pythonhosted.org/packages/97/dc/6fcda0e36e75eb6cb98dc9190fa4737d727eeae29e58f892980b2c96b656/lupa-2.8-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:097e7d0f1719a88020b67c82e05d53d7973c166952393afcecfd8434c7e19a15", size = 2408890, upload-time = "2026-04-15T20:05:37.994Z" },
{ url = "https://files.pythonhosted.org/packages/58/29/7ea176eac3c1dac83d059762daa875ad1390decc0bf2c3b4c7bbfc1f1665/lupa-2.8-cp310-cp310-win_amd64.whl", hash = "sha256:7bb223ee8f72d0dc076b0d65296ee72f1c69450f9d2fed5315f7707d98c4a03d", size = 1910396, upload-time = "2026-04-15T20:05:41.163Z" },
{ url = "https://files.pythonhosted.org/packages/b7/0a/5a740717f27aa77481e6a61b97cf79d1e0c1ede729b1268caacded915326/lupa-2.8-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b12e43c1fb787189dfc28cd604aef0baa2cb95e27da19498d520361d0ace070a", size = 1202376, upload-time = "2026-04-15T20:05:44.049Z" },
{ url = "https://files.pythonhosted.org/packages/1b/75/6b64d0098c64275a801896cb7a6a30e7e653d25fa102c64e747292afcdbb/lupa-2.8-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f6f603391dffb256e36a79fd2044084d5f4b8a0a4c0e5ad291cd3ab3aaf1fd0a", size = 1839271, upload-time = "2026-04-15T20:05:47.399Z" },
{ url = "https://files.pythonhosted.org/packages/7b/2f/0d4f00563046ff616ef6a421f8b776a5ffb327f7b32ed69e856d52b917a8/lupa-2.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9f6f41c91366e7d0d474f87d81c1274af861f40812bf729c9f97ab4c8f3c7ac8", size = 2376251, upload-time = "2026-04-15T20:05:49.891Z" },
{ url = "https://files.pythonhosted.org/packages/4c/8e/caa83237f427d9e85b7f02c816e7270c9c9571dec1673e06b0180402f70e/lupa-2.8-cp311-cp311-win_amd64.whl", hash = "sha256:f5a6af145b0ea818f01d27bfe2583a4b538570bef61d22c8773e0eccf011234c", size = 1923488, upload-time = "2026-04-15T20:05:52.954Z" },
{ url = "https://files.pythonhosted.org/packages/ad/0b/368f2f0bc750b25c69d4563e44f677925ab5dd3d2887f9b0c15465d21a2a/lupa-2.8-cp312-abi3-macosx_10_13_x86_64.whl", hash = "sha256:f4342f4de76ae7ce2ab0672d36003bdb7e1a33252f293b569298ddd792e70e33", size = 1194056, upload-time = "2026-04-15T20:05:55.794Z" },
{ url = "https://files.pythonhosted.org/packages/5b/0f/c89eb8dd36fdea4e50ae3f7f5275bea3b0cc5d4057b8ee7b3bbc78010422/lupa-2.8-cp312-abi3-manylinux2010_i686.manylinux_2_12_i686.manylinux_2_28_i686.whl", hash = "sha256:4203fa1659315e939a5304e75001b8cc14234fb3cbb3ed86c049b0cc5d90fcee", size = 1434278, upload-time = "2026-04-15T20:05:57.94Z" },
{ url = "https://files.pythonhosted.org/packages/47/30/c3b4d2cd8733621b404b8a4214e5f852955c4ba632546dc84123bea9ee89/lupa-2.8-cp312-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:81f2d843ce668b653146c007467570210ae44be51dac6926666c51d49536f307", size = 1150068, upload-time = "2026-04-15T20:06:01.04Z" },
{ url = "https://files.pythonhosted.org/packages/8d/d2/bac12c398519efafc6af84be1974edd0d7a4895fb4735b5c8d615d298595/lupa-2.8-cp312-abi3-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d3d0cde2c77588d1c60875a4f34f059513476c6e1775351897195b51e0f3df08", size = 1409532, upload-time = "2026-04-15T20:06:03.592Z" },
{ url = "https://files.pythonhosted.org/packages/9c/6a/18b52e11962014026e07813530b0b108ee8bc0a2a13ef0eaea5d41dce023/lupa-2.8-cp312-abi3-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9e0d11b8f3a8dac6413f704fef7161d048bb10c58bdac6cbffa5e60efa56e9a3", size = 1242687, upload-time = "2026-04-15T20:06:06.863Z" },
{ url = "https://files.pythonhosted.org/packages/b3/8e/7fd4eb049875f61429b96780d2eae4700f0e78fe0a52db8edb231b1cd09f/lupa-2.8-cp312-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:54cff414f21f8cd8c6be4aae52541f3b9cd39602b59e3a3db9b5c9f9f674ff18", size = 1856038, upload-time = "2026-04-15T20:06:09.358Z" },
{ url = "https://files.pythonhosted.org/packages/e9/f9/37ad9d2773d30f2931890d310a4bdce28d45484206e6f48bc18b0325eabd/lupa-2.8-cp312-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:24b4d8af5558e549b70daf1547f5c1c1d664ecea9fc790f83efe5d75e9a93797", size = 1128982, upload-time = "2026-04-15T20:06:12.312Z" },
{ url = "https://files.pythonhosted.org/packages/57/31/c0fd7984c24844ea79caa45c0235f61a06b38fd69a839f6c62770f8d684a/lupa-2.8-cp312-abi3-musllinux_1_2_i686.whl", hash = "sha256:ce86dff1ee7f7cf45f5622065ae991949dd7bb1703581cbc58a630137bb7ccf9", size = 1457594, upload-time = "2026-04-15T20:06:15.881Z" },
{ url = "https://files.pythonhosted.org/packages/11/f5/a28e411be30ec1bf0db1eb0c087eebc73be9e7a1adcfe6ac209861ccc446/lupa-2.8-cp312-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:f4d01b2a08c70bbb883a9e082b6b36b89121ed5910b710f1ba11c73295ff4fba", size = 1425721, upload-time = "2026-04-15T20:06:18.009Z" },
{ url = "https://files.pythonhosted.org/packages/ed/c1/359f767c4ae024be30d909fe8a9f0e9af266bad47ce2bd2ed248fb986fcf/lupa-2.8-cp312-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:7f210d5a8353e510ea1199c42cf3cbdd630553bf2bc8fb4c00fea06fdec7c798", size = 1253258, upload-time = "2026-04-15T20:06:21.17Z" },
{ url = "https://files.pythonhosted.org/packages/17/52/473f11790c261fd02bbf318a546fe040e9ec9f677181272fa78d3b4112a4/lupa-2.8-cp312-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:4f81a02806e7c7ad26d8c6fa222c8bef1b0c1b124347c879be880b41339d41e4", size = 2395272, upload-time = "2026-04-15T20:06:24.137Z" },
{ url = "https://files.pythonhosted.org/packages/94/bf/75c8795655a8836eab6a11a630352c4b7c5dc5c54d075077bc9bffdeee45/lupa-2.8-cp312-abi3-win32.whl", hash = "sha256:360056453a7a4eaa4ac5a204c31a5a014b1eb2ee5490603234d2ba831684f1f2", size = 1606136, upload-time = "2026-04-15T20:06:27.815Z" },
{ url = "https://files.pythonhosted.org/packages/d8/29/11a2cdd612b6f55e506292dfb6ba343216e80a693e7fe3f876ef204ce9c6/lupa-2.8-cp312-abi3-win_arm64.whl", hash = "sha256:1628371c6592a6d5650497a9e31fb2bb3a7e9883c1f301d1111265e484045af9", size = 1364495, upload-time = "2026-04-15T20:06:30.254Z" },
{ url = "https://files.pythonhosted.org/packages/4d/17/fa834b6b09ad17e7df5d0f7715d64877a125a3776ada689751a1f9dc2959/lupa-2.8-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:450650f91c48c2415b0d59ab3abfcfda3b6efb5b858205f4d4bda8ad141fa529", size = 1190111, upload-time = "2026-04-15T20:06:32.84Z" },
{ url = "https://files.pythonhosted.org/packages/ab/43/45589901b7d1a0e3a9d91d19a311fb6a56924e8571536c3f2212160fd953/lupa-2.8-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:27044f3363047f946b3d3aab9157cbd172b3538ada9ec1baef43432bf7d03a78", size = 1812999, upload-time = "2026-04-15T20:06:35.664Z" },
{ url = "https://files.pythonhosted.org/packages/a1/ac/4ade7d15ff5c61758d7943ac6f0a496bf1cc65b6c09f842b52a0702e664c/lupa-2.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8cf4f064a0e5531afce2d7d750120c10c10f9529139af6ca6150d13151034398", size = 2368731, upload-time = "2026-04-15T20:06:37.959Z" },
{ url = "https://files.pythonhosted.org/packages/0c/27/05f950d15b8ab120b39c43588b438ff3ace70c1b1b0225a960393a497483/lupa-2.8-cp312-cp312-win_amd64.whl", hash = "sha256:281bedc5deb92d31e649a3552edd662449365a635904fa4d5cb4509c7245e34e", size = 1941809, upload-time = "2026-04-15T20:06:40.302Z" },
{ url = "https://files.pythonhosted.org/packages/a6/3f/19f83c3a0c84dc8bea8a58e7416dca6a3ede662c33c8d1ec758e5afc754a/lupa-2.8-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:45fc9da0145ecb0083ef5ff9975116cc784bd0258bdc2bd131ba15483ce18398", size = 1201203, upload-time = "2026-04-15T20:06:42.169Z" },
{ url = "https://files.pythonhosted.org/packages/89/0f/a14f0073f09610158038582e230618a48c14da6bd88185289461aa4cb854/lupa-2.8-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:58e18afed57955b41130e269c78f53d4123ab86e236b53816f4cbffa25cb5d30", size = 1806210, upload-time = "2026-04-15T20:06:45.486Z" },
{ url = "https://files.pythonhosted.org/packages/2f/14/48fff156c63a136001a7620878af7d31aa07e66b495ed621e3eddd73c294/lupa-2.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fc47f536ac13a79cef47d29a2b205576a22841f042a2bcec1676b95806e7706a", size = 2359005, upload-time = "2026-04-15T20:06:47.819Z" },
{ url = "https://files.pythonhosted.org/packages/fe/18/3ac638ec90edf178242b8a2b2f00f8adae694248c03a26341ef941bb746e/lupa-2.8-cp313-cp313-win_amd64.whl", hash = "sha256:ce9404c661dbac65cc9bed351ad45e797af93d30d70be309a3fa8209ac86d93b", size = 1936754, upload-time = "2026-04-15T20:06:50.448Z" },
{ url = "https://files.pythonhosted.org/packages/b0/ef/5ee5fed6ea7459a671196359ce04bfeeaf26be1dac8ff24bf28e5c7a6e81/lupa-2.8-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:348c3f8ecabb6324dcbc05c2740d762ef8fcec7b06c79e45262ab97a217684e3", size = 1209388, upload-time = "2026-04-15T20:06:53.022Z" },
{ url = "https://files.pythonhosted.org/packages/6e/b1/67a940d5542cb0384b443fe951b5a83ea9340d1333a733a258fdd1c619ba/lupa-2.8-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:951496471056061598a7d1729a6cdf48d662fec777a9f2d8aa5a1e62fd30e5a5", size = 1826821, upload-time = "2026-04-15T20:06:55.699Z" },
{ url = "https://files.pythonhosted.org/packages/a1/a2/b354e5ba3b911ec50686003dc8897e892b9e8c5c036b33219b03d54c4daf/lupa-2.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a591b9947ca347b41a63370e121d6e2b1458fe6dde9ae065029ec10a37f25ff4", size = 2366893, upload-time = "2026-04-15T20:06:58.9Z" },
{ url = "https://files.pythonhosted.org/packages/8e/52/d76066401f29539df5352f70ecded66576f32933b6045cd0bfc56cb770b9/lupa-2.8-cp314-cp314-win_amd64.whl", hash = "sha256:3903c9cf628dae2f56405503247b77a61a3a61bd2dda470e336950c74776d55d", size = 1994716, upload-time = "2026-04-15T20:07:19.194Z" },
{ url = "https://files.pythonhosted.org/packages/c3/bd/3efc437a4361c16d25e66478c50357c9a8e8ecfb718fe749eb9ca3176ef6/lupa-2.8-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f711a8ab0486b9ac6fdda94a22ddcfbc9f0d4a27e3a8cf1bf79c6e48b33017c1", size = 1251217, upload-time = "2026-04-15T20:07:01.64Z" },
{ url = "https://files.pythonhosted.org/packages/ea/f4/2e9f8ecbaca854bfdf14af8a9b505ec0cbc640377b3b218921594b7563cd/lupa-2.8-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:dc51250e76367a3e27fcd01dc769b9bfcbbc34f48df48dde53d6af6e75b7eaa5", size = 1814701, upload-time = "2026-04-15T20:07:04.149Z" },
{ url = "https://files.pythonhosted.org/packages/ba/53/4000b1acaa8b1f3827fcff0cfcdff44d3befddda42cab7e685a49689b5a1/lupa-2.8-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f8a22088a552828958603323f0a5c4b3e11e03b75d0bf4c965ef879de9b60a8d", size = 2348414, upload-time = "2026-04-15T20:07:07.285Z" },
{ url = "https://files.pythonhosted.org/packages/d5/78/26ee48d3890cddf03cefb65f433e3492759c0b3c0582180755bddbaab7bd/lupa-2.8-cp314-cp314t-win32.whl", hash = "sha256:4f7c553c1d8cfffbe85d81daef730d12cae4b6002d457542914da0ac8a1145b3", size = 1831611, upload-time = "2026-04-15T20:07:09.752Z" },
{ url = "https://files.pythonhosted.org/packages/3c/d1/4a5cc64a3cad22821ae4c3f7a90456a08ca19457d8354f4abf46ad03c7e8/lupa-2.8-cp314-cp314t-win_amd64.whl", hash = "sha256:d8766aff03a78c80ad2d188a8bdb216de5ec838359cd87e05bbdfa56394a6105", size = 2209250, upload-time = "2026-04-15T20:07:11.906Z" },
{ url = "https://files.pythonhosted.org/packages/37/7c/cdcb654daf668192aaf36b0aeb94f2281dad092aaa5003688691131736ea/lupa-2.8-cp314-cp314t-win_arm64.whl", hash = "sha256:91d622777febda3ab1bed1d45295f2f32a4680c7b3d7caf8c669998ed5c44118", size = 1126735, upload-time = "2026-04-15T20:07:15.434Z" },
{ url = "https://files.pythonhosted.org/packages/1d/44/de1961ad38e17cd326a53c246c7e3b91178ed578f4cf22ffcd5e7e11b041/lupa-2.8-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:b036738282a5acd2e71fdddb317c9df8b87c1673aa57f403d05fcc2be8abc4ba", size = 1186020, upload-time = "2026-04-15T20:07:35.017Z" },
{ url = "https://files.pythonhosted.org/packages/13/c2/276f0b9dc8bcc5a8a58af5316dfa0e6f56be3613dd6dbcc8d3d2cb6559ba/lupa-2.8-cp39-abi3-manylinux2010_i686.manylinux_2_12_i686.manylinux_2_28_i686.whl", hash = "sha256:ac6b6e8d0e617e26a98cbb44880bcd75de5d32b3ad7b3b3793583909292b47ed", size = 1468944, upload-time = "2026-04-15T20:07:37.782Z" },
{ url = "https://files.pythonhosted.org/packages/63/38/52934e52a5180dc6425d20284d004fe4b27a4f9171a82dc99fb67af250bf/lupa-2.8-cp39-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:ba3a7dd839f90c3d2e53bebe3c192b1f3f9fd720a6781256405123211fd0dce6", size = 1172998, upload-time = "2026-04-15T20:07:40.812Z" },
{ url = "https://files.pythonhosted.org/packages/c7/82/76b3809bd0839d9b3b4ec58d06591e08f17337b6d9576877cb9d48b34e94/lupa-2.8-cp39-abi3-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d7edb13a7a5250b5c6c22d1495d9e842b5c9fc5081c8fe6b5efe2112fe3e41f9", size = 1449975, upload-time = "2026-04-15T20:07:44.262Z" },
{ url = "https://files.pythonhosted.org/packages/16/07/2f89d54f747c67c23b4b9ae4aa8c8dd06bb409155dedcf406157f2736b66/lupa-2.8-cp39-abi3-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:891f72e0bffbed1e4175f975aeb2a083956586a100066525e1be485f617f7b25", size = 1281944, upload-time = "2026-04-15T20:07:46.458Z" },
{ url = "https://files.pythonhosted.org/packages/e7/bd/7375d2b0fcae79d806baf52a76f26c96964593f58e1372d13ae5ac09c676/lupa-2.8-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:a295f87b5b7ebbfd5191932e8cb0e51df3c7769101ac6b6c7d7c9fb27bfd1307", size = 1910455, upload-time = "2026-04-15T20:07:49.75Z" },
{ url = "https://files.pythonhosted.org/packages/8b/0c/8abb3bc0e08b311fc01db05b6e9f9ff31a8f65e4fc3f0aeb05cfef75c8ac/lupa-2.8-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:4fe5d7a810b64ea8511eb885fc8cdde042ee5ff7b7d08ae78f32449756acb177", size = 1155548, upload-time = "2026-04-15T20:07:52.657Z" },
{ url = "https://files.pythonhosted.org/packages/80/2e/9eeecd3f493099721c1d3f31beeca23a4237db1a54223684df4dc96aa1bd/lupa-2.8-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:bfc470012ef66ad064c7bd77416af03a3452ef630b04b9012595ea13f2e54518", size = 1489232, upload-time = "2026-04-15T20:07:54.92Z" },
{ url = "https://files.pythonhosted.org/packages/c3/13/731c99dc2e7652ae818a6de45bdf0142049f7cb566049061c898355f1891/lupa-2.8-cp39-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:250e035fdaffe8c87093e3ebc206ac29a26131b1568ea711d780c26001ce96e7", size = 1466321, upload-time = "2026-04-15T20:07:57.627Z" },
{ url = "https://files.pythonhosted.org/packages/de/71/3ad8cc4fc05a77dc0d3f7079348bd1cad4675a0d14c24f8e6a3ce5f008f7/lupa-2.8-cp39-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:b9bddb09acfffb4f828f790f444b11dc0cca591afea1a244d9329eea2d20c003", size = 1288577, upload-time = "2026-04-15T20:07:59.913Z" },
{ url = "https://files.pythonhosted.org/packages/d8/b2/1175f6d0aa7b68627fbe2f58bd1e8bea36a89d10dfd67671d2b024c96162/lupa-2.8-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:2e64acbbd47e9b82a64405a39e0d2b36a5a7dad8ab41c0f3437f572f7d282ba3", size = 2444866, upload-time = "2026-04-15T20:08:02.753Z" },
{ url = "https://files.pythonhosted.org/packages/92/f7/e78df680c7a0ea452daac07467ca188d63c2c00ca1c884c0a50e27eb83b5/lupa-2.8-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:32e4e5103bbddcdd2458fb2ccae6c8ba11c9997c711d7e379e0d45551d109c76", size = 1778509, upload-time = "2026-04-15T20:08:21.784Z" },
{ url = "https://files.pythonhosted.org/packages/e6/23/0e53cabb16b2a8aa9cf1fde499c097d8942c5dab709fc8e921f3b824b18b/lupa-2.8-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7667001804657496dee9feced2daae5000b4604a3218dd8e6b7b754982ba88b8", size = 2300480, upload-time = "2026-04-15T20:08:24.394Z" },
{ url = "https://files.pythonhosted.org/packages/7e/85/0271227eab939921a12ebba5d17aa4cd18346aa534ca7f5da09cd0b63dd4/lupa-2.8-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:86f6f668966965b15247dc32d064cfe7be67b71e584ccfacbe2f637575296878", size = 1847445, upload-time = "2026-04-15T20:08:27.031Z" },
]
[[package]]
name = "lxml"
version = "6.1.1"
@@ -3653,7 +3820,8 @@ dependencies = [
{ name = "flatbuffers" },
{ name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11' or python_full_version >= '3.14'" },
{ name = "numpy", version = "2.4.1", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11' and python_full_version < '3.14' and platform_machine == 'x86_64' and sys_platform == 'darwin'" },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11' or python_full_version >= '3.14'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11' and python_full_version < '3.14' and platform_machine == 'x86_64' and sys_platform == 'darwin'" },
{ name = "protobuf" },
{ name = "sympy" },
]
@@ -3703,7 +3871,7 @@ resolution-markers = [
dependencies = [
{ name = "flatbuffers" },
{ name = "numpy", version = "2.4.1", source = { registry = "https://pypi.org/simple/" } },
{ name = "packaging" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" } },
{ name = "protobuf" },
]
wheels = [
@@ -3797,112 +3965,144 @@ wheels = [
[[package]]
name = "opentelemetry-api"
version = "1.44.0"
version = "1.45.1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/ee/8b/aa9e2d8b8dfa7c946f7dec5d1f8f6ba8eca062f43509a06bdb5ce93d26c0/opentelemetry_api-1.44.0.tar.gz", hash = "sha256:67647e5e9566edcf421166fdf022b3537f818635daa852b289e34604dc6fb33a", size = 72406, upload-time = "2026-07-16T15:25:32.678Z" }
sdist = { url = "https://files.pythonhosted.org/packages/2e/02/6e0ae9cc61bd3169d401077b507b3ebc344745171e1051ab430be012dcd9/opentelemetry_api-1.45.1.tar.gz", hash = "sha256:aa38ed19bcc084ba42782a73255b3582283eced7ad6dddbd6695189e69adfb75", size = 72804, upload-time = "2026-10-06T17:32:58.133Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/ca/6f/a04e900f465ff3221ccc395522503e2d10e79fa21f2723c8e177aae1e0d1/opentelemetry_api-1.44.0-py3-none-any.whl", hash = "sha256:94b98c893a91b88657eaac1e3ba89618cdb85be6918196705354f34728b2cdef", size = 60018, upload-time = "2026-07-16T15:25:11.657Z" },
{ url = "https://files.pythonhosted.org/packages/1e/41/f7dcf80b81ee8e71c1a2b59f14208bc723edbd89ed027a73b175abf6348e/opentelemetry_api-1.45.1-py3-none-any.whl", hash = "sha256:b31553efa588ae44bc306f863c785c5333a9ecc091248c6ee68b4b6c87fdedfb", size = 60256, upload-time = "2026-10-06T17:32:33.506Z" },
]
[[package]]
name = "opentelemetry-exporter-http-transport"
version = "0.66b1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "opentelemetry-api" },
]
sdist = { url = "https://files.pythonhosted.org/packages/62/0c/e3ebdb4b507f66afcc905e6885a4946969bd75b45988492643356fbbdc63/opentelemetry_exporter_http_transport-0.66b1.tar.gz", hash = "sha256:443080203bf52586ce0b2ad901e8951c61833eab1aa539ae6f1f16fe9e8e7952", size = 11693, upload-time = "2026-10-06T17:32:59.65Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/04/69/6af86ff66492b481c6a4c05dcfd68beb47ed8ba046440a26a2aac76b95c7/opentelemetry_exporter_http_transport-0.66b1-py3-none-any.whl", hash = "sha256:2f95404bdee7f9d2d529c7de56c7bd86d014d774d8fbf137810e0167f8a492bf", size = 12155, upload-time = "2026-10-06T17:32:35.454Z" },
]
[package.optional-dependencies]
requests = [
{ name = "requests" },
]
[[package]]
name = "opentelemetry-exporter-otlp-common"
version = "0.66b1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "opentelemetry-sdk" },
]
sdist = { url = "https://files.pythonhosted.org/packages/cb/19/41de712173f43057e4532d42ece7d0c6d4210d353e5752433cb14987643f/opentelemetry_exporter_otlp_common-0.66b1.tar.gz", hash = "sha256:6b1403487a2185ac1feb45fd5546fdf8630ce71c36bcefaadf51e2130e9e23f9", size = 14325, upload-time = "2026-10-06T17:33:01.725Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/fc/39/8c23d67665c762aa51840fa06f86e902e8f6f1693bc8d7e3d98cd6e2f753/opentelemetry_exporter_otlp_common-0.66b1-py3-none-any.whl", hash = "sha256:00ff8592c3a7cb729ff3fdc7ffa12372c243bdf2163e80c180994d0c7bd83ee9", size = 12385, upload-time = "2026-10-06T17:32:38.177Z" },
]
[[package]]
name = "opentelemetry-exporter-otlp-proto-common"
version = "1.44.0"
version = "1.45.1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "opentelemetry-proto" },
]
sdist = { url = "https://files.pythonhosted.org/packages/61/09/4d717852c1cf3f854b76c7110a5d00883bc3c99288b9b0dbcbeb9e306eb6/opentelemetry_exporter_otlp_proto_common-1.44.0.tar.gz", hash = "sha256:dc87a5a5bc58f149a56d1547e4691588fa12994cdc3bc039a694ccb3375862ac", size = 20202, upload-time = "2026-07-16T15:25:37.658Z" }
sdist = { url = "https://files.pythonhosted.org/packages/c1/8e/65e85e5137991a3c493b11682151d198638a5bc1dd4b4c5f67e013c57d7c/opentelemetry_exporter_otlp_proto_common-1.45.1.tar.gz", hash = "sha256:2e4adcc3a67bcf57804fc49514f0ef64974ca7590aa3491da389852b4a0628f6", size = 18873, upload-time = "2026-10-06T17:33:04.471Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/5e/71/65fd9d54c10b860f87c045ccee1264cab7011268895d3528818a29c1172a/opentelemetry_exporter_otlp_proto_common-1.44.0-py3-none-any.whl", hash = "sha256:9a9fe61bba73d802904bc989f1d6b4a7b1ee40f06c40e98d6f85af65aaebb694", size = 17045, upload-time = "2026-07-16T15:25:18.201Z" },
{ url = "https://files.pythonhosted.org/packages/84/aa/92f225d353904e7f70b8b3e3c1b02db0cf56f744c2e83c581dc372e78873/opentelemetry_exporter_otlp_proto_common-1.45.1-py3-none-any.whl", hash = "sha256:2f446183ae7047b036226f1d846c41a834b0e8755ad13b51a51dd38952eb466c", size = 15393, upload-time = "2026-10-06T17:32:41.911Z" },
]
[[package]]
name = "opentelemetry-exporter-otlp-proto-http"
version = "1.44.0"
version = "1.45.1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "googleapis-common-protos" },
{ name = "opentelemetry-api" },
{ name = "opentelemetry-exporter-http-transport", extra = ["requests"] },
{ name = "opentelemetry-exporter-otlp-common" },
{ name = "opentelemetry-exporter-otlp-proto-common" },
{ name = "opentelemetry-proto" },
{ name = "opentelemetry-sdk" },
{ name = "requests" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/1a/87/95e2a5aaa795b4e2260d74e16df2d5541deb2ea9de010bcd615f4dee2654/opentelemetry_exporter_otlp_proto_http-1.44.0.tar.gz", hash = "sha256:c633d7270ad6b57cd4cfbe8b0007a9e2e7c0cb50bd6c50fe2a7b245f721a09d8", size = 25806, upload-time = "2026-07-16T15:25:39.162Z" }
sdist = { url = "https://files.pythonhosted.org/packages/1b/17/26487707ea4caa97b17e6e4b5fa72133a53512ffa2f5cf7a49ef284b29cb/opentelemetry_exporter_otlp_proto_http-1.45.1.tar.gz", hash = "sha256:45c218405ce3fd879596924b1874bf9a8f6880206d61065c5a912c8e5c297fb7", size = 28839, upload-time = "2026-10-06T17:33:05.713Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/cd/d0/fdeb1a98d8d3a6205f5f297c51b4a9bfe65126ab60339669bbe3dd54c2e2/opentelemetry_exporter_otlp_proto_http-1.44.0-py3-none-any.whl", hash = "sha256:838592fce774c1c8bb7b9a0a7facbfa82e17be5a8a4e94cef10cb84ae026bae3", size = 21850, upload-time = "2026-07-16T15:25:20.006Z" },
{ url = "https://files.pythonhosted.org/packages/aa/1f/517eaa0187ba106a9da97160ce2add3a371812681dc440930b267f714e42/opentelemetry_exporter_otlp_proto_http-1.45.1-py3-none-any.whl", hash = "sha256:24a97cf3753c7fb52fad44a696e452ff371686339e2acf3309e2eda3d0230700", size = 22180, upload-time = "2026-10-06T17:32:43.946Z" },
]
[[package]]
name = "opentelemetry-instrumentation"
version = "0.65b0"
version = "0.66b1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "opentelemetry-api" },
{ name = "opentelemetry-semantic-conventions" },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "wrapt" },
]
sdist = { url = "https://files.pythonhosted.org/packages/13/91/3c58961cb0360cd60509064734f0be4275383c8681d73c580a40ca83ddce/opentelemetry_instrumentation-0.65b0.tar.gz", hash = "sha256:071d9d9eced9bd6460444ec3b0c77229870ed05a881c22c84fdede58e4eed09b", size = 42689, upload-time = "2026-07-16T15:25:50.275Z" }
sdist = { url = "https://files.pythonhosted.org/packages/a5/03/89e47ff8d52a4f83b343e6eb9ef1698ff45357216e5b6b2b21e0da5c5c7d/opentelemetry_instrumentation-0.66b1.tar.gz", hash = "sha256:e79a510f7d87c72d95e964ddb42193a0d9a75668c027d980eab032ea1322a5ce", size = 43308, upload-time = "2026-10-06T17:36:10.703Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/40/7b/85eab1215f72adf0e68d3dc4a679b9bff993fa679ff34cd8dd378e2659fd/opentelemetry_instrumentation-0.65b0-py3-none-any.whl", hash = "sha256:ea967a72b9939b5fcfdad572753b4306c59dcb99e3f382d95dae04286805e137", size = 36717, upload-time = "2026-07-16T15:24:51.424Z" },
{ url = "https://files.pythonhosted.org/packages/da/b2/d1413681ff43e13ac9860df27e1226d3199ab0b97b352ceea41abcc660a5/opentelemetry_instrumentation-0.66b1-py3-none-any.whl", hash = "sha256:4c4aa14dc9a24a02325a9d4c42c4d0208dbb1374c2b1b8fe6c9392d59f3e1008", size = 36904, upload-time = "2026-10-06T17:35:11.663Z" },
]
[[package]]
name = "opentelemetry-instrumentation-threading"
version = "0.65b0"
version = "0.66b1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "opentelemetry-api" },
{ name = "opentelemetry-instrumentation" },
{ name = "wrapt" },
]
sdist = { url = "https://files.pythonhosted.org/packages/85/62/626ee68e07e38f792e741db351087fb7c40888e861097029faae595d91fe/opentelemetry_instrumentation_threading-0.65b0.tar.gz", hash = "sha256:aefd23eb16c5e7a7c6c6eacdcb6c6f269ed8ed3a1b458bf5dd555b878bf58937", size = 9080, upload-time = "2026-07-16T15:26:22.367Z" }
sdist = { url = "https://files.pythonhosted.org/packages/55/4f/5fa05266cf24cae93fc32d557d0d2d2f605f81cca1df90614231bbad3cd1/opentelemetry_instrumentation_threading-0.66b1.tar.gz", hash = "sha256:2c217359439d09ca4a4be524db368c05a3cc7f218b85e8086f22664db0a03538", size = 9031, upload-time = "2026-10-06T17:36:41.147Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/50/8d/387b69572f81f9b78c2b0d3a98acfcd43c5ef4ce16ea903f1a90c1dd1d04/opentelemetry_instrumentation_threading-0.65b0-py3-none-any.whl", hash = "sha256:d8a1a1f35418a32769d469ef2d7e8401935e097a8553abcfba833da9c74736ce", size = 8484, upload-time = "2026-07-16T15:25:37.422Z" },
{ url = "https://files.pythonhosted.org/packages/86/da/1cd52b8be7a521958ccdb9a1c4e5ae743aa2be295ba21ec0b620dc87842a/opentelemetry_instrumentation_threading-0.66b1-py3-none-any.whl", hash = "sha256:94039c60603060d26524e31aed1181a5d153e43f58462d110dbeb4830687d7d7", size = 8493, upload-time = "2026-10-06T17:35:57.958Z" },
]
[[package]]
name = "opentelemetry-proto"
version = "1.44.0"
version = "1.45.1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "protobuf" },
]
sdist = { url = "https://files.pythonhosted.org/packages/64/01/40ac4ae9a149263cc52c2cee200ddd80cb6d8db1a4610abf8eabce0fe771/opentelemetry_proto-1.44.0.tar.gz", hash = "sha256:c547a79c2f8c0c515d31509154682e5921c7cfd5ca67b70e1f9266e2c3e103f3", size = 46488, upload-time = "2026-07-16T15:25:45.34Z" }
sdist = { url = "https://files.pythonhosted.org/packages/4b/7f/15f014fb195da6c2dbb6c71399b8e76824878718e94de6454038488eed28/opentelemetry_proto-1.45.1.tar.gz", hash = "sha256:79e0fb95e4616691a469439238aa9224d75779b3e108e895d1aa125ab29ca77c", size = 46488, upload-time = "2026-10-06T17:33:11.49Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/d1/7c/8be563d68e93bbefa5c8affb82ddcff91b3ad858ce49957ba7b16fd3e0ab/opentelemetry_proto-1.44.0-py3-none-any.whl", hash = "sha256:898b155a0e1557afd867478fb6158e8122a46329ca0bb8dc53cc55e98f017f56", size = 72483, upload-time = "2026-07-16T15:25:28.429Z" },
{ url = "https://files.pythonhosted.org/packages/ab/9a/42ec8180a769516ae757e893b69736826efceac7332553915b4528a91c6d/opentelemetry_proto-1.45.1-py3-none-any.whl", hash = "sha256:f38e2a8413053c180cd3d2637fbb279673ec2f6a6e09c995aafa2f452c52b46e", size = 72488, upload-time = "2026-10-06T17:32:53.057Z" },
]
[[package]]
name = "opentelemetry-sdk"
version = "1.44.0"
version = "1.45.1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "opentelemetry-api" },
{ name = "opentelemetry-semantic-conventions" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/5d/77/a6592cbc7c8d9bcc9d6757a9df45e04a7c585e3e6e7a13456da522b21109/opentelemetry_sdk-1.44.0.tar.gz", hash = "sha256:cebe7f65dc12f26ead75c6064de12fd2a9052e5060c0272d402cfa203aae123b", size = 208624, upload-time = "2026-07-16T15:25:46.078Z" }
sdist = { url = "https://files.pythonhosted.org/packages/a1/79/7392e21a1c8f0c61d90b223e31c7e48cb9d452e91a6b820ad24cca5f23c4/opentelemetry_sdk-1.45.1.tar.gz", hash = "sha256:63d24a6ca645019a631e6a51999c73e93adcac1196ca640b8ae78a7cc4762bf3", size = 218324, upload-time = "2026-10-06T17:33:13.26Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e7/23/ff077e61886ee020a17ce9c8b6fa11c601c8d8345b09ea24f605445df62a/opentelemetry_sdk-1.44.0-py3-none-any.whl", hash = "sha256:df081c4c6bcfdb1211e3e86140376792643128a25f8d72d1d27675936e7e96ad", size = 137221, upload-time = "2026-07-16T15:25:29.534Z" },
{ url = "https://files.pythonhosted.org/packages/95/3c/87c42b4bd6dd297536f04cd9383d212ac557ecd49f2cbdcd46da1c9ef5c8/opentelemetry_sdk-1.45.1-py3-none-any.whl", hash = "sha256:c604c11dc429810812348989115fa44bd558772a3d7442afc43d024f2c250ca4", size = 140063, upload-time = "2026-10-06T17:32:55.04Z" },
]
[[package]]
name = "opentelemetry-semantic-conventions"
version = "0.65b0"
version = "0.66b1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "opentelemetry-api" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/8f/73/0cbdebcb4cf545fdd328da14f5137e37d0770c3f26185e478b0d15d94f50/opentelemetry_semantic_conventions-0.65b0.tar.gz", hash = "sha256:f9b2b81e9d5b64f11bc952075e7e9c7fb0aab075c7fd1c46d597f1b919852d60", size = 148774, upload-time = "2026-07-16T15:25:46.902Z" }
sdist = { url = "https://files.pythonhosted.org/packages/46/e4/dbbfb2a010c4db2224a5114638acede6fe563d33cc20fb1752cebcbe6298/opentelemetry_semantic_conventions-0.66b1.tar.gz", hash = "sha256:497ca63bf383723411e8eaf60c8779e9877633c936bb641080adab59d0eb6ec8", size = 150250, upload-time = "2026-10-06T17:33:14.073Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/a6/0e/49df70d9b81fb5cbae4bbf2a49d865b09bcbcbc4eb53f5851b1027738d78/opentelemetry_semantic_conventions-0.65b0-py3-none-any.whl", hash = "sha256:1cacde7b0ad306f84c5ef08c3dbe1bbaf20165bba6f8bff43b670e555a086bcb", size = 204645, upload-time = "2026-07-16T15:25:30.688Z" },
{ url = "https://files.pythonhosted.org/packages/bc/14/67f8aa798857f8cf686f515bf93d9bb877ce952ddc8efae0fa25b45ce0d6/opentelemetry_semantic_conventions-0.66b1-py3-none-any.whl", hash = "sha256:d4cddeb4315490b35213f55e2bdc9ac54bb1e4d318927475bed62b35545e581b", size = 206279, upload-time = "2026-10-06T17:32:56.103Z" },
]
[[package]]
@@ -4046,11 +4246,41 @@ wheels = [
name = "packaging"
version = "25.0"
source = { registry = "https://pypi.org/simple/" }
resolution-markers = [
"python_full_version < '3.11'",
]
sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727, upload-time = "2025-04-19T11:48:59.673Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" },
]
[[package]]
name = "packaging"
version = "26.3"
source = { registry = "https://pypi.org/simple/" }
resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'win32'",
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"(python_full_version >= '3.14' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version >= '3.14' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.13.*' and sys_platform == 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.13.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.13.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.12.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.12.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.12.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.11.*' and sys_platform == 'win32'",
"python_full_version == '3.11.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.11.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.11.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
]
sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" },
]
[[package]]
name = "pandas"
version = "2.3.3"
@@ -4206,6 +4436,9 @@ wheels = [
name = "pillow"
version = "12.3.0"
source = { registry = "https://pypi.org/simple/" }
resolution-markers = [
"python_full_version < '3.11'",
]
sdist = { url = "https://files.pythonhosted.org/packages/1c/3d/bb7fca845737cf9d7dbde16ed1843984665ff2e0a518f5db43e77ec540b9/pillow-12.3.0.tar.gz", hash = "sha256:3b8182a766685eaa002637e28b4ec8d6b18819a0c71f579bf0dbaa5830297cce", size = 47025035, upload-time = "2026-07-01T11:56:38.965Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/25/c2/669d88644cddb1485bd9534e63e8cf476c8e51cb3c3a1297677023505c0e/pillow-12.3.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:6c0016e7b354317c4e9e525b937ac8596c38d2d232b419529b9cd7a1cd46e39a", size = 5392418, upload-time = "2026-07-01T11:53:27.808Z" },
@@ -4296,6 +4529,114 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/36/54/0169bc772ec491108b62f644f8ecf1fe5d8ae5ebafde2ee2142210166903/pillow-12.3.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:04f01d28a6aaff387bf842a13be313df23ba0597a44f1a976c9feb3c6ff4711a", size = 7231786, upload-time = "2026-07-01T11:56:35.046Z" },
]
[[package]]
name = "pillow"
version = "13.0.0"
source = { registry = "https://pypi.org/simple/" }
resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'win32'",
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"(python_full_version >= '3.14' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version >= '3.14' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.13.*' and sys_platform == 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.13.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.13.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.12.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.12.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.12.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.11.*' and sys_platform == 'win32'",
"python_full_version == '3.11.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.11.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.11.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
]
sdist = { url = "https://files.pythonhosted.org/packages/ce/a4/9cc30690a394a8305e8be4c9036aa16d0dfddadd09079860b582f562496d/pillow-13.0.0.tar.gz", hash = "sha256:cdcd1ba258178f7356d74170c9a81ba4eab6a5d55748bc402a5a2a6fe6be3510", size = 47058631, upload-time = "2026-10-16T22:18:09.718Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/6c/d7/af6af1b8cc55e07cb0489d5b0950bf5a9bb1461eeba825700b6d8d0e26ea/pillow-13.0.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:6f38f3f885a09cafc93fd667b1173a92f379e43785d635e7983c893f0da319fb", size = 5592324, upload-time = "2026-10-16T22:15:24.672Z" },
{ url = "https://files.pythonhosted.org/packages/0b/d2/2c12cb4fbb5d95f38d1001ff3d95fafcb830077018cba40e56a8f932dfbc/pillow-13.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:37290fbef0c73e2d51d594eb78fded7dc7170d1c3ad0a890269e6fd8c8c4e061", size = 4856298, upload-time = "2026-10-16T22:15:27.669Z" },
{ url = "https://files.pythonhosted.org/packages/5c/ee/229b27472483a4801ea94990815e710391836afdf987b4b722b62bd75db6/pillow-13.0.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7c88c10dd432f3b39ccdafc9ed81d0c21b8fd634502574da76d1bfa4fe2c76d0", size = 6517304, upload-time = "2026-10-16T22:15:29.43Z" },
{ url = "https://files.pythonhosted.org/packages/36/46/f509b74787f40ce0627501089d630b2c741b63b244c1f40b640b3b01e181/pillow-13.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a625df9a2a5597fa5e5266e01aefc82604bb85d291e3547981e863560d75da6c", size = 7140667, upload-time = "2026-10-16T22:15:31.368Z" },
{ url = "https://files.pythonhosted.org/packages/aa/a4/5a398b8ec2c37145397d6461c0b551c23ec03072aa64f357aed25e582b00/pillow-13.0.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:10b5019883c98f1dd819ca48ffc6f33a91cee04948fe637c605f4345c7cafd6f", size = 6610583, upload-time = "2026-10-16T22:15:34.025Z" },
{ url = "https://files.pythonhosted.org/packages/4f/7b/f2f1109b230fd4e2d57ab2305de31adc37ea9b4ff8719436c623cb484415/pillow-13.0.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f391dc92a015c478745192fe4f2e120c2af2aba18d9fe0616341cbf537599806", size = 7218241, upload-time = "2026-10-16T22:15:36.214Z" },
{ url = "https://files.pythonhosted.org/packages/ab/d3/069edb9083b267746baf59756282cacef904d3475c5288c7216fb5195a98/pillow-13.0.0-cp311-cp311-win32.whl", hash = "sha256:6a0920cb55df5a4d3f6862964908078c0bd59332bdd1bcd20d14e8c70ef27cc5", size = 6515278, upload-time = "2026-10-16T22:15:38.129Z" },
{ url = "https://files.pythonhosted.org/packages/7d/f6/6e2d96413e4c9dbec12ea584d9e646d602877d4cce3ea669099f959deac6/pillow-13.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:d7710eb676e9bb68965cb045be0d333b4c0d7f9dfbaa7fbf121385b1588683d3", size = 7278471, upload-time = "2026-10-16T22:15:40.286Z" },
{ url = "https://files.pythonhosted.org/packages/70/e7/baff21f8cb60496c8c250609501b88919eeedb4088d3da106f6c62f3f3c0/pillow-13.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:12fbb851cf323cc19aac3eea1df5ad17b57e91e9fe3cfd06100dba7bb8208c13", size = 2698981, upload-time = "2026-10-16T22:15:42.637Z" },
{ url = "https://files.pythonhosted.org/packages/7a/b8/58d79332229482eb0d27c82973850808c19d37e5bdc14443d3417bd373f5/pillow-13.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:67c8d44ad89fa7eb88de5d6ef6199b1e03dd24974f85a67639fc8badb801fe79", size = 5568643, upload-time = "2026-10-16T22:15:44.474Z" },
{ url = "https://files.pythonhosted.org/packages/39/4b/f2ed53d83aa44ac19599ac0a54897f867fafb95f406980d1e24083f8cbe3/pillow-13.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc481f742ccda20e9ed760b8f978dff50f2a4e9bc253ac167fb0a05b0783ef52", size = 4852329, upload-time = "2026-10-16T22:15:46.284Z" },
{ url = "https://files.pythonhosted.org/packages/3b/bb/9e30e8ed18c20800ee327a12107d5249ad8dc444867b3adfcc21654e3c71/pillow-13.0.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8bf295fe459343bc6093c8e5e0df60bfa189e0fcb775a22e2c2488fdeccc6c0d", size = 6519309, upload-time = "2026-10-16T22:15:48.14Z" },
{ url = "https://files.pythonhosted.org/packages/e6/99/fdf65cc539e266ab93546c261bdf98411fe165c6e4e13f9dbf597097192b/pillow-13.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:42d63be3af4f9b951b199b0a9d23365d37ab14687e6d77b74940432c8515c4ca", size = 7144542, upload-time = "2026-10-16T22:15:50.093Z" },
{ url = "https://files.pythonhosted.org/packages/26/9b/f38b7c4d8f599537e2d1a6d546cec9beef7536ff8f5c49a3f9c78179d8ac/pillow-13.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4bd024d567eca931b668978d672dba914d4b8e2628e2c3073a2ad178de8a2620", size = 6618042, upload-time = "2026-10-16T22:15:52.054Z" },
{ url = "https://files.pythonhosted.org/packages/a8/7c/45ee28531f89ee4582967d8a17f7a26d71ca64cd902b93c269590cd60a00/pillow-13.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:23edf4ec4b6f4f240e8df6e4985e9ee2ced86474632433e55fb1e2548744bf40", size = 7228137, upload-time = "2026-10-16T22:15:54.009Z" },
{ url = "https://files.pythonhosted.org/packages/01/bc/9c2a969cb1b70201d04fa17fd5aedf02a732870b8da86bceaaa30b0ca385/pillow-13.0.0-cp312-cp312-win32.whl", hash = "sha256:02464da86f561f410e13b061ec37c3068a9cb557a095494157742d07b3c24a27", size = 6515423, upload-time = "2026-10-16T22:15:56.25Z" },
{ url = "https://files.pythonhosted.org/packages/ff/cd/73a79ecdc822076002eb24b5e1e4a530b0bb5310fcb6d239abbec877110b/pillow-13.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:ff3fe9eb621fbb9db4c4be33ab946f6bac5f98ab50ca8d3260503653656c961b", size = 7272166, upload-time = "2026-10-16T22:15:58.597Z" },
{ url = "https://files.pythonhosted.org/packages/4a/a3/be5a1236efd085b3984e4305da8f179ae9dab80c991d2ad78f2bd5c4c843/pillow-13.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:c3bc8ee0271387e0b1e3ad0ff893645990a656e79bf9c42f4f734a3642b11d51", size = 2698943, upload-time = "2026-10-16T22:16:00.637Z" },
{ url = "https://files.pythonhosted.org/packages/82/e2/9132d38df320e8099e2642d9fa538f18a7dfebf68a875a31725dc2a115aa/pillow-13.0.0-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:e98b4f91f99b24b1da72e10621ba181f7281922384a7403094debb4199de6c00", size = 4190620, upload-time = "2026-10-16T22:16:02.527Z" },
{ url = "https://files.pythonhosted.org/packages/cb/be/436dac0996876f65ef1916ffb711c5ef4af2ebc57414b6f16642e07f6b47/pillow-13.0.0-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:34fb3db1149c879343861831728c243c432d4a5afc8f1878ca7612ef8de2a033", size = 4290286, upload-time = "2026-10-16T22:16:04.861Z" },
{ url = "https://files.pythonhosted.org/packages/60/16/7c1007162e4169ea0d5bec47e2e0b2174f56c50cf5b8c02a1dc23e41037e/pillow-13.0.0-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:2d50500a4a3bc6469adcdb319cf05d688b08ca3bf0f22a05339f3b25b433a599", size = 3723169, upload-time = "2026-10-16T22:16:06.956Z" },
{ url = "https://files.pythonhosted.org/packages/08/bc/578ab2eaa04705a8978bd9be0fe15c3d43a8fc95097c4f7e39540e79e4fa/pillow-13.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:ef5fe6b7db3f501c56000ba8fe7c7e1a35ca1d45824fbeb95a67daa85cff4dbe", size = 5568469, upload-time = "2026-10-16T22:16:08.664Z" },
{ url = "https://files.pythonhosted.org/packages/98/c8/ccede3dcc4f274b80fb49199eed1ef34ba05566c8b71976b9d1f111da2e3/pillow-13.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f11a3c1358bb3c68012a7b1f41b223c3db9f7bfde90b481df028cfe1c3363313", size = 4852187, upload-time = "2026-10-16T22:16:10.693Z" },
{ url = "https://files.pythonhosted.org/packages/fb/3c/cd0770e96d20bfd990db024bcbd43897ff3e88da1f4782cf90ea231b1d4f/pillow-13.0.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:19b66ca0a4d25cc0200b381ce824c7ea090db61427315e73cfb05dbf1b35c369", size = 6515908, upload-time = "2026-10-16T22:16:12.896Z" },
{ url = "https://files.pythonhosted.org/packages/ef/fe/f5cdaa2d1c4086e757430f368c271a58ee29cfe7378e7ae7b9d964015c25/pillow-13.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5f56499c1a74d2b862beb0c33b8016f99d095858455df9d21583bbbc1c15b582", size = 7142544, upload-time = "2026-10-16T22:16:14.844Z" },
{ url = "https://files.pythonhosted.org/packages/fb/b5/a54f6d44adbcd23737c8c12953f42be107e4cca64e247c0ca3a5b563061c/pillow-13.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a2a14cd73d5e6c927f644b0110ee81f59c4ef506259ec9183904747f2caacc81", size = 6613097, upload-time = "2026-10-16T22:16:16.893Z" },
{ url = "https://files.pythonhosted.org/packages/e6/b4/9e6c1207c21b2e91db0d15c16d30f3701ce5add1bd4da0e787761e66cb6e/pillow-13.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:08b826a9bf1265c76de04a42061d61ea6b109418b7826f28ff1ecdfaa26c5502", size = 7224846, upload-time = "2026-10-16T22:16:19.195Z" },
{ url = "https://files.pythonhosted.org/packages/78/9f/d3c3cb0518f3dd1eee0ef501535f53d15597a53c5c4118d178086143397a/pillow-13.0.0-cp313-cp313-win32.whl", hash = "sha256:12b0fa15879fe5a9d9eebe66e4e2d74128a773b1a4448010c9c714f45e04b9d8", size = 6516013, upload-time = "2026-10-16T22:16:21.389Z" },
{ url = "https://files.pythonhosted.org/packages/d7/ed/1b16fb66a37e1b9e41370b93b2c614c7da761a5b2a41dc333f7af4639962/pillow-13.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:9dda0788a9932776a75d8bcc020076edc308ce2508b51f6739a45e3158b3fc42", size = 7284777, upload-time = "2026-10-16T22:16:23.393Z" },
{ url = "https://files.pythonhosted.org/packages/87/7d/8d02eba9f7ecc87f8e90f731e032cc4773802f2a843763afd0c66a535ff4/pillow-13.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:40a266371ece581e5de13b6635ef78d7487824af80561b6ca27694a88c19bc0f", size = 2698826, upload-time = "2026-10-16T22:16:25.382Z" },
{ url = "https://files.pythonhosted.org/packages/8e/45/fbad9c7f5e2f1745c373a434d46072bc84eddfefaa28b852425ac957fda6/pillow-13.0.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:44629d4498c9cb6b2051806155f22141df0d8a929c56134b166655232dfb2f8c", size = 4190721, upload-time = "2026-10-16T22:16:27.524Z" },
{ url = "https://files.pythonhosted.org/packages/a2/bf/2074902a259a90692c5dbf132885d21671644cbbd3f690047516243a55db/pillow-13.0.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:bf97ba1b5542050e9b0c74e632323b6d8136cc99d64e193abebee22fe6013c76", size = 4290236, upload-time = "2026-10-16T22:16:29.562Z" },
{ url = "https://files.pythonhosted.org/packages/ff/a5/3d1bb93b8ea38d15d21356c1b8e9f50971ac592aaa248f7fb71739094c0e/pillow-13.0.0-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:aa694c49787040943570d61c9b8fc01271bd2a2cfdd55f0d896f8aecdce1a981", size = 3723093, upload-time = "2026-10-16T22:16:31.249Z" },
{ url = "https://files.pythonhosted.org/packages/84/a1/be060135d85187b25fa8b2573786c0e45c62ae27527fff5257675eb97f4a/pillow-13.0.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:49c12af515073e9bf511e4ef736743bf70d531a643668722279314b937742ba4", size = 5572253, upload-time = "2026-10-16T22:16:33.103Z" },
{ url = "https://files.pythonhosted.org/packages/b5/f4/0bf6f1ac9ba7ee2ffe9914aeb410a1035a0c1a3c42f122388d7fc950bc4b/pillow-13.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:d9b0a2bee3f3e03e9f29057aedb807dbf1e1d96ee1b9d0f422d9db6c8583271d", size = 4852269, upload-time = "2026-10-16T22:16:35.102Z" },
{ url = "https://files.pythonhosted.org/packages/83/16/b603274617b3e6728da3a0133d4fba1ea8d7fbe0c4ea5fef9cbffa398b8b/pillow-13.0.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5933fcea5a5ba64c686f55c886a115cbfd92f2900460784a1e79909fdbafd7b6", size = 6516058, upload-time = "2026-10-16T22:16:37.228Z" },
{ url = "https://files.pythonhosted.org/packages/1d/f2/1371707ce438ba9a43f9d24089828494ec6f9396e28cd7903aa704dd6306/pillow-13.0.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e91c2b1cbeae768c98752e67e717e283d68dae45717b41f2d91eaee648e37b7d", size = 7142574, upload-time = "2026-10-16T22:16:39.172Z" },
{ url = "https://files.pythonhosted.org/packages/b9/a9/62cf68587f910bc87c5951bcb6e9430c7643a65076adf5f18b4bf350e2bd/pillow-13.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7f6299e494e46253d40c34653cac369412f44ca53b5f85d848d3f95b1ed0546c", size = 6614295, upload-time = "2026-10-16T22:16:41.117Z" },
{ url = "https://files.pythonhosted.org/packages/6c/c9/9e9b48178649730299be0bafbf5f810a5b6977538f5a92d47e4ba5f5d608/pillow-13.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:f9bd7d260d986f3553518c5d723544346fa48031f8aef3265d786aeb59845bc0", size = 7224841, upload-time = "2026-10-16T22:16:43.118Z" },
{ url = "https://files.pythonhosted.org/packages/8f/48/c44e91384b1b6c072a714a63d00608acc16a6a968735e478e4be4384e5ac/pillow-13.0.0-cp314-cp314-win32.whl", hash = "sha256:2e31c4e68cffd7b1f116127626813b82fcba19edf6b940a7b0c266d6484d0055", size = 6508694, upload-time = "2026-10-16T22:16:45.883Z" },
{ url = "https://files.pythonhosted.org/packages/50/e2/7ad17747517e4c813dca78257d6bb593466f8231baf1384bc98d92745edb/pillow-13.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:f7cbb7a64e7ec664775195e4f81923bc8a93d9451b963f844e59118f63147a7a", size = 7281830, upload-time = "2026-10-16T22:16:47.725Z" },
{ url = "https://files.pythonhosted.org/packages/41/9f/e5b51f2ce8ef4563215334035403ce61a244f93a2e65c24a940131618f87/pillow-13.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:a6aaa7871aebca081eb5c45f83e845bbd9712ae99fa9286dbfdcee835e63f4b4", size = 2695468, upload-time = "2026-10-16T22:16:49.515Z" },
{ url = "https://files.pythonhosted.org/packages/97/73/a53502f731f6c84805a4ce87a8881e86d07a65aee64728b900d112dc703e/pillow-13.0.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7b999816b5850a35ada08443e6e03945f1f6488144a83afe2d37b240a552aafa", size = 5578196, upload-time = "2026-10-16T22:16:51.291Z" },
{ url = "https://files.pythonhosted.org/packages/21/50/7e949959a56b5559c78ef172b70fc6025706acb289f3f648a15329e4fa6f/pillow-13.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:67871a13cf47275201553b536c025da777f997fa562a19eb798af4ad4b97c18f", size = 4857276, upload-time = "2026-10-16T22:16:53.399Z" },
{ url = "https://files.pythonhosted.org/packages/c9/52/43ded0ac08e77e39d17bd6d894162572201b5e8fdc4a022b14c55a1960a4/pillow-13.0.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e8ca8f69b7c77fa96dad99f8638c1fc4f1c0bed4acaa1baf7a3c31bdb80a0ab1", size = 6607008, upload-time = "2026-10-16T22:16:55.525Z" },
{ url = "https://files.pythonhosted.org/packages/0d/2e/4a57ed216d5bf877387cba4d44c02aa87abe51ad2e06404aa6b597c4da39/pillow-13.0.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6bce6a29c3898191f4c9998e4d4e8f69790caeabde46e54da4bc235ce5bde683", size = 7224281, upload-time = "2026-10-16T22:16:57.738Z" },
{ url = "https://files.pythonhosted.org/packages/5c/3d/2929b248e135752d63aaeabf53f6de797e905b7b6263f9c1e2adade20aba/pillow-13.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:816752a5ef76a80484c8c441c85593b7ea9304f6231fc5776ad1fbff7e773058", size = 6695600, upload-time = "2026-10-16T22:16:59.842Z" },
{ url = "https://files.pythonhosted.org/packages/bc/33/fb0da992cf084ed1ee6ee05e96b6191e35c351eb707ca2df874feb24ce47/pillow-13.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5bdb38ba220b61b4ec31dd1046dea6b016d3c6850a23f43ed8b58332b2fc668e", size = 7300589, upload-time = "2026-10-16T22:17:01.686Z" },
{ url = "https://files.pythonhosted.org/packages/bb/af/c30dd9ef6a3dce84ecb1b2393cac629047a32e66279056c6cb46c3ffd65c/pillow-13.0.0-cp314-cp314t-win32.whl", hash = "sha256:06903aac074d00c988e77a1fc435286dc498506d4ca8d6f69df9babddf4ecc15", size = 6517204, upload-time = "2026-10-16T22:17:03.722Z" },
{ url = "https://files.pythonhosted.org/packages/85/d5/ef3a8ae7609c8ab26570abf18194882534b480d245a9148b895a2262c004/pillow-13.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:9a635068d9793c7f0d929f39f18b58f1bd86c236e8e7b64167b86af9232ebca0", size = 7286695, upload-time = "2026-10-16T22:17:05.543Z" },
{ url = "https://files.pythonhosted.org/packages/84/3c/0861db0c69a03689ebe3e7599d35668a414deb5aaafd8255215e4e62e3d3/pillow-13.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0d1a9cf7bc6917538b20f8d06b9ab2147e542f68849e96fc58eb66bdf6acc692", size = 2698098, upload-time = "2026-10-16T22:17:07.674Z" },
{ url = "https://files.pythonhosted.org/packages/6e/eb/e86a41962a3a31ad495a3d6a912d9002b01bba4a6fa71c28703abdca7f69/pillow-13.0.0-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7d5e097eabd5d4915c27ac9f6e9325bb1e01a7c94d7348b5c4451d3fc30e8521", size = 4191213, upload-time = "2026-10-16T22:17:09.449Z" },
{ url = "https://files.pythonhosted.org/packages/dd/04/7e7445e706afec84ef06dc25b2c77f9cecff242c23730c62928ad1089d4a/pillow-13.0.0-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:51ebb529fc5e8abdd55302f6c3f8943037348ec2384329a3e55677f69ae2fdfc", size = 4290650, upload-time = "2026-10-16T22:17:11.196Z" },
{ url = "https://files.pythonhosted.org/packages/46/85/d534089068ac40c0f61f650389a296c812eab745a8a733f81feec39ae955/pillow-13.0.0-cp315-cp315-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:c87a04e7f152ee4db5dbe15f0bfa3fe628a1aeedbe66b81c43b87f52c813f9ac", size = 3723078, upload-time = "2026-10-16T22:17:12.772Z" },
{ url = "https://files.pythonhosted.org/packages/ce/2b/00b5c3b401df538b5dbe311d3899730fae5ba1e21cb8b80a128887ac6747/pillow-13.0.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:20722cd5375533ad754053363a80b8fb30c79d37930a6f7228030e237ce3bd5d", size = 5572292, upload-time = "2026-10-16T22:17:14.539Z" },
{ url = "https://files.pythonhosted.org/packages/72/f5/a6b0610f946e9b54ae888ba7ad29d6e2f8d9b11f69e212d70416b7186c09/pillow-13.0.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:04a63720f79e22fd54d897c233a68314c50ca0603360f54ce2bd5db8f0f43782", size = 4852222, upload-time = "2026-10-16T22:17:16.521Z" },
{ url = "https://files.pythonhosted.org/packages/1e/d0/c0ff25bb0427ec70f32aac995453321fc3c4494a46c7292ff02d9d260b04/pillow-13.0.0-cp315-cp315-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4f8db54177035a2b5f717f94475b74907e12a96dc74f6d487f3966b0a4694071", size = 6527349, upload-time = "2026-10-16T22:17:18.534Z" },
{ url = "https://files.pythonhosted.org/packages/85/11/e46fa0bcc0fc117f1eacc206b3d51f04d583fab328b4b740672d0438d83f/pillow-13.0.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f36aa77f74b14a2103622b196402c71330e4e7cf4122ee45c854e9a01e0eecf", size = 7152873, upload-time = "2026-10-16T22:17:20.415Z" },
{ url = "https://files.pythonhosted.org/packages/7c/53/2bdeca705f3a58679fa9201233193c86a30238340ca29b3a152c3fcc719b/pillow-13.0.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:149a1c323ba366f90b48e6f1a6db6582eb50512df374588de56fc909abc0f0f3", size = 6626871, upload-time = "2026-10-16T22:17:22.361Z" },
{ url = "https://files.pythonhosted.org/packages/14/de/3829030f209722ade3753bb456b805a0e7f885cf885b483407365c82e9ca/pillow-13.0.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:e892354a424b1e82a78ba16785822bdd40de06f19446a3d4a28047df1a4f8932", size = 7236439, upload-time = "2026-10-16T22:17:24.352Z" },
{ url = "https://files.pythonhosted.org/packages/44/b1/67fc37388382bc036a74f04da5bb6fcbf90ec3ac1f45893e06176c373fd3/pillow-13.0.0-cp315-cp315-win32.whl", hash = "sha256:8e459b613cf31f8980f584387b4fe47bf08e076e288d61aa8eba1f7fd4ddbb81", size = 6508688, upload-time = "2026-10-16T22:17:26.314Z" },
{ url = "https://files.pythonhosted.org/packages/44/05/fdb6a79aee10861165526b41b7b440e36ee1ff58613b2fbefe3acbf06d4f/pillow-13.0.0-cp315-cp315-win_amd64.whl", hash = "sha256:d4737f50d23ddd11d6685faacbb9252887dde0bc7997127757247983d74399d6", size = 7281107, upload-time = "2026-10-16T22:17:28.198Z" },
{ url = "https://files.pythonhosted.org/packages/e6/9c/6c6f7dc2a566467baf121394e83de25ac287cffe34cc030726beb4be0224/pillow-13.0.0-cp315-cp315-win_arm64.whl", hash = "sha256:2310e2adfc13c6d457d7d0f2ffdd5c56a74a317650cf765887df8d515a647ac0", size = 2695513, upload-time = "2026-10-16T22:17:30.013Z" },
{ url = "https://files.pythonhosted.org/packages/23/16/e9120defdb8bff693b582d035312acc6f530cdc2bc5238a87f410efccd82/pillow-13.0.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:21c32061a5512dc13f87cc7303e120e4d77c2f70df89a35af0e3ce246e5ac57f", size = 5578129, upload-time = "2026-10-16T22:17:31.642Z" },
{ url = "https://files.pythonhosted.org/packages/47/22/76faf2bb2448f48a84cf894c1e2bb1090d7d2b1aa521ece131cb2f05d631/pillow-13.0.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:1c774b9c0ba0d0b356f71530677b39028878a2cae5a93e0a13779cfd17120f88", size = 4857428, upload-time = "2026-10-16T22:17:33.43Z" },
{ url = "https://files.pythonhosted.org/packages/b3/64/0861ea4e03c50b14af9ed9dd8b9f388ab42f445c623a9fcbab19aef7aa55/pillow-13.0.0-cp315-cp315t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:20822140c9a2ba9c5e42df342b0a892ab2e102fc0e3db967a133bb9ce3f898bb", size = 6612582, upload-time = "2026-10-16T22:17:35.415Z" },
{ url = "https://files.pythonhosted.org/packages/5c/20/cd1e9b3f60a9f3d5ebe46da36955c26004092a501f7f2c42f9fcc26611bc/pillow-13.0.0-cp315-cp315t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ffea6b2986a797c84b6d1d27d4f43e0b83c73fc16281a930891cd237cf0d08fe", size = 7230176, upload-time = "2026-10-16T22:17:37.362Z" },
{ url = "https://files.pythonhosted.org/packages/b6/ef/ffb0a2fc85690714fb7ac662956949645d57f15bf4426f520da361e7b6e3/pillow-13.0.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:05cd2cd39055d0b9650060e4513ef4a9a0aea870083950bd046a0d6490f93a22", size = 6703640, upload-time = "2026-10-16T22:17:39.313Z" },
{ url = "https://files.pythonhosted.org/packages/e0/c2/6402ee3ccb3363aeed8fdb3f9fe56703ac5377a539f0b81b53999d7e121f/pillow-13.0.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:c6fd031333dedcad7ce3e03d244093f43504f209e86925ebdb2b868fa4037630", size = 7309231, upload-time = "2026-10-16T22:17:41.021Z" },
{ url = "https://files.pythonhosted.org/packages/fc/96/d6b82e8b8c06ad143b66b12e0b31051e4bf489b4fabca1f390a14fe1ebde/pillow-13.0.0-cp315-cp315t-win32.whl", hash = "sha256:c50c80e3591e5cf9a8dfa6007d4f10732f02e32263850999286e56ccd650cfb2", size = 6517200, upload-time = "2026-10-16T22:17:42.886Z" },
{ url = "https://files.pythonhosted.org/packages/60/d4/0062e6005e9b270b165015aafd343364ac378ec5a685431ea42baad33357/pillow-13.0.0-cp315-cp315t-win_amd64.whl", hash = "sha256:adb3c2124c68e480f4632d06cb7caa3b48a51678475f483b4edb1c6dee29ea43", size = 7287488, upload-time = "2026-10-16T22:17:45.56Z" },
{ url = "https://files.pythonhosted.org/packages/e4/81/b8eb349746be7bce47dd95337c6634e84910af91b59aaa9159c034c614fa/pillow-13.0.0-cp315-cp315t-win_arm64.whl", hash = "sha256:4a25756244bdcce3b50580baadf320fa48297f0eeb8e114ba64139a40d4d0fc8", size = 2698073, upload-time = "2026-10-16T22:17:47.556Z" },
{ url = "https://files.pythonhosted.org/packages/68/c0/fb7b1caf25ed5ac5d46116f09b8b0706b9559833c65c667cecb1a53153f2/pillow-13.0.0-pp311-pypy311_pp80-macosx_10_15_x86_64.whl", hash = "sha256:405be6058e206a86fedce2f715ecc2343f94072d7925251632dffa2c05f70dca", size = 5521630, upload-time = "2026-10-16T22:17:50.008Z" },
{ url = "https://files.pythonhosted.org/packages/1a/e6/4d11d5b1137f4fc080605cce410cfaae4f303ad400bdec75d27d3083fa29/pillow-13.0.0-pp311-pypy311_pp80-macosx_11_0_arm64.whl", hash = "sha256:b84be41387fc00db28c13c02e30d42b02d8d8f6a4a741a1aee6012ca7f1f6039", size = 4806023, upload-time = "2026-10-16T22:17:51.932Z" },
{ url = "https://files.pythonhosted.org/packages/f1/45/0923202a658e8ff6aafd72c1a4395ebadcdebaa182c437d8595d3dd3db32/pillow-13.0.0-pp311-pypy311_pp80-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a192360d512305fe92d3053e4f7627bbad1f7708f1f4ad38cccd9336acabe9ad", size = 5464831, upload-time = "2026-10-16T22:17:53.742Z" },
{ url = "https://files.pythonhosted.org/packages/07/52/d3e38f0cad1dadea2a658b9a7d6ba8a04048f5ae14f011b806e5c3bd6bcb/pillow-13.0.0-pp311-pypy311_pp80-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:83b37abd87b590acd8f47ca8a61f70893322b11834d36e07c2298dacad4d14d2", size = 6043133, upload-time = "2026-10-16T22:17:55.625Z" },
{ url = "https://files.pythonhosted.org/packages/c4/f9/2ed7685980c1d64f8131a7d87a19c369424747577152622b73ddeff163b7/pillow-13.0.0-pp311-pypy311_pp80-win_amd64.whl", hash = "sha256:73ee25cf8cf8b75d5a5aeed7cb6588f5e5dbfbb0fde51707b630bbb23897645c", size = 7365208, upload-time = "2026-10-16T22:17:57.509Z" },
{ url = "https://files.pythonhosted.org/packages/60/da/f6d644e631c5b370c5d0b899f3ccadd2780aab070b29a110527cf4e1fd2c/pillow-13.0.0-pp312-pypy312_pp80-macosx_10_15_x86_64.whl", hash = "sha256:8619685cad8efc4c38c66d3b36aad854523297c43d748b3b6f0cc03c90ba3463", size = 5523188, upload-time = "2026-10-16T22:17:59.334Z" },
{ url = "https://files.pythonhosted.org/packages/e4/b0/2594f202d743a35d4fe80682bfd96f277e5ca7aecb27cf64ef5bfc1d000b/pillow-13.0.0-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:7e91e97a929232cdb828889ee6ad0e48d7f40f4ec38818f4e4a8968b2b1af22e", size = 4806808, upload-time = "2026-10-16T22:18:01.188Z" },
{ url = "https://files.pythonhosted.org/packages/8e/ed/d504165ef79af6fafe25c76726cf30f544cc236002f7ed054f1d51adc4ff/pillow-13.0.0-pp312-pypy312_pp80-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:93ff9c9c3663ce23aaa5d0b6b6abac55359e2a0c06c7e30f3771829af816be63", size = 5464358, upload-time = "2026-10-16T22:18:02.779Z" },
{ url = "https://files.pythonhosted.org/packages/7b/fe/a10aba5503ca13e9e009b8bd0a1a4ce5584bdce246245fd6f3a83701369c/pillow-13.0.0-pp312-pypy312_pp80-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e65dd6e75de67b2362a4fa3e16aa627595f65054dc4ec73d64680c84d592fa61", size = 6043514, upload-time = "2026-10-16T22:18:04.538Z" },
{ url = "https://files.pythonhosted.org/packages/c0/37/66b12dc476041fe523bca29c9d58fbf1ea92a4eaf73acfb9e993948f1191/pillow-13.0.0-pp312-pypy312_pp80-win_amd64.whl", hash = "sha256:567f20f1c75897d7663830da6ea8af719e03d712b1d9ee7f813319f9ece42e5a", size = 7366030, upload-time = "2026-10-16T22:18:06.638Z" },
]
[[package]]
name = "platformdirs"
version = "4.5.1"
@@ -4351,7 +4692,8 @@ dependencies = [
{ name = "identify" },
{ name = "nodeenv" },
{ name = "pyyaml" },
{ name = "virtualenv" },
{ name = "virtualenv", version = "21.14.5", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "virtualenv", version = "21.14.13", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/40/f1/6d86a29246dfd2e9b6237f0b5823717f60cad94d47ddc26afa916d21f525/pre_commit-4.5.1.tar.gz", hash = "sha256:eb545fcff725875197837263e977ea257a402056661f09dae08e4b149b030a61", size = 198232, upload-time = "2025-12-16T21:14:33.552Z" }
wheels = [
@@ -4865,7 +5207,8 @@ dependencies = [
{ name = "colorama", marker = "sys_platform == 'win32'" },
{ name = "exceptiongroup", marker = "python_full_version < '3.11'" },
{ name = "iniconfig" },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "pluggy" },
{ name = "pygments" },
{ name = "tomli", marker = "python_full_version < '3.11'" },
@@ -4920,7 +5263,8 @@ name = "python-discovery"
version = "1.6.1"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "filelock" },
{ name = "filelock", version = "4.1.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "filelock", version = "4.2.4", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/0c/57/250bd238b966cece44328235eb85290045d059265fdaf7527a3a958123db/python_discovery-1.6.1.tar.gz", hash = "sha256:cf87d3627dfb4412437fdd5b13eae402607722998d21567993aedbc59b23c15e", size = 84338, upload-time = "2026-09-18T01:31:53.971Z" }
wheels = [
@@ -5068,7 +5412,7 @@ dependencies = [
{ name = "numpy", version = "2.4.1", source = { registry = "https://pypi.org/simple/" } },
{ name = "omegaconf" },
{ name = "opencv-python" },
{ name = "pillow" },
{ name = "pillow", version = "13.0.0", source = { registry = "https://pypi.org/simple/" } },
{ name = "pyclipper" },
{ name = "pyyaml" },
{ name = "requests" },
@@ -5090,7 +5434,8 @@ dependencies = [
{ name = "onnxruntime", version = "1.23.2", source = { registry = "https://pypi.org/simple/" }, marker = "(python_full_version < '3.11' and platform_machine != 'x86_64') or (python_full_version >= '3.13' and platform_machine != 'x86_64') or (python_full_version < '3.11' and sys_platform != 'darwin') or (python_full_version >= '3.13' and sys_platform != 'darwin') or (platform_machine == 'x86_64' and sys_platform == 'darwin')" },
{ name = "onnxruntime", version = "1.26.0", source = { registry = "https://pypi.org/simple/" }, marker = "(python_full_version >= '3.11' and python_full_version < '3.13' and platform_machine != 'x86_64') or (python_full_version >= '3.11' and python_full_version < '3.13' and sys_platform != 'darwin')" },
{ name = "opencv-python" },
{ name = "pillow" },
{ name = "pillow", version = "12.3.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11' or python_full_version >= '3.13'" },
{ name = "pillow", version = "13.0.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11' and python_full_version < '3.13'" },
{ name = "pyclipper" },
{ name = "pyyaml" },
{ name = "shapely" },
@@ -5101,6 +5446,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/ba/12/1e5497183bdbe782dbb91bad1d0d2297dba4d2831b2652657f7517bfc6df/rapidocr_onnxruntime-1.4.4-py3-none-any.whl", hash = "sha256:971d7d5f223a7a808662229df1ef69893809d8457d834e6373d3854bc1782cbf", size = 14915192, upload-time = "2025-01-17T01:48:25.104Z" },
]
[[package]]
name = "redis"
version = "8.1.0"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "async-timeout", marker = "python_full_version < '3.11.3'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/a8/99/604f0b666d4c616d891cf77ebb9db6bb21601344c051aebf1b72b9ff915f/redis-8.1.0.tar.gz", hash = "sha256:6e1a19beef9225c83efd689c7e6b7da2d5215b1f42cd13b7fc3714d0a09c7b25", size = 5254356, upload-time = "2026-07-30T08:51:00.269Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/66/9d/c5731f6e3608663d4d3656fd8d3aecee8b509c3082818f5a13eae925baea/redis-8.1.0-py3-none-any.whl", hash = "sha256:a4fe1aac3d3b3cc791d4b3d5931c5a956045dc951ee74d1c913ee3ac4d2ee9fb", size = 560618, upload-time = "2026-07-30T08:50:58.497Z" },
]
[[package]]
name = "referencing"
version = "0.37.0"
@@ -5823,11 +6180,11 @@ wheels = [
[[package]]
name = "setuptools"
version = "83.0.0"
version = "84.2.1"
source = { registry = "https://pypi.org/simple/" }
sdist = { url = "https://files.pythonhosted.org/packages/34/26/f5d29e25ffdb535afef2d35cdb55b325298f96debd670da4c325e08d70f4/setuptools-83.0.0.tar.gz", hash = "sha256:025bccbbf0fa05b6192bc64ae1e7b16e001fd6d6d4d5de03c97b1c1ade523bef", size = 1154254, upload-time = "2026-07-04T15:31:22.699Z" }
sdist = { url = "https://files.pythonhosted.org/packages/70/b3/c19426f783614d625699a4b247faf628ea9ab1db228674491767b417f9e1/setuptools-84.2.1.tar.gz", hash = "sha256:3ff8b3b5492a0aa66960f4419365a86b84e013070d4313e4d4a6894f5d64d6bc", size = 1230289, upload-time = "2026-10-20T19:01:37.742Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/5d/40/e1e72872c6354b306daef1703549e8e83b4d43cfea356311bf722a043752/setuptools-83.0.0-py3-none-any.whl", hash = "sha256:29b23c360f22f414dc7336bb39178cc7bcbf6021ed2733cde173f09dba19abb3", size = 1008090, upload-time = "2026-07-04T15:31:20.885Z" },
{ url = "https://files.pythonhosted.org/packages/ef/55/6dc6d6bb953bdfc52519a0059592c52b6e3b8ad51cf8256dffceb55b0610/setuptools-84.2.1-py3-none-any.whl", hash = "sha256:ca140b45d5325a9478f880e351484f62fef15f336462e449ca0c03c873d589c2", size = 876263, upload-time = "2026-10-20T19:01:35.678Z" },
]
[[package]]
@@ -5943,6 +6300,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/37/c3/6eeb6034408dac0fa653d126c9204ade96b819c936e136c5e8a6897eee9c/socksio-1.0.0-py3-none-any.whl", hash = "sha256:95dc1f15f9b34e8d7b16f06d74b8ccf48f609af32ab33c608d08761c5dcbb1f3", size = 12763, upload-time = "2020-04-17T15:50:31.878Z" },
]
[[package]]
name = "sortedcontainers"
version = "2.4.0"
source = { registry = "https://pypi.org/simple/" }
sdist = { url = "https://files.pythonhosted.org/packages/e8/c4/ba2f8066cceb6f23394729afe52f3bf7adec04bf9ed2c820b39e19299111/sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88", size = 30594, upload-time = "2021-05-16T22:03:42.897Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/32/46/9cb0e58b2deb7f82b84065f37f3bffeb12413f947f9388e4cac22c4621ce/sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0", size = 29575, upload-time = "2021-05-16T22:03:41.177Z" },
]
[[package]]
name = "sqlalchemy"
version = "2.0.49"
@@ -6218,7 +6584,8 @@ source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "cuda-bindings", marker = "python_full_version < '3.15' and sys_platform == 'linux'" },
{ name = "cuda-toolkit", extra = ["cublas", "cudart", "cufft", "cufile", "cupti", "curand", "cusolver", "cusparse", "nvjitlink", "nvrtc", "nvtx"], marker = "sys_platform == 'linux'" },
{ name = "filelock" },
{ name = "filelock", version = "4.1.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "filelock", version = "4.2.4", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "fsspec" },
{ name = "jinja2" },
{ name = "networkx", version = "3.4.2", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
@@ -6297,7 +6664,8 @@ dependencies = [
{ name = "huggingface-hub" },
{ name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "numpy", version = "2.4.1", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "packaging" },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version < '3.11'" },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" }, marker = "python_full_version >= '3.11'" },
{ name = "pyyaml" },
{ name = "regex" },
{ name = "safetensors" },
@@ -6566,18 +6934,56 @@ wheels = [
[[package]]
name = "virtualenv"
version = "21.7.13"
version = "21.14.5"
source = { registry = "https://pypi.org/simple/" }
resolution-markers = [
"python_full_version < '3.11'",
]
dependencies = [
{ name = "distlib" },
{ name = "filelock" },
{ name = "distlib", version = "0.4.0", source = { registry = "https://pypi.org/simple/" } },
{ name = "filelock", version = "4.1.0", source = { registry = "https://pypi.org/simple/" } },
{ name = "packaging", version = "25.0", source = { registry = "https://pypi.org/simple/" } },
{ name = "platformdirs" },
{ name = "python-discovery" },
{ name = "typing-extensions", marker = "python_full_version < '3.11'" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/13/50/c9b84eb106d0db420b9878dac0a386c5791726f127ce20b06897f6e3a1e9/virtualenv-21.7.13.tar.gz", hash = "sha256:0355558b6f33619aab31347e43643b0ebc97f61ea3acf617b2b69e1f8a843d11", size = 5360306, upload-time = "2026-09-18T04:35:49.354Z" }
sdist = { url = "https://files.pythonhosted.org/packages/c4/f9/f323b3b6058cff3853b31cf6a49c0425ed797bf9611572ec10d065e08bac/virtualenv-21.14.5.tar.gz", hash = "sha256:c4cb6c13e46b57225a999c7e22a09b163393878facc7ac4c059a57f46faa1647", size = 5467127, upload-time = "2026-10-02T17:42:25.613Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/9a/ce/e74453531b0c49a58d0e8a4f9bab4495705859fee4a4f7de27d58f4a791a/virtualenv-21.7.13-py3-none-any.whl", hash = "sha256:1bea5af7463f59c4719db48fe739579a2a4f569c96f26c086edda85c96da9f59", size = 5328680, upload-time = "2026-09-18T04:35:47.194Z" },
{ url = "https://files.pythonhosted.org/packages/df/93/084f10ebbecdedf7902ed68fbecc903f0e9c5742155bfffb05eccbc071da/virtualenv-21.14.5-py3-none-any.whl", hash = "sha256:b0651e0174982bba17cc6f0aaa2ef496730cb85a3f35eb5d1119d1c904f7d1da", size = 5487482, upload-time = "2026-10-02T17:42:23.38Z" },
]
[[package]]
name = "virtualenv"
version = "21.14.13"
source = { registry = "https://pypi.org/simple/" }
resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'win32'",
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"(python_full_version >= '3.14' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version >= '3.14' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version >= '3.14' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.13.*' and sys_platform == 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.13.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.13.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.13.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.12.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.12.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.12.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
"python_full_version == '3.11.*' and sys_platform == 'win32'",
"python_full_version == '3.11.*' and sys_platform == 'emscripten'",
"(python_full_version == '3.11.*' and platform_machine != 'x86_64' and sys_platform == 'darwin') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')",
"python_full_version == '3.11.*' and platform_machine == 'x86_64' and sys_platform == 'darwin'",
]
dependencies = [
{ name = "distlib", version = "0.4.4", source = { registry = "https://pypi.org/simple/" } },
{ name = "filelock", version = "4.2.4", source = { registry = "https://pypi.org/simple/" } },
{ name = "packaging", version = "26.3", source = { registry = "https://pypi.org/simple/" } },
{ name = "platformdirs" },
{ name = "python-discovery" },
]
sdist = { url = "https://files.pythonhosted.org/packages/70/aa/bff50daee0488e16d611258a9b6c5a1d0c9e128f8ca424e9f4e1c0444ef2/virtualenv-21.14.13.tar.gz", hash = "sha256:de5307ba4b9a0001d9c8ea02832d38f63ca432880f416c1bface61c4323fd905", size = 5570301, upload-time = "2026-10-22T20:10:16.952Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/bb/a9/c10d8a44a29fb94a18b43fdf11f38caca53ae7c9406f11a72b1cb8f624f1/virtualenv-21.14.13-py3-none-any.whl", hash = "sha256:5fbb04138a4861580b78ba9110d529a26bc48fcc93c8ec36bc0202eeed96a788", size = 5557094, upload-time = "2026-10-22T20:10:15.096Z" },
]
[[package]]