theus-cli-linux-x64 1.2.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -11
- package/RELEASE.json +6 -6
- package/bin/theus +0 -0
- package/package.json +1 -1
- package/vendor/higiene-motor/PARCHES.md +244 -0
- package/vendor/higiene-motor/audit_dir.py +166 -0
- package/vendor/higiene-motor/audit_lib.py +333 -0
- package/vendor/higiene-motor/audit_website.py +635 -0
- package/vendor/higiene-motor/av_meta.py +498 -0
- package/vendor/higiene-motor/check_staged.py +71 -0
- package/vendor/higiene-motor/clean_ctrlregen.py +212 -0
- package/vendor/higiene-motor/clean_file.py +237 -0
- package/vendor/higiene-motor/clean_image.py +218 -0
- package/vendor/higiene-motor/clean_staged.py +143 -0
- package/vendor/higiene-motor/clean_text.py +108 -0
- package/vendor/higiene-motor/common.py +486 -0
- package/vendor/higiene-motor/container_meta.py +2522 -0
- package/vendor/higiene-motor/detect_gumbel.py +308 -0
- package/vendor/higiene-motor/detect_text_watermark.py +613 -0
- package/vendor/higiene-motor/format_dispatch.py +157 -0
- package/vendor/higiene-motor/hook_written_file.py +253 -0
- package/vendor/higiene-motor/image_meta.py +2171 -0
- package/vendor/higiene-motor/inspect_file.py +138 -0
- package/vendor/higiene-motor/inspect_image.py +72 -0
- package/vendor/higiene-motor/inspect_text.py +86 -0
- package/vendor/higiene-motor/markdiffusion_harness.py +533 -0
- package/vendor/higiene-motor/rewrite_text.py +737 -0
- package/vendor/higiene-motor/score_stylometry.py +460 -0
- package/vendor/higiene-motor/score_synthid.py +165 -0
- package/vendor/higiene-motor/server.py +1059 -0
- package/vendor/higiene-motor/synthid_score_server.py +176 -0
- package/vendor/higiene-motor/text_detectors.py +433 -0
- package/vendor/higiene-motor/text_unicode.py +730 -0
- package/vendor/theus-arsenal/.arsenal-nombres-ola2.json +0 -6
- package/vendor/theus-arsenal/.arsenal-nombres-ola3.json +0 -72
- package/vendor/theus-arsenal/.mailmap +0 -2
- package/vendor/theus-arsenal/.theus-plugin/marketplace.json +0 -25
- package/vendor/theus-arsenal/.theus-plugin/plugin.json +0 -20
- package/vendor/theus-arsenal/AUTHORS.md +0 -8
- package/vendor/theus-arsenal/CLEANROOM_REPLACEMENT_PLAN.md +0 -11
- package/vendor/theus-arsenal/LICENSE +0 -26
- package/vendor/theus-arsenal/PROVENANCE.md +0 -9
- package/vendor/theus-arsenal/README.md +0 -41
- package/vendor/theus-arsenal/THIRD_PARTY.md +0 -80
- package/vendor/theus-arsenal/agents/actualizador-docs.md +0 -123
- package/vendor/theus-arsenal/agents/analista-comentarios.md +0 -53
- package/vendor/theus-arsenal/agents/analista-conversaciones.md +0 -60
- package/vendor/theus-arsenal/agents/analista-tests-pr.md +0 -53
- package/vendor/theus-arsenal/agents/analista-tipos.md +0 -49
- package/vendor/theus-arsenal/agents/arquitecto-accesibilidad.md +0 -148
- package/vendor/theus-arsenal/agents/arquitecto-codigo.md +0 -79
- package/vendor/theus-arsenal/agents/arquitecto-homelab.md +0 -90
- package/vendor/theus-arsenal/agents/arquitecto-redes.md +0 -116
- package/vendor/theus-arsenal/agents/arquitecto-sistemas.md +0 -219
- package/vendor/theus-arsenal/agents/bifurcador-opensource.md +0 -206
- package/vendor/theus-arsenal/agents/cazador-fallos-silenciosos.md +0 -58
- package/vendor/theus-arsenal/agents/consultor-documentacion.md +0 -76
- package/vendor/theus-arsenal/agents/diagnosticador-redes.md +0 -135
- package/vendor/theus-arsenal/agents/ejecutor-e2e.md +0 -96
- package/vendor/theus-arsenal/agents/empaquetador-opensource.md +0 -257
- package/vendor/theus-arsenal/agents/escaner-secretos.md +0 -196
- package/vendor/theus-arsenal/agents/especialista-seo.md +0 -70
- package/vendor/theus-arsenal/agents/estratega-marketing.md +0 -158
- package/vendor/theus-arsenal/agents/evaluador-agentes.md +0 -214
- package/vendor/theus-arsenal/agents/evaluador-harness.md +0 -217
- package/vendor/theus-arsenal/agents/explorador-codigo.md +0 -79
- package/vendor/theus-arsenal/agents/extractor-specs.md +0 -214
- package/vendor/theus-arsenal/agents/generador-harness.md +0 -139
- package/vendor/theus-arsenal/agents/guia-tdd.md +0 -99
- package/vendor/theus-arsenal/agents/jefe-de-gabinete.md +0 -162
- package/vendor/theus-arsenal/agents/limpiador-refactors.md +0 -93
- package/vendor/theus-arsenal/agents/optimizador-rendimiento.md +0 -454
- package/vendor/theus-arsenal/agents/planificador-harness.md +0 -107
- package/vendor/theus-arsenal/agents/planificador.md +0 -221
- package/vendor/theus-arsenal/agents/resolutor-apps-harmonyos.md +0 -181
- package/vendor/theus-arsenal/agents/resolutor-builds-cpp.md +0 -98
- package/vendor/theus-arsenal/agents/resolutor-builds-dart.md +0 -209
- package/vendor/theus-arsenal/agents/resolutor-builds-django.md +0 -253
- package/vendor/theus-arsenal/agents/resolutor-builds-go.md +0 -102
- package/vendor/theus-arsenal/agents/resolutor-builds-java.md +0 -274
- package/vendor/theus-arsenal/agents/resolutor-builds-kotlin.md +0 -128
- package/vendor/theus-arsenal/agents/resolutor-builds-pytorch.md +0 -128
- package/vendor/theus-arsenal/agents/resolutor-builds-react.md +0 -214
- package/vendor/theus-arsenal/agents/resolutor-builds-rust.md +0 -156
- package/vendor/theus-arsenal/agents/resolutor-builds-swift.md +0 -169
- package/vendor/theus-arsenal/agents/resolutor-builds.md +0 -122
- package/vendor/theus-arsenal/agents/revisor-bd.md +0 -97
- package/vendor/theus-arsenal/agents/revisor-codigo.md +0 -291
- package/vendor/theus-arsenal/agents/revisor-config-red.md +0 -116
- package/vendor/theus-arsenal/agents/revisor-cpp.md +0 -80
- package/vendor/theus-arsenal/agents/revisor-csharp.md +0 -109
- package/vendor/theus-arsenal/agents/revisor-django.md +0 -168
- package/vendor/theus-arsenal/agents/revisor-fastapi.md +0 -82
- package/vendor/theus-arsenal/agents/revisor-flutter.md +0 -251
- package/vendor/theus-arsenal/agents/revisor-go.md +0 -84
- package/vendor/theus-arsenal/agents/revisor-java.md +0 -192
- package/vendor/theus-arsenal/agents/revisor-kotlin.md +0 -171
- package/vendor/theus-arsenal/agents/revisor-ml.md +0 -159
- package/vendor/theus-arsenal/agents/revisor-php.md +0 -108
- package/vendor/theus-arsenal/agents/revisor-python.md +0 -106
- package/vendor/theus-arsenal/agents/revisor-react.md +0 -166
- package/vendor/theus-arsenal/agents/revisor-rust.md +0 -102
- package/vendor/theus-arsenal/agents/revisor-seguridad.md +0 -116
- package/vendor/theus-arsenal/agents/revisor-software-clinico.md +0 -95
- package/vendor/theus-arsenal/agents/revisor-swift.md +0 -115
- package/vendor/theus-arsenal/agents/revisor-typescript.md +0 -123
- package/vendor/theus-arsenal/agents/revisor-vue.md +0 -205
- package/vendor/theus-arsenal/agents/simplificador-codigo.md +0 -55
- package/vendor/theus-arsenal/commands/actualizar-docs.md +0 -88
- package/vendor/theus-arsenal/commands/actualizar-mapas-codigo.md +0 -78
- package/vendor/theus-arsenal/commands/aprender-evaluar.md +0 -109
- package/vendor/theus-arsenal/commands/aprender.md +0 -74
- package/vendor/theus-arsenal/commands/arreglar-build.md +0 -66
- package/vendor/theus-arsenal/commands/bucle-multiperspectiva.md +0 -153
- package/vendor/theus-arsenal/commands/build-cpp.md +0 -173
- package/vendor/theus-arsenal/commands/build-flutter.md +0 -164
- package/vendor/theus-arsenal/commands/build-go.md +0 -183
- package/vendor/theus-arsenal/commands/build-gradle.md +0 -75
- package/vendor/theus-arsenal/commands/build-kotlin.md +0 -176
- package/vendor/theus-arsenal/commands/build-react.md +0 -187
- package/vendor/theus-arsenal/commands/build-rust.md +0 -187
- package/vendor/theus-arsenal/commands/campana-marketing.md +0 -125
- package/vendor/theus-arsenal/commands/checkpoint.md +0 -78
- package/vendor/theus-arsenal/commands/cobertura-tests.md +0 -73
- package/vendor/theus-arsenal/commands/configurar-gestor-paquetes.md +0 -86
- package/vendor/theus-arsenal/commands/consulta.md +0 -164
- package/vendor/theus-arsenal/commands/control-calidad.md +0 -50
- package/vendor/theus-arsenal/commands/crear-skill.md +0 -77
- package/vendor/theus-arsenal/commands/enrutar-modelo.md +0 -30
- package/vendor/theus-arsenal/commands/epica-desbloquear.md +0 -17
- package/vendor/theus-arsenal/commands/epica-descomponer.md +0 -22
- package/vendor/theus-arsenal/commands/epica-publicar.md +0 -21
- package/vendor/theus-arsenal/commands/epica-reclamar.md +0 -25
- package/vendor/theus-arsenal/commands/epica-revisar.md +0 -22
- package/vendor/theus-arsenal/commands/epica-sincronizar.md +0 -21
- package/vendor/theus-arsenal/commands/epica-validar.md +0 -21
- package/vendor/theus-arsenal/commands/evolucionar.md +0 -176
- package/vendor/theus-arsenal/commands/funcionalidad.md +0 -49
- package/vendor/theus-arsenal/commands/guardar-sesion.md +0 -278
- package/vendor/theus-arsenal/commands/harness-build.md +0 -111
- package/vendor/theus-arsenal/commands/harness-diseno.md +0 -46
- package/vendor/theus-arsenal/commands/informe-costos.md +0 -90
- package/vendor/theus-arsenal/commands/iniciar-bucle.md +0 -36
- package/vendor/theus-arsenal/commands/instintos-estado.md +0 -53
- package/vendor/theus-arsenal/commands/instintos-exportar.md +0 -69
- package/vendor/theus-arsenal/commands/instintos-importar.md +0 -120
- package/vendor/theus-arsenal/commands/lienzo-planes.md +0 -48
- package/vendor/theus-arsenal/commands/limpiar-refactor.md +0 -84
- package/vendor/theus-arsenal/commands/modo-seguro.md +0 -96
- package/vendor/theus-arsenal/commands/orq-agregar-funcionalidad.md +0 -36
- package/vendor/theus-arsenal/commands/orq-cambiar-funcionalidad.md +0 -38
- package/vendor/theus-arsenal/commands/orq-construir-mvp.md +0 -36
- package/vendor/theus-arsenal/commands/orq-corregir-defecto.md +0 -40
- package/vendor/theus-arsenal/commands/orq-refinar-codigo.md +0 -44
- package/vendor/theus-arsenal/commands/orq-revisar.md +0 -135
- package/vendor/theus-arsenal/commands/plan-prd.md +0 -160
- package/vendor/theus-arsenal/commands/plan.md +0 -198
- package/vendor/theus-arsenal/commands/podar.md +0 -31
- package/vendor/theus-arsenal/commands/pr.md +0 -181
- package/vendor/theus-arsenal/commands/promover.md +0 -41
- package/vendor/theus-arsenal/commands/proyectos.md +0 -33
- package/vendor/theus-arsenal/commands/prp-commit.md +0 -112
- package/vendor/theus-arsenal/commands/prp-implementar.md +0 -385
- package/vendor/theus-arsenal/commands/prp-planificar.md +0 -501
- package/vendor/theus-arsenal/commands/reanudar-sesion.md +0 -160
- package/vendor/theus-arsenal/commands/revisar-codigo.md +0 -289
- package/vendor/theus-arsenal/commands/revisar-cpp.md +0 -132
- package/vendor/theus-arsenal/commands/revisar-fastapi.md +0 -39
- package/vendor/theus-arsenal/commands/revisar-flutter.md +0 -115
- package/vendor/theus-arsenal/commands/revisar-go.md +0 -148
- package/vendor/theus-arsenal/commands/revisar-kotlin.md +0 -140
- package/vendor/theus-arsenal/commands/revisar-pr.md +0 -37
- package/vendor/theus-arsenal/commands/revisar-python.md +0 -297
- package/vendor/theus-arsenal/commands/revisar-react.md +0 -170
- package/vendor/theus-arsenal/commands/revisar-rust.md +0 -142
- package/vendor/theus-arsenal/commands/revisar-vue.md +0 -174
- package/vendor/theus-arsenal/commands/salud-skills.md +0 -52
- package/vendor/theus-arsenal/commands/sesiones.md +0 -345
- package/vendor/theus-arsenal/commands/test-cpp.md +0 -252
- package/vendor/theus-arsenal/commands/test-flutter.md +0 -143
- package/vendor/theus-arsenal/commands/test-go.md +0 -268
- package/vendor/theus-arsenal/commands/test-kotlin.md +0 -312
- package/vendor/theus-arsenal/commands/test-react.md +0 -265
- package/vendor/theus-arsenal/commands/test-rust.md +0 -309
- package/vendor/theus-arsenal/commands/vigilancia-canary.md +0 -43
- package/vendor/theus-arsenal/hooks/hooks.json +0 -274
- package/vendor/theus-arsenal/package.json +0 -6
- package/vendor/theus-arsenal/rules/angular/coding-style.md +0 -182
- package/vendor/theus-arsenal/rules/angular/hooks.md +0 -25
- package/vendor/theus-arsenal/rules/angular/patterns.md +0 -249
- package/vendor/theus-arsenal/rules/angular/security.md +0 -87
- package/vendor/theus-arsenal/rules/angular/testing.md +0 -164
- package/vendor/theus-arsenal/rules/arkts/coding-style.md +0 -153
- package/vendor/theus-arsenal/rules/arkts/hooks.md +0 -80
- package/vendor/theus-arsenal/rules/arkts/patterns.md +0 -236
- package/vendor/theus-arsenal/rules/arkts/security.md +0 -141
- package/vendor/theus-arsenal/rules/arkts/testing.md +0 -126
- package/vendor/theus-arsenal/rules/common/agents.md +0 -49
- package/vendor/theus-arsenal/rules/common/code-review.md +0 -123
- package/vendor/theus-arsenal/rules/common/coding-style.md +0 -90
- package/vendor/theus-arsenal/rules/common/development-workflow.md +0 -44
- package/vendor/theus-arsenal/rules/common/git-workflow.md +0 -24
- package/vendor/theus-arsenal/rules/common/hooks.md +0 -32
- package/vendor/theus-arsenal/rules/common/patterns.md +0 -31
- package/vendor/theus-arsenal/rules/common/performance.md +0 -53
- package/vendor/theus-arsenal/rules/common/security.md +0 -29
- package/vendor/theus-arsenal/rules/common/testing.md +0 -57
- package/vendor/theus-arsenal/rules/cpp/coding-style.md +0 -44
- package/vendor/theus-arsenal/rules/cpp/hooks.md +0 -39
- package/vendor/theus-arsenal/rules/cpp/patterns.md +0 -51
- package/vendor/theus-arsenal/rules/cpp/security.md +0 -51
- package/vendor/theus-arsenal/rules/cpp/testing.md +0 -44
- package/vendor/theus-arsenal/rules/csharp/coding-style.md +0 -72
- package/vendor/theus-arsenal/rules/csharp/hooks.md +0 -25
- package/vendor/theus-arsenal/rules/csharp/patterns.md +0 -50
- package/vendor/theus-arsenal/rules/csharp/security.md +0 -58
- package/vendor/theus-arsenal/rules/csharp/testing.md +0 -50
- package/vendor/theus-arsenal/rules/dart/coding-style.md +0 -159
- package/vendor/theus-arsenal/rules/dart/hooks.md +0 -68
- package/vendor/theus-arsenal/rules/dart/patterns.md +0 -261
- package/vendor/theus-arsenal/rules/dart/security.md +0 -135
- package/vendor/theus-arsenal/rules/dart/testing.md +0 -215
- package/vendor/theus-arsenal/rules/fsharp/coding-style.md +0 -112
- package/vendor/theus-arsenal/rules/fsharp/hooks.md +0 -26
- package/vendor/theus-arsenal/rules/fsharp/patterns.md +0 -111
- package/vendor/theus-arsenal/rules/fsharp/security.md +0 -76
- package/vendor/theus-arsenal/rules/fsharp/testing.md +0 -62
- package/vendor/theus-arsenal/rules/golang/coding-style.md +0 -32
- package/vendor/theus-arsenal/rules/golang/hooks.md +0 -17
- package/vendor/theus-arsenal/rules/golang/patterns.md +0 -45
- package/vendor/theus-arsenal/rules/golang/security.md +0 -34
- package/vendor/theus-arsenal/rules/golang/testing.md +0 -31
- package/vendor/theus-arsenal/rules/java/coding-style.md +0 -114
- package/vendor/theus-arsenal/rules/java/hooks.md +0 -18
- package/vendor/theus-arsenal/rules/java/patterns.md +0 -147
- package/vendor/theus-arsenal/rules/java/security.md +0 -101
- package/vendor/theus-arsenal/rules/java/testing.md +0 -133
- package/vendor/theus-arsenal/rules/kotlin/coding-style.md +0 -86
- package/vendor/theus-arsenal/rules/kotlin/hooks.md +0 -17
- package/vendor/theus-arsenal/rules/kotlin/patterns.md +0 -146
- package/vendor/theus-arsenal/rules/kotlin/security.md +0 -82
- package/vendor/theus-arsenal/rules/kotlin/testing.md +0 -128
- package/vendor/theus-arsenal/rules/nuxt/coding-style.md +0 -47
- package/vendor/theus-arsenal/rules/nuxt/hooks.md +0 -39
- package/vendor/theus-arsenal/rules/nuxt/patterns.md +0 -54
- package/vendor/theus-arsenal/rules/nuxt/security.md +0 -48
- package/vendor/theus-arsenal/rules/nuxt/testing.md +0 -49
- package/vendor/theus-arsenal/rules/php/coding-style.md +0 -40
- package/vendor/theus-arsenal/rules/php/hooks.md +0 -24
- package/vendor/theus-arsenal/rules/php/patterns.md +0 -33
- package/vendor/theus-arsenal/rules/php/security.md +0 -37
- package/vendor/theus-arsenal/rules/php/testing.md +0 -38
- package/vendor/theus-arsenal/rules/python/coding-style.md +0 -42
- package/vendor/theus-arsenal/rules/python/fastapi.md +0 -58
- package/vendor/theus-arsenal/rules/python/hooks.md +0 -19
- package/vendor/theus-arsenal/rules/python/patterns.md +0 -39
- package/vendor/theus-arsenal/rules/python/security.md +0 -30
- package/vendor/theus-arsenal/rules/python/testing.md +0 -38
- package/vendor/theus-arsenal/rules/react/coding-style.md +0 -109
- package/vendor/theus-arsenal/rules/react/hooks.md +0 -187
- package/vendor/theus-arsenal/rules/react/patterns.md +0 -194
- package/vendor/theus-arsenal/rules/react/security.md +0 -180
- package/vendor/theus-arsenal/rules/react/testing.md +0 -208
- package/vendor/theus-arsenal/rules/react-native/accessibility.md +0 -55
- package/vendor/theus-arsenal/rules/react-native/coding-style.md +0 -71
- package/vendor/theus-arsenal/rules/react-native/hooks.md +0 -28
- package/vendor/theus-arsenal/rules/react-native/patterns.md +0 -88
- package/vendor/theus-arsenal/rules/react-native/performance.md +0 -45
- package/vendor/theus-arsenal/rules/react-native/production-readiness.md +0 -51
- package/vendor/theus-arsenal/rules/react-native/security.md +0 -43
- package/vendor/theus-arsenal/rules/react-native/testing.md +0 -52
- package/vendor/theus-arsenal/rules/ruby/coding-style.md +0 -46
- package/vendor/theus-arsenal/rules/ruby/hooks.md +0 -37
- package/vendor/theus-arsenal/rules/ruby/patterns.md +0 -44
- package/vendor/theus-arsenal/rules/ruby/security.md +0 -51
- package/vendor/theus-arsenal/rules/ruby/testing.md +0 -51
- package/vendor/theus-arsenal/rules/rust/coding-style.md +0 -151
- package/vendor/theus-arsenal/rules/rust/hooks.md +0 -16
- package/vendor/theus-arsenal/rules/rust/patterns.md +0 -168
- package/vendor/theus-arsenal/rules/rust/security.md +0 -141
- package/vendor/theus-arsenal/rules/rust/testing.md +0 -154
- package/vendor/theus-arsenal/rules/swift/coding-style.md +0 -47
- package/vendor/theus-arsenal/rules/swift/hooks.md +0 -20
- package/vendor/theus-arsenal/rules/swift/patterns.md +0 -66
- package/vendor/theus-arsenal/rules/swift/security.md +0 -33
- package/vendor/theus-arsenal/rules/swift/testing.md +0 -45
- package/vendor/theus-arsenal/rules/typescript/coding-style.md +0 -199
- package/vendor/theus-arsenal/rules/typescript/hooks.md +0 -22
- package/vendor/theus-arsenal/rules/typescript/patterns.md +0 -52
- package/vendor/theus-arsenal/rules/typescript/security.md +0 -28
- package/vendor/theus-arsenal/rules/typescript/testing.md +0 -18
- package/vendor/theus-arsenal/rules/vue/coding-style.md +0 -54
- package/vendor/theus-arsenal/rules/vue/hooks.md +0 -45
- package/vendor/theus-arsenal/rules/vue/patterns.md +0 -56
- package/vendor/theus-arsenal/rules/vue/security.md +0 -46
- package/vendor/theus-arsenal/rules/vue/testing.md +0 -53
- package/vendor/theus-arsenal/rules/web/coding-style.md +0 -108
- package/vendor/theus-arsenal/rules/web/design-quality.md +0 -75
- package/vendor/theus-arsenal/rules/web/hooks.md +0 -141
- package/vendor/theus-arsenal/rules/web/patterns.md +0 -91
- package/vendor/theus-arsenal/rules/web/performance.md +0 -76
- package/vendor/theus-arsenal/rules/web/security.md +0 -69
- package/vendor/theus-arsenal/rules/web/testing.md +0 -67
- package/vendor/theus-arsenal/scripts/hooks/bash-hook-dispatcher.js +0 -192
- package/vendor/theus-arsenal/scripts/hooks/block-no-verify.js +0 -556
- package/vendor/theus-arsenal/scripts/hooks/check-console-log.js +0 -92
- package/vendor/theus-arsenal/scripts/hooks/check-hook-enabled.js +0 -16
- package/vendor/theus-arsenal/scripts/hooks/config-protection.js +0 -171
- package/vendor/theus-arsenal/scripts/hooks/design-quality-check.js +0 -132
- package/vendor/theus-arsenal/scripts/hooks/doc-file-warning.js +0 -110
- package/vendor/theus-arsenal/scripts/hooks/modo-seguro.js +0 -158
- package/vendor/theus-arsenal/scripts/hooks/notificacion-escritorio.js +0 -208
- package/vendor/theus-arsenal/scripts/hooks/plugin-hook-bootstrap.js +0 -280
- package/vendor/theus-arsenal/scripts/hooks/post-bash-command-log.js +0 -87
- package/vendor/theus-arsenal/scripts/hooks/post-bash-dispatcher.js +0 -24
- package/vendor/theus-arsenal/scripts/hooks/post-bash-pr-created.js +0 -60
- package/vendor/theus-arsenal/scripts/hooks/post-edit-accumulator.js +0 -94
- package/vendor/theus-arsenal/scripts/hooks/post-edit-console-warn.js +0 -54
- package/vendor/theus-arsenal/scripts/hooks/post-edit-format.js +0 -110
- package/vendor/theus-arsenal/scripts/hooks/post-edit-typecheck.js +0 -98
- package/vendor/theus-arsenal/scripts/hooks/pre-bash-commit-quality.js +0 -447
- package/vendor/theus-arsenal/scripts/hooks/pre-bash-dev-server-block.js +0 -232
- package/vendor/theus-arsenal/scripts/hooks/pre-bash-dispatcher.js +0 -27
- package/vendor/theus-arsenal/scripts/hooks/pre-compact.js +0 -101
- package/vendor/theus-arsenal/scripts/hooks/pretooluse-visible-output.js +0 -49
- package/vendor/theus-arsenal/scripts/hooks/quality-gate.js +0 -168
- package/vendor/theus-arsenal/scripts/hooks/run-with-flags.js +0 -271
- package/vendor/theus-arsenal/scripts/hooks/salud-mcp.js +0 -749
- package/vendor/theus-arsenal/scripts/hooks/seguimiento-costos.js +0 -161
- package/vendor/theus-arsenal/scripts/hooks/session-end.js +0 -340
- package/vendor/theus-arsenal/scripts/hooks/session-start.js +0 -906
- package/vendor/theus-arsenal/scripts/hooks/stop-format-typecheck.js +0 -263
- package/vendor/theus-arsenal/scripts/hooks/suggest-compact.js +0 -286
- package/vendor/theus-arsenal/scripts/hooks/theus-context-monitor.js +0 -289
- package/vendor/theus-arsenal/scripts/hooks/verificacion-factual.js +0 -1278
- package/vendor/theus-arsenal/scripts/lib/agent-data-home.js +0 -96
- package/vendor/theus-arsenal/scripts/lib/cost-estimate.js +0 -66
- package/vendor/theus-arsenal/scripts/lib/hook-flags.js +0 -79
- package/vendor/theus-arsenal/scripts/lib/llm-summary.js +0 -185
- package/vendor/theus-arsenal/scripts/lib/loopback-guard.js +0 -54
- package/vendor/theus-arsenal/scripts/lib/observer-sessions.js +0 -237
- package/vendor/theus-arsenal/scripts/lib/package-manager.d.ts +0 -120
- package/vendor/theus-arsenal/scripts/lib/package-manager.js +0 -434
- package/vendor/theus-arsenal/scripts/lib/path-safety.js +0 -86
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/markdown.js +0 -285
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/sdk.js +0 -238
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/server.js +0 -534
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/sessions.js +0 -274
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/ui.js +0 -546
- package/vendor/theus-arsenal/scripts/lib/project-detect.js +0 -451
- package/vendor/theus-arsenal/scripts/lib/resolve-formatter.js +0 -193
- package/vendor/theus-arsenal/scripts/lib/resolve-theus-root.js +0 -101
- package/vendor/theus-arsenal/scripts/lib/session-aliases.d.ts +0 -138
- package/vendor/theus-arsenal/scripts/lib/session-aliases.js +0 -483
- package/vendor/theus-arsenal/scripts/lib/session-bridge.js +0 -155
- package/vendor/theus-arsenal/scripts/lib/session-manager.d.ts +0 -137
- package/vendor/theus-arsenal/scripts/lib/session-manager.js +0 -555
- package/vendor/theus-arsenal/scripts/lib/shell-split.js +0 -86
- package/vendor/theus-arsenal/scripts/lib/shell-substitution.js +0 -501
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/dashboard.js +0 -414
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/health.js +0 -285
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/index.js +0 -22
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/provenance.js +0 -200
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/tracker.js +0 -157
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/versioning.js +0 -246
- package/vendor/theus-arsenal/scripts/lib/transcript-context.js +0 -232
- package/vendor/theus-arsenal/scripts/lib/utils.d.ts +0 -205
- package/vendor/theus-arsenal/scripts/lib/utils.js +0 -658
- package/vendor/theus-arsenal/scripts/plan-canvas.js +0 -341
- package/vendor/theus-arsenal/scripts/setup-package-manager.js +0 -46
- package/vendor/theus-arsenal/scripts/skills-health.js +0 -143
- package/vendor/theus-arsenal/skills/a11y-frontend/SKILL.md +0 -444
- package/vendor/theus-arsenal/skills/accesibilidad/SKILL.md +0 -144
- package/vendor/theus-arsenal/skills/acelerador-throughput-datos/SKILL.md +0 -72
- package/vendor/theus-arsenal/skills/agente-scraper-datos/SKILL.md +0 -771
- package/vendor/theus-arsenal/skills/analisis-plataformas-competencia/SKILL.md +0 -137
- package/vendor/theus-arsenal/skills/api-x/SKILL.md +0 -233
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/SKILL.md +0 -335
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/observer-loop.sh +0 -374
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/observer.md +0 -188
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/session-guardian.sh +0 -153
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/start-observer.sh +0 -253
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/config.json +0 -8
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/hooks/observe.sh +0 -594
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/detect-project.sh +0 -325
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/instinct-cli.py +0 -1918
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/lib/arsenal-dir.sh +0 -23
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/test_parse_instinct.py +0 -1420
- package/vendor/theus-arsenal/skills/arquitectura-hexagonal/SKILL.md +0 -275
- package/vendor/theus-arsenal/skills/arquitectura-limpia-android/SKILL.md +0 -340
- package/vendor/theus-arsenal/skills/arquitectura-pipelines-recomendacion/SKILL.md +0 -112
- package/vendor/theus-arsenal/skills/atlas-datos-prediccion/SKILL.md +0 -53
- package/vendor/theus-arsenal/skills/auditoria-arquitectura-agentes/SKILL.md +0 -257
- package/vendor/theus-arsenal/skills/auditoria-produccion/SKILL.md +0 -180
- package/vendor/theus-arsenal/skills/auditoria-rutas-clic/SKILL.md +0 -243
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/SKILL.md +0 -180
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/examples/high-score-example.md +0 -89
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/examples/low-score-example.md +0 -87
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/references/evaluation-criteria.md +0 -71
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/references/hook-integration.md +0 -90
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/scripts/evaluate.py +0 -409
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/templates/evaluation-report.md +0 -86
- package/vendor/theus-arsenal/skills/automatizacion-ssh-netmiko/SKILL.md +0 -176
- package/vendor/theus-arsenal/skills/base-datos-pubmed/SKILL.md +0 -174
- package/vendor/theus-arsenal/skills/base-datos-uspto/SKILL.md +0 -173
- package/vendor/theus-arsenal/skills/benchmark/SKILL.md +0 -92
- package/vendor/theus-arsenal/skills/bitacora-crecimiento/SKILL.md +0 -120
- package/vendor/theus-arsenal/skills/bucle-verificacion/SKILL.md +0 -125
- package/vendor/theus-arsenal/skills/buscar-primero/SKILL.md +0 -184
- package/vendor/theus-arsenal/skills/busqueda-exa/SKILL.md +0 -111
- package/vendor/theus-arsenal/skills/cache-por-hash/SKILL.md +0 -160
- package/vendor/theus-arsenal/skills/campana-marketing/SKILL.md +0 -118
- package/vendor/theus-arsenal/skills/capacidad-producto/SKILL.md +0 -138
- package/vendor/theus-arsenal/skills/cazador-vulnerabilidades/SKILL.md +0 -104
- package/vendor/theus-arsenal/skills/compactacion-estrategica/SKILL.md +0 -115
- package/vendor/theus-arsenal/skills/comparador-baskets-prediccion/SKILL.md +0 -69
- package/vendor/theus-arsenal/skills/compras-energia/SKILL.md +0 -206
- package/vendor/theus-arsenal/skills/concurrencia-swift-6-2/SKILL.md +0 -224
- package/vendor/theus-arsenal/skills/consejo/SKILL.md +0 -201
- package/vendor/theus-arsenal/skills/construccion-harness-agentes/SKILL.md +0 -78
- package/vendor/theus-arsenal/skills/constructor-conectores/SKILL.md +0 -119
- package/vendor/theus-arsenal/skills/constructor-equipos/SKILL.md +0 -169
- package/vendor/theus-arsenal/skills/consulta-documentacion/SKILL.md +0 -92
- package/vendor/theus-arsenal/skills/consultas-genomicas-gget/SKILL.md +0 -170
- package/vendor/theus-arsenal/skills/contacto-inversores/SKILL.md +0 -95
- package/vendor/theus-arsenal/skills/corrutinas-flows-kotlin/SKILL.md +0 -284
- package/vendor/theus-arsenal/skills/creacion-video-remotion/SKILL.md +0 -46
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/3d.md +0 -86
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/animations.md +0 -29
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets/charts-bar-chart.tsx +0 -173
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets/text-animations-typewriter.tsx +0 -100
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets/text-animations-word-highlight.tsx +0 -108
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets.md +0 -78
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/audio.md +0 -172
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/calculate-metadata.md +0 -104
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/can-decode.md +0 -75
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/charts.md +0 -58
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/compositions.md +0 -146
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/display-captions.md +0 -126
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/extract-frames.md +0 -229
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/fonts.md +0 -152
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/get-audio-duration.md +0 -58
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/get-video-dimensions.md +0 -68
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/get-video-duration.md +0 -58
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/gifs.md +0 -138
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/images.md +0 -130
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/import-srt-captions.md +0 -67
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/lottie.md +0 -67
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/measuring-dom-nodes.md +0 -34
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/measuring-text.md +0 -143
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/sequencing.md +0 -106
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/tailwind.md +0 -11
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/text-animations.md +0 -20
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/timing.md +0 -179
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/transcribe-captions.md +0 -19
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/transitions.md +0 -122
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/trimming.md +0 -52
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/videos.md +0 -171
- package/vendor/theus-arsenal/skills/cumplimiento-aduanero/SKILL.md +0 -270
- package/vendor/theus-arsenal/skills/cumplimiento-hipaa/SKILL.md +0 -78
- package/vendor/theus-arsenal/skills/datos-sensibles-salud/SKILL.md +0 -149
- package/vendor/theus-arsenal/skills/decimales-tokens-evm/SKILL.md +0 -128
- package/vendor/theus-arsenal/skills/decisiones-arquitectura/SKILL.md +0 -206
- package/vendor/theus-arsenal/skills/demos-ui/SKILL.md +0 -469
- package/vendor/theus-arsenal/skills/desarrollo-por-intencion/SKILL.md +0 -369
- package/vendor/theus-arsenal/skills/descubrimiento-marca/SKILL.md +0 -149
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/10_proposito-porque.md +0 -42
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/20_posicionamiento.md +0 -47
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/30_audiencia-nicho.md +0 -53
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/40_personalidad-arquetipo.md +0 -61
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/50_voz-tono.md +0 -62
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/60_narrativa-historia.md +0 -54
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/70_tension-fundador.md +0 -50
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/90_SINTESIS.md +0 -133
- package/vendor/theus-arsenal/skills/descubrimiento-plugins-laravel/SKILL.md +0 -230
- package/vendor/theus-arsenal/skills/destilado-reglas/SKILL.md +0 -263
- package/vendor/theus-arsenal/skills/destilado-reglas/scripts/scan-rules.sh +0 -58
- package/vendor/theus-arsenal/skills/destilado-reglas/scripts/scan-skills.sh +0 -129
- package/vendor/theus-arsenal/skills/diagnostico-bgp/SKILL.md +0 -170
- package/vendor/theus-arsenal/skills/direccion-estetica/SKILL.md +0 -220
- package/vendor/theus-arsenal/skills/direccion-estetica/references/taxonomia-generos.md +0 -89
- package/vendor/theus-arsenal/skills/diseno-api/SKILL.md +0 -522
- package/vendor/theus-arsenal/skills/diseno-liquid-glass/SKILL.md +0 -282
- package/vendor/theus-arsenal/skills/e2e-escritorio-windows/SKILL.md +0 -879
- package/vendor/theus-arsenal/skills/edicion-video/SKILL.md +0 -289
- package/vendor/theus-arsenal/skills/enfoque-producto/SKILL.md +0 -91
- package/vendor/theus-arsenal/skills/entornos-flox/SKILL.md +0 -493
- package/vendor/theus-arsenal/skills/estandares-codigo/SKILL.md +0 -548
- package/vendor/theus-arsenal/skills/estandares-cpp/SKILL.md +0 -727
- package/vendor/theus-arsenal/skills/estandares-java/SKILL.md +0 -389
- package/vendor/theus-arsenal/skills/estilo-legado/SKILL.md +0 -149
- package/vendor/theus-arsenal/skills/estructura-informes-competencia/SKILL.md +0 -95
- package/vendor/theus-arsenal/skills/evaluacion-academica/SKILL.md +0 -165
- package/vendor/theus-arsenal/skills/explorador-skills/SKILL.md +0 -129
- package/vendor/theus-arsenal/skills/flujo-git/SKILL.md +0 -714
- package/vendor/theus-arsenal/skills/flujo-ingenieria-ml/SKILL.md +0 -343
- package/vendor/theus-arsenal/skills/flujo-tdd/SKILL.md +0 -584
- package/vendor/theus-arsenal/skills/forja-personas/SKILL.md +0 -298
- package/vendor/theus-arsenal/skills/forja-personas/gacha.py +0 -224
- package/vendor/theus-arsenal/skills/forja-personas/gacha.sh +0 -5
- package/vendor/theus-arsenal/skills/forja-personas/references/avatar-style.md +0 -123
- package/vendor/theus-arsenal/skills/forja-personas/references/boundary-rules.md +0 -53
- package/vendor/theus-arsenal/skills/forja-personas/references/error-handling.md +0 -53
- package/vendor/theus-arsenal/skills/forja-personas/references/identity-tension.md +0 -48
- package/vendor/theus-arsenal/skills/forja-personas/references/naming-system.md +0 -39
- package/vendor/theus-arsenal/skills/forja-personas/references/output-template.md +0 -166
- package/vendor/theus-arsenal/skills/fundamentos-animacion/SKILL.md +0 -296
- package/vendor/theus-arsenal/skills/generacion-iconos-ios/SKILL.md +0 -156
- package/vendor/theus-arsenal/skills/generacion-iconos-ios/scripts/generate_icons.swift +0 -258
- package/vendor/theus-arsenal/skills/generacion-iconos-ios/scripts/iconify_gen.sh +0 -235
- package/vendor/theus-arsenal/skills/gestion-excepciones-logisticas/SKILL.md +0 -208
- package/vendor/theus-arsenal/skills/gestion-transportistas/SKILL.md +0 -204
- package/vendor/theus-arsenal/skills/guia-adopcion-ml/SKILL.md +0 -64
- package/vendor/theus-arsenal/skills/harness-agente-autonomo/SKILL.md +0 -252
- package/vendor/theus-arsenal/skills/harness-eval-clinico/SKILL.md +0 -212
- package/vendor/theus-arsenal/skills/harness-evaluacion/SKILL.md +0 -296
- package/vendor/theus-arsenal/skills/harness-generador-evaluador/SKILL.md +0 -254
- package/vendor/theus-arsenal/skills/homelab-diseno-red/SKILL.md +0 -120
- package/vendor/theus-arsenal/skills/homelab-dns-pihole/SKILL.md +0 -264
- package/vendor/theus-arsenal/skills/homelab-preparacion-red/SKILL.md +0 -144
- package/vendor/theus-arsenal/skills/homelab-segmentacion-vlan/SKILL.md +0 -307
- package/vendor/theus-arsenal/skills/homelab-vpn-wireguard/SKILL.md +0 -299
- package/vendor/theus-arsenal/skills/ingenieria-agentica/SKILL.md +0 -96
- package/vendor/theus-arsenal/skills/inspeccion-animaciones-blender/SKILL.md +0 -164
- package/vendor/theus-arsenal/skills/instaladores-python/SKILL.md +0 -820
- package/vendor/theus-arsenal/skills/integracion-jira/SKILL.md +0 -307
- package/vendor/theus-arsenal/skills/inteligencia-leads/SKILL.md +0 -312
- package/vendor/theus-arsenal/skills/inteligencia-leads/agents/agente-enriquecimiento.md +0 -87
- package/vendor/theus-arsenal/skills/inteligencia-leads/agents/mapeador-mutuos.md +0 -76
- package/vendor/theus-arsenal/skills/inteligencia-leads/agents/puntuador-senales.md +0 -60
- package/vendor/theus-arsenal/skills/inteligencia-leads/agents/redactor-outreach.md +0 -102
- package/vendor/theus-arsenal/skills/inteligencia-mercados-prediccion/SKILL.md +0 -53
- package/vendor/theus-arsenal/skills/introspeccion-agente/SKILL.md +0 -150
- package/vendor/theus-arsenal/skills/inventario-skills/SKILL.md +0 -194
- package/vendor/theus-arsenal/skills/inventario-skills/scripts/quick-diff.sh +0 -87
- package/vendor/theus-arsenal/skills/inventario-skills/scripts/save-results.sh +0 -57
- package/vendor/theus-arsenal/skills/inventario-skills/scripts/scan.sh +0 -170
- package/vendor/theus-arsenal/skills/investigacion-mercado/SKILL.md +0 -87
- package/vendor/theus-arsenal/skills/investigacion-oraculos-prediccion/SKILL.md +0 -59
- package/vendor/theus-arsenal/skills/investigacion-profunda/SKILL.md +0 -161
- package/vendor/theus-arsenal/skills/keccak256-nodejs/SKILL.md +0 -100
- package/vendor/theus-arsenal/skills/libro-decisiones-recursivo/SKILL.md +0 -82
- package/vendor/theus-arsenal/skills/lienzo-planes/SKILL.md +0 -111
- package/vendor/theus-arsenal/skills/limpieza-configuracion/SKILL.md +0 -116
- package/vendor/theus-arsenal/skills/logistica-inversa-devoluciones/SKILL.md +0 -241
- package/vendor/theus-arsenal/skills/manejo-errores/SKILL.md +0 -375
- package/vendor/theus-arsenal/skills/materiales-inversores/SKILL.md +0 -101
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/SKILL.md +0 -170
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/forget.mjs +0 -44
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/info.mjs +0 -24
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/init.mjs +0 -152
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/list.mjs +0 -40
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/migrate.mjs +0 -214
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/resume.mjs +0 -36
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/save.mjs +0 -210
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/shared.mjs +0 -402
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/hooks/session-start.mjs +0 -238
- package/vendor/theus-arsenal/skills/metodologia-benchmarks/SKILL.md +0 -131
- package/vendor/theus-arsenal/skills/migraciones-bd/SKILL.md +0 -430
- package/vendor/theus-arsenal/skills/modelos-fundacionales-en-dispositivo/SKILL.md +0 -244
- package/vendor/theus-arsenal/skills/modo-seguro/SKILL.md +0 -86
- package/vendor/theus-arsenal/skills/motion-avanzado/SKILL.md +0 -592
- package/vendor/theus-arsenal/skills/motor-de-contenido/SKILL.md +0 -136
- package/vendor/theus-arsenal/skills/no-conformidades-calidad/SKILL.md +0 -249
- package/vendor/theus-arsenal/skills/onboarding-codigo/SKILL.md +0 -244
- package/vendor/theus-arsenal/skills/operaciones-agentes-empresariales/SKILL.md +0 -51
- package/vendor/theus-arsenal/skills/operaciones-conocimiento/SKILL.md +0 -159
- package/vendor/theus-arsenal/skills/operaciones-correo/SKILL.md +0 -123
- package/vendor/theus-arsenal/skills/operaciones-facturacion/SKILL.md +0 -142
- package/vendor/theus-arsenal/skills/operaciones-flujo-proyectos/SKILL.md +0 -110
- package/vendor/theus-arsenal/skills/operaciones-github/SKILL.md +0 -143
- package/vendor/theus-arsenal/skills/operaciones-google-workspace/SKILL.md +0 -100
- package/vendor/theus-arsenal/skills/operaciones-investigacion/SKILL.md +0 -124
- package/vendor/theus-arsenal/skills/operaciones-mensajes/SKILL.md +0 -103
- package/vendor/theus-arsenal/skills/operaciones-terminal/SKILL.md +0 -110
- package/vendor/theus-arsenal/skills/optimizacion-benchmark/SKILL.md +0 -70
- package/vendor/theus-arsenal/skills/optimizacion-costos-llm/SKILL.md +0 -182
- package/vendor/theus-arsenal/skills/optimizador-conexiones/SKILL.md +0 -191
- package/vendor/theus-arsenal/skills/optimizador-paralelismo/SKILL.md +0 -75
- package/vendor/theus-arsenal/skills/optimizador-prompts/SKILL.md +0 -374
- package/vendor/theus-arsenal/skills/orq-agregar-funcionalidad/SKILL.md +0 -37
- package/vendor/theus-arsenal/skills/orq-cambiar-funcionalidad/SKILL.md +0 -36
- package/vendor/theus-arsenal/skills/orq-construir-mvp/SKILL.md +0 -38
- package/vendor/theus-arsenal/skills/orq-corregir-defecto/SKILL.md +0 -36
- package/vendor/theus-arsenal/skills/orq-pipeline/SKILL.md +0 -134
- package/vendor/theus-arsenal/skills/orq-refinar-codigo/SKILL.md +0 -49
- package/vendor/theus-arsenal/skills/orquestacion-equipos-agentes/SKILL.md +0 -117
- package/vendor/theus-arsenal/skills/pagos-agentes-x402/SKILL.md +0 -237
- package/vendor/theus-arsenal/skills/patrones-angular/SKILL.md +0 -153
- package/vendor/theus-arsenal/skills/patrones-angular/references/angular-animations.md +0 -160
- package/vendor/theus-arsenal/skills/patrones-angular/references/angular-aria.md +0 -410
- package/vendor/theus-arsenal/skills/patrones-angular/references/cli.md +0 -86
- package/vendor/theus-arsenal/skills/patrones-angular/references/component-harnesses.md +0 -59
- package/vendor/theus-arsenal/skills/patrones-angular/references/component-styling.md +0 -91
- package/vendor/theus-arsenal/skills/patrones-angular/references/components.md +0 -117
- package/vendor/theus-arsenal/skills/patrones-angular/references/creating-services.md +0 -97
- package/vendor/theus-arsenal/skills/patrones-angular/references/data-resolvers.md +0 -69
- package/vendor/theus-arsenal/skills/patrones-angular/references/define-routes.md +0 -67
- package/vendor/theus-arsenal/skills/patrones-angular/references/defining-providers.md +0 -72
- package/vendor/theus-arsenal/skills/patrones-angular/references/di-fundamentals.md +0 -120
- package/vendor/theus-arsenal/skills/patrones-angular/references/e2e-testing.md +0 -56
- package/vendor/theus-arsenal/skills/patrones-angular/references/effects.md +0 -83
- package/vendor/theus-arsenal/skills/patrones-angular/references/hierarchical-injectors.md +0 -43
- package/vendor/theus-arsenal/skills/patrones-angular/references/host-elements.md +0 -80
- package/vendor/theus-arsenal/skills/patrones-angular/references/injection-context.md +0 -63
- package/vendor/theus-arsenal/skills/patrones-angular/references/inputs.md +0 -101
- package/vendor/theus-arsenal/skills/patrones-angular/references/linked-signal.md +0 -59
- package/vendor/theus-arsenal/skills/patrones-angular/references/loading-strategies.md +0 -61
- package/vendor/theus-arsenal/skills/patrones-angular/references/mcp.md +0 -67
- package/vendor/theus-arsenal/skills/patrones-angular/references/navigate-to-routes.md +0 -69
- package/vendor/theus-arsenal/skills/patrones-angular/references/outputs.md +0 -86
- package/vendor/theus-arsenal/skills/patrones-angular/references/reactive-forms.md +0 -122
- package/vendor/theus-arsenal/skills/patrones-angular/references/rendering-strategies.md +0 -44
- package/vendor/theus-arsenal/skills/patrones-angular/references/resource.md +0 -77
- package/vendor/theus-arsenal/skills/patrones-angular/references/route-animations.md +0 -56
- package/vendor/theus-arsenal/skills/patrones-angular/references/route-guards.md +0 -52
- package/vendor/theus-arsenal/skills/patrones-angular/references/router-lifecycle.md +0 -45
- package/vendor/theus-arsenal/skills/patrones-angular/references/router-testing.md +0 -87
- package/vendor/theus-arsenal/skills/patrones-angular/references/show-routes-with-outlets.md +0 -68
- package/vendor/theus-arsenal/skills/patrones-angular/references/signal-forms.md +0 -795
- package/vendor/theus-arsenal/skills/patrones-angular/references/signals-overview.md +0 -94
- package/vendor/theus-arsenal/skills/patrones-angular/references/tailwind-css.md +0 -69
- package/vendor/theus-arsenal/skills/patrones-angular/references/template-driven-forms.md +0 -114
- package/vendor/theus-arsenal/skills/patrones-angular/references/testing-fundamentals.md +0 -65
- package/vendor/theus-arsenal/skills/patrones-animacion/SKILL.md +0 -432
- package/vendor/theus-arsenal/skills/patrones-backend/SKILL.md +0 -560
- package/vendor/theus-arsenal/skills/patrones-cdss-clinico/SKILL.md +0 -249
- package/vendor/theus-arsenal/skills/patrones-cisco-ios/SKILL.md +0 -148
- package/vendor/theus-arsenal/skills/patrones-clickhouse/SKILL.md +0 -443
- package/vendor/theus-arsenal/skills/patrones-compose-multiplatform/SKILL.md +0 -298
- package/vendor/theus-arsenal/skills/patrones-dart-flutter/SKILL.md +0 -566
- package/vendor/theus-arsenal/skills/patrones-despliegue/SKILL.md +0 -426
- package/vendor/theus-arsenal/skills/patrones-django/SKILL.md +0 -739
- package/vendor/theus-arsenal/skills/patrones-django-celery/SKILL.md +0 -456
- package/vendor/theus-arsenal/skills/patrones-docker/SKILL.md +0 -363
- package/vendor/theus-arsenal/skills/patrones-dotnet/SKILL.md +0 -321
- package/vendor/theus-arsenal/skills/patrones-emr-clinico/SKILL.md +0 -168
- package/vendor/theus-arsenal/skills/patrones-fastapi/SKILL.md +0 -513
- package/vendor/theus-arsenal/skills/patrones-frontend/SKILL.md +0 -655
- package/vendor/theus-arsenal/skills/patrones-go/SKILL.md +0 -674
- package/vendor/theus-arsenal/skills/patrones-jpa/SKILL.md +0 -156
- package/vendor/theus-arsenal/skills/patrones-kotlin/SKILL.md +0 -717
- package/vendor/theus-arsenal/skills/patrones-kotlin-exposed/SKILL.md +0 -724
- package/vendor/theus-arsenal/skills/patrones-kotlin-ktor/SKILL.md +0 -694
- package/vendor/theus-arsenal/skills/patrones-kubernetes/SKILL.md +0 -754
- package/vendor/theus-arsenal/skills/patrones-laravel/SKILL.md +0 -414
- package/vendor/theus-arsenal/skills/patrones-mcp/SKILL.md +0 -66
- package/vendor/theus-arsenal/skills/patrones-mysql/SKILL.md +0 -420
- package/vendor/theus-arsenal/skills/patrones-nestjs/SKILL.md +0 -229
- package/vendor/theus-arsenal/skills/patrones-nextjs/SKILL.md +0 -56
- package/vendor/theus-arsenal/skills/patrones-nuxt4/SKILL.md +0 -99
- package/vendor/theus-arsenal/skills/patrones-perl/SKILL.md +0 -508
- package/vendor/theus-arsenal/skills/patrones-postgres/SKILL.md +0 -141
- package/vendor/theus-arsenal/skills/patrones-prisma/SKILL.md +0 -399
- package/vendor/theus-arsenal/skills/patrones-python/SKILL.md +0 -750
- package/vendor/theus-arsenal/skills/patrones-pytorch/SKILL.md +0 -400
- package/vendor/theus-arsenal/skills/patrones-quarkus/SKILL.md +0 -729
- package/vendor/theus-arsenal/skills/patrones-react/SKILL.md +0 -339
- package/vendor/theus-arsenal/skills/patrones-react-native/SKILL.md +0 -325
- package/vendor/theus-arsenal/skills/patrones-redis/SKILL.md +0 -401
- package/vendor/theus-arsenal/skills/patrones-rust/SKILL.md +0 -504
- package/vendor/theus-arsenal/skills/patrones-springboot/SKILL.md +0 -314
- package/vendor/theus-arsenal/skills/patrones-swiftui/SKILL.md +0 -261
- package/vendor/theus-arsenal/skills/patrones-tinystruct/SKILL.md +0 -281
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/architecture.md +0 -90
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/data-handling.md +0 -60
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/database.md +0 -99
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/routing.md +0 -64
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/system-usage.md +0 -97
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/testing.md +0 -72
- package/vendor/theus-arsenal/skills/patrones-vite/SKILL.md +0 -449
- package/vendor/theus-arsenal/skills/patrones-vue/SKILL.md +0 -469
- package/vendor/theus-arsenal/skills/persistencia-actores-swift/SKILL.md +0 -148
- package/vendor/theus-arsenal/skills/pipeline-opensource/SKILL.md +0 -254
- package/vendor/theus-arsenal/skills/planificacion-demanda-inventario/SKILL.md +0 -236
- package/vendor/theus-arsenal/skills/planificador-trades-prediccion/SKILL.md +0 -60
- package/vendor/theus-arsenal/skills/plano-tecnico/SKILL.md +0 -102
- package/vendor/theus-arsenal/skills/presentaciones-html/SKILL.md +0 -189
- package/vendor/theus-arsenal/skills/presentaciones-html/STYLE_PRESETS.md +0 -330
- package/vendor/theus-arsenal/skills/presentaciones-html/animation-patterns.md +0 -122
- package/vendor/theus-arsenal/skills/presentaciones-html/html-template.md +0 -419
- package/vendor/theus-arsenal/skills/presentaciones-html/scripts/export-pdf.sh +0 -418
- package/vendor/theus-arsenal/skills/presentaciones-html/scripts/extract-pptx.py +0 -96
- package/vendor/theus-arsenal/skills/presentaciones-html/viewport-base.css +0 -153
- package/vendor/theus-arsenal/skills/presupuesto-contexto/SKILL.md +0 -263
- package/vendor/theus-arsenal/skills/procesamiento-documentos-nutrient/SKILL.md +0 -168
- package/vendor/theus-arsenal/skills/programacion-produccion/SKILL.md +0 -220
- package/vendor/theus-arsenal/skills/publicacion-cruzada/SKILL.md +0 -117
- package/vendor/theus-arsenal/skills/publicador-social/SKILL.md +0 -121
- package/vendor/theus-arsenal/skills/puerta-de-entrega/SKILL.md +0 -164
- package/vendor/theus-arsenal/skills/puerta-de-entrega/hooks/puerta-entrega.py +0 -242
- package/vendor/theus-arsenal/skills/pulir-interfaces/SKILL.md +0 -126
- package/vendor/theus-arsenal/skills/qa-navegador/SKILL.md +0 -103
- package/vendor/theus-arsenal/skills/ranking-grafo-social/SKILL.md +0 -153
- package/vendor/theus-arsenal/skills/recuperacion-iterativa/SKILL.md +0 -236
- package/vendor/theus-arsenal/skills/redaccion-articulos/SKILL.md +0 -81
- package/vendor/theus-arsenal/skills/regex-vs-llm/SKILL.md +0 -221
- package/vendor/theus-arsenal/skills/regresion-codigo-ia/SKILL.md +0 -388
- package/vendor/theus-arsenal/skills/rendimiento-react/SKILL.md +0 -567
- package/vendor/theus-arsenal/skills/revision-codigo-flutter-dart/SKILL.md +0 -442
- package/vendor/theus-arsenal/skills/revision-literatura-cientifica/SKILL.md +0 -191
- package/vendor/theus-arsenal/skills/revision-multiperspectiva/SKILL.md +0 -302
- package/vendor/theus-arsenal/skills/revision-riesgo-prediccion/SKILL.md +0 -56
- package/vendor/theus-arsenal/skills/revision-seguridad/SKILL.md +0 -505
- package/vendor/theus-arsenal/skills/revision-seguridad/cloud-infrastructure-security.md +0 -361
- package/vendor/theus-arsenal/skills/runtime-bun/SKILL.md +0 -83
- package/vendor/theus-arsenal/skills/salud-codigo-codescene/SKILL.md +0 -163
- package/vendor/theus-arsenal/skills/salud-interfaces-red/SKILL.md +0 -143
- package/vendor/theus-arsenal/skills/seguimiento-costos/SKILL.md +0 -122
- package/vendor/theus-arsenal/skills/seguridad-agentes-trading/SKILL.md +0 -145
- package/vendor/theus-arsenal/skills/seguridad-amm-defi/SKILL.md +0 -166
- package/vendor/theus-arsenal/skills/seguridad-django/SKILL.md +0 -648
- package/vendor/theus-arsenal/skills/seguridad-laravel/SKILL.md +0 -945
- package/vendor/theus-arsenal/skills/seguridad-perl/SKILL.md +0 -507
- package/vendor/theus-arsenal/skills/seguridad-quarkus/SKILL.md +0 -474
- package/vendor/theus-arsenal/skills/seguridad-springboot/SKILL.md +0 -279
- package/vendor/theus-arsenal/skills/seo/SKILL.md +0 -166
- package/vendor/theus-arsenal/skills/sistema-diseno/SKILL.md +0 -81
- package/vendor/theus-arsenal/skills/sistema-operativo-agentico/SKILL.md +0 -375
- package/vendor/theus-arsenal/skills/sistemas-latencia-critica/SKILL.md +0 -65
- package/vendor/theus-arsenal/skills/tdd-django/SKILL.md +0 -735
- package/vendor/theus-arsenal/skills/tdd-laravel/SKILL.md +0 -673
- package/vendor/theus-arsenal/skills/tdd-quarkus/SKILL.md +0 -817
- package/vendor/theus-arsenal/skills/tdd-springboot/SKILL.md +0 -165
- package/vendor/theus-arsenal/skills/testing-cpp/SKILL.md +0 -328
- package/vendor/theus-arsenal/skills/testing-csharp/SKILL.md +0 -321
- package/vendor/theus-arsenal/skills/testing-e2e/SKILL.md +0 -325
- package/vendor/theus-arsenal/skills/testing-go/SKILL.md +0 -719
- package/vendor/theus-arsenal/skills/testing-kotlin/SKILL.md +0 -829
- package/vendor/theus-arsenal/skills/testing-perl/SKILL.md +0 -479
- package/vendor/theus-arsenal/skills/testing-protocolos-di-swift/SKILL.md +0 -196
- package/vendor/theus-arsenal/skills/testing-python/SKILL.md +0 -815
- package/vendor/theus-arsenal/skills/testing-react/SKILL.md +0 -421
- package/vendor/theus-arsenal/skills/testing-rust/SKILL.md +0 -506
- package/vendor/theus-arsenal/skills/tours-de-codigo/SKILL.md +0 -252
- package/vendor/theus-arsenal/skills/traduccion-documentos-visado/SKILL.md +0 -121
- package/vendor/theus-arsenal/skills/ui-a-vue/SKILL.md +0 -141
- package/vendor/theus-arsenal/skills/validacion-config-red/SKILL.md +0 -211
- package/vendor/theus-arsenal/skills/verificacion-django/SKILL.md +0 -470
- package/vendor/theus-arsenal/skills/verificacion-factual/SKILL.md +0 -142
- package/vendor/theus-arsenal/skills/verificacion-laravel/SKILL.md +0 -184
- package/vendor/theus-arsenal/skills/verificacion-quarkus/SKILL.md +0 -485
- package/vendor/theus-arsenal/skills/verificacion-springboot/SKILL.md +0 -237
- package/vendor/theus-arsenal/skills/videodb/SKILL.md +0 -374
- package/vendor/theus-arsenal/skills/videodb/reference/api-reference.md +0 -550
- package/vendor/theus-arsenal/skills/videodb/reference/capture-reference.md +0 -407
- package/vendor/theus-arsenal/skills/videodb/reference/capture.md +0 -101
- package/vendor/theus-arsenal/skills/videodb/reference/editor.md +0 -443
- package/vendor/theus-arsenal/skills/videodb/reference/generative.md +0 -331
- package/vendor/theus-arsenal/skills/videodb/reference/rtstream-reference.md +0 -564
- package/vendor/theus-arsenal/skills/videodb/reference/rtstream.md +0 -65
- package/vendor/theus-arsenal/skills/videodb/reference/search.md +0 -230
- package/vendor/theus-arsenal/skills/videodb/reference/streaming.md +0 -406
- package/vendor/theus-arsenal/skills/videodb/reference/use-cases.md +0 -118
- package/vendor/theus-arsenal/skills/videodb/scripts/ws_listener.py +0 -279
- package/vendor/theus-arsenal/skills/videos-manim/SKILL.md +0 -91
- package/vendor/theus-arsenal/skills/videos-manim/assets/network_graph_scene.py +0 -52
- package/vendor/theus-arsenal/skills/vigilancia-canary/SKILL.md +0 -108
- package/vendor/theus-arsenal/skills/voz-de-marca/SKILL.md +0 -106
|
@@ -0,0 +1,1059 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""HTTP service exposing the watermarks-remover cleaning pipeline.
|
|
3
|
+
|
|
4
|
+
Stdlib-only. The agent skill and any web app can call it over HTTP instead of
|
|
5
|
+
running the CLI scripts locally.
|
|
6
|
+
|
|
7
|
+
Endpoints:
|
|
8
|
+
GET /health -> {"ok": true, "version": ...}
|
|
9
|
+
GET /capabilities -> which optional tools / pixel backends are present
|
|
10
|
+
GET /openapi.json -> dynamically generated OpenAPI 3.0.3 spec
|
|
11
|
+
POST /inspect -> {"file": <base64>, "name": "x.png"} -> findings JSON
|
|
12
|
+
POST /detect -> {"file": <base64>, "name": "x.txt"} -> watermark detector reports
|
|
13
|
+
POST /clean -> {"file": <base64>, "name": "x.png", "options": {...}}
|
|
14
|
+
-> {"cleaned": <base64>, "report": {...}}
|
|
15
|
+
POST /inspect/batch -> {"files": [{"file": <base64>, "name": "x.png"}, ...]}
|
|
16
|
+
-> {"results": [{"name", "ok", "kind", "report", "suspicious"}, ...]}
|
|
17
|
+
POST /detect/batch -> {"files": [{"file": <base64>, "name": "x.txt"}, ...]}
|
|
18
|
+
-> {"results": [{"name", "ok", "kind", "detections", "report"}, ...]}
|
|
19
|
+
POST /clean/batch -> {"files": [{"file": <base64>, "name": "x.png", "options": {...}}, ...]}
|
|
20
|
+
-> {"results": [{"name", "ok", "kind", "cleaned", "report"}, ...]}
|
|
21
|
+
|
|
22
|
+
Batch endpoints loop the same single-file pipeline as /inspect, /detect, and /clean; a
|
|
23
|
+
per-file failure (unknown format, oversized name, bad option) shows up as
|
|
24
|
+
that entry's "ok": false with an "error" string and never aborts the rest of
|
|
25
|
+
the batch. Capped at WATERMARKS_MAX_BATCH_FILES entries per request (default
|
|
26
|
+
50) — the existing MAX_BODY_BYTES envelope cap still bounds total payload
|
|
27
|
+
size the same as a single-file request.
|
|
28
|
+
|
|
29
|
+
Hardening mirrors the CLIs: input size caps, binary-as-text guard, atomic
|
|
30
|
+
writes, loopback-only bind by default, optional bearer API key. Run it as an
|
|
31
|
+
unprivileged user (the Docker image does). Intended for a trusted network;
|
|
32
|
+
expose through a reverse proxy if reachable from untrusted clients.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
from __future__ import annotations
|
|
36
|
+
|
|
37
|
+
import argparse
|
|
38
|
+
import base64
|
|
39
|
+
import binascii
|
|
40
|
+
import json
|
|
41
|
+
import os
|
|
42
|
+
import subprocess
|
|
43
|
+
import sys
|
|
44
|
+
import tempfile
|
|
45
|
+
from functools import cache
|
|
46
|
+
from http import HTTPStatus
|
|
47
|
+
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
48
|
+
from pathlib import Path
|
|
49
|
+
from typing import Any
|
|
50
|
+
from urllib.parse import urlparse
|
|
51
|
+
|
|
52
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
53
|
+
|
|
54
|
+
from av_meta import clean_av, inspect_av
|
|
55
|
+
from common import (
|
|
56
|
+
MAX_INPUT_BYTES,
|
|
57
|
+
eprint,
|
|
58
|
+
looks_binary,
|
|
59
|
+
subprocess_creationflags,
|
|
60
|
+
subprocess_preexec_fn,
|
|
61
|
+
which,
|
|
62
|
+
)
|
|
63
|
+
from container_meta import DEEP_IMAGE_MODES, clean_container, inspect_container
|
|
64
|
+
from format_dispatch import classify_bytes
|
|
65
|
+
from image_meta import clean_image, inspect_image, run_synthid_score
|
|
66
|
+
from score_stylometry import score_text_stylometry
|
|
67
|
+
from text_detectors import detector_status, run_all_text_detectors, run_text_detectors
|
|
68
|
+
from text_unicode import clean_text, inspect_text
|
|
69
|
+
|
|
70
|
+
VERSION = os.environ.get("WATERMARKS_SERVER_VERSION", "dev")
|
|
71
|
+
|
|
72
|
+
# Optional bearer token: when set, every request must send
|
|
73
|
+
# `Authorization: Bearer <key>`. Empty means no auth (default).
|
|
74
|
+
API_KEY = os.environ.get("WATERMARKS_SERVER_API_KEY", "").strip()
|
|
75
|
+
|
|
76
|
+
# Body cap for the JSON envelope. Base64 inflates by 4/3, so the decoded file
|
|
77
|
+
# stays well under MAX_INPUT_BYTES for the same cap.
|
|
78
|
+
MAX_BODY_BYTES = MAX_INPUT_BYTES + (MAX_INPUT_BYTES >> 1)
|
|
79
|
+
|
|
80
|
+
# Per-request file count cap for /inspect/batch and /clean/batch. MAX_BODY_BYTES
|
|
81
|
+
# already bounds total payload size; this bounds worst-case CPU/thread time from
|
|
82
|
+
# a request packing many tiny files into one call.
|
|
83
|
+
MAX_BATCH_FILES = int(os.environ.get("WATERMARKS_MAX_BATCH_FILES", "50"))
|
|
84
|
+
|
|
85
|
+
ALLOWED_CLEAN_OPTIONS = {
|
|
86
|
+
"nfkc": bool,
|
|
87
|
+
"aggressive_homoglyphs": bool,
|
|
88
|
+
"keep_non_ai_metadata": bool,
|
|
89
|
+
"also_layer_a_text": bool,
|
|
90
|
+
"remove_pixel": str,
|
|
91
|
+
"strip_all_metadata": bool,
|
|
92
|
+
"detect_before": bool,
|
|
93
|
+
"detect_after": bool,
|
|
94
|
+
"deep_images": str,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@cache
|
|
99
|
+
def _ghostscript_usable() -> bool:
|
|
100
|
+
"""True when a Ghostscript binary is present and runnable.
|
|
101
|
+
|
|
102
|
+
Cached and guarded like _tool_usable: /capabilities is polled, and probing
|
|
103
|
+
spawns a process every time otherwise.
|
|
104
|
+
"""
|
|
105
|
+
from container_meta import which_ghostscript
|
|
106
|
+
|
|
107
|
+
gs = which_ghostscript()
|
|
108
|
+
if not gs:
|
|
109
|
+
return False
|
|
110
|
+
try:
|
|
111
|
+
r = subprocess.run(
|
|
112
|
+
[gs, "--version"],
|
|
113
|
+
capture_output=True,
|
|
114
|
+
text=True,
|
|
115
|
+
timeout=10,
|
|
116
|
+
check=False,
|
|
117
|
+
preexec_fn=subprocess_preexec_fn,
|
|
118
|
+
creationflags=subprocess_creationflags,
|
|
119
|
+
)
|
|
120
|
+
return r.returncode == 0
|
|
121
|
+
except Exception:
|
|
122
|
+
return False
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _json_ok(payload: dict[str, Any]) -> bytes:
|
|
126
|
+
return json.dumps(payload, ensure_ascii=False, indent=2).encode("utf-8")
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
# Flag that makes each tool print its version and exit 0. They disagree:
|
|
130
|
+
# exiftool treats `--version` as an unknown option and prints usage instead.
|
|
131
|
+
_VERSION_FLAG = {"c2patool": "--version", "exiftool": "-ver", "qpdf": "--version"}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@cache
|
|
135
|
+
def _tool_usable(cmd: str) -> bool:
|
|
136
|
+
"""True only when the tool is on PATH *and* can actually execute.
|
|
137
|
+
|
|
138
|
+
`which` alone answers the wrong question. A binary built for another
|
|
139
|
+
architecture sits on PATH and still dies before main() -- the published
|
|
140
|
+
image pins a multi-arch base digest, so an arm64 host gets an arm64 image
|
|
141
|
+
carrying the x86_64-only c2patool release. Advertising that as available
|
|
142
|
+
is what lets a probe which never ran read as a clean verdict downstream.
|
|
143
|
+
|
|
144
|
+
Cached: a container's tool set cannot change while the process lives.
|
|
145
|
+
"""
|
|
146
|
+
path = which(cmd)
|
|
147
|
+
if not path:
|
|
148
|
+
return False
|
|
149
|
+
try:
|
|
150
|
+
r = subprocess.run(
|
|
151
|
+
[path, _VERSION_FLAG.get(cmd, "--version")],
|
|
152
|
+
capture_output=True,
|
|
153
|
+
text=True,
|
|
154
|
+
timeout=10,
|
|
155
|
+
preexec_fn=subprocess_preexec_fn,
|
|
156
|
+
check=False,
|
|
157
|
+
creationflags=subprocess_creationflags,
|
|
158
|
+
)
|
|
159
|
+
except Exception:
|
|
160
|
+
return False
|
|
161
|
+
return r.returncode == 0
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def capabilities() -> dict[str, Any]:
|
|
165
|
+
return {
|
|
166
|
+
"version": VERSION,
|
|
167
|
+
"tools": {
|
|
168
|
+
"c2patool": _tool_usable("c2patool"),
|
|
169
|
+
"exiftool": _tool_usable("exiftool"),
|
|
170
|
+
"qpdf": _tool_usable("qpdf"),
|
|
171
|
+
"ghostscript": _ghostscript_usable(),
|
|
172
|
+
},
|
|
173
|
+
"pixel_backends": {
|
|
174
|
+
"ctrlregen": bool(os.environ.get("NOAI_WATERMARK_DIR")),
|
|
175
|
+
"diffusion": bool(os.environ.get("MARKDIFFUSION_DIR")),
|
|
176
|
+
},
|
|
177
|
+
"scorers": {
|
|
178
|
+
"synthid": bool(os.environ.get("REVERSE_SYNTHID_DIR")),
|
|
179
|
+
"synthid_http": bool(os.environ.get("WATERMARKS_SYNTHID_SCORER_URL")),
|
|
180
|
+
"stylometry": True,
|
|
181
|
+
},
|
|
182
|
+
"text_detectors": detector_status(),
|
|
183
|
+
"harnesses": {
|
|
184
|
+
"markllm": bool(os.environ.get("MARKLLM_DIR")),
|
|
185
|
+
},
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
# OpenAPI generation. The spec is built from this single declarative table
|
|
190
|
+
# plus live runtime values (version, auth, allowed options), so it can never
|
|
191
|
+
# drift from the endpoints the handler actually serves. Served at /openapi.json.
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _schema(**props: Any) -> dict[str, Any]:
|
|
195
|
+
return props
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def _file_request(extra: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
199
|
+
schema: dict[str, Any] = {
|
|
200
|
+
"type": "object",
|
|
201
|
+
"required": ["file"],
|
|
202
|
+
"properties": {
|
|
203
|
+
"file": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"description": "Base64-encoded file bytes",
|
|
206
|
+
"example": "SGVsbG8gd29ybGQ=",
|
|
207
|
+
},
|
|
208
|
+
"name": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"description": "Original filename (extension drives format routing)",
|
|
211
|
+
"example": "notes.md",
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
}
|
|
215
|
+
if extra:
|
|
216
|
+
schema["properties"].update(extra["properties"])
|
|
217
|
+
schema["required"] = schema["required"] + extra.get("required", [])
|
|
218
|
+
return schema
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def _clean_request_schema() -> dict[str, Any]:
|
|
222
|
+
options: dict[str, Any] = {}
|
|
223
|
+
for key, kind in ALLOWED_CLEAN_OPTIONS.items():
|
|
224
|
+
if kind is bool:
|
|
225
|
+
options[key] = _schema(type="boolean")
|
|
226
|
+
else:
|
|
227
|
+
options[key] = _schema(type="string")
|
|
228
|
+
return _file_request(
|
|
229
|
+
{
|
|
230
|
+
"properties": {
|
|
231
|
+
"options": _schema(type="object", properties=options, additionalProperties=False)
|
|
232
|
+
},
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
_OPENAPI_PATHS: dict[str, dict[str, Any]] = {
|
|
238
|
+
"/health": {
|
|
239
|
+
"get": {
|
|
240
|
+
"summary": "Liveness and version",
|
|
241
|
+
"responses": {
|
|
242
|
+
"200": _schema(
|
|
243
|
+
type="object",
|
|
244
|
+
properties={"ok": _schema(type="boolean"), "version": _schema(type="string")},
|
|
245
|
+
)
|
|
246
|
+
},
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"/capabilities": {
|
|
250
|
+
"get": {
|
|
251
|
+
"summary": "Which optional tools and heavy backends are available",
|
|
252
|
+
"responses": {
|
|
253
|
+
"200": _schema(
|
|
254
|
+
type="object",
|
|
255
|
+
properties={
|
|
256
|
+
"ok": _schema(type="boolean"),
|
|
257
|
+
"version": _schema(type="string"),
|
|
258
|
+
"tools": _schema(
|
|
259
|
+
type="object",
|
|
260
|
+
properties={
|
|
261
|
+
k: _schema(type="boolean")
|
|
262
|
+
for k in ("c2patool", "exiftool", "qpdf", "ghostscript")
|
|
263
|
+
},
|
|
264
|
+
),
|
|
265
|
+
"pixel_backends": _schema(
|
|
266
|
+
type="object",
|
|
267
|
+
properties={
|
|
268
|
+
k: _schema(type="boolean") for k in ("ctrlregen", "diffusion")
|
|
269
|
+
},
|
|
270
|
+
),
|
|
271
|
+
"scorers": _schema(
|
|
272
|
+
type="object",
|
|
273
|
+
properties={
|
|
274
|
+
"synthid": _schema(type="boolean"),
|
|
275
|
+
"synthid_http": _schema(type="boolean"),
|
|
276
|
+
"stylometry": _schema(type="boolean"),
|
|
277
|
+
},
|
|
278
|
+
),
|
|
279
|
+
"harnesses": _schema(
|
|
280
|
+
type="object", properties={"markllm": _schema(type="boolean")}
|
|
281
|
+
),
|
|
282
|
+
"text_detectors": _schema(
|
|
283
|
+
type="object",
|
|
284
|
+
additionalProperties=_schema(type="boolean"),
|
|
285
|
+
),
|
|
286
|
+
},
|
|
287
|
+
)
|
|
288
|
+
},
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
"/openapi.json": {
|
|
292
|
+
"get": {
|
|
293
|
+
"summary": "This OpenAPI 3.0.3 document, generated dynamically",
|
|
294
|
+
"responses": {
|
|
295
|
+
"200": _schema(type="object", description="An OpenAPI 3.0.3 document"),
|
|
296
|
+
},
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"/inspect": {
|
|
300
|
+
"post": {
|
|
301
|
+
"summary": "Inspect a file for AI provenance marks (text / image / container auto-routed)",
|
|
302
|
+
"requestBody": _schema(
|
|
303
|
+
required=True,
|
|
304
|
+
content={
|
|
305
|
+
"application/json": _schema(
|
|
306
|
+
schema=_file_request(
|
|
307
|
+
{
|
|
308
|
+
"properties": {
|
|
309
|
+
"detect": _schema(
|
|
310
|
+
type="boolean",
|
|
311
|
+
description=(
|
|
312
|
+
"Also run configured text watermark detectors "
|
|
313
|
+
"(opt-in; may call vendor APIs and send text "
|
|
314
|
+
"to them)"
|
|
315
|
+
),
|
|
316
|
+
)
|
|
317
|
+
},
|
|
318
|
+
"required": [],
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
)
|
|
322
|
+
},
|
|
323
|
+
),
|
|
324
|
+
"responses": {
|
|
325
|
+
"200": _schema(
|
|
326
|
+
type="object",
|
|
327
|
+
properties={
|
|
328
|
+
"ok": _schema(type="boolean"),
|
|
329
|
+
"kind": _schema(type="string", enum=["text", "image", "container", "av"]),
|
|
330
|
+
"suspicious": _schema(type="boolean"),
|
|
331
|
+
"report": _schema(type="object"),
|
|
332
|
+
},
|
|
333
|
+
)
|
|
334
|
+
},
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"/clean": {
|
|
338
|
+
"post": {
|
|
339
|
+
"summary": "Clean a file; returns the cleaned bytes and an actions/stats report",
|
|
340
|
+
"requestBody": _schema(
|
|
341
|
+
required=True,
|
|
342
|
+
content={"application/json": _schema(schema=_clean_request_schema())},
|
|
343
|
+
),
|
|
344
|
+
"responses": {
|
|
345
|
+
"200": _schema(
|
|
346
|
+
type="object",
|
|
347
|
+
properties={
|
|
348
|
+
"ok": _schema(type="boolean"),
|
|
349
|
+
"kind": _schema(type="string", enum=["text", "image", "container", "av"]),
|
|
350
|
+
"cleaned": _schema(
|
|
351
|
+
type="string", description="Base64-encoded cleaned file bytes"
|
|
352
|
+
),
|
|
353
|
+
"report": _schema(type="object"),
|
|
354
|
+
},
|
|
355
|
+
)
|
|
356
|
+
},
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"/detect": {
|
|
360
|
+
"post": {
|
|
361
|
+
"summary": "Run watermark detectors on a file (text: vendor/statistical; image: SynthID score)",
|
|
362
|
+
"requestBody": _schema(
|
|
363
|
+
required=True,
|
|
364
|
+
content={"application/json": _schema(schema=_file_request())},
|
|
365
|
+
),
|
|
366
|
+
"responses": {
|
|
367
|
+
"200": _schema(
|
|
368
|
+
type="object",
|
|
369
|
+
properties={
|
|
370
|
+
"ok": _schema(type="boolean"),
|
|
371
|
+
"kind": _schema(type="string", enum=["text", "image", "container", "av"]),
|
|
372
|
+
"detections": _schema(type="array", items=_schema(type="object")),
|
|
373
|
+
},
|
|
374
|
+
)
|
|
375
|
+
},
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
"/inspect/batch": {
|
|
379
|
+
"post": {
|
|
380
|
+
"summary": f"Inspect up to {MAX_BATCH_FILES} files in one request",
|
|
381
|
+
"requestBody": _schema(
|
|
382
|
+
required=True,
|
|
383
|
+
content={
|
|
384
|
+
"application/json": _schema(
|
|
385
|
+
schema=_schema(
|
|
386
|
+
type="object",
|
|
387
|
+
required=["files"],
|
|
388
|
+
properties={"files": _schema(type="array", items=_file_request())},
|
|
389
|
+
)
|
|
390
|
+
)
|
|
391
|
+
},
|
|
392
|
+
),
|
|
393
|
+
"responses": {
|
|
394
|
+
"200": _schema(
|
|
395
|
+
type="object",
|
|
396
|
+
properties={
|
|
397
|
+
"ok": _schema(type="boolean"),
|
|
398
|
+
"results": _schema(
|
|
399
|
+
type="array",
|
|
400
|
+
items=_schema(
|
|
401
|
+
type="object",
|
|
402
|
+
properties={
|
|
403
|
+
"name": _schema(type="string"),
|
|
404
|
+
"ok": _schema(type="boolean"),
|
|
405
|
+
"kind": _schema(
|
|
406
|
+
type="string",
|
|
407
|
+
enum=["text", "image", "container", "av", "unknown"],
|
|
408
|
+
),
|
|
409
|
+
"suspicious": _schema(type="boolean"),
|
|
410
|
+
"report": _schema(type="object"),
|
|
411
|
+
"error": _schema(type="string"),
|
|
412
|
+
},
|
|
413
|
+
),
|
|
414
|
+
),
|
|
415
|
+
},
|
|
416
|
+
)
|
|
417
|
+
},
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
"/detect/batch": {
|
|
421
|
+
"post": {
|
|
422
|
+
"summary": f"Run watermark detectors on up to {MAX_BATCH_FILES} files in one request",
|
|
423
|
+
"requestBody": _schema(
|
|
424
|
+
required=True,
|
|
425
|
+
content={
|
|
426
|
+
"application/json": _schema(
|
|
427
|
+
schema=_schema(
|
|
428
|
+
type="object",
|
|
429
|
+
required=["files"],
|
|
430
|
+
properties={"files": _schema(type="array", items=_file_request())},
|
|
431
|
+
)
|
|
432
|
+
)
|
|
433
|
+
},
|
|
434
|
+
),
|
|
435
|
+
"responses": {
|
|
436
|
+
"200": _schema(
|
|
437
|
+
type="object",
|
|
438
|
+
properties={
|
|
439
|
+
"ok": _schema(type="boolean"),
|
|
440
|
+
"results": _schema(
|
|
441
|
+
type="array",
|
|
442
|
+
items=_schema(
|
|
443
|
+
type="object",
|
|
444
|
+
properties={
|
|
445
|
+
"name": _schema(type="string"),
|
|
446
|
+
"ok": _schema(type="boolean"),
|
|
447
|
+
"kind": _schema(
|
|
448
|
+
type="string",
|
|
449
|
+
enum=["text", "image", "container", "av"],
|
|
450
|
+
),
|
|
451
|
+
"detections": _schema(
|
|
452
|
+
type="array", items=_schema(type="object")
|
|
453
|
+
),
|
|
454
|
+
"report": _schema(type="object"),
|
|
455
|
+
"error": _schema(type="string"),
|
|
456
|
+
},
|
|
457
|
+
),
|
|
458
|
+
),
|
|
459
|
+
},
|
|
460
|
+
)
|
|
461
|
+
},
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
"/clean/batch": {
|
|
465
|
+
"post": {
|
|
466
|
+
"summary": f"Clean up to {MAX_BATCH_FILES} files in one request",
|
|
467
|
+
"requestBody": _schema(
|
|
468
|
+
required=True,
|
|
469
|
+
content={
|
|
470
|
+
"application/json": _schema(
|
|
471
|
+
schema=_schema(
|
|
472
|
+
type="object",
|
|
473
|
+
required=["files"],
|
|
474
|
+
properties={
|
|
475
|
+
"files": _schema(type="array", items=_clean_request_schema())
|
|
476
|
+
},
|
|
477
|
+
)
|
|
478
|
+
)
|
|
479
|
+
},
|
|
480
|
+
),
|
|
481
|
+
"responses": {
|
|
482
|
+
"200": _schema(
|
|
483
|
+
type="object",
|
|
484
|
+
properties={
|
|
485
|
+
"ok": _schema(type="boolean"),
|
|
486
|
+
"results": _schema(
|
|
487
|
+
type="array",
|
|
488
|
+
items=_schema(
|
|
489
|
+
type="object",
|
|
490
|
+
properties={
|
|
491
|
+
"name": _schema(type="string"),
|
|
492
|
+
"ok": _schema(type="boolean"),
|
|
493
|
+
"kind": _schema(
|
|
494
|
+
type="string", enum=["text", "image", "container", "av"]
|
|
495
|
+
),
|
|
496
|
+
"cleaned": _schema(type="string"),
|
|
497
|
+
"report": _schema(type="object"),
|
|
498
|
+
"error": _schema(type="string"),
|
|
499
|
+
},
|
|
500
|
+
),
|
|
501
|
+
),
|
|
502
|
+
},
|
|
503
|
+
)
|
|
504
|
+
},
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
_ERROR_SCHEMA = _schema(
|
|
510
|
+
type="object",
|
|
511
|
+
properties={"ok": _schema(type="boolean", enum=[False]), "error": _schema(type="string")},
|
|
512
|
+
)
|
|
513
|
+
_COMMON_ERRORS = {
|
|
514
|
+
"400": {
|
|
515
|
+
"description": "Bad request",
|
|
516
|
+
"content": {"application/json": {"schema": _ERROR_SCHEMA}},
|
|
517
|
+
},
|
|
518
|
+
"401": {
|
|
519
|
+
"description": "Missing/invalid bearer token",
|
|
520
|
+
"content": {"application/json": {"schema": _ERROR_SCHEMA}},
|
|
521
|
+
},
|
|
522
|
+
"404": {"description": "Not found", "content": {"application/json": {"schema": _ERROR_SCHEMA}}},
|
|
523
|
+
"413": {
|
|
524
|
+
"description": "Request body too large",
|
|
525
|
+
"content": {"application/json": {"schema": _ERROR_SCHEMA}},
|
|
526
|
+
},
|
|
527
|
+
"500": {
|
|
528
|
+
"description": "Internal error",
|
|
529
|
+
"content": {"application/json": {"schema": _ERROR_SCHEMA}},
|
|
530
|
+
},
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
def openapi_spec() -> dict[str, Any]:
|
|
535
|
+
paths: dict[str, Any] = {}
|
|
536
|
+
for path, ops in _OPENAPI_PATHS.items():
|
|
537
|
+
for method, op in ops.items():
|
|
538
|
+
responses = dict(_COMMON_ERRORS)
|
|
539
|
+
for status, body in op["responses"].items():
|
|
540
|
+
responses[status] = {
|
|
541
|
+
"description": "Success",
|
|
542
|
+
"content": {"application/json": {"schema": body}},
|
|
543
|
+
}
|
|
544
|
+
paths.setdefault(path, {})[method] = {
|
|
545
|
+
"summary": op["summary"],
|
|
546
|
+
"responses": responses,
|
|
547
|
+
**((op.get("requestBody") and {"requestBody": op["requestBody"]}) or {}),
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
spec: dict[str, Any] = {
|
|
551
|
+
"openapi": "3.0.3",
|
|
552
|
+
"info": {
|
|
553
|
+
"title": "watermarks-remover service",
|
|
554
|
+
"version": VERSION,
|
|
555
|
+
"description": "Strip multi-vendor AI provenance marks (Unicode, C2PA/EXIF/XMP, containers). "
|
|
556
|
+
"Files are passed base64-encoded in JSON; cleaned bytes come back base64-encoded.",
|
|
557
|
+
},
|
|
558
|
+
"paths": paths,
|
|
559
|
+
}
|
|
560
|
+
if API_KEY:
|
|
561
|
+
spec["components"] = {
|
|
562
|
+
"securitySchemes": {
|
|
563
|
+
"bearerAuth": {"type": "http", "scheme": "bearer"},
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
spec["security"] = [{"bearerAuth": []}]
|
|
567
|
+
return spec
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
def _safe_name(name: str) -> str:
|
|
571
|
+
"""Reduce a client-supplied filename to a bare basename safe for temp use.
|
|
572
|
+
|
|
573
|
+
CodeQL (uncontrolled data in path expression): a name like '../../x'
|
|
574
|
+
would otherwise let the write below escape the request temp dir. Fold
|
|
575
|
+
Windows separators too, and fall back to a neutral name for '.', '..' or
|
|
576
|
+
empty results.
|
|
577
|
+
"""
|
|
578
|
+
base = Path(name.replace("\\", "/")).name
|
|
579
|
+
if base in ("", ".", ".."):
|
|
580
|
+
return "input"
|
|
581
|
+
return base
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
def _tmp_path(tmpdir: Path, *parts: str) -> Path:
|
|
585
|
+
"""Join *parts* under *tmpdir* and refuse anything that escapes it.
|
|
586
|
+
|
|
587
|
+
Defense-in-depth for the CodeQL "uncontrolled data in path expression"
|
|
588
|
+
findings: even if a caller slips a separator through, the write can never
|
|
589
|
+
land outside the request temp dir.
|
|
590
|
+
"""
|
|
591
|
+
path = tmpdir.joinpath(*parts)
|
|
592
|
+
if path.parent != tmpdir:
|
|
593
|
+
raise ValueError("unsafe filename")
|
|
594
|
+
return path
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
def _decode_input(body: dict[str, Any]) -> tuple[bytes, str]:
|
|
598
|
+
raw = body.get("file")
|
|
599
|
+
if not isinstance(raw, str):
|
|
600
|
+
raise ValueError("missing string field 'file' (base64-encoded bytes)")
|
|
601
|
+
name = body.get("name")
|
|
602
|
+
if name is not None and not isinstance(name, str):
|
|
603
|
+
raise ValueError("'name' must be a string")
|
|
604
|
+
try:
|
|
605
|
+
data = base64.b64decode(raw, validate=True)
|
|
606
|
+
except (binascii.Error, ValueError):
|
|
607
|
+
raise ValueError("'file' is not valid base64") from None
|
|
608
|
+
return data, _safe_name(name or "")
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
def _parse_clean_options(options: Any) -> dict[str, Any]:
|
|
612
|
+
if options is None:
|
|
613
|
+
return {}
|
|
614
|
+
if not isinstance(options, dict):
|
|
615
|
+
raise ValueError("'options' must be an object")
|
|
616
|
+
for key, value in options.items():
|
|
617
|
+
if key not in ALLOWED_CLEAN_OPTIONS:
|
|
618
|
+
raise ValueError(f"unknown option: {key}")
|
|
619
|
+
expected_type = ALLOWED_CLEAN_OPTIONS[key]
|
|
620
|
+
if not isinstance(value, expected_type):
|
|
621
|
+
type_name = "boolean" if expected_type is bool else "string"
|
|
622
|
+
raise ValueError(f"option {key!r} must be a {type_name}")
|
|
623
|
+
# An unrecognised deep_images value used to fall back to "auto", which turns
|
|
624
|
+
# a request for lossless cleaning into one that may recompress. Reject it
|
|
625
|
+
# here, where every caller -- single file and batch alike -- passes through.
|
|
626
|
+
deep_images = options.get("deep_images")
|
|
627
|
+
if deep_images is not None and deep_images not in DEEP_IMAGE_MODES:
|
|
628
|
+
raise ValueError(f"option 'deep_images' must be one of {sorted(DEEP_IMAGE_MODES)}")
|
|
629
|
+
return options
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
def _batch_items(
|
|
633
|
+
body: dict[str, Any],
|
|
634
|
+
) -> list[tuple[str, bytes, dict[str, Any], str | None]]:
|
|
635
|
+
"""Decode a batch request's 'files' array into (name, data, options, error) tuples.
|
|
636
|
+
|
|
637
|
+
A malformed individual entry (bad base64, unknown option) becomes an error
|
|
638
|
+
string paired with that entry rather than raising, so one bad file never
|
|
639
|
+
aborts the rest of the batch. Only 'files' itself being missing, empty, or
|
|
640
|
+
over MAX_BATCH_FILES raises — that is a malformed request, not a per-file
|
|
641
|
+
problem.
|
|
642
|
+
"""
|
|
643
|
+
files = body.get("files")
|
|
644
|
+
if not isinstance(files, list):
|
|
645
|
+
raise ValueError("missing array field 'files'")
|
|
646
|
+
if not files:
|
|
647
|
+
raise ValueError("'files' must not be empty")
|
|
648
|
+
if len(files) > MAX_BATCH_FILES:
|
|
649
|
+
raise ValueError(f"'files' exceeds the {MAX_BATCH_FILES}-file batch limit")
|
|
650
|
+
|
|
651
|
+
items: list[tuple[str, bytes, dict[str, Any], str | None]] = []
|
|
652
|
+
for entry in files:
|
|
653
|
+
if not isinstance(entry, dict):
|
|
654
|
+
items.append(("", b"", {}, "each entry in 'files' must be an object"))
|
|
655
|
+
continue
|
|
656
|
+
try:
|
|
657
|
+
data, name = _decode_input(entry)
|
|
658
|
+
except ValueError as e:
|
|
659
|
+
fallback_name = entry.get("name") if isinstance(entry.get("name"), str) else ""
|
|
660
|
+
items.append((fallback_name, b"", {}, str(e)))
|
|
661
|
+
continue
|
|
662
|
+
try:
|
|
663
|
+
options = _parse_clean_options(entry.get("options"))
|
|
664
|
+
except ValueError as e:
|
|
665
|
+
items.append((name, b"", {}, str(e)))
|
|
666
|
+
continue
|
|
667
|
+
items.append((name, data, options, None))
|
|
668
|
+
return items
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
def _inspect_payload(data: bytes, name: str, run_detect: bool) -> dict[str, Any]:
|
|
672
|
+
kind = classify_bytes(data, Path(name).suffix)
|
|
673
|
+
if kind == "unknown":
|
|
674
|
+
return {
|
|
675
|
+
"ok": True,
|
|
676
|
+
"kind": "unknown",
|
|
677
|
+
"report": {"note": "unrecognized format; use a filename with a known extension"},
|
|
678
|
+
"suspicious": False,
|
|
679
|
+
}
|
|
680
|
+
with tempfile.TemporaryDirectory(prefix="wm-inspect-") as tmp:
|
|
681
|
+
path = _tmp_path(Path(tmp), name or "input")
|
|
682
|
+
path.write_bytes(data)
|
|
683
|
+
if kind == "text":
|
|
684
|
+
if looks_binary(data):
|
|
685
|
+
raise ValueError(
|
|
686
|
+
"refusing to inspect bytes that look like a binary container as text"
|
|
687
|
+
)
|
|
688
|
+
raw_text = data.decode("utf-8", errors="surrogateescape")
|
|
689
|
+
report = inspect_text(raw_text).to_dict()
|
|
690
|
+
s_rep = score_text_stylometry(raw_text, path=name or "<text>")
|
|
691
|
+
report["stylometry"] = s_rep.to_dict()
|
|
692
|
+
if run_detect:
|
|
693
|
+
report["text_detectors"] = run_all_text_detectors(raw_text)
|
|
694
|
+
elif kind == "image":
|
|
695
|
+
report = inspect_image(path).to_dict()
|
|
696
|
+
elif kind == "av":
|
|
697
|
+
report = inspect_av(path).to_dict()
|
|
698
|
+
else:
|
|
699
|
+
report = inspect_container(path).to_dict()
|
|
700
|
+
detected_wm = any(
|
|
701
|
+
entry.get("available") and entry.get("is_watermarked")
|
|
702
|
+
for entry in report.get("text_detectors") or []
|
|
703
|
+
)
|
|
704
|
+
suspicious = (
|
|
705
|
+
bool(report.get("suspicious_total"))
|
|
706
|
+
or bool(report.get("has_c2pa") or report.get("has_ai_metadata"))
|
|
707
|
+
or bool(report.get("stylometry", {}).get("score", 0.0) >= 0.65)
|
|
708
|
+
or detected_wm
|
|
709
|
+
)
|
|
710
|
+
return {"ok": True, "kind": kind, "report": report, "suspicious": suspicious}
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
def _detect_payload(data: bytes, name: str) -> dict[str, Any]:
|
|
714
|
+
kind = classify_bytes(data, Path(name).suffix)
|
|
715
|
+
with tempfile.TemporaryDirectory(prefix="wm-detect-") as tmp:
|
|
716
|
+
path = _tmp_path(Path(tmp), name or "input")
|
|
717
|
+
path.write_bytes(data)
|
|
718
|
+
if kind == "text":
|
|
719
|
+
if looks_binary(data):
|
|
720
|
+
raise ValueError(
|
|
721
|
+
"refusing to detect bytes that look like a binary container as text"
|
|
722
|
+
)
|
|
723
|
+
raw_text = data.decode("utf-8", errors="surrogateescape")
|
|
724
|
+
detections: list[dict[str, Any]] = run_all_text_detectors(raw_text)
|
|
725
|
+
s_rep = score_text_stylometry(raw_text, path=name or "<text>")
|
|
726
|
+
detections.append({"detector": "stylometry", "available": True, **s_rep.to_dict()})
|
|
727
|
+
return {"ok": True, "kind": kind, "detections": detections}
|
|
728
|
+
elif kind == "image":
|
|
729
|
+
score = run_synthid_score(path)
|
|
730
|
+
if score is None:
|
|
731
|
+
score = {
|
|
732
|
+
"detector": "synthid",
|
|
733
|
+
"available": False,
|
|
734
|
+
"error": (
|
|
735
|
+
"no SynthID scorer configured (set "
|
|
736
|
+
"WATERMARKS_SYNTHID_SCORER_URL or REVERSE_SYNTHID_DIR)"
|
|
737
|
+
),
|
|
738
|
+
}
|
|
739
|
+
else:
|
|
740
|
+
score.setdefault("detector", "synthid")
|
|
741
|
+
detections = [score]
|
|
742
|
+
return {"ok": True, "kind": kind, "detections": detections}
|
|
743
|
+
elif kind == "av":
|
|
744
|
+
return {
|
|
745
|
+
"ok": True,
|
|
746
|
+
"kind": kind,
|
|
747
|
+
"detections": [],
|
|
748
|
+
"report": inspect_av(path).to_dict(),
|
|
749
|
+
}
|
|
750
|
+
else:
|
|
751
|
+
detections = []
|
|
752
|
+
report = inspect_container(path).to_dict()
|
|
753
|
+
return {
|
|
754
|
+
"ok": True,
|
|
755
|
+
"kind": kind,
|
|
756
|
+
"detections": detections,
|
|
757
|
+
"report": report,
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
def _clean_payload(data: bytes, name: str, options: dict[str, Any]) -> dict[str, Any]:
|
|
762
|
+
kind = classify_bytes(data, Path(name).suffix)
|
|
763
|
+
if kind == "unknown":
|
|
764
|
+
raise ValueError(
|
|
765
|
+
"unrecognized file format; use a filename with a known extension "
|
|
766
|
+
"(e.g. notes.txt) or a supported image/container name"
|
|
767
|
+
)
|
|
768
|
+
|
|
769
|
+
with tempfile.TemporaryDirectory(prefix="wm-clean-") as tmp:
|
|
770
|
+
tmpdir = Path(tmp)
|
|
771
|
+
src = _tmp_path(tmpdir, name or "input")
|
|
772
|
+
src.write_bytes(data)
|
|
773
|
+
if kind == "text":
|
|
774
|
+
if looks_binary(data):
|
|
775
|
+
raise ValueError(
|
|
776
|
+
"refusing to clean bytes that look like a binary container as text"
|
|
777
|
+
)
|
|
778
|
+
text = data.decode("utf-8", errors="surrogateescape")
|
|
779
|
+
detect_before = bool(options.get("detect_before"))
|
|
780
|
+
detect_after = bool(options.get("detect_after"))
|
|
781
|
+
detector_reports: dict[str, Any] = {}
|
|
782
|
+
if detect_before:
|
|
783
|
+
detector_reports["before"] = run_text_detectors(text)
|
|
784
|
+
cleaned, stats = clean_text(
|
|
785
|
+
text,
|
|
786
|
+
nfkc=bool(options.get("nfkc")),
|
|
787
|
+
aggressive_homoglyphs=bool(options.get("aggressive_homoglyphs")),
|
|
788
|
+
)
|
|
789
|
+
if detect_after:
|
|
790
|
+
detector_reports["after"] = run_text_detectors(cleaned)
|
|
791
|
+
cleaned_bytes = cleaned.encode("utf-8", errors="surrogateescape")
|
|
792
|
+
report: dict[str, Any] = {"kind": "text", "stats": stats, "length": len(cleaned)}
|
|
793
|
+
if detector_reports:
|
|
794
|
+
report["text_detectors"] = detector_reports
|
|
795
|
+
elif kind == "image":
|
|
796
|
+
ext = Path(name).suffix
|
|
797
|
+
if not ext:
|
|
798
|
+
from image_meta import detect_format
|
|
799
|
+
|
|
800
|
+
fmt_name = detect_format(data)
|
|
801
|
+
ext = f".{fmt_name}" if fmt_name != "unknown" else ".png"
|
|
802
|
+
dest = _tmp_path(tmpdir, f"out{ext}")
|
|
803
|
+
strip_all = not bool(options.get("keep_non_ai_metadata"))
|
|
804
|
+
if "strip_all_metadata" in options:
|
|
805
|
+
strip_all = bool(options["strip_all_metadata"])
|
|
806
|
+
remove_pixel = options.get("remove_pixel")
|
|
807
|
+
if remove_pixel not in (None, "ctrlregen", "diffusion"):
|
|
808
|
+
raise ValueError("remove_pixel must be one of: ctrlregen, diffusion")
|
|
809
|
+
result = clean_image(
|
|
810
|
+
src,
|
|
811
|
+
dest,
|
|
812
|
+
strip_all_metadata=strip_all,
|
|
813
|
+
remove_pixel=remove_pixel,
|
|
814
|
+
)
|
|
815
|
+
if bool(options.get("detect_before")) and result.get("synthid_before") is None:
|
|
816
|
+
result["synthid_before"] = run_synthid_score(src)
|
|
817
|
+
if bool(options.get("detect_after")) and result.get("synthid_after") is None:
|
|
818
|
+
result["synthid_after"] = run_synthid_score(dest)
|
|
819
|
+
cleaned_bytes = dest.read_bytes()
|
|
820
|
+
report = {"kind": "image", **result}
|
|
821
|
+
elif kind == "av":
|
|
822
|
+
dest = _tmp_path(tmpdir, f"out{Path(name).suffix or '.bin'}")
|
|
823
|
+
strip_all = not bool(options.get("keep_non_ai_metadata"))
|
|
824
|
+
if "strip_all_metadata" in options:
|
|
825
|
+
strip_all = bool(options["strip_all_metadata"])
|
|
826
|
+
result = clean_av(src, dest, strip_all_metadata=strip_all)
|
|
827
|
+
cleaned_bytes = dest.read_bytes()
|
|
828
|
+
report = {"kind": "av", **result}
|
|
829
|
+
else:
|
|
830
|
+
ext = Path(name).suffix
|
|
831
|
+
container_fmt = None
|
|
832
|
+
if not ext:
|
|
833
|
+
from container_meta import detect_container_format
|
|
834
|
+
|
|
835
|
+
container_fmt = detect_container_format(Path("input"), data)
|
|
836
|
+
ext_map = {
|
|
837
|
+
"svg": ".svg",
|
|
838
|
+
"pdf": ".pdf",
|
|
839
|
+
"docx": ".docx",
|
|
840
|
+
"xlsx": ".xlsx",
|
|
841
|
+
"pptx": ".pptx",
|
|
842
|
+
"odt": ".odt",
|
|
843
|
+
"epub": ".epub",
|
|
844
|
+
"html": ".html",
|
|
845
|
+
"markdown": ".md",
|
|
846
|
+
}
|
|
847
|
+
ext = ext_map.get(container_fmt, "")
|
|
848
|
+
dest = _tmp_path(tmpdir, f"out{ext}")
|
|
849
|
+
result = clean_container(
|
|
850
|
+
src,
|
|
851
|
+
dest,
|
|
852
|
+
fmt=container_fmt,
|
|
853
|
+
also_layer_a_text=bool(options.get("also_layer_a_text", True)),
|
|
854
|
+
deep_images=str(options.get("deep_images", "auto")),
|
|
855
|
+
)
|
|
856
|
+
cleaned_bytes = dest.read_bytes()
|
|
857
|
+
report = {"kind": "container", **result}
|
|
858
|
+
report.pop("input", None)
|
|
859
|
+
report.pop("output", None)
|
|
860
|
+
|
|
861
|
+
return {
|
|
862
|
+
"ok": True,
|
|
863
|
+
"kind": kind,
|
|
864
|
+
"cleaned": base64.b64encode(cleaned_bytes).decode("ascii"),
|
|
865
|
+
"report": report,
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
class Handler(BaseHTTPRequestHandler):
|
|
870
|
+
server_version = f"watermarks-remover/{VERSION}"
|
|
871
|
+
|
|
872
|
+
def log_message(self, fmt: str, *args: object) -> None:
|
|
873
|
+
eprint(f"{self.address_string()} - {fmt % args}")
|
|
874
|
+
|
|
875
|
+
def _authorized(self) -> bool:
|
|
876
|
+
if not API_KEY:
|
|
877
|
+
return True
|
|
878
|
+
header = self.headers.get("Authorization", "")
|
|
879
|
+
return header == f"Bearer {API_KEY}"
|
|
880
|
+
|
|
881
|
+
def _read_json(self) -> dict[str, Any] | None:
|
|
882
|
+
raw = self.headers.get("Content-Length")
|
|
883
|
+
if raw is None or not raw.isdigit():
|
|
884
|
+
return None
|
|
885
|
+
length = int(raw)
|
|
886
|
+
if length > MAX_BODY_BYTES:
|
|
887
|
+
return None
|
|
888
|
+
try:
|
|
889
|
+
body = json.loads(self.rfile.read(length).decode("utf-8"))
|
|
890
|
+
except (UnicodeDecodeError, json.JSONDecodeError, OSError):
|
|
891
|
+
return None
|
|
892
|
+
if not isinstance(body, dict):
|
|
893
|
+
return None
|
|
894
|
+
return body
|
|
895
|
+
|
|
896
|
+
def _respond(self, status: int, payload: dict[str, Any]) -> None:
|
|
897
|
+
data = _json_ok(payload)
|
|
898
|
+
self.send_response(status)
|
|
899
|
+
self.send_header("Content-Type", "application/json; charset=utf-8")
|
|
900
|
+
self.send_header("Content-Length", str(len(data)))
|
|
901
|
+
self.send_header("Cache-Control", "no-store")
|
|
902
|
+
self.end_headers()
|
|
903
|
+
self.wfile.write(data)
|
|
904
|
+
|
|
905
|
+
def do_GET(self) -> None:
|
|
906
|
+
path = urlparse(self.path).path
|
|
907
|
+
if not self._authorized():
|
|
908
|
+
self._respond(HTTPStatus.UNAUTHORIZED, {"ok": False, "error": "unauthorized"})
|
|
909
|
+
return
|
|
910
|
+
if path == "/health":
|
|
911
|
+
self._respond(HTTPStatus.OK, {"ok": True, "version": VERSION})
|
|
912
|
+
elif path == "/capabilities":
|
|
913
|
+
self._respond(HTTPStatus.OK, {"ok": True, **capabilities()})
|
|
914
|
+
elif path == "/openapi.json":
|
|
915
|
+
self._respond(HTTPStatus.OK, openapi_spec())
|
|
916
|
+
else:
|
|
917
|
+
self._respond(HTTPStatus.NOT_FOUND, {"ok": False, "error": "not found"})
|
|
918
|
+
|
|
919
|
+
def do_POST(self) -> None:
|
|
920
|
+
path = urlparse(self.path).path
|
|
921
|
+
if not self._authorized():
|
|
922
|
+
self._respond(HTTPStatus.UNAUTHORIZED, {"ok": False, "error": "unauthorized"})
|
|
923
|
+
return
|
|
924
|
+
if path not in (
|
|
925
|
+
"/inspect",
|
|
926
|
+
"/clean",
|
|
927
|
+
"/detect",
|
|
928
|
+
"/inspect/batch",
|
|
929
|
+
"/detect/batch",
|
|
930
|
+
"/clean/batch",
|
|
931
|
+
):
|
|
932
|
+
self._respond(HTTPStatus.NOT_FOUND, {"ok": False, "error": "not found"})
|
|
933
|
+
return
|
|
934
|
+
body = self._read_json()
|
|
935
|
+
if body is None:
|
|
936
|
+
raw_len = self.headers.get("Content-Length")
|
|
937
|
+
oversized = raw_len is not None and raw_len.isdigit() and int(raw_len) > MAX_BODY_BYTES
|
|
938
|
+
self._respond(
|
|
939
|
+
HTTPStatus.REQUEST_ENTITY_TOO_LARGE if oversized else HTTPStatus.BAD_REQUEST,
|
|
940
|
+
{"ok": False, "error": "invalid request body"},
|
|
941
|
+
)
|
|
942
|
+
return
|
|
943
|
+
try:
|
|
944
|
+
if path == "/inspect/batch":
|
|
945
|
+
self._handle_inspect_batch(body)
|
|
946
|
+
elif path == "/detect/batch":
|
|
947
|
+
self._handle_detect_batch(body)
|
|
948
|
+
elif path == "/clean/batch":
|
|
949
|
+
self._handle_clean_batch(body)
|
|
950
|
+
else:
|
|
951
|
+
data, name = _decode_input(body)
|
|
952
|
+
if path == "/inspect":
|
|
953
|
+
self._handle_inspect(data, name, body)
|
|
954
|
+
elif path == "/detect":
|
|
955
|
+
self._handle_detect(data, name)
|
|
956
|
+
else:
|
|
957
|
+
self._handle_clean(data, name, body)
|
|
958
|
+
except ValueError as e:
|
|
959
|
+
self._respond(HTTPStatus.BAD_REQUEST, {"ok": False, "error": str(e)})
|
|
960
|
+
except Exception as e:
|
|
961
|
+
eprint(f"error handling {path}: {e!r}")
|
|
962
|
+
self._respond(
|
|
963
|
+
HTTPStatus.INTERNAL_SERVER_ERROR, {"ok": False, "error": "internal error"}
|
|
964
|
+
)
|
|
965
|
+
|
|
966
|
+
def _handle_inspect(self, data: bytes, name: str, body: dict[str, Any]) -> None:
|
|
967
|
+
run_detect = body.get("detect") is True
|
|
968
|
+
self._respond(HTTPStatus.OK, _inspect_payload(data, name, run_detect))
|
|
969
|
+
|
|
970
|
+
def _handle_inspect_batch(self, body: dict[str, Any]) -> None:
|
|
971
|
+
items = _batch_items(body)
|
|
972
|
+
run_detect = body.get("detect") is True
|
|
973
|
+
results = []
|
|
974
|
+
for name, data, _options, error in items:
|
|
975
|
+
if error is not None:
|
|
976
|
+
results.append({"name": name, "ok": False, "error": error})
|
|
977
|
+
continue
|
|
978
|
+
try:
|
|
979
|
+
payload = _inspect_payload(data, name, run_detect)
|
|
980
|
+
except ValueError as e:
|
|
981
|
+
results.append({"name": name, "ok": False, "error": str(e)})
|
|
982
|
+
continue
|
|
983
|
+
results.append({"name": name, **payload})
|
|
984
|
+
self._respond(HTTPStatus.OK, {"ok": True, "results": results})
|
|
985
|
+
|
|
986
|
+
def _handle_detect(self, data: bytes, name: str) -> None:
|
|
987
|
+
self._respond(HTTPStatus.OK, _detect_payload(data, name))
|
|
988
|
+
|
|
989
|
+
def _handle_detect_batch(self, body: dict[str, Any]) -> None:
|
|
990
|
+
items = _batch_items(body)
|
|
991
|
+
results = []
|
|
992
|
+
for name, data, _options, error in items:
|
|
993
|
+
if error is not None:
|
|
994
|
+
results.append({"name": name, "ok": False, "error": error})
|
|
995
|
+
continue
|
|
996
|
+
try:
|
|
997
|
+
payload = _detect_payload(data, name)
|
|
998
|
+
except ValueError as e:
|
|
999
|
+
results.append({"name": name, "ok": False, "error": str(e)})
|
|
1000
|
+
continue
|
|
1001
|
+
results.append({"name": name, **payload})
|
|
1002
|
+
self._respond(HTTPStatus.OK, {"ok": True, "results": results})
|
|
1003
|
+
|
|
1004
|
+
def _handle_clean(self, data: bytes, name: str, body: dict[str, Any]) -> None:
|
|
1005
|
+
options = _parse_clean_options(body.get("options"))
|
|
1006
|
+
self._respond(HTTPStatus.OK, _clean_payload(data, name, options))
|
|
1007
|
+
|
|
1008
|
+
def _handle_clean_batch(self, body: dict[str, Any]) -> None:
|
|
1009
|
+
items = _batch_items(body)
|
|
1010
|
+
results = []
|
|
1011
|
+
for name, data, options, error in items:
|
|
1012
|
+
if error is not None:
|
|
1013
|
+
results.append({"name": name, "ok": False, "error": error})
|
|
1014
|
+
continue
|
|
1015
|
+
try:
|
|
1016
|
+
payload = _clean_payload(data, name, options)
|
|
1017
|
+
except ValueError as e:
|
|
1018
|
+
results.append({"name": name, "ok": False, "error": str(e)})
|
|
1019
|
+
continue
|
|
1020
|
+
results.append({"name": name, **payload})
|
|
1021
|
+
self._respond(HTTPStatus.OK, {"ok": True, "results": results})
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
def main() -> int:
|
|
1025
|
+
global API_KEY # noqa: PLW0603 — CLI overrides env
|
|
1026
|
+
p = argparse.ArgumentParser(description=__doc__)
|
|
1027
|
+
p.add_argument("--host", default=os.environ.get("WATERMARKS_SERVER_HOST", "127.0.0.1"))
|
|
1028
|
+
p.add_argument(
|
|
1029
|
+
"--port", type=int, default=int(os.environ.get("WATERMARKS_SERVER_PORT", "8765"))
|
|
1030
|
+
)
|
|
1031
|
+
p.add_argument("--api-key", default=API_KEY, help="require this bearer token (default: none)")
|
|
1032
|
+
p.add_argument("-V", "--version", action="store_true", help="print version and exit")
|
|
1033
|
+
args = p.parse_args()
|
|
1034
|
+
|
|
1035
|
+
if args.version:
|
|
1036
|
+
print(VERSION)
|
|
1037
|
+
return 0
|
|
1038
|
+
|
|
1039
|
+
API_KEY = args.api_key
|
|
1040
|
+
|
|
1041
|
+
if args.host not in ("127.0.0.1", "localhost", "::1"):
|
|
1042
|
+
eprint(f"warning: binding {args.host} — intended for a trusted network only")
|
|
1043
|
+
if API_KEY:
|
|
1044
|
+
eprint("API key required for requests")
|
|
1045
|
+
else:
|
|
1046
|
+
eprint("warning: no API key set — only bind to loopback or a trusted network")
|
|
1047
|
+
|
|
1048
|
+
server = ThreadingHTTPServer((args.host, args.port), Handler)
|
|
1049
|
+
eprint(f"watermarks-remover service {VERSION} on http://{args.host}:{args.port}")
|
|
1050
|
+
try:
|
|
1051
|
+
server.serve_forever()
|
|
1052
|
+
except KeyboardInterrupt:
|
|
1053
|
+
eprint("shutting down")
|
|
1054
|
+
server.shutdown()
|
|
1055
|
+
return 0
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
if __name__ == "__main__":
|
|
1059
|
+
raise SystemExit(main())
|