Files
SnapOtter/docker/feature-manifest.json
T
SnapOtterandGitHub 60d01ab2dd fix: release-acceptance QA follow-ups (upload crash, scipy ABI conflict, rate limit, OCR fallback) (#458)
* fix(api): prevent a crash when an over-limit upload stream has no consumer yet

busboy's "limit" handler destroyed the file stream with an error but never
attached its own error listener, relying entirely on whatever consumes
part.file downstream to do so. On a fast enough connection (or a fully
buffered body, e.g. Fastify inject()), busboy can process enough bytes to
hit the size limit before the route handler's receiveUpload() call has
attached its own stream listener, leaving the resulting "error" event with
zero listeners -- which crashes the whole process by default in Node.

Surfaced by tonight's FULL_MATRIX+FUZZ integration run (880 uncaught
exceptions, all the same root cause). Reproduces deterministically in
isolation; unrelated to this release's actual code delta (file untouched
since PR #413, well before the baseline QA pass).

Fix: attach a baseline no-op error listener the moment the stream is
created, guaranteeing at least one listener always exists. EventEmitter
delivers "error" to every registered listener, so the real consumer's own
error handling is unaffected.

* fix(ai-bundles): rebuild upscale-enhance and photo-restoration to reconcile scipy ABI

upscale-enhance and photo-restoration both depend on codeformer-pip, whose
transitive closure (basicsr -> realesrgan -> gfpgan) pulls in an unpinned
scipy. Both bundles were last built ~June 18-19, before PR #437 added the
manifest's `constraints` array (numpy==1.26.4, scipy==1.12.0, etc.) to pin
exactly this kind of dependency during bundle builds. Only the ocr bundle
was rebuilt after that fix landed.

install_feature.py has no pip install step -- it's a raw tarfile extraction
with no cross-bundle conflict resolution, so installing OCR alongside either
stale bundle left three incompatible scipy versions' files mixed in the same
site-packages directory (a compiled _rotation.*.so from one release next to
Python files expecting a different release's API), breaking the `upscale`
tool and OCR's higher-quality tiers with an ImportError.

Rebuilt both bundles for amd64-gpu and arm64-cpu from the current manifest,
verified scipy/scikit-learn/scikit-image/pandas all resolve to the pinned
versions in the tarballs themselves, then verified end-to-end on real
hardware (Mac arm64 CPU and ubuntu_gpu .248 RTX 4070): installing all
affected bundles together now yields exactly one version of each constrained
package, `upscale` produces correct output, and OCR's balanced/best tiers
correctly use PaddleOCR-GPU instead of erroring out.

Published the rebuilt tarballs to the public deepsafe/feature-bundles
HuggingFace repo and updated this manifest's sha256/sizes to match.

Also adds verify-bundle-compatibility.sh: verify-bundle.sh checks each
bundle in isolation (a fresh venv per bundle), which is exactly why this
shipped twice -- nothing ever checked that bundles built at different times
agree once layered into the one shared venv real installs use. The new
script installs every bundle for an arch into one venv and asserts each
constrained package has exactly one, correct version.

Known follow-up (not fixed here, needs separate discussion): uninstalling a
bundle only removes its downloaded model weights, never the site-packages
it added, so existing installations that already hit this bug have no clean
self-service fix via uninstall+reinstall -- they need a full AI-venv wipe.

* fix(docker): bake a real rate limit default for the all-in-one one-liner

The documented single-container `docker run` install had RATE_LIMIT_PER_MIN=0
(effectively unlimited, ~50k/min) baked in, since only docker-compose.yml
carried a hardened override. A self-hoster following the one-liner path got
no meaningful throttling anywhere, including auth-adjacent routes with no
dedicated per-route limit. Bakes a generous-but-real 1000/min default into
the Dockerfile, raises both compose files' fallback to match so the two
documented install paths converge on the same posture, and updates the Zod
schema default plus docs that quoted the old value.

* fix(api): boot log undercounted tool routes by the conversion-preset total

The "Tool routes: N active" line logged before registerConversionPresets(app)
ran, so it only ever reported the base 158 tools, 83 short of the real
241-tool total. Presets have to register after the base loop (they delegate
to each base tool's own processV2), so the fix moves the log line to after
that call and has registerConversionPresets return its count instead of
reordering the dependency.

* fix(ai): forward {info}/{warning} stderr JSON instead of dropping it

The dispatcher stderr parser only recognized {ready} and {progress,stage}
shaped JSON lines; anything else that parsed as valid JSON (like ocr.py's
GPU-to-tesseract downgrade notice, an {"info": ...} line) matched neither
branch and fell through silently, never reaching docker logs. Adds explicit
{info}/{warning} handling that forwards to console.log/console.warn, same as
the existing [prefix]-tagged non-JSON path.

* fix(api): fall back to a lower OCR tier when PaddleOCR itself is unusable

ocr.ts already retries lower quality tiers on a crashed dispatcher, but the
condition only matched crash-style messages (segfault, exited unexpectedly).
ocr.py's own ImportError/exception handlers already produce messages telling
the caller to use a lower tier (e.g. on the scipy ABI conflict class of bug),
but nothing ever acted on them, so a broken PaddleOCR hard-failed with 422
instead of degrading to Tesseract like ocr-pdf effectively does. Broadens the
retry condition to also catch PaddleOCR-engine-unusable messages.

Note: ocr-pdf's tesseract-only behavior turned out to be an unrelated,
pre-existing, deliberate design choice (PaddleOCR segfaults on rasterized PDF
pages on arm64), not a graceful-fallback mechanism to copy -- the two tools
weren't actually solving the same problem, so this fixes ocr.ts's own gap
rather than trying to mirror ocr-pdf.
2026-07-07 12:18:28 +08:00

523 lines
18 KiB
JSON

{
"manifestVersion": 2,
"imageVersion": "2.0.0",
"pythonVersion": { "amd64": "3.12", "arm64": "3.11" },
"basePackages": ["numpy==1.26.4", "Pillow==12.2.0", "opencv-python-headless==4.10.0.84"],
"constraints": [
"numpy==1.26.4",
"scipy==1.12.0",
"scikit-learn==1.4.2",
"scikit-image==0.24.0",
"pandas==2.2.2"
],
"bundleRepo": "deepsafe/feature-bundles",
"bundles": {
"background-removal": {
"name": "Background Removal",
"description": "Remove image backgrounds with AI",
"estimatedSize": "4-5 GB",
"archives": {
"amd64-gpu": {
"file": "v2.0.0/background-removal-amd64-gpu.tar.gz",
"sha256": "a1dfbdd5862fd32c7719ca79b0c7e4b76a327330a5991ddad98a2761abca10cb",
"compressedSize": 4808242472,
"extractedSize": 0
},
"arm64-cpu": {
"file": "v2.0.0/background-removal-arm64-cpu.tar.gz",
"sha256": "cbb570b81bfd740dd05e265dd8c93ade53a9f41fdd30cc8b3fbc47a8daa824af",
"compressedSize": 4631430295,
"extractedSize": 0
}
},
"packages": {
"common": ["rembg==2.0.62"],
"amd64": ["onnxruntime-gpu==1.20.1", "mediapipe>=0.10.21"],
"arm64": ["onnxruntime==1.20.1", "mediapipe>=0.10.18"]
},
"pipFlags": {},
"postInstall": [],
"models": [
{
"id": "rembg-u2net",
"downloadFn": "rembg_session",
"args": ["u2net"]
},
{
"id": "rembg-isnet-general-use",
"downloadFn": "rembg_session",
"args": ["isnet-general-use"]
},
{
"id": "rembg-bria-rmbg",
"downloadFn": "rembg_session",
"args": ["bria-rmbg"]
},
{
"id": "rembg-birefnet-general-lite",
"downloadFn": "rembg_session",
"args": ["birefnet-general-lite"]
},
{
"id": "rembg-birefnet-portrait",
"downloadFn": "rembg_session",
"args": ["birefnet-portrait"]
},
{
"id": "rembg-birefnet-general",
"downloadFn": "rembg_session",
"args": ["birefnet-general"]
},
{
"id": "rembg-birefnet-matting",
"downloadFn": "rembg_session",
"args": ["birefnet-matting"]
},
{
"id": "rembg-birefnet-hr-matting",
"downloadFn": "rembg_session",
"args": ["birefnet-hr-matting"]
}
],
"enablesTools": [
"remove-background",
"passport-photo",
"transparency-fixer",
"background-replace",
"blur-background"
]
},
"face-detection": {
"name": "Face Detection",
"description": "Detect and blur faces, fix red-eye, smart crop",
"estimatedSize": "200-300 MB",
"archives": {
"amd64-gpu": {
"file": "v2.0.0/face-detection-amd64-gpu.tar.gz",
"sha256": "0ee28b86dac88c60e005604ba0595746f455ec97f08d0c8307ba9b57e131bc7f",
"compressedSize": 75358868,
"extractedSize": 209838080
},
"arm64-cpu": {
"file": "v2.0.0/face-detection-arm64-cpu.tar.gz",
"sha256": "8ad922514aba1721de154d370f9335f78c5ce5aceade5b19515e0192d4367909",
"compressedSize": 222878753,
"extractedSize": 704276480
}
},
"packages": {
"common": [],
"amd64": ["mediapipe>=0.10.21"],
"arm64": ["mediapipe>=0.10.18"]
},
"pipFlags": {},
"postInstall": [],
"models": [
{
"id": "mediapipe-face-detector",
"url": "https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/latest/blaze_face_short_range.tflite",
"path": "mediapipe/blaze_face_short_range.tflite",
"minSize": 100000
},
{
"id": "mediapipe-face-landmarker",
"url": "https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",
"path": "mediapipe/face_landmarker.task",
"minSize": 1000000
}
],
"enablesTools": ["blur-faces", "red-eye-removal", "smart-crop"]
},
"object-eraser-colorize": {
"name": "Object Eraser & Colorize",
"description": "Erase objects from photos and colorize B&W images",
"estimatedSize": "1-2 GB",
"archives": {
"amd64-gpu": {
"file": "v2.0.0/object-eraser-colorize-amd64-gpu.tar.gz",
"sha256": "a3f6cd2eca9e5dd907497d0d58ca5f6532887bb748e4062de0f4fb9815782c31",
"compressedSize": 1545472964,
"extractedSize": 2249379840
},
"arm64-cpu": {
"file": "v2.0.0/object-eraser-colorize-arm64-cpu.tar.gz",
"sha256": "252c0b4fc4ca6f807b2b93038a98469323d906d5c4d75df88e9f47497d30e67c",
"compressedSize": 1263259968,
"extractedSize": 1464884023
}
},
"packages": {
"common": ["huggingface-hub"],
"amd64": ["onnxruntime-gpu==1.20.1"],
"arm64": ["onnxruntime==1.20.1", "protobuf>=4.25.3,<5"]
},
"pipFlags": {},
"postInstall": [],
"models": [
{
"id": "lama-onnx",
"downloadFn": "hf_snapshot",
"args": ["Carve/LaMa-ONNX", "lama"],
"file": "lama_fp32.onnx",
"path": "lama/lama_fp32.onnx",
"minSize": 100000000
},
{
"id": "ddcolor-onnx",
"downloadFn": "hf_snapshot",
"args": ["facefusion/models-3.0.0", "ddcolor"],
"file": "ddcolor.onnx",
"path": "ddcolor/ddcolor.onnx",
"minSize": 50000000
},
{
"id": "opencv-colorize-prototxt",
"url": "https://raw.githubusercontent.com/richzhang/colorization/caffe/colorization/models/colorization_deploy_v2.prototxt",
"path": "colorize-opencv/colorization_deploy_v2.prototxt",
"minSize": 0
},
{
"id": "opencv-colorize-caffemodel",
"downloadFn": "hf_snapshot",
"args": ["BilalSardar/Black-N-White-To-Color", "colorize-opencv"],
"file": "colorization_release_v2.caffemodel",
"path": "colorize-opencv/colorization_release_v2.caffemodel",
"minSize": 100000000,
"repoType": "space"
},
{
"id": "opencv-colorize-points",
"url": "https://raw.githubusercontent.com/richzhang/colorization/caffe/colorization/resources/pts_in_hull.npy",
"path": "colorize-opencv/pts_in_hull.npy",
"minSize": 0
}
],
"enablesTools": ["erase-object", "colorize", "ai-canvas-expand"]
},
"upscale-enhance": {
"name": "Upscale & Enhance",
"description": "AI upscaling, face enhancement, and noise removal",
"estimatedSize": "4-5 GB",
"archives": {
"amd64-gpu": {
"file": "v2.0.0/upscale-enhance-amd64-gpu.tar.gz",
"sha256": "b725a0b18a8295cb87e15f79b31c294f1de98101dedd76389728300a8d377a15",
"compressedSize": 5358573124,
"extractedSize": 8406943960
},
"arm64-cpu": {
"file": "v2.0.0/upscale-enhance-arm64-cpu.tar.gz",
"sha256": "bfb25ff1468d426ba6a125632beabece11e1afebfa6a3adefc64f7b81d7bf469",
"compressedSize": 2319501276,
"extractedSize": 3661453942
}
},
"packages": {
"common": ["codeformer-pip==0.0.4", "huggingface-hub", "einops", "setuptools<75"],
"amd64": [
"torch==2.7.0+cu126 torchvision==0.22.0+cu126 --index-url https://download.pytorch.org/whl/cu126",
"lpips",
"basicsr==1.4.2",
"realesrgan==0.3.0",
"mediapipe>=0.10.21"
],
"arm64": [
"torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cpu",
"lpips",
"basicsr==1.4.2",
"realesrgan==0.3.0",
"mediapipe>=0.10.18"
]
},
"pipFlags": {
"codeformer-pip==0.0.4": "--no-deps",
"basicsr==1.4.2": "--no-build-isolation"
},
"postInstall": ["numpy==1.26.4"],
"models": [
{
"id": "realesrgan-x4plus",
"url": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth",
"path": "realesrgan/RealESRGAN_x4plus.pth",
"minSize": 60000000
},
{
"id": "realesrgan-x2plus",
"url": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth",
"path": "realesrgan/RealESRGAN_x2plus.pth",
"minSize": 60000000
},
{
"id": "gfpgan-v1.3",
"url": "https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth",
"path": "gfpgan/GFPGANv1.3.pth",
"minSize": 300000000
},
{
"id": "codeformer-pth",
"url": "https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth",
"path": "codeformer/codeformer.pth",
"minSize": 350000000
},
{
"id": "codeformer-onnx",
"downloadFn": "hf_snapshot",
"args": ["facefusion/models-3.0.0", "codeformer"],
"file": "codeformer.onnx",
"path": "codeformer/codeformer.onnx",
"minSize": 100000000
},
{
"id": "facexlib-detection",
"url": "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth",
"path": "gfpgan/facelib/detection_Resnet50_Final.pth",
"minSize": 100000000
},
{
"id": "facexlib-parsing",
"url": "https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth",
"path": "gfpgan/facelib/parsing_parsenet.pth",
"minSize": 80000000
},
{
"id": "scunet-color-real",
"url": "https://github.com/cszn/KAIR/releases/download/v1.0/scunet_color_real_psnr.pth",
"path": "scunet/scunet_color_real_psnr.pth",
"minSize": 3000000
},
{
"id": "nafnet-sidd",
"downloadFn": "hf_snapshot",
"args": ["mikestealth/nafnet-models", "nafnet"],
"file": "NAFNet-SIDD-width64.pth",
"path": "nafnet/NAFNet-SIDD-width64.pth",
"minSize": 60000000
}
],
"patches": [
{
"file": "basicsr/data/degradations.py",
"search": "from torchvision.transforms.functional_tensor import rgb_to_grayscale",
"replace": "from torchvision.transforms.functional import rgb_to_grayscale"
}
],
"enablesTools": ["upscale", "enhance-faces", "noise-removal"]
},
"photo-restoration": {
"name": "Photo Restoration",
"description": "Restore old or damaged photos",
"estimatedSize": "800 MB - 1 GB",
"archives": {
"amd64-gpu": {
"file": "v2.0.0/photo-restoration-amd64-gpu.tar.gz",
"sha256": "4747953db35c71b83db19ce12cc6c591730f0cb9f64621f239db17ae3e3563fd",
"compressedSize": 4680254837,
"extractedSize": 8172949791
},
"arm64-cpu": {
"file": "v2.0.0/photo-restoration-arm64-cpu.tar.gz",
"sha256": "261a27a176b9f3e76d8cd92576b73a1c014b19e87b4f16e58ed46d17c77697c0",
"compressedSize": 1361837793,
"extractedSize": 2584214411
}
},
"packages": {
"common": ["codeformer-pip==0.0.4", "huggingface-hub", "setuptools<75"],
"amd64": [
"onnxruntime-gpu==1.20.1",
"mediapipe>=0.10.21",
"torch==2.7.0+cu126 torchvision==0.22.0+cu126 --index-url https://download.pytorch.org/whl/cu126",
"lpips",
"basicsr==1.4.2",
"realesrgan==0.3.0"
],
"arm64": [
"torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cpu",
"onnxruntime==1.20.1",
"mediapipe>=0.10.18",
"lpips",
"basicsr==1.4.2",
"realesrgan==0.3.0"
]
},
"pipFlags": {
"codeformer-pip==0.0.4": "--no-deps",
"basicsr==1.4.2": "--no-build-isolation"
},
"postInstall": ["numpy==1.26.4"],
"models": [
{
"id": "lama-onnx",
"downloadFn": "hf_snapshot",
"args": ["Carve/LaMa-ONNX", "lama"],
"file": "lama_fp32.onnx",
"path": "lama/lama_fp32.onnx",
"minSize": 100000000
},
{
"id": "codeformer-onnx",
"downloadFn": "hf_snapshot",
"args": ["facefusion/models-3.0.0", "codeformer"],
"file": "codeformer.onnx",
"path": "codeformer/codeformer.onnx",
"minSize": 100000000
},
{
"id": "realesrgan-x4plus",
"url": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth",
"path": "realesrgan/RealESRGAN_x4plus.pth",
"minSize": 60000000
},
{
"id": "facexlib-detection",
"url": "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth",
"path": "gfpgan/facelib/detection_Resnet50_Final.pth",
"minSize": 100000000
},
{
"id": "facexlib-parsing",
"url": "https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth",
"path": "gfpgan/facelib/parsing_parsenet.pth",
"minSize": 80000000
},
{
"id": "mediapipe-face-detector",
"url": "https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/latest/blaze_face_short_range.tflite",
"path": "mediapipe/blaze_face_short_range.tflite",
"minSize": 100000
},
{
"id": "mediapipe-face-landmarker",
"url": "https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",
"path": "mediapipe/face_landmarker.task",
"minSize": 1000000
},
{
"id": "scunet-color-real",
"url": "https://github.com/cszn/KAIR/releases/download/v1.0/scunet_color_real_psnr.pth",
"path": "scunet/scunet_color_real_psnr.pth",
"minSize": 3000000
}
],
"patches": [
{
"file": "basicsr/data/degradations.py",
"search": "from torchvision.transforms.functional_tensor import rgb_to_grayscale",
"replace": "from torchvision.transforms.functional import rgb_to_grayscale"
}
],
"enablesTools": ["restore-photo"]
},
"ocr": {
"name": "OCR",
"description": "Extract text from images",
"estimatedSize": "3-4 GB",
"archives": {
"amd64-gpu": {
"file": "v2.0.0/ocr-amd64-gpu.tar.gz",
"sha256": "2a00a3184f6a635f1fa9ae2a6517ad740a11f9e5ff58c098d2fd369a2bb1e16b",
"compressedSize": 5933794814,
"extractedSize": 9343914078
},
"arm64-cpu": {
"file": "v2.0.0/ocr-arm64-cpu.tar.gz",
"sha256": "6868c264069dcb74c6675c0b1f58dc1c9f60d9aa4459725e3dbde07a99a6a09a",
"compressedSize": 1984611355,
"extractedSize": 3103671712
}
},
"packages": {
"common": ["huggingface-hub"],
"amd64": [
"paddlepaddle-gpu>=3.2.1 --index-url https://www.paddlepaddle.org.cn/packages/stable/cu126/ --extra-index-url https://pypi.org/simple/",
"paddleocr[doc-parser]>=3.4.0,<3.5.0"
],
"arm64": [
"paddlepaddle>=3.2.1",
"paddleocr[doc-parser]>=3.4.0,<3.5.0",
"protobuf>=4.25.3,<5"
]
},
"pipFlags": {},
"postInstall": [],
"models": [
{
"id": "paddleocr-server-det",
"downloadFn": "hf_snapshot",
"args": ["PaddlePaddle/PP-OCRv5_server_det", "PP-OCRv5_server_det"]
},
{
"id": "paddleocr-server-rec",
"downloadFn": "hf_snapshot",
"args": ["PaddlePaddle/PP-OCRv5_server_rec", "PP-OCRv5_server_rec"]
},
{
"id": "paddleocr-mobile-det",
"downloadFn": "hf_snapshot",
"args": ["PaddlePaddle/PP-OCRv5_mobile_det", "PP-OCRv5_mobile_det"]
},
{
"id": "paddleocr-mobile-rec",
"downloadFn": "hf_snapshot",
"args": ["PaddlePaddle/PP-OCRv5_mobile_rec", "PP-OCRv5_mobile_rec"]
},
{
"id": "paddleocr-latin-rec",
"downloadFn": "hf_snapshot",
"args": ["PaddlePaddle/latin_PP-OCRv5_mobile_rec", "latin_PP-OCRv5_mobile_rec"]
},
{
"id": "paddleocr-korean-rec",
"downloadFn": "hf_snapshot",
"args": ["PaddlePaddle/korean_PP-OCRv5_mobile_rec", "korean_PP-OCRv5_mobile_rec"]
},
{
"id": "paddleocr-textline-ori",
"downloadFn": "hf_snapshot",
"args": ["PaddlePaddle/PP-LCNet_x1_0_textline_ori", "PP-LCNet_x1_0_textline_ori"]
},
{
"id": "paddleocr-vl",
"downloadFn": "hf_snapshot",
"args": ["PaddlePaddle/PaddleOCR-VL-1.5", "PaddleOCR-VL-1.5"]
}
],
"enablesTools": ["ocr", "ocr-pdf"]
},
"transcription": {
"name": "Transcription",
"description": "Speech to text for audio and video (subtitles)",
"estimatedSize": "~600 MB",
"archives": {
"amd64-gpu": {
"file": "v2.0.0/transcription-amd64-gpu.tar.gz",
"sha256": "3033d480c6183df66855d78c355233dbc86a754d07414e544e1df1038337c9e1",
"compressedSize": 559189061,
"extractedSize": 845987840
},
"arm64-cpu": {
"file": "v2.0.0/transcription-arm64-cpu.tar.gz",
"sha256": "07088951300dec14b80f4723a3d5bd968574ce2650259be3fd487e7abb47e120",
"compressedSize": 528491203,
"extractedSize": 741534382
}
},
"packages": {
"common": ["faster-whisper>=1.0.0"],
"amd64": [],
"arm64": ["protobuf>=4.25.3,<5"]
},
"pipFlags": {},
"postInstall": [],
"models": [
{
"id": "faster-whisper-small",
"downloadFn": "hf_snapshot",
"args": ["Systran/faster-whisper-small", "faster-whisper-small"]
}
],
"enablesTools": ["transcribe-audio", "auto-subtitles"]
}
}
}