theus-cli-linux-arm64 0.2.84
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/LICENSE +42 -0
- package/README.md +295 -0
- package/RELEASE.json +18 -0
- package/assets/brand-official/v1.0/logo/theus-lockup-negative-official.png +0 -0
- package/assets/brand-official/v1.0/logo/theus-lockup-primary-dark-official.png +0 -0
- package/assets/fonts/satoshi/satoshi-300.woff2 +0 -0
- package/assets/fonts/satoshi/satoshi-400.woff2 +0 -0
- package/assets/fonts/satoshi/satoshi-500.woff2 +0 -0
- package/assets/fonts/satoshi/satoshi-700.woff2 +0 -0
- package/assets/fonts/satoshi/satoshi-900.woff2 +0 -0
- package/assets/windows-store/Square150x150Logo.png +0 -0
- package/assets/windows-store/Square44x44Logo.png +0 -0
- package/assets/windows-store/StoreLogo.png +0 -0
- package/assets/windows-store/theus-store-icon-master.png +0 -0
- package/bin/theus +0 -0
- package/package.json +18 -0
- package/vendor/theus-arsenal/.arsenal-nombres-ola2.json +6 -0
- package/vendor/theus-arsenal/.arsenal-nombres-ola3.json +72 -0
- package/vendor/theus-arsenal/.mailmap +2 -0
- package/vendor/theus-arsenal/.theus-plugin/marketplace.json +25 -0
- package/vendor/theus-arsenal/.theus-plugin/plugin.json +20 -0
- package/vendor/theus-arsenal/AUTHORS.md +8 -0
- package/vendor/theus-arsenal/CLEANROOM_REPLACEMENT_PLAN.md +11 -0
- package/vendor/theus-arsenal/LICENSE +26 -0
- package/vendor/theus-arsenal/PROVENANCE.md +9 -0
- package/vendor/theus-arsenal/README.md +41 -0
- package/vendor/theus-arsenal/THIRD_PARTY.md +80 -0
- package/vendor/theus-arsenal/agents/actualizador-docs.md +123 -0
- package/vendor/theus-arsenal/agents/analista-comentarios.md +53 -0
- package/vendor/theus-arsenal/agents/analista-conversaciones.md +60 -0
- package/vendor/theus-arsenal/agents/analista-tests-pr.md +53 -0
- package/vendor/theus-arsenal/agents/analista-tipos.md +49 -0
- package/vendor/theus-arsenal/agents/arquitecto-accesibilidad.md +148 -0
- package/vendor/theus-arsenal/agents/arquitecto-codigo.md +79 -0
- package/vendor/theus-arsenal/agents/arquitecto-homelab.md +90 -0
- package/vendor/theus-arsenal/agents/arquitecto-redes.md +116 -0
- package/vendor/theus-arsenal/agents/arquitecto-sistemas.md +219 -0
- package/vendor/theus-arsenal/agents/bifurcador-opensource.md +206 -0
- package/vendor/theus-arsenal/agents/cazador-fallos-silenciosos.md +58 -0
- package/vendor/theus-arsenal/agents/consultor-documentacion.md +76 -0
- package/vendor/theus-arsenal/agents/diagnosticador-redes.md +135 -0
- package/vendor/theus-arsenal/agents/ejecutor-e2e.md +96 -0
- package/vendor/theus-arsenal/agents/empaquetador-opensource.md +257 -0
- package/vendor/theus-arsenal/agents/escaner-secretos.md +196 -0
- package/vendor/theus-arsenal/agents/especialista-seo.md +70 -0
- package/vendor/theus-arsenal/agents/estratega-marketing.md +158 -0
- package/vendor/theus-arsenal/agents/evaluador-agentes.md +214 -0
- package/vendor/theus-arsenal/agents/evaluador-harness.md +217 -0
- package/vendor/theus-arsenal/agents/explorador-codigo.md +79 -0
- package/vendor/theus-arsenal/agents/extractor-specs.md +214 -0
- package/vendor/theus-arsenal/agents/generador-harness.md +139 -0
- package/vendor/theus-arsenal/agents/guia-tdd.md +99 -0
- package/vendor/theus-arsenal/agents/jefe-de-gabinete.md +162 -0
- package/vendor/theus-arsenal/agents/limpiador-refactors.md +93 -0
- package/vendor/theus-arsenal/agents/optimizador-rendimiento.md +454 -0
- package/vendor/theus-arsenal/agents/planificador-harness.md +107 -0
- package/vendor/theus-arsenal/agents/planificador.md +221 -0
- package/vendor/theus-arsenal/agents/resolutor-apps-harmonyos.md +181 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-cpp.md +98 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-dart.md +209 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-django.md +253 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-go.md +102 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-java.md +274 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-kotlin.md +128 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-pytorch.md +128 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-react.md +214 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-rust.md +156 -0
- package/vendor/theus-arsenal/agents/resolutor-builds-swift.md +169 -0
- package/vendor/theus-arsenal/agents/resolutor-builds.md +122 -0
- package/vendor/theus-arsenal/agents/revisor-bd.md +97 -0
- package/vendor/theus-arsenal/agents/revisor-codigo.md +291 -0
- package/vendor/theus-arsenal/agents/revisor-config-red.md +116 -0
- package/vendor/theus-arsenal/agents/revisor-cpp.md +80 -0
- package/vendor/theus-arsenal/agents/revisor-csharp.md +109 -0
- package/vendor/theus-arsenal/agents/revisor-django.md +168 -0
- package/vendor/theus-arsenal/agents/revisor-fastapi.md +82 -0
- package/vendor/theus-arsenal/agents/revisor-flutter.md +251 -0
- package/vendor/theus-arsenal/agents/revisor-go.md +84 -0
- package/vendor/theus-arsenal/agents/revisor-java.md +192 -0
- package/vendor/theus-arsenal/agents/revisor-kotlin.md +171 -0
- package/vendor/theus-arsenal/agents/revisor-ml.md +159 -0
- package/vendor/theus-arsenal/agents/revisor-php.md +108 -0
- package/vendor/theus-arsenal/agents/revisor-python.md +106 -0
- package/vendor/theus-arsenal/agents/revisor-react.md +166 -0
- package/vendor/theus-arsenal/agents/revisor-rust.md +102 -0
- package/vendor/theus-arsenal/agents/revisor-seguridad.md +116 -0
- package/vendor/theus-arsenal/agents/revisor-software-clinico.md +95 -0
- package/vendor/theus-arsenal/agents/revisor-swift.md +115 -0
- package/vendor/theus-arsenal/agents/revisor-typescript.md +123 -0
- package/vendor/theus-arsenal/agents/revisor-vue.md +205 -0
- package/vendor/theus-arsenal/agents/simplificador-codigo.md +55 -0
- package/vendor/theus-arsenal/commands/actualizar-docs.md +88 -0
- package/vendor/theus-arsenal/commands/actualizar-mapas-codigo.md +78 -0
- package/vendor/theus-arsenal/commands/aprender-evaluar.md +109 -0
- package/vendor/theus-arsenal/commands/aprender.md +74 -0
- package/vendor/theus-arsenal/commands/arreglar-build.md +66 -0
- package/vendor/theus-arsenal/commands/bucle-multiperspectiva.md +153 -0
- package/vendor/theus-arsenal/commands/build-cpp.md +173 -0
- package/vendor/theus-arsenal/commands/build-flutter.md +164 -0
- package/vendor/theus-arsenal/commands/build-go.md +183 -0
- package/vendor/theus-arsenal/commands/build-gradle.md +75 -0
- package/vendor/theus-arsenal/commands/build-kotlin.md +176 -0
- package/vendor/theus-arsenal/commands/build-react.md +187 -0
- package/vendor/theus-arsenal/commands/build-rust.md +187 -0
- package/vendor/theus-arsenal/commands/campana-marketing.md +125 -0
- package/vendor/theus-arsenal/commands/checkpoint.md +78 -0
- package/vendor/theus-arsenal/commands/cobertura-tests.md +73 -0
- package/vendor/theus-arsenal/commands/configurar-gestor-paquetes.md +86 -0
- package/vendor/theus-arsenal/commands/consulta.md +164 -0
- package/vendor/theus-arsenal/commands/control-calidad.md +50 -0
- package/vendor/theus-arsenal/commands/crear-skill.md +77 -0
- package/vendor/theus-arsenal/commands/enrutar-modelo.md +30 -0
- package/vendor/theus-arsenal/commands/epica-desbloquear.md +17 -0
- package/vendor/theus-arsenal/commands/epica-descomponer.md +22 -0
- package/vendor/theus-arsenal/commands/epica-publicar.md +21 -0
- package/vendor/theus-arsenal/commands/epica-reclamar.md +25 -0
- package/vendor/theus-arsenal/commands/epica-revisar.md +22 -0
- package/vendor/theus-arsenal/commands/epica-sincronizar.md +21 -0
- package/vendor/theus-arsenal/commands/epica-validar.md +21 -0
- package/vendor/theus-arsenal/commands/evolucionar.md +176 -0
- package/vendor/theus-arsenal/commands/funcionalidad.md +49 -0
- package/vendor/theus-arsenal/commands/guardar-sesion.md +278 -0
- package/vendor/theus-arsenal/commands/harness-build.md +111 -0
- package/vendor/theus-arsenal/commands/harness-diseno.md +46 -0
- package/vendor/theus-arsenal/commands/informe-costos.md +90 -0
- package/vendor/theus-arsenal/commands/iniciar-bucle.md +36 -0
- package/vendor/theus-arsenal/commands/instintos-estado.md +53 -0
- package/vendor/theus-arsenal/commands/instintos-exportar.md +69 -0
- package/vendor/theus-arsenal/commands/instintos-importar.md +120 -0
- package/vendor/theus-arsenal/commands/lienzo-planes.md +48 -0
- package/vendor/theus-arsenal/commands/limpiar-refactor.md +84 -0
- package/vendor/theus-arsenal/commands/modo-seguro.md +96 -0
- package/vendor/theus-arsenal/commands/orq-agregar-funcionalidad.md +36 -0
- package/vendor/theus-arsenal/commands/orq-cambiar-funcionalidad.md +38 -0
- package/vendor/theus-arsenal/commands/orq-construir-mvp.md +36 -0
- package/vendor/theus-arsenal/commands/orq-corregir-defecto.md +40 -0
- package/vendor/theus-arsenal/commands/orq-refinar-codigo.md +44 -0
- package/vendor/theus-arsenal/commands/orq-revisar.md +135 -0
- package/vendor/theus-arsenal/commands/plan-prd.md +160 -0
- package/vendor/theus-arsenal/commands/plan.md +198 -0
- package/vendor/theus-arsenal/commands/podar.md +31 -0
- package/vendor/theus-arsenal/commands/pr.md +181 -0
- package/vendor/theus-arsenal/commands/promover.md +41 -0
- package/vendor/theus-arsenal/commands/proyectos.md +33 -0
- package/vendor/theus-arsenal/commands/prp-commit.md +112 -0
- package/vendor/theus-arsenal/commands/prp-implementar.md +385 -0
- package/vendor/theus-arsenal/commands/prp-planificar.md +501 -0
- package/vendor/theus-arsenal/commands/reanudar-sesion.md +160 -0
- package/vendor/theus-arsenal/commands/revisar-codigo.md +289 -0
- package/vendor/theus-arsenal/commands/revisar-cpp.md +132 -0
- package/vendor/theus-arsenal/commands/revisar-fastapi.md +39 -0
- package/vendor/theus-arsenal/commands/revisar-flutter.md +115 -0
- package/vendor/theus-arsenal/commands/revisar-go.md +148 -0
- package/vendor/theus-arsenal/commands/revisar-kotlin.md +140 -0
- package/vendor/theus-arsenal/commands/revisar-pr.md +37 -0
- package/vendor/theus-arsenal/commands/revisar-python.md +297 -0
- package/vendor/theus-arsenal/commands/revisar-react.md +170 -0
- package/vendor/theus-arsenal/commands/revisar-rust.md +142 -0
- package/vendor/theus-arsenal/commands/revisar-vue.md +174 -0
- package/vendor/theus-arsenal/commands/salud-skills.md +52 -0
- package/vendor/theus-arsenal/commands/sesiones.md +345 -0
- package/vendor/theus-arsenal/commands/test-cpp.md +252 -0
- package/vendor/theus-arsenal/commands/test-flutter.md +143 -0
- package/vendor/theus-arsenal/commands/test-go.md +268 -0
- package/vendor/theus-arsenal/commands/test-kotlin.md +312 -0
- package/vendor/theus-arsenal/commands/test-react.md +265 -0
- package/vendor/theus-arsenal/commands/test-rust.md +309 -0
- package/vendor/theus-arsenal/commands/vigilancia-canary.md +43 -0
- package/vendor/theus-arsenal/hooks/hooks.json +274 -0
- package/vendor/theus-arsenal/package.json +6 -0
- package/vendor/theus-arsenal/rules/angular/coding-style.md +182 -0
- package/vendor/theus-arsenal/rules/angular/hooks.md +25 -0
- package/vendor/theus-arsenal/rules/angular/patterns.md +249 -0
- package/vendor/theus-arsenal/rules/angular/security.md +87 -0
- package/vendor/theus-arsenal/rules/angular/testing.md +164 -0
- package/vendor/theus-arsenal/rules/arkts/coding-style.md +153 -0
- package/vendor/theus-arsenal/rules/arkts/hooks.md +80 -0
- package/vendor/theus-arsenal/rules/arkts/patterns.md +236 -0
- package/vendor/theus-arsenal/rules/arkts/security.md +141 -0
- package/vendor/theus-arsenal/rules/arkts/testing.md +126 -0
- package/vendor/theus-arsenal/rules/common/agents.md +49 -0
- package/vendor/theus-arsenal/rules/common/code-review.md +123 -0
- package/vendor/theus-arsenal/rules/common/coding-style.md +90 -0
- package/vendor/theus-arsenal/rules/common/development-workflow.md +44 -0
- package/vendor/theus-arsenal/rules/common/git-workflow.md +24 -0
- package/vendor/theus-arsenal/rules/common/hooks.md +32 -0
- package/vendor/theus-arsenal/rules/common/patterns.md +31 -0
- package/vendor/theus-arsenal/rules/common/performance.md +53 -0
- package/vendor/theus-arsenal/rules/common/security.md +29 -0
- package/vendor/theus-arsenal/rules/common/testing.md +57 -0
- package/vendor/theus-arsenal/rules/cpp/coding-style.md +44 -0
- package/vendor/theus-arsenal/rules/cpp/hooks.md +39 -0
- package/vendor/theus-arsenal/rules/cpp/patterns.md +51 -0
- package/vendor/theus-arsenal/rules/cpp/security.md +51 -0
- package/vendor/theus-arsenal/rules/cpp/testing.md +44 -0
- package/vendor/theus-arsenal/rules/csharp/coding-style.md +72 -0
- package/vendor/theus-arsenal/rules/csharp/hooks.md +25 -0
- package/vendor/theus-arsenal/rules/csharp/patterns.md +50 -0
- package/vendor/theus-arsenal/rules/csharp/security.md +58 -0
- package/vendor/theus-arsenal/rules/csharp/testing.md +50 -0
- package/vendor/theus-arsenal/rules/dart/coding-style.md +159 -0
- package/vendor/theus-arsenal/rules/dart/hooks.md +68 -0
- package/vendor/theus-arsenal/rules/dart/patterns.md +261 -0
- package/vendor/theus-arsenal/rules/dart/security.md +135 -0
- package/vendor/theus-arsenal/rules/dart/testing.md +215 -0
- package/vendor/theus-arsenal/rules/fsharp/coding-style.md +112 -0
- package/vendor/theus-arsenal/rules/fsharp/hooks.md +26 -0
- package/vendor/theus-arsenal/rules/fsharp/patterns.md +111 -0
- package/vendor/theus-arsenal/rules/fsharp/security.md +76 -0
- package/vendor/theus-arsenal/rules/fsharp/testing.md +62 -0
- package/vendor/theus-arsenal/rules/golang/coding-style.md +32 -0
- package/vendor/theus-arsenal/rules/golang/hooks.md +17 -0
- package/vendor/theus-arsenal/rules/golang/patterns.md +45 -0
- package/vendor/theus-arsenal/rules/golang/security.md +34 -0
- package/vendor/theus-arsenal/rules/golang/testing.md +31 -0
- package/vendor/theus-arsenal/rules/java/coding-style.md +114 -0
- package/vendor/theus-arsenal/rules/java/hooks.md +18 -0
- package/vendor/theus-arsenal/rules/java/patterns.md +147 -0
- package/vendor/theus-arsenal/rules/java/security.md +101 -0
- package/vendor/theus-arsenal/rules/java/testing.md +133 -0
- package/vendor/theus-arsenal/rules/kotlin/coding-style.md +86 -0
- package/vendor/theus-arsenal/rules/kotlin/hooks.md +17 -0
- package/vendor/theus-arsenal/rules/kotlin/patterns.md +146 -0
- package/vendor/theus-arsenal/rules/kotlin/security.md +82 -0
- package/vendor/theus-arsenal/rules/kotlin/testing.md +128 -0
- package/vendor/theus-arsenal/rules/nuxt/coding-style.md +47 -0
- package/vendor/theus-arsenal/rules/nuxt/hooks.md +39 -0
- package/vendor/theus-arsenal/rules/nuxt/patterns.md +54 -0
- package/vendor/theus-arsenal/rules/nuxt/security.md +48 -0
- package/vendor/theus-arsenal/rules/nuxt/testing.md +49 -0
- package/vendor/theus-arsenal/rules/php/coding-style.md +40 -0
- package/vendor/theus-arsenal/rules/php/hooks.md +24 -0
- package/vendor/theus-arsenal/rules/php/patterns.md +33 -0
- package/vendor/theus-arsenal/rules/php/security.md +37 -0
- package/vendor/theus-arsenal/rules/php/testing.md +38 -0
- package/vendor/theus-arsenal/rules/python/coding-style.md +42 -0
- package/vendor/theus-arsenal/rules/python/fastapi.md +58 -0
- package/vendor/theus-arsenal/rules/python/hooks.md +19 -0
- package/vendor/theus-arsenal/rules/python/patterns.md +39 -0
- package/vendor/theus-arsenal/rules/python/security.md +30 -0
- package/vendor/theus-arsenal/rules/python/testing.md +38 -0
- package/vendor/theus-arsenal/rules/react/coding-style.md +109 -0
- package/vendor/theus-arsenal/rules/react/hooks.md +187 -0
- package/vendor/theus-arsenal/rules/react/patterns.md +194 -0
- package/vendor/theus-arsenal/rules/react/security.md +180 -0
- package/vendor/theus-arsenal/rules/react/testing.md +208 -0
- package/vendor/theus-arsenal/rules/react-native/accessibility.md +55 -0
- package/vendor/theus-arsenal/rules/react-native/coding-style.md +71 -0
- package/vendor/theus-arsenal/rules/react-native/hooks.md +28 -0
- package/vendor/theus-arsenal/rules/react-native/patterns.md +88 -0
- package/vendor/theus-arsenal/rules/react-native/performance.md +45 -0
- package/vendor/theus-arsenal/rules/react-native/production-readiness.md +51 -0
- package/vendor/theus-arsenal/rules/react-native/security.md +43 -0
- package/vendor/theus-arsenal/rules/react-native/testing.md +52 -0
- package/vendor/theus-arsenal/rules/ruby/coding-style.md +46 -0
- package/vendor/theus-arsenal/rules/ruby/hooks.md +37 -0
- package/vendor/theus-arsenal/rules/ruby/patterns.md +44 -0
- package/vendor/theus-arsenal/rules/ruby/security.md +51 -0
- package/vendor/theus-arsenal/rules/ruby/testing.md +51 -0
- package/vendor/theus-arsenal/rules/rust/coding-style.md +151 -0
- package/vendor/theus-arsenal/rules/rust/hooks.md +16 -0
- package/vendor/theus-arsenal/rules/rust/patterns.md +168 -0
- package/vendor/theus-arsenal/rules/rust/security.md +141 -0
- package/vendor/theus-arsenal/rules/rust/testing.md +154 -0
- package/vendor/theus-arsenal/rules/swift/coding-style.md +47 -0
- package/vendor/theus-arsenal/rules/swift/hooks.md +20 -0
- package/vendor/theus-arsenal/rules/swift/patterns.md +66 -0
- package/vendor/theus-arsenal/rules/swift/security.md +33 -0
- package/vendor/theus-arsenal/rules/swift/testing.md +45 -0
- package/vendor/theus-arsenal/rules/typescript/coding-style.md +199 -0
- package/vendor/theus-arsenal/rules/typescript/hooks.md +22 -0
- package/vendor/theus-arsenal/rules/typescript/patterns.md +52 -0
- package/vendor/theus-arsenal/rules/typescript/security.md +28 -0
- package/vendor/theus-arsenal/rules/typescript/testing.md +18 -0
- package/vendor/theus-arsenal/rules/vue/coding-style.md +54 -0
- package/vendor/theus-arsenal/rules/vue/hooks.md +45 -0
- package/vendor/theus-arsenal/rules/vue/patterns.md +56 -0
- package/vendor/theus-arsenal/rules/vue/security.md +46 -0
- package/vendor/theus-arsenal/rules/vue/testing.md +53 -0
- package/vendor/theus-arsenal/rules/web/coding-style.md +108 -0
- package/vendor/theus-arsenal/rules/web/design-quality.md +75 -0
- package/vendor/theus-arsenal/rules/web/hooks.md +141 -0
- package/vendor/theus-arsenal/rules/web/patterns.md +91 -0
- package/vendor/theus-arsenal/rules/web/performance.md +76 -0
- package/vendor/theus-arsenal/rules/web/security.md +69 -0
- package/vendor/theus-arsenal/rules/web/testing.md +67 -0
- package/vendor/theus-arsenal/scripts/hooks/bash-hook-dispatcher.js +192 -0
- package/vendor/theus-arsenal/scripts/hooks/block-no-verify.js +556 -0
- package/vendor/theus-arsenal/scripts/hooks/check-console-log.js +92 -0
- package/vendor/theus-arsenal/scripts/hooks/check-hook-enabled.js +16 -0
- package/vendor/theus-arsenal/scripts/hooks/config-protection.js +171 -0
- package/vendor/theus-arsenal/scripts/hooks/design-quality-check.js +132 -0
- package/vendor/theus-arsenal/scripts/hooks/doc-file-warning.js +110 -0
- package/vendor/theus-arsenal/scripts/hooks/modo-seguro.js +158 -0
- package/vendor/theus-arsenal/scripts/hooks/notificacion-escritorio.js +208 -0
- package/vendor/theus-arsenal/scripts/hooks/plugin-hook-bootstrap.js +280 -0
- package/vendor/theus-arsenal/scripts/hooks/post-bash-command-log.js +87 -0
- package/vendor/theus-arsenal/scripts/hooks/post-bash-dispatcher.js +24 -0
- package/vendor/theus-arsenal/scripts/hooks/post-bash-pr-created.js +60 -0
- package/vendor/theus-arsenal/scripts/hooks/post-edit-accumulator.js +94 -0
- package/vendor/theus-arsenal/scripts/hooks/post-edit-console-warn.js +54 -0
- package/vendor/theus-arsenal/scripts/hooks/post-edit-format.js +110 -0
- package/vendor/theus-arsenal/scripts/hooks/post-edit-typecheck.js +98 -0
- package/vendor/theus-arsenal/scripts/hooks/pre-bash-commit-quality.js +447 -0
- package/vendor/theus-arsenal/scripts/hooks/pre-bash-dev-server-block.js +232 -0
- package/vendor/theus-arsenal/scripts/hooks/pre-bash-dispatcher.js +27 -0
- package/vendor/theus-arsenal/scripts/hooks/pre-compact.js +101 -0
- package/vendor/theus-arsenal/scripts/hooks/pretooluse-visible-output.js +49 -0
- package/vendor/theus-arsenal/scripts/hooks/quality-gate.js +168 -0
- package/vendor/theus-arsenal/scripts/hooks/run-with-flags.js +271 -0
- package/vendor/theus-arsenal/scripts/hooks/salud-mcp.js +749 -0
- package/vendor/theus-arsenal/scripts/hooks/seguimiento-costos.js +161 -0
- package/vendor/theus-arsenal/scripts/hooks/session-end.js +340 -0
- package/vendor/theus-arsenal/scripts/hooks/session-start.js +906 -0
- package/vendor/theus-arsenal/scripts/hooks/stop-format-typecheck.js +263 -0
- package/vendor/theus-arsenal/scripts/hooks/suggest-compact.js +286 -0
- package/vendor/theus-arsenal/scripts/hooks/theus-context-monitor.js +289 -0
- package/vendor/theus-arsenal/scripts/hooks/verificacion-factual.js +1278 -0
- package/vendor/theus-arsenal/scripts/lib/agent-data-home.js +96 -0
- package/vendor/theus-arsenal/scripts/lib/cost-estimate.js +66 -0
- package/vendor/theus-arsenal/scripts/lib/hook-flags.js +79 -0
- package/vendor/theus-arsenal/scripts/lib/llm-summary.js +185 -0
- package/vendor/theus-arsenal/scripts/lib/loopback-guard.js +54 -0
- package/vendor/theus-arsenal/scripts/lib/observer-sessions.js +237 -0
- package/vendor/theus-arsenal/scripts/lib/package-manager.d.ts +120 -0
- package/vendor/theus-arsenal/scripts/lib/package-manager.js +434 -0
- package/vendor/theus-arsenal/scripts/lib/path-safety.js +86 -0
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/markdown.js +285 -0
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/sdk.js +238 -0
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/server.js +534 -0
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/sessions.js +274 -0
- package/vendor/theus-arsenal/scripts/lib/plan-canvas/ui.js +546 -0
- package/vendor/theus-arsenal/scripts/lib/project-detect.js +451 -0
- package/vendor/theus-arsenal/scripts/lib/resolve-formatter.js +193 -0
- package/vendor/theus-arsenal/scripts/lib/resolve-theus-root.js +101 -0
- package/vendor/theus-arsenal/scripts/lib/session-aliases.d.ts +138 -0
- package/vendor/theus-arsenal/scripts/lib/session-aliases.js +483 -0
- package/vendor/theus-arsenal/scripts/lib/session-bridge.js +155 -0
- package/vendor/theus-arsenal/scripts/lib/session-manager.d.ts +137 -0
- package/vendor/theus-arsenal/scripts/lib/session-manager.js +555 -0
- package/vendor/theus-arsenal/scripts/lib/shell-split.js +86 -0
- package/vendor/theus-arsenal/scripts/lib/shell-substitution.js +501 -0
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/dashboard.js +414 -0
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/health.js +285 -0
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/index.js +22 -0
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/provenance.js +200 -0
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/tracker.js +157 -0
- package/vendor/theus-arsenal/scripts/lib/skill-evolution/versioning.js +246 -0
- package/vendor/theus-arsenal/scripts/lib/transcript-context.js +232 -0
- package/vendor/theus-arsenal/scripts/lib/utils.d.ts +205 -0
- package/vendor/theus-arsenal/scripts/lib/utils.js +658 -0
- package/vendor/theus-arsenal/scripts/plan-canvas.js +341 -0
- package/vendor/theus-arsenal/scripts/setup-package-manager.js +46 -0
- package/vendor/theus-arsenal/scripts/skills-health.js +143 -0
- package/vendor/theus-arsenal/skills/a11y-frontend/SKILL.md +444 -0
- package/vendor/theus-arsenal/skills/accesibilidad/SKILL.md +144 -0
- package/vendor/theus-arsenal/skills/acelerador-throughput-datos/SKILL.md +72 -0
- package/vendor/theus-arsenal/skills/agente-scraper-datos/SKILL.md +771 -0
- package/vendor/theus-arsenal/skills/analisis-plataformas-competencia/SKILL.md +137 -0
- package/vendor/theus-arsenal/skills/api-x/SKILL.md +233 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/SKILL.md +335 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/observer-loop.sh +374 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/observer.md +188 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/session-guardian.sh +153 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/start-observer.sh +253 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/config.json +8 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/hooks/observe.sh +594 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/detect-project.sh +325 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/instinct-cli.py +1918 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/lib/arsenal-dir.sh +23 -0
- package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/test_parse_instinct.py +1420 -0
- package/vendor/theus-arsenal/skills/arquitectura-hexagonal/SKILL.md +275 -0
- package/vendor/theus-arsenal/skills/arquitectura-limpia-android/SKILL.md +340 -0
- package/vendor/theus-arsenal/skills/arquitectura-pipelines-recomendacion/SKILL.md +112 -0
- package/vendor/theus-arsenal/skills/atlas-datos-prediccion/SKILL.md +53 -0
- package/vendor/theus-arsenal/skills/auditoria-arquitectura-agentes/SKILL.md +257 -0
- package/vendor/theus-arsenal/skills/auditoria-produccion/SKILL.md +180 -0
- package/vendor/theus-arsenal/skills/auditoria-rutas-clic/SKILL.md +243 -0
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/SKILL.md +180 -0
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/examples/high-score-example.md +89 -0
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/examples/low-score-example.md +87 -0
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/references/evaluation-criteria.md +71 -0
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/references/hook-integration.md +90 -0
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/scripts/evaluate.py +409 -0
- package/vendor/theus-arsenal/skills/autoevaluacion-agente/templates/evaluation-report.md +86 -0
- package/vendor/theus-arsenal/skills/automatizacion-ssh-netmiko/SKILL.md +176 -0
- package/vendor/theus-arsenal/skills/base-datos-pubmed/SKILL.md +174 -0
- package/vendor/theus-arsenal/skills/base-datos-uspto/SKILL.md +173 -0
- package/vendor/theus-arsenal/skills/benchmark/SKILL.md +92 -0
- package/vendor/theus-arsenal/skills/bitacora-crecimiento/SKILL.md +120 -0
- package/vendor/theus-arsenal/skills/bucle-verificacion/SKILL.md +125 -0
- package/vendor/theus-arsenal/skills/buscar-primero/SKILL.md +184 -0
- package/vendor/theus-arsenal/skills/busqueda-exa/SKILL.md +111 -0
- package/vendor/theus-arsenal/skills/cache-por-hash/SKILL.md +160 -0
- package/vendor/theus-arsenal/skills/campana-marketing/SKILL.md +118 -0
- package/vendor/theus-arsenal/skills/capacidad-producto/SKILL.md +138 -0
- package/vendor/theus-arsenal/skills/cazador-vulnerabilidades/SKILL.md +104 -0
- package/vendor/theus-arsenal/skills/compactacion-estrategica/SKILL.md +115 -0
- package/vendor/theus-arsenal/skills/comparador-baskets-prediccion/SKILL.md +69 -0
- package/vendor/theus-arsenal/skills/compras-energia/SKILL.md +206 -0
- package/vendor/theus-arsenal/skills/concurrencia-swift-6-2/SKILL.md +224 -0
- package/vendor/theus-arsenal/skills/consejo/SKILL.md +201 -0
- package/vendor/theus-arsenal/skills/construccion-harness-agentes/SKILL.md +78 -0
- package/vendor/theus-arsenal/skills/constructor-conectores/SKILL.md +119 -0
- package/vendor/theus-arsenal/skills/constructor-equipos/SKILL.md +169 -0
- package/vendor/theus-arsenal/skills/consulta-documentacion/SKILL.md +92 -0
- package/vendor/theus-arsenal/skills/consultas-genomicas-gget/SKILL.md +170 -0
- package/vendor/theus-arsenal/skills/contacto-inversores/SKILL.md +95 -0
- package/vendor/theus-arsenal/skills/corrutinas-flows-kotlin/SKILL.md +284 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/SKILL.md +46 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/3d.md +86 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/animations.md +29 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets/charts-bar-chart.tsx +173 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets/text-animations-typewriter.tsx +100 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets/text-animations-word-highlight.tsx +108 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets.md +78 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/audio.md +172 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/calculate-metadata.md +104 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/can-decode.md +75 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/charts.md +58 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/compositions.md +146 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/display-captions.md +126 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/extract-frames.md +229 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/fonts.md +152 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/get-audio-duration.md +58 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/get-video-dimensions.md +68 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/get-video-duration.md +58 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/gifs.md +138 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/images.md +130 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/import-srt-captions.md +67 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/lottie.md +67 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/measuring-dom-nodes.md +34 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/measuring-text.md +143 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/sequencing.md +106 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/tailwind.md +11 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/text-animations.md +20 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/timing.md +179 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/transcribe-captions.md +19 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/transitions.md +122 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/trimming.md +52 -0
- package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/videos.md +171 -0
- package/vendor/theus-arsenal/skills/cumplimiento-aduanero/SKILL.md +270 -0
- package/vendor/theus-arsenal/skills/cumplimiento-hipaa/SKILL.md +78 -0
- package/vendor/theus-arsenal/skills/datos-sensibles-salud/SKILL.md +149 -0
- package/vendor/theus-arsenal/skills/decimales-tokens-evm/SKILL.md +128 -0
- package/vendor/theus-arsenal/skills/decisiones-arquitectura/SKILL.md +206 -0
- package/vendor/theus-arsenal/skills/demos-ui/SKILL.md +469 -0
- package/vendor/theus-arsenal/skills/desarrollo-por-intencion/SKILL.md +369 -0
- package/vendor/theus-arsenal/skills/descubrimiento-marca/SKILL.md +149 -0
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/10_proposito-porque.md +42 -0
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/20_posicionamiento.md +47 -0
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/30_audiencia-nicho.md +53 -0
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/40_personalidad-arquetipo.md +61 -0
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/50_voz-tono.md +62 -0
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/60_narrativa-historia.md +54 -0
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/70_tension-fundador.md +50 -0
- package/vendor/theus-arsenal/skills/descubrimiento-marca/references/90_SINTESIS.md +133 -0
- package/vendor/theus-arsenal/skills/descubrimiento-plugins-laravel/SKILL.md +230 -0
- package/vendor/theus-arsenal/skills/destilado-reglas/SKILL.md +263 -0
- package/vendor/theus-arsenal/skills/destilado-reglas/scripts/scan-rules.sh +58 -0
- package/vendor/theus-arsenal/skills/destilado-reglas/scripts/scan-skills.sh +129 -0
- package/vendor/theus-arsenal/skills/diagnostico-bgp/SKILL.md +170 -0
- package/vendor/theus-arsenal/skills/direccion-estetica/SKILL.md +220 -0
- package/vendor/theus-arsenal/skills/direccion-estetica/references/taxonomia-generos.md +89 -0
- package/vendor/theus-arsenal/skills/diseno-api/SKILL.md +522 -0
- package/vendor/theus-arsenal/skills/diseno-liquid-glass/SKILL.md +282 -0
- package/vendor/theus-arsenal/skills/e2e-escritorio-windows/SKILL.md +879 -0
- package/vendor/theus-arsenal/skills/edicion-video/SKILL.md +289 -0
- package/vendor/theus-arsenal/skills/enfoque-producto/SKILL.md +91 -0
- package/vendor/theus-arsenal/skills/entornos-flox/SKILL.md +493 -0
- package/vendor/theus-arsenal/skills/estandares-codigo/SKILL.md +548 -0
- package/vendor/theus-arsenal/skills/estandares-cpp/SKILL.md +727 -0
- package/vendor/theus-arsenal/skills/estandares-java/SKILL.md +389 -0
- package/vendor/theus-arsenal/skills/estilo-legado/SKILL.md +149 -0
- package/vendor/theus-arsenal/skills/estructura-informes-competencia/SKILL.md +95 -0
- package/vendor/theus-arsenal/skills/evaluacion-academica/SKILL.md +165 -0
- package/vendor/theus-arsenal/skills/explorador-skills/SKILL.md +129 -0
- package/vendor/theus-arsenal/skills/flujo-git/SKILL.md +714 -0
- package/vendor/theus-arsenal/skills/flujo-ingenieria-ml/SKILL.md +343 -0
- package/vendor/theus-arsenal/skills/flujo-tdd/SKILL.md +584 -0
- package/vendor/theus-arsenal/skills/forja-personas/SKILL.md +298 -0
- package/vendor/theus-arsenal/skills/forja-personas/gacha.py +224 -0
- package/vendor/theus-arsenal/skills/forja-personas/gacha.sh +5 -0
- package/vendor/theus-arsenal/skills/forja-personas/references/avatar-style.md +123 -0
- package/vendor/theus-arsenal/skills/forja-personas/references/boundary-rules.md +53 -0
- package/vendor/theus-arsenal/skills/forja-personas/references/error-handling.md +53 -0
- package/vendor/theus-arsenal/skills/forja-personas/references/identity-tension.md +48 -0
- package/vendor/theus-arsenal/skills/forja-personas/references/naming-system.md +39 -0
- package/vendor/theus-arsenal/skills/forja-personas/references/output-template.md +166 -0
- package/vendor/theus-arsenal/skills/fundamentos-animacion/SKILL.md +296 -0
- package/vendor/theus-arsenal/skills/generacion-iconos-ios/SKILL.md +156 -0
- package/vendor/theus-arsenal/skills/generacion-iconos-ios/scripts/generate_icons.swift +258 -0
- package/vendor/theus-arsenal/skills/generacion-iconos-ios/scripts/iconify_gen.sh +235 -0
- package/vendor/theus-arsenal/skills/gestion-excepciones-logisticas/SKILL.md +208 -0
- package/vendor/theus-arsenal/skills/gestion-transportistas/SKILL.md +204 -0
- package/vendor/theus-arsenal/skills/guia-adopcion-ml/SKILL.md +64 -0
- package/vendor/theus-arsenal/skills/harness-agente-autonomo/SKILL.md +252 -0
- package/vendor/theus-arsenal/skills/harness-eval-clinico/SKILL.md +212 -0
- package/vendor/theus-arsenal/skills/harness-evaluacion/SKILL.md +296 -0
- package/vendor/theus-arsenal/skills/harness-generador-evaluador/SKILL.md +254 -0
- package/vendor/theus-arsenal/skills/homelab-diseno-red/SKILL.md +120 -0
- package/vendor/theus-arsenal/skills/homelab-dns-pihole/SKILL.md +264 -0
- package/vendor/theus-arsenal/skills/homelab-preparacion-red/SKILL.md +144 -0
- package/vendor/theus-arsenal/skills/homelab-segmentacion-vlan/SKILL.md +307 -0
- package/vendor/theus-arsenal/skills/homelab-vpn-wireguard/SKILL.md +299 -0
- package/vendor/theus-arsenal/skills/ingenieria-agentica/SKILL.md +96 -0
- package/vendor/theus-arsenal/skills/inspeccion-animaciones-blender/SKILL.md +164 -0
- package/vendor/theus-arsenal/skills/instaladores-python/SKILL.md +820 -0
- package/vendor/theus-arsenal/skills/integracion-jira/SKILL.md +307 -0
- package/vendor/theus-arsenal/skills/inteligencia-leads/SKILL.md +312 -0
- package/vendor/theus-arsenal/skills/inteligencia-leads/agents/agente-enriquecimiento.md +87 -0
- package/vendor/theus-arsenal/skills/inteligencia-leads/agents/mapeador-mutuos.md +76 -0
- package/vendor/theus-arsenal/skills/inteligencia-leads/agents/puntuador-senales.md +60 -0
- package/vendor/theus-arsenal/skills/inteligencia-leads/agents/redactor-outreach.md +102 -0
- package/vendor/theus-arsenal/skills/inteligencia-mercados-prediccion/SKILL.md +53 -0
- package/vendor/theus-arsenal/skills/introspeccion-agente/SKILL.md +150 -0
- package/vendor/theus-arsenal/skills/inventario-skills/SKILL.md +194 -0
- package/vendor/theus-arsenal/skills/inventario-skills/scripts/quick-diff.sh +87 -0
- package/vendor/theus-arsenal/skills/inventario-skills/scripts/save-results.sh +57 -0
- package/vendor/theus-arsenal/skills/inventario-skills/scripts/scan.sh +170 -0
- package/vendor/theus-arsenal/skills/investigacion-mercado/SKILL.md +87 -0
- package/vendor/theus-arsenal/skills/investigacion-oraculos-prediccion/SKILL.md +59 -0
- package/vendor/theus-arsenal/skills/investigacion-profunda/SKILL.md +161 -0
- package/vendor/theus-arsenal/skills/keccak256-nodejs/SKILL.md +100 -0
- package/vendor/theus-arsenal/skills/libro-decisiones-recursivo/SKILL.md +82 -0
- package/vendor/theus-arsenal/skills/lienzo-planes/SKILL.md +111 -0
- package/vendor/theus-arsenal/skills/limpieza-configuracion/SKILL.md +116 -0
- package/vendor/theus-arsenal/skills/logistica-inversa-devoluciones/SKILL.md +241 -0
- package/vendor/theus-arsenal/skills/manejo-errores/SKILL.md +375 -0
- package/vendor/theus-arsenal/skills/materiales-inversores/SKILL.md +101 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/SKILL.md +170 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/forget.mjs +44 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/info.mjs +24 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/init.mjs +152 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/list.mjs +40 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/migrate.mjs +214 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/resume.mjs +36 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/save.mjs +210 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/shared.mjs +402 -0
- package/vendor/theus-arsenal/skills/memoria-por-proyecto/hooks/session-start.mjs +238 -0
- package/vendor/theus-arsenal/skills/metodologia-benchmarks/SKILL.md +131 -0
- package/vendor/theus-arsenal/skills/migraciones-bd/SKILL.md +430 -0
- package/vendor/theus-arsenal/skills/modelos-fundacionales-en-dispositivo/SKILL.md +244 -0
- package/vendor/theus-arsenal/skills/modo-seguro/SKILL.md +86 -0
- package/vendor/theus-arsenal/skills/motion-avanzado/SKILL.md +592 -0
- package/vendor/theus-arsenal/skills/motor-de-contenido/SKILL.md +136 -0
- package/vendor/theus-arsenal/skills/no-conformidades-calidad/SKILL.md +249 -0
- package/vendor/theus-arsenal/skills/onboarding-codigo/SKILL.md +244 -0
- package/vendor/theus-arsenal/skills/operaciones-agentes-empresariales/SKILL.md +51 -0
- package/vendor/theus-arsenal/skills/operaciones-conocimiento/SKILL.md +159 -0
- package/vendor/theus-arsenal/skills/operaciones-correo/SKILL.md +123 -0
- package/vendor/theus-arsenal/skills/operaciones-facturacion/SKILL.md +142 -0
- package/vendor/theus-arsenal/skills/operaciones-flujo-proyectos/SKILL.md +110 -0
- package/vendor/theus-arsenal/skills/operaciones-github/SKILL.md +143 -0
- package/vendor/theus-arsenal/skills/operaciones-google-workspace/SKILL.md +100 -0
- package/vendor/theus-arsenal/skills/operaciones-investigacion/SKILL.md +124 -0
- package/vendor/theus-arsenal/skills/operaciones-mensajes/SKILL.md +103 -0
- package/vendor/theus-arsenal/skills/operaciones-terminal/SKILL.md +110 -0
- package/vendor/theus-arsenal/skills/optimizacion-benchmark/SKILL.md +70 -0
- package/vendor/theus-arsenal/skills/optimizacion-costos-llm/SKILL.md +182 -0
- package/vendor/theus-arsenal/skills/optimizador-conexiones/SKILL.md +191 -0
- package/vendor/theus-arsenal/skills/optimizador-paralelismo/SKILL.md +75 -0
- package/vendor/theus-arsenal/skills/optimizador-prompts/SKILL.md +374 -0
- package/vendor/theus-arsenal/skills/orq-agregar-funcionalidad/SKILL.md +37 -0
- package/vendor/theus-arsenal/skills/orq-cambiar-funcionalidad/SKILL.md +36 -0
- package/vendor/theus-arsenal/skills/orq-construir-mvp/SKILL.md +38 -0
- package/vendor/theus-arsenal/skills/orq-corregir-defecto/SKILL.md +36 -0
- package/vendor/theus-arsenal/skills/orq-pipeline/SKILL.md +134 -0
- package/vendor/theus-arsenal/skills/orq-refinar-codigo/SKILL.md +49 -0
- package/vendor/theus-arsenal/skills/orquestacion-equipos-agentes/SKILL.md +117 -0
- package/vendor/theus-arsenal/skills/pagos-agentes-x402/SKILL.md +237 -0
- package/vendor/theus-arsenal/skills/patrones-angular/SKILL.md +153 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/angular-animations.md +160 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/angular-aria.md +410 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/cli.md +86 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/component-harnesses.md +59 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/component-styling.md +91 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/components.md +117 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/creating-services.md +97 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/data-resolvers.md +69 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/define-routes.md +67 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/defining-providers.md +72 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/di-fundamentals.md +120 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/e2e-testing.md +56 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/effects.md +83 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/hierarchical-injectors.md +43 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/host-elements.md +80 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/injection-context.md +63 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/inputs.md +101 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/linked-signal.md +59 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/loading-strategies.md +61 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/mcp.md +67 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/navigate-to-routes.md +69 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/outputs.md +86 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/reactive-forms.md +122 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/rendering-strategies.md +44 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/resource.md +77 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/route-animations.md +56 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/route-guards.md +52 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/router-lifecycle.md +45 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/router-testing.md +87 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/show-routes-with-outlets.md +68 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/signal-forms.md +795 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/signals-overview.md +94 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/tailwind-css.md +69 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/template-driven-forms.md +114 -0
- package/vendor/theus-arsenal/skills/patrones-angular/references/testing-fundamentals.md +65 -0
- package/vendor/theus-arsenal/skills/patrones-animacion/SKILL.md +432 -0
- package/vendor/theus-arsenal/skills/patrones-backend/SKILL.md +560 -0
- package/vendor/theus-arsenal/skills/patrones-cdss-clinico/SKILL.md +249 -0
- package/vendor/theus-arsenal/skills/patrones-cisco-ios/SKILL.md +148 -0
- package/vendor/theus-arsenal/skills/patrones-clickhouse/SKILL.md +443 -0
- package/vendor/theus-arsenal/skills/patrones-compose-multiplatform/SKILL.md +298 -0
- package/vendor/theus-arsenal/skills/patrones-dart-flutter/SKILL.md +566 -0
- package/vendor/theus-arsenal/skills/patrones-despliegue/SKILL.md +426 -0
- package/vendor/theus-arsenal/skills/patrones-django/SKILL.md +739 -0
- package/vendor/theus-arsenal/skills/patrones-django-celery/SKILL.md +456 -0
- package/vendor/theus-arsenal/skills/patrones-docker/SKILL.md +363 -0
- package/vendor/theus-arsenal/skills/patrones-dotnet/SKILL.md +321 -0
- package/vendor/theus-arsenal/skills/patrones-emr-clinico/SKILL.md +168 -0
- package/vendor/theus-arsenal/skills/patrones-fastapi/SKILL.md +513 -0
- package/vendor/theus-arsenal/skills/patrones-frontend/SKILL.md +655 -0
- package/vendor/theus-arsenal/skills/patrones-go/SKILL.md +674 -0
- package/vendor/theus-arsenal/skills/patrones-jpa/SKILL.md +156 -0
- package/vendor/theus-arsenal/skills/patrones-kotlin/SKILL.md +717 -0
- package/vendor/theus-arsenal/skills/patrones-kotlin-exposed/SKILL.md +724 -0
- package/vendor/theus-arsenal/skills/patrones-kotlin-ktor/SKILL.md +694 -0
- package/vendor/theus-arsenal/skills/patrones-kubernetes/SKILL.md +754 -0
- package/vendor/theus-arsenal/skills/patrones-laravel/SKILL.md +414 -0
- package/vendor/theus-arsenal/skills/patrones-mcp/SKILL.md +66 -0
- package/vendor/theus-arsenal/skills/patrones-mysql/SKILL.md +420 -0
- package/vendor/theus-arsenal/skills/patrones-nestjs/SKILL.md +229 -0
- package/vendor/theus-arsenal/skills/patrones-nextjs/SKILL.md +56 -0
- package/vendor/theus-arsenal/skills/patrones-nuxt4/SKILL.md +99 -0
- package/vendor/theus-arsenal/skills/patrones-perl/SKILL.md +508 -0
- package/vendor/theus-arsenal/skills/patrones-postgres/SKILL.md +141 -0
- package/vendor/theus-arsenal/skills/patrones-prisma/SKILL.md +399 -0
- package/vendor/theus-arsenal/skills/patrones-python/SKILL.md +750 -0
- package/vendor/theus-arsenal/skills/patrones-pytorch/SKILL.md +400 -0
- package/vendor/theus-arsenal/skills/patrones-quarkus/SKILL.md +729 -0
- package/vendor/theus-arsenal/skills/patrones-react/SKILL.md +339 -0
- package/vendor/theus-arsenal/skills/patrones-react-native/SKILL.md +325 -0
- package/vendor/theus-arsenal/skills/patrones-redis/SKILL.md +401 -0
- package/vendor/theus-arsenal/skills/patrones-rust/SKILL.md +504 -0
- package/vendor/theus-arsenal/skills/patrones-springboot/SKILL.md +314 -0
- package/vendor/theus-arsenal/skills/patrones-swiftui/SKILL.md +261 -0
- package/vendor/theus-arsenal/skills/patrones-tinystruct/SKILL.md +281 -0
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/architecture.md +90 -0
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/data-handling.md +60 -0
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/database.md +99 -0
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/routing.md +64 -0
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/system-usage.md +97 -0
- package/vendor/theus-arsenal/skills/patrones-tinystruct/references/testing.md +72 -0
- package/vendor/theus-arsenal/skills/patrones-vite/SKILL.md +449 -0
- package/vendor/theus-arsenal/skills/patrones-vue/SKILL.md +469 -0
- package/vendor/theus-arsenal/skills/persistencia-actores-swift/SKILL.md +148 -0
- package/vendor/theus-arsenal/skills/pipeline-opensource/SKILL.md +254 -0
- package/vendor/theus-arsenal/skills/planificacion-demanda-inventario/SKILL.md +236 -0
- package/vendor/theus-arsenal/skills/planificador-trades-prediccion/SKILL.md +60 -0
- package/vendor/theus-arsenal/skills/plano-tecnico/SKILL.md +102 -0
- package/vendor/theus-arsenal/skills/presentaciones-html/SKILL.md +189 -0
- package/vendor/theus-arsenal/skills/presentaciones-html/STYLE_PRESETS.md +330 -0
- package/vendor/theus-arsenal/skills/presentaciones-html/animation-patterns.md +122 -0
- package/vendor/theus-arsenal/skills/presentaciones-html/html-template.md +419 -0
- package/vendor/theus-arsenal/skills/presentaciones-html/scripts/export-pdf.sh +418 -0
- package/vendor/theus-arsenal/skills/presentaciones-html/scripts/extract-pptx.py +96 -0
- package/vendor/theus-arsenal/skills/presentaciones-html/viewport-base.css +153 -0
- package/vendor/theus-arsenal/skills/presupuesto-contexto/SKILL.md +263 -0
- package/vendor/theus-arsenal/skills/procesamiento-documentos-nutrient/SKILL.md +168 -0
- package/vendor/theus-arsenal/skills/programacion-produccion/SKILL.md +220 -0
- package/vendor/theus-arsenal/skills/publicacion-cruzada/SKILL.md +117 -0
- package/vendor/theus-arsenal/skills/publicador-social/SKILL.md +121 -0
- package/vendor/theus-arsenal/skills/puerta-de-entrega/SKILL.md +164 -0
- package/vendor/theus-arsenal/skills/puerta-de-entrega/hooks/puerta-entrega.py +242 -0
- package/vendor/theus-arsenal/skills/pulir-interfaces/SKILL.md +126 -0
- package/vendor/theus-arsenal/skills/qa-navegador/SKILL.md +103 -0
- package/vendor/theus-arsenal/skills/ranking-grafo-social/SKILL.md +153 -0
- package/vendor/theus-arsenal/skills/recuperacion-iterativa/SKILL.md +236 -0
- package/vendor/theus-arsenal/skills/redaccion-articulos/SKILL.md +81 -0
- package/vendor/theus-arsenal/skills/regex-vs-llm/SKILL.md +221 -0
- package/vendor/theus-arsenal/skills/regresion-codigo-ia/SKILL.md +388 -0
- package/vendor/theus-arsenal/skills/rendimiento-react/SKILL.md +567 -0
- package/vendor/theus-arsenal/skills/revision-codigo-flutter-dart/SKILL.md +442 -0
- package/vendor/theus-arsenal/skills/revision-literatura-cientifica/SKILL.md +191 -0
- package/vendor/theus-arsenal/skills/revision-multiperspectiva/SKILL.md +302 -0
- package/vendor/theus-arsenal/skills/revision-riesgo-prediccion/SKILL.md +56 -0
- package/vendor/theus-arsenal/skills/revision-seguridad/SKILL.md +505 -0
- package/vendor/theus-arsenal/skills/revision-seguridad/cloud-infrastructure-security.md +361 -0
- package/vendor/theus-arsenal/skills/runtime-bun/SKILL.md +83 -0
- package/vendor/theus-arsenal/skills/salud-codigo-codescene/SKILL.md +163 -0
- package/vendor/theus-arsenal/skills/salud-interfaces-red/SKILL.md +143 -0
- package/vendor/theus-arsenal/skills/seguimiento-costos/SKILL.md +122 -0
- package/vendor/theus-arsenal/skills/seguridad-agentes-trading/SKILL.md +145 -0
- package/vendor/theus-arsenal/skills/seguridad-amm-defi/SKILL.md +166 -0
- package/vendor/theus-arsenal/skills/seguridad-django/SKILL.md +648 -0
- package/vendor/theus-arsenal/skills/seguridad-laravel/SKILL.md +945 -0
- package/vendor/theus-arsenal/skills/seguridad-perl/SKILL.md +507 -0
- package/vendor/theus-arsenal/skills/seguridad-quarkus/SKILL.md +474 -0
- package/vendor/theus-arsenal/skills/seguridad-springboot/SKILL.md +279 -0
- package/vendor/theus-arsenal/skills/seo/SKILL.md +166 -0
- package/vendor/theus-arsenal/skills/sistema-diseno/SKILL.md +81 -0
- package/vendor/theus-arsenal/skills/sistema-operativo-agentico/SKILL.md +375 -0
- package/vendor/theus-arsenal/skills/sistemas-latencia-critica/SKILL.md +65 -0
- package/vendor/theus-arsenal/skills/tdd-django/SKILL.md +735 -0
- package/vendor/theus-arsenal/skills/tdd-laravel/SKILL.md +673 -0
- package/vendor/theus-arsenal/skills/tdd-quarkus/SKILL.md +817 -0
- package/vendor/theus-arsenal/skills/tdd-springboot/SKILL.md +165 -0
- package/vendor/theus-arsenal/skills/testing-cpp/SKILL.md +328 -0
- package/vendor/theus-arsenal/skills/testing-csharp/SKILL.md +321 -0
- package/vendor/theus-arsenal/skills/testing-e2e/SKILL.md +325 -0
- package/vendor/theus-arsenal/skills/testing-go/SKILL.md +719 -0
- package/vendor/theus-arsenal/skills/testing-kotlin/SKILL.md +829 -0
- package/vendor/theus-arsenal/skills/testing-perl/SKILL.md +479 -0
- package/vendor/theus-arsenal/skills/testing-protocolos-di-swift/SKILL.md +196 -0
- package/vendor/theus-arsenal/skills/testing-python/SKILL.md +815 -0
- package/vendor/theus-arsenal/skills/testing-react/SKILL.md +421 -0
- package/vendor/theus-arsenal/skills/testing-rust/SKILL.md +506 -0
- package/vendor/theus-arsenal/skills/tours-de-codigo/SKILL.md +252 -0
- package/vendor/theus-arsenal/skills/traduccion-documentos-visado/SKILL.md +121 -0
- package/vendor/theus-arsenal/skills/ui-a-vue/SKILL.md +141 -0
- package/vendor/theus-arsenal/skills/validacion-config-red/SKILL.md +211 -0
- package/vendor/theus-arsenal/skills/verificacion-django/SKILL.md +470 -0
- package/vendor/theus-arsenal/skills/verificacion-factual/SKILL.md +142 -0
- package/vendor/theus-arsenal/skills/verificacion-laravel/SKILL.md +184 -0
- package/vendor/theus-arsenal/skills/verificacion-quarkus/SKILL.md +485 -0
- package/vendor/theus-arsenal/skills/verificacion-springboot/SKILL.md +237 -0
- package/vendor/theus-arsenal/skills/videodb/SKILL.md +374 -0
- package/vendor/theus-arsenal/skills/videodb/reference/api-reference.md +550 -0
- package/vendor/theus-arsenal/skills/videodb/reference/capture-reference.md +407 -0
- package/vendor/theus-arsenal/skills/videodb/reference/capture.md +101 -0
- package/vendor/theus-arsenal/skills/videodb/reference/editor.md +443 -0
- package/vendor/theus-arsenal/skills/videodb/reference/generative.md +331 -0
- package/vendor/theus-arsenal/skills/videodb/reference/rtstream-reference.md +564 -0
- package/vendor/theus-arsenal/skills/videodb/reference/rtstream.md +65 -0
- package/vendor/theus-arsenal/skills/videodb/reference/search.md +230 -0
- package/vendor/theus-arsenal/skills/videodb/reference/streaming.md +406 -0
- package/vendor/theus-arsenal/skills/videodb/reference/use-cases.md +118 -0
- package/vendor/theus-arsenal/skills/videodb/scripts/ws_listener.py +279 -0
- package/vendor/theus-arsenal/skills/videos-manim/SKILL.md +91 -0
- package/vendor/theus-arsenal/skills/videos-manim/assets/network_graph_scene.py +52 -0
- package/vendor/theus-arsenal/skills/vigilancia-canary/SKILL.md +108 -0
- package/vendor/theus-arsenal/skills/voz-de-marca/SKILL.md +106 -0
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* MCP health-check hook.
|
|
6
|
+
*
|
|
7
|
+
* Compatible con los eventos de hook del motor de Theus:
|
|
8
|
+
* - PreToolUse: probe MCP server health before MCP tool execution
|
|
9
|
+
* - PostToolUseFailure: mark unhealthy servers, attempt reconnect, and re-probe
|
|
10
|
+
*
|
|
11
|
+
* The hook persists health state outside the conversation context so it
|
|
12
|
+
* survives compaction and later turns.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const os = require('os');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const http = require('http');
|
|
19
|
+
const https = require('https');
|
|
20
|
+
const { spawn, spawnSync } = require('child_process');
|
|
21
|
+
|
|
22
|
+
const MAX_STDIN = 1024 * 1024;
|
|
23
|
+
const DEFAULT_TTL_MS = 2 * 60 * 1000;
|
|
24
|
+
const DEFAULT_TIMEOUT_MS = 5000;
|
|
25
|
+
const DEFAULT_BACKOFF_MS = 30 * 1000;
|
|
26
|
+
const MAX_BACKOFF_MS = 10 * 60 * 1000;
|
|
27
|
+
// The preflight HTTP probe only checks reachability; it does not have access to
|
|
28
|
+
// el token OAuth almacenado del CLI. Trata las respuestas con auth como
|
|
29
|
+
// reachable so the real MCP client can attempt the authenticated call. A
|
|
30
|
+
// Streamable HTTP MCP server can also return 406 to a bare GET that omits
|
|
31
|
+
// Accept: text/event-stream; that still proves the endpoint is alive.
|
|
32
|
+
const HEALTHY_HTTP_CODES = new Set([200, 201, 202, 204, 301, 302, 303, 304, 307, 308, 400, 401, 403, 405, 406]);
|
|
33
|
+
const RECONNECT_STATUS_CODES = new Set([401, 403, 429, 503]);
|
|
34
|
+
const FAILURE_PATTERNS = [
|
|
35
|
+
{ code: 401, pattern: /\b401\b|unauthori[sz]ed|auth(?:entication)?\s+(?:failed|expired|invalid)/i },
|
|
36
|
+
{ code: 403, pattern: /\b403\b|forbidden|permission denied/i },
|
|
37
|
+
{ code: 429, pattern: /\b429\b|rate limit|too many requests/i },
|
|
38
|
+
{ code: 503, pattern: /\b503\b|service unavailable|overloaded|temporarily unavailable/i },
|
|
39
|
+
{ code: 'transport', pattern: /ECONNREFUSED|ENOTFOUND|EAI_AGAIN|timed? out|socket hang up|connection (?:failed|lost|reset|closed)/i }
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
function envNumber(name, fallback) {
|
|
43
|
+
const value = Number(process.env[name]);
|
|
44
|
+
return Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function stateFilePath() {
|
|
48
|
+
if (process.env.THEUS_SALUD_MCP_STATE_PATH) {
|
|
49
|
+
return path.resolve(process.env.THEUS_SALUD_MCP_STATE_PATH);
|
|
50
|
+
}
|
|
51
|
+
return path.join(require('../lib/agent-data-home').resolveAgentDataHome(), 'salud-mcp', 'cache-salud.json');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function configPaths() {
|
|
55
|
+
if (process.env.THEUS_SALUD_MCP_CONFIG_PATH) {
|
|
56
|
+
return process.env.THEUS_SALUD_MCP_CONFIG_PATH
|
|
57
|
+
.split(path.delimiter)
|
|
58
|
+
.map(entry => entry.trim())
|
|
59
|
+
.filter(Boolean)
|
|
60
|
+
.map(entry => path.resolve(entry));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const cwd = process.cwd();
|
|
64
|
+
const home = os.homedir();
|
|
65
|
+
|
|
66
|
+
return [
|
|
67
|
+
path.join(cwd, '.mcp.json'),
|
|
68
|
+
path.join(cwd, '.theus', 'settings.json'),
|
|
69
|
+
path.join(home, '.theus.json'),
|
|
70
|
+
path.join(home, '.theus', 'settings.json')
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function readJsonFile(filePath) {
|
|
75
|
+
try {
|
|
76
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
77
|
+
} catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function loadState(filePath) {
|
|
83
|
+
const state = readJsonFile(filePath);
|
|
84
|
+
if (!state || typeof state !== 'object' || Array.isArray(state)) {
|
|
85
|
+
return { version: 1, servers: {} };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!state.servers || typeof state.servers !== 'object' || Array.isArray(state.servers)) {
|
|
89
|
+
state.servers = {};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return state;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function saveState(filePath, state) {
|
|
96
|
+
try {
|
|
97
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
98
|
+
fs.writeFileSync(filePath, JSON.stringify(state, null, 2));
|
|
99
|
+
} catch {
|
|
100
|
+
// Never block the hook on state persistence errors.
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function readRawStdin() {
|
|
105
|
+
return new Promise(resolve => {
|
|
106
|
+
let raw = '';
|
|
107
|
+
let truncated = /^(1|true|yes)$/i.test(String(process.env.THEUS_HOOK_INPUT_TRUNCATED || ''));
|
|
108
|
+
process.stdin.setEncoding('utf8');
|
|
109
|
+
process.stdin.on('data', chunk => {
|
|
110
|
+
if (raw.length < MAX_STDIN) {
|
|
111
|
+
const remaining = MAX_STDIN - raw.length;
|
|
112
|
+
raw += chunk.substring(0, remaining);
|
|
113
|
+
if (chunk.length > remaining) {
|
|
114
|
+
truncated = true;
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
truncated = true;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
process.stdin.on('end', () => resolve({ raw, truncated }));
|
|
121
|
+
process.stdin.on('error', () => resolve({ raw, truncated }));
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function safeParse(raw) {
|
|
126
|
+
try {
|
|
127
|
+
return raw.trim() ? JSON.parse(raw) : {};
|
|
128
|
+
} catch {
|
|
129
|
+
return {};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function extractMcpTarget(input) {
|
|
134
|
+
const toolName = String(input.tool_name || input.name || '');
|
|
135
|
+
const explicitServer = input.server
|
|
136
|
+
|| input.mcp_server
|
|
137
|
+
|| input.tool_input?.server
|
|
138
|
+
|| input.tool_input?.mcp_server
|
|
139
|
+
|| input.tool_input?.connector
|
|
140
|
+
|| null;
|
|
141
|
+
const explicitTool = input.tool
|
|
142
|
+
|| input.mcp_tool
|
|
143
|
+
|| input.tool_input?.tool
|
|
144
|
+
|| input.tool_input?.mcp_tool
|
|
145
|
+
|| null;
|
|
146
|
+
|
|
147
|
+
if (explicitServer) {
|
|
148
|
+
return {
|
|
149
|
+
server: String(explicitServer),
|
|
150
|
+
tool: explicitTool ? String(explicitTool) : toolName
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!toolName.startsWith('mcp__')) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const segments = toolName.slice(5).split('__');
|
|
159
|
+
if (segments.length < 2 || !segments[0]) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
server: segments[0],
|
|
165
|
+
tool: segments.slice(1).join('__')
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function extractMcpTargetFromRaw(raw) {
|
|
170
|
+
const toolNameMatch = raw.match(/"(?:tool_name|name)"\s*:\s*"([^"]+)"/);
|
|
171
|
+
const serverMatch = raw.match(/"(?:server|mcp_server|connector)"\s*:\s*"([^"]+)"/);
|
|
172
|
+
const toolMatch = raw.match(/"(?:tool|mcp_tool)"\s*:\s*"([^"]+)"/);
|
|
173
|
+
|
|
174
|
+
return extractMcpTarget({
|
|
175
|
+
tool_name: toolNameMatch ? toolNameMatch[1] : '',
|
|
176
|
+
server: serverMatch ? serverMatch[1] : undefined,
|
|
177
|
+
tool: toolMatch ? toolMatch[1] : undefined
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function resolveServerConfig(serverName) {
|
|
182
|
+
for (const filePath of configPaths()) {
|
|
183
|
+
const data = readJsonFile(filePath);
|
|
184
|
+
const server = data?.mcpServers?.[serverName]
|
|
185
|
+
|| data?.mcp_servers?.[serverName]
|
|
186
|
+
|| null;
|
|
187
|
+
|
|
188
|
+
if (server && typeof server === 'object' && !Array.isArray(server)) {
|
|
189
|
+
return {
|
|
190
|
+
config: server,
|
|
191
|
+
source: filePath
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function markHealthy(state, serverName, now, details = {}) {
|
|
200
|
+
state.servers[serverName] = {
|
|
201
|
+
status: 'healthy',
|
|
202
|
+
checkedAt: now,
|
|
203
|
+
expiresAt: now + envNumber('THEUS_SALUD_MCP_TTL_MS', DEFAULT_TTL_MS),
|
|
204
|
+
failureCount: 0,
|
|
205
|
+
lastError: null,
|
|
206
|
+
lastFailureCode: null,
|
|
207
|
+
nextRetryAt: now,
|
|
208
|
+
lastRestoredAt: now,
|
|
209
|
+
...details
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function markUnhealthy(state, serverName, now, failureCode, errorMessage) {
|
|
214
|
+
const previous = state.servers[serverName] || {};
|
|
215
|
+
const failureCount = Number(previous.failureCount || 0) + 1;
|
|
216
|
+
const backoffBase = envNumber('THEUS_SALUD_MCP_BACKOFF_MS', DEFAULT_BACKOFF_MS);
|
|
217
|
+
const nextRetryDelay = Math.min(backoffBase * (2 ** Math.max(failureCount - 1, 0)), MAX_BACKOFF_MS);
|
|
218
|
+
|
|
219
|
+
state.servers[serverName] = {
|
|
220
|
+
status: 'unhealthy',
|
|
221
|
+
checkedAt: now,
|
|
222
|
+
expiresAt: now,
|
|
223
|
+
failureCount,
|
|
224
|
+
lastError: errorMessage || null,
|
|
225
|
+
lastFailureCode: failureCode || null,
|
|
226
|
+
nextRetryAt: now + nextRetryDelay,
|
|
227
|
+
lastRestoredAt: previous.lastRestoredAt || null
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function failureSummary(input) {
|
|
232
|
+
const output = input.tool_output;
|
|
233
|
+
const pieces = [
|
|
234
|
+
typeof input.error === 'string' ? input.error : '',
|
|
235
|
+
typeof input.message === 'string' ? input.message : '',
|
|
236
|
+
typeof input.tool_response === 'string' ? input.tool_response : '',
|
|
237
|
+
typeof output === 'string' ? output : '',
|
|
238
|
+
typeof output?.output === 'string' ? output.output : '',
|
|
239
|
+
typeof output?.stderr === 'string' ? output.stderr : '',
|
|
240
|
+
typeof input.tool_input?.error === 'string' ? input.tool_input.error : ''
|
|
241
|
+
].filter(Boolean);
|
|
242
|
+
|
|
243
|
+
return pieces.join('\n');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function detectFailureCode(text) {
|
|
247
|
+
const summary = String(text || '');
|
|
248
|
+
for (const entry of FAILURE_PATTERNS) {
|
|
249
|
+
if (entry.pattern.test(summary)) {
|
|
250
|
+
return entry.code;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function requestHttp(urlString, headers, timeoutMs) {
|
|
257
|
+
return new Promise(resolve => {
|
|
258
|
+
let settled = false;
|
|
259
|
+
let timedOut = false;
|
|
260
|
+
|
|
261
|
+
const url = new URL(urlString);
|
|
262
|
+
const client = url.protocol === 'https:' ? https : http;
|
|
263
|
+
|
|
264
|
+
const req = client.request(
|
|
265
|
+
url,
|
|
266
|
+
{
|
|
267
|
+
method: 'GET',
|
|
268
|
+
headers,
|
|
269
|
+
},
|
|
270
|
+
res => {
|
|
271
|
+
if (settled) return;
|
|
272
|
+
settled = true;
|
|
273
|
+
res.resume();
|
|
274
|
+
resolve({
|
|
275
|
+
ok: HEALTHY_HTTP_CODES.has(res.statusCode),
|
|
276
|
+
statusCode: res.statusCode,
|
|
277
|
+
reason: `HTTP ${res.statusCode}`
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
req.setTimeout(timeoutMs, () => {
|
|
283
|
+
timedOut = true;
|
|
284
|
+
req.destroy(new Error('timeout'));
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
req.on('error', error => {
|
|
288
|
+
if (settled) return;
|
|
289
|
+
settled = true;
|
|
290
|
+
resolve({
|
|
291
|
+
ok: false,
|
|
292
|
+
statusCode: null,
|
|
293
|
+
reason: timedOut ? 'request timed out' : error.message
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
req.end();
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function probeCommandServer(serverName, config) {
|
|
302
|
+
return new Promise(resolve => {
|
|
303
|
+
const command = config.command;
|
|
304
|
+
const args = Array.isArray(config.args) ? config.args.map(arg => String(arg)) : [];
|
|
305
|
+
const timeoutMs = envNumber('THEUS_SALUD_MCP_TIMEOUT_MS', DEFAULT_TIMEOUT_MS);
|
|
306
|
+
const mergedEnv = {
|
|
307
|
+
...process.env,
|
|
308
|
+
...(config.env && typeof config.env === 'object' && !Array.isArray(config.env) ? config.env : {})
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
let done = false;
|
|
312
|
+
|
|
313
|
+
function finish(result) {
|
|
314
|
+
if (done) return;
|
|
315
|
+
done = true;
|
|
316
|
+
resolve(result);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// On Windows, commands like 'npx' are commonly exposed as npx.cmd.
|
|
320
|
+
// Probe bare PATH commands through platform-extension fallbacks, but keep
|
|
321
|
+
// absolute/relative path commands as a single candidate so their existing
|
|
322
|
+
// ENOENT failure semantics stay intact.
|
|
323
|
+
const commandIsString = typeof command === 'string' && command.length > 0;
|
|
324
|
+
const isPathLike = commandIsString && (
|
|
325
|
+
path.isAbsolute(command)
|
|
326
|
+
|| command.includes('/')
|
|
327
|
+
|| command.includes('\\')
|
|
328
|
+
);
|
|
329
|
+
const candidates = process.platform === 'win32'
|
|
330
|
+
&& commandIsString
|
|
331
|
+
&& !path.extname(command)
|
|
332
|
+
&& !isPathLike
|
|
333
|
+
? [command, `${command}.cmd`, `${command}.exe`, `${command}.bat`]
|
|
334
|
+
: [command];
|
|
335
|
+
|
|
336
|
+
// cmd.exe treats these as operators, grouping syntax, expansion markers,
|
|
337
|
+
// separators, or argument boundaries. Do not route such command strings
|
|
338
|
+
// through shell mode.
|
|
339
|
+
const UNSAFE_SHELL_CHARS = /[&|<>^%!()\s;]/;
|
|
340
|
+
|
|
341
|
+
// When spawning via cmd.exe (shell:true) on Windows, Node concatenates
|
|
342
|
+
// command + args WITHOUT quoting (DEP0190). An arg containing a space —
|
|
343
|
+
// such as a path under "C:\Program Files" — gets re-split by cmd.exe.
|
|
344
|
+
// Build a properly-quoted command line instead and pass it as a single
|
|
345
|
+
// string with no args array, so cmd.exe sees each token as one unit.
|
|
346
|
+
function quoteWin(token) {
|
|
347
|
+
// If the token has no characters that need quoting, return it as-is.
|
|
348
|
+
if (!/[\s"&|<>^%!();]/.test(token)) {
|
|
349
|
+
return token;
|
|
350
|
+
}
|
|
351
|
+
// Escape embedded double quotes by doubling them, then wrap in double
|
|
352
|
+
// quotes. cmd.exe uses "" as an escaped quote inside a quoted string.
|
|
353
|
+
return '"' + token.replace(/"/g, '""') + '"';
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function attempt(idx) {
|
|
357
|
+
const tryCommand = candidates[idx];
|
|
358
|
+
const isLast = idx + 1 >= candidates.length;
|
|
359
|
+
let stderr = '';
|
|
360
|
+
let attemptDone = false;
|
|
361
|
+
let timer = null;
|
|
362
|
+
|
|
363
|
+
function retryNext() {
|
|
364
|
+
if (attemptDone) return;
|
|
365
|
+
attemptDone = true;
|
|
366
|
+
if (timer) {
|
|
367
|
+
clearTimeout(timer);
|
|
368
|
+
timer = null;
|
|
369
|
+
}
|
|
370
|
+
attempt(idx + 1);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function attemptFinish(result) {
|
|
374
|
+
if (attemptDone) return;
|
|
375
|
+
attemptDone = true;
|
|
376
|
+
if (timer) {
|
|
377
|
+
clearTimeout(timer);
|
|
378
|
+
timer = null;
|
|
379
|
+
}
|
|
380
|
+
finish(result);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Node 18.20+/20.12+ refuse to spawn .cmd/.bat directly on Windows
|
|
384
|
+
// after the CVE-2024-27980 mitigation. Only those extension candidates
|
|
385
|
+
// go through cmd.exe, after the command string is shell-character clean.
|
|
386
|
+
const useShell = process.platform === 'win32'
|
|
387
|
+
&& typeof tryCommand === 'string'
|
|
388
|
+
&& /\.(cmd|bat)$/i.test(tryCommand)
|
|
389
|
+
&& !UNSAFE_SHELL_CHARS.test(tryCommand);
|
|
390
|
+
|
|
391
|
+
let child;
|
|
392
|
+
try {
|
|
393
|
+
if (useShell) {
|
|
394
|
+
// Build a single quoted command line for cmd.exe. Passing an args
|
|
395
|
+
// array with shell:true causes Node to concatenate without quoting
|
|
396
|
+
// (DEP0190), which splits space-containing args (e.g. paths under
|
|
397
|
+
// "C:\Program Files") at every space boundary.
|
|
398
|
+
const quotedCmdline = [tryCommand, ...args].map(quoteWin).join(' ');
|
|
399
|
+
child = spawn(quotedCmdline, {
|
|
400
|
+
env: mergedEnv,
|
|
401
|
+
cwd: process.cwd(),
|
|
402
|
+
stdio: ['pipe', 'ignore', 'pipe'],
|
|
403
|
+
shell: true
|
|
404
|
+
});
|
|
405
|
+
} else {
|
|
406
|
+
child = spawn(tryCommand, args, {
|
|
407
|
+
env: mergedEnv,
|
|
408
|
+
cwd: process.cwd(),
|
|
409
|
+
stdio: ['pipe', 'ignore', 'pipe'],
|
|
410
|
+
shell: false
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
} catch (error) {
|
|
414
|
+
if ((error.code === 'ENOENT' || error.code === 'EINVAL') && !isLast) {
|
|
415
|
+
retryNext();
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
attemptFinish({
|
|
419
|
+
ok: false,
|
|
420
|
+
statusCode: null,
|
|
421
|
+
reason: error.message
|
|
422
|
+
});
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
child.stderr.on('data', chunk => {
|
|
427
|
+
if (stderr.length < 4000) {
|
|
428
|
+
const remaining = 4000 - stderr.length;
|
|
429
|
+
stderr += String(chunk).slice(0, remaining);
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
child.on('error', error => {
|
|
434
|
+
if ((error.code === 'ENOENT' || error.code === 'EINVAL') && !isLast) {
|
|
435
|
+
retryNext();
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
attemptFinish({
|
|
439
|
+
ok: false,
|
|
440
|
+
statusCode: null,
|
|
441
|
+
reason: error.message
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
child.on('exit', (code, signal) => {
|
|
446
|
+
attemptFinish({
|
|
447
|
+
ok: false,
|
|
448
|
+
statusCode: code,
|
|
449
|
+
reason: stderr.trim() || `process exited before handshake (${signal || code || 'unknown'})`
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
timer = setTimeout(() => {
|
|
454
|
+
// A fast-crashing stdio server can finish before the timer callback runs
|
|
455
|
+
// on a loaded machine. Check the process state again before classifying it
|
|
456
|
+
// as healthy on timeout.
|
|
457
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
458
|
+
attemptFinish({
|
|
459
|
+
ok: false,
|
|
460
|
+
statusCode: child.exitCode,
|
|
461
|
+
reason: stderr.trim() || `process exited before handshake (${child.signalCode || child.exitCode || 'unknown'})`
|
|
462
|
+
});
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
try {
|
|
467
|
+
if (useShell && child.pid && process.platform === 'win32') {
|
|
468
|
+
// When spawned via shell on Windows, child is cmd.exe. kill() only
|
|
469
|
+
// terminates the shell and leaves the real server process orphaned.
|
|
470
|
+
// taskkill /T kills the entire process tree rooted at cmd.exe.
|
|
471
|
+
const killResult = spawnSync('taskkill', ['/PID', String(child.pid), '/T', '/F'], {
|
|
472
|
+
stdio: 'ignore',
|
|
473
|
+
windowsHide: true
|
|
474
|
+
});
|
|
475
|
+
if (killResult.error || (typeof killResult.status === 'number' && killResult.status !== 0)) {
|
|
476
|
+
// taskkill not on PATH, permission denied, or already exited.
|
|
477
|
+
// Best-effort fallback: signal the cmd.exe shell directly. The
|
|
478
|
+
// child tree may still leak if it already detached, but this at
|
|
479
|
+
// least kills the shell we spawned.
|
|
480
|
+
try { child.kill('SIGKILL'); } catch { /* ignore */ }
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
child.kill('SIGTERM');
|
|
484
|
+
setTimeout(() => {
|
|
485
|
+
try {
|
|
486
|
+
child.kill('SIGKILL');
|
|
487
|
+
} catch {
|
|
488
|
+
// ignore
|
|
489
|
+
}
|
|
490
|
+
}, 200).unref?.();
|
|
491
|
+
}
|
|
492
|
+
} catch {
|
|
493
|
+
// ignore
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
attemptFinish({
|
|
497
|
+
ok: true,
|
|
498
|
+
statusCode: null,
|
|
499
|
+
reason: `${serverName} accepted a new stdio process`
|
|
500
|
+
});
|
|
501
|
+
}, timeoutMs);
|
|
502
|
+
|
|
503
|
+
if (typeof timer.unref === 'function') {
|
|
504
|
+
timer.unref();
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
attempt(0);
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
async function probeServer(serverName, resolvedConfig) {
|
|
513
|
+
const config = resolvedConfig.config;
|
|
514
|
+
|
|
515
|
+
if (config.type === 'http' || config.url) {
|
|
516
|
+
const result = await requestHttp(config.url, config.headers || {}, envNumber('THEUS_SALUD_MCP_TIMEOUT_MS', DEFAULT_TIMEOUT_MS));
|
|
517
|
+
|
|
518
|
+
return {
|
|
519
|
+
ok: result.ok,
|
|
520
|
+
failureCode: RECONNECT_STATUS_CODES.has(result.statusCode) ? result.statusCode : null,
|
|
521
|
+
reason: result.reason,
|
|
522
|
+
source: resolvedConfig.source
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
if (config.command) {
|
|
527
|
+
const result = await probeCommandServer(serverName, config);
|
|
528
|
+
|
|
529
|
+
return {
|
|
530
|
+
ok: result.ok,
|
|
531
|
+
failureCode: RECONNECT_STATUS_CODES.has(result.statusCode) ? result.statusCode : null,
|
|
532
|
+
reason: result.reason,
|
|
533
|
+
source: resolvedConfig.source
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return {
|
|
538
|
+
ok: false,
|
|
539
|
+
failureCode: null,
|
|
540
|
+
reason: 'unsupported MCP server config',
|
|
541
|
+
source: resolvedConfig.source
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function reconnectCommand(serverName) {
|
|
546
|
+
const key = `THEUS_SALUD_MCP_RECONEXION_${String(serverName).toUpperCase().replace(/[^A-Z0-9]/g, '_')}`;
|
|
547
|
+
const command = process.env[key] || process.env.THEUS_SALUD_MCP_COMANDO_RECONEXION || '';
|
|
548
|
+
if (!command.trim()) {
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
return command.includes('{server}')
|
|
553
|
+
? command.replace(/\{server\}/g, serverName)
|
|
554
|
+
: command;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function attemptReconnect(serverName) {
|
|
558
|
+
const command = reconnectCommand(serverName);
|
|
559
|
+
if (!command) {
|
|
560
|
+
return { attempted: false, success: false, reason: 'no reconnect command configured' };
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const result = spawnSync(command, {
|
|
564
|
+
shell: true,
|
|
565
|
+
env: process.env,
|
|
566
|
+
cwd: process.cwd(),
|
|
567
|
+
encoding: 'utf8',
|
|
568
|
+
timeout: envNumber('THEUS_SALUD_MCP_RECONEXION_TIMEOUT_MS', DEFAULT_TIMEOUT_MS)
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
if (result.error) {
|
|
572
|
+
return { attempted: true, success: false, reason: result.error.message };
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if (result.status !== 0) {
|
|
576
|
+
return {
|
|
577
|
+
attempted: true,
|
|
578
|
+
success: false,
|
|
579
|
+
reason: (result.stderr || result.stdout || `reconnect exited ${result.status}`).trim()
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
return { attempted: true, success: true, reason: 'reconnect command completed' };
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function shouldFailOpen() {
|
|
587
|
+
return /^(1|true|yes)$/i.test(String(process.env.THEUS_SALUD_MCP_FAIL_OPEN || ''));
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function emitLogs(logs) {
|
|
591
|
+
for (const line of logs) {
|
|
592
|
+
process.stderr.write(`${line}\n`);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
async function handlePreToolUse(rawInput, input, target, statePathValue, now) {
|
|
597
|
+
const logs = [];
|
|
598
|
+
const state = loadState(statePathValue);
|
|
599
|
+
const previous = state.servers[target.server] || {};
|
|
600
|
+
|
|
601
|
+
if (previous.status === 'healthy' && Number(previous.expiresAt || 0) > now) {
|
|
602
|
+
return { rawInput, exitCode: 0, logs };
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
if (previous.status === 'unhealthy' && Number(previous.nextRetryAt || 0) > now) {
|
|
606
|
+
logs.push(
|
|
607
|
+
`[salud-mcp] ${target.server} está marcado como no saludable hasta ${new Date(previous.nextRetryAt).toISOString()}; se omite ${target.tool || 'la tool'}`
|
|
608
|
+
);
|
|
609
|
+
return { rawInput, exitCode: shouldFailOpen() ? 0 : 2, logs };
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const resolvedConfig = resolveServerConfig(target.server);
|
|
613
|
+
if (!resolvedConfig) {
|
|
614
|
+
logs.push(`[salud-mcp] No se encontró configuración MCP para ${target.server}; se omite el sondeo previo`);
|
|
615
|
+
return { rawInput, exitCode: 0, logs };
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
const probe = await probeServer(target.server, resolvedConfig);
|
|
619
|
+
if (probe.ok) {
|
|
620
|
+
markHealthy(state, target.server, now, { source: resolvedConfig.source });
|
|
621
|
+
saveState(statePathValue, state);
|
|
622
|
+
|
|
623
|
+
if (previous.status === 'unhealthy') {
|
|
624
|
+
logs.push(`[salud-mcp] ${target.server}: conexión restablecida`);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
return { rawInput, exitCode: 0, logs };
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
let reconnect = { attempted: false, success: false, reason: 'probe failed' };
|
|
631
|
+
if (probe.failureCode || previous.status === 'unhealthy') {
|
|
632
|
+
reconnect = attemptReconnect(target.server);
|
|
633
|
+
if (reconnect.success) {
|
|
634
|
+
const reprobe = await probeServer(target.server, resolvedConfig);
|
|
635
|
+
if (reprobe.ok) {
|
|
636
|
+
markHealthy(state, target.server, now, {
|
|
637
|
+
source: resolvedConfig.source,
|
|
638
|
+
restoredBy: 'reconnect-command'
|
|
639
|
+
});
|
|
640
|
+
saveState(statePathValue, state);
|
|
641
|
+
logs.push(`[salud-mcp] ${target.server}: conexión restablecida tras la reconexión`);
|
|
642
|
+
return { rawInput, exitCode: 0, logs };
|
|
643
|
+
}
|
|
644
|
+
probe.reason = `${probe.reason}; reconnect reprobe failed: ${reprobe.reason}`;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
markUnhealthy(state, target.server, now, probe.failureCode, probe.reason);
|
|
649
|
+
saveState(statePathValue, state);
|
|
650
|
+
|
|
651
|
+
const reconnectSuffix = reconnect.attempted
|
|
652
|
+
? ` Reconnect attempt: ${reconnect.success ? 'ok' : reconnect.reason}.`
|
|
653
|
+
: '';
|
|
654
|
+
logs.push(
|
|
655
|
+
`[salud-mcp] ${target.server} no está disponible (${probe.reason}). Se bloquea ${target.tool || 'la tool'} para que el agente recurra a herramientas no MCP.${reconnectSuffix}`
|
|
656
|
+
);
|
|
657
|
+
|
|
658
|
+
return { rawInput, exitCode: shouldFailOpen() ? 0 : 2, logs };
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
async function handlePostToolUseFailure(rawInput, input, target, statePathValue, now) {
|
|
662
|
+
const logs = [];
|
|
663
|
+
const summary = failureSummary(input);
|
|
664
|
+
const failureCode = detectFailureCode(summary);
|
|
665
|
+
|
|
666
|
+
if (!failureCode) {
|
|
667
|
+
return { rawInput, exitCode: 0, logs };
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
const state = loadState(statePathValue);
|
|
671
|
+
markUnhealthy(state, target.server, now, failureCode, summary.slice(0, 500));
|
|
672
|
+
saveState(statePathValue, state);
|
|
673
|
+
|
|
674
|
+
logs.push(`[salud-mcp] ${target.server} reportó ${failureCode}; se marca el servidor como no saludable y se intenta reconectar`);
|
|
675
|
+
|
|
676
|
+
const reconnect = attemptReconnect(target.server);
|
|
677
|
+
if (!reconnect.attempted) {
|
|
678
|
+
logs.push(`[salud-mcp] ${target.server}: reconexión omitida: ${reconnect.reason}`);
|
|
679
|
+
return { rawInput, exitCode: 0, logs };
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (!reconnect.success) {
|
|
683
|
+
logs.push(`[salud-mcp] ${target.server}: la reconexión falló: ${reconnect.reason}`);
|
|
684
|
+
return { rawInput, exitCode: 0, logs };
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
const resolvedConfig = resolveServerConfig(target.server);
|
|
688
|
+
if (!resolvedConfig) {
|
|
689
|
+
logs.push(`[salud-mcp] ${target.server}: la reconexión terminó pero no había configuración para un sondeo de confirmación`);
|
|
690
|
+
return { rawInput, exitCode: 0, logs };
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
const reprobe = await probeServer(target.server, resolvedConfig);
|
|
694
|
+
if (!reprobe.ok) {
|
|
695
|
+
logs.push(`[salud-mcp] ${target.server}: el comando de reconexión corrió, pero el sondeo de salud siguió fallando: ${reprobe.reason}`);
|
|
696
|
+
return { rawInput, exitCode: 0, logs };
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
const refreshed = loadState(statePathValue);
|
|
700
|
+
markHealthy(refreshed, target.server, now, {
|
|
701
|
+
source: resolvedConfig.source,
|
|
702
|
+
restoredBy: 'post-failure-reconnect'
|
|
703
|
+
});
|
|
704
|
+
saveState(statePathValue, refreshed);
|
|
705
|
+
logs.push(`[salud-mcp] ${target.server}: conexión restablecida`);
|
|
706
|
+
return { rawInput, exitCode: 0, logs };
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
async function main() {
|
|
710
|
+
const { raw: rawInput, truncated } = await readRawStdin();
|
|
711
|
+
const input = safeParse(rawInput);
|
|
712
|
+
const target = extractMcpTarget(input) || (truncated ? extractMcpTargetFromRaw(rawInput) : null);
|
|
713
|
+
|
|
714
|
+
if (!target) {
|
|
715
|
+
process.stdout.write(rawInput);
|
|
716
|
+
process.exit(0);
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (truncated) {
|
|
721
|
+
const limit = Number(process.env.THEUS_HOOK_INPUT_MAX_BYTES) || MAX_STDIN;
|
|
722
|
+
const logs = [
|
|
723
|
+
shouldFailOpen()
|
|
724
|
+
? `[salud-mcp] La entrada del hook superó ${limit} bytes al revisar ${target.server}; se permite ${target.tool || 'la tool'} porque el modo fail-open está activo`
|
|
725
|
+
: `[salud-mcp] La entrada del hook superó ${limit} bytes al revisar ${target.server}; se bloquea ${target.tool || 'la tool'} para no eludir los chequeos de salud MCP`
|
|
726
|
+
];
|
|
727
|
+
emitLogs(logs);
|
|
728
|
+
process.stdout.write(rawInput);
|
|
729
|
+
process.exit(shouldFailOpen() ? 0 : 2);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
const eventName = process.env.THEUS_HOOK_EVENT_NAME || 'PreToolUse';
|
|
734
|
+
const now = Date.now();
|
|
735
|
+
const statePathValue = stateFilePath();
|
|
736
|
+
|
|
737
|
+
const result = eventName === 'PostToolUseFailure'
|
|
738
|
+
? await handlePostToolUseFailure(rawInput, input, target, statePathValue, now)
|
|
739
|
+
: await handlePreToolUse(rawInput, input, target, statePathValue, now);
|
|
740
|
+
|
|
741
|
+
emitLogs(result.logs);
|
|
742
|
+
process.stdout.write(result.rawInput);
|
|
743
|
+
process.exit(result.exitCode);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
main().catch(error => {
|
|
747
|
+
process.stderr.write(`[salud-mcp] Error inesperado: ${error.message}\n`);
|
|
748
|
+
process.exit(0);
|
|
749
|
+
});
|