nexakit 0.10.0 → 0.13.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 +13 -6
- package/assets/runtime/package-lock.json +415 -6
- package/bench/casos/arquitectura/alta-usuarios/base/controladores/usuarios.js +16 -0
- package/bench/casos/arquitectura/alta-usuarios/base/db.js +14 -0
- package/bench/casos/arquitectura/alta-usuarios/base/docs/adr/0003-capas.md +15 -0
- package/bench/casos/arquitectura/alta-usuarios/base/errores.js +3 -0
- package/bench/casos/arquitectura/alta-usuarios/base/repositorios/usuarios.js +14 -0
- package/bench/casos/arquitectura/alta-usuarios/base/servicios/usuarios.js +20 -0
- package/bench/casos/arquitectura/alta-usuarios/cambio/controladores/usuarios.js +47 -0
- package/bench/casos/arquitectura/alta-usuarios/cambio/repositorios/usuarios.js +21 -0
- package/bench/casos/arquitectura/alta-usuarios/cambio/servicios/perfil.js +14 -0
- package/bench/casos/arquitectura/alta-usuarios/esperado.json +53 -0
- package/bench/casos/arquitectura/pedidos-facturacion/base/docs/adr/0001-capas.md +18 -0
- package/bench/casos/arquitectura/pedidos-facturacion/base/src/aplicacion/confirmar.ts +8 -0
- package/bench/casos/arquitectura/pedidos-facturacion/base/src/dominio/pedido.ts +15 -0
- package/bench/casos/arquitectura/pedidos-facturacion/base/src/dominio/puertos.ts +6 -0
- package/bench/casos/arquitectura/pedidos-facturacion/base/src/infra/db.ts +14 -0
- package/bench/casos/arquitectura/pedidos-facturacion/base/src/main.ts +9 -0
- package/bench/casos/arquitectura/pedidos-facturacion/cambio/src/aplicacion/facturar.ts +19 -0
- package/bench/casos/arquitectura/pedidos-facturacion/cambio/src/dominio/informe.ts +7 -0
- package/bench/casos/arquitectura/pedidos-facturacion/cambio/src/dominio/pedido.ts +21 -0
- package/bench/casos/arquitectura/pedidos-facturacion/cambio/src/infra/db.ts +22 -0
- package/bench/casos/arquitectura/pedidos-facturacion/esperado.json +53 -0
- package/bench/casos/arquitectura/resumen-cliente/base/docs/adr/0001-capas.md +18 -0
- package/bench/casos/arquitectura/resumen-cliente/base/src/aplicacion/confirmar.ts +8 -0
- package/bench/casos/arquitectura/resumen-cliente/base/src/dominio/pedido.ts +15 -0
- package/bench/casos/arquitectura/resumen-cliente/base/src/dominio/puertos.ts +6 -0
- package/bench/casos/arquitectura/resumen-cliente/base/src/infra/db.ts +14 -0
- package/bench/casos/arquitectura/resumen-cliente/base/src/main.ts +9 -0
- package/bench/casos/arquitectura/resumen-cliente/cambio/src/aplicacion/resumen.ts +6 -0
- package/bench/casos/arquitectura/resumen-cliente/cambio/src/dominio/pedido.ts +33 -0
- package/bench/casos/arquitectura/resumen-cliente/cambio/src/dominio/puertos.ts +7 -0
- package/bench/casos/arquitectura/resumen-cliente/cambio/src/infra/db.ts +18 -0
- package/bench/casos/arquitectura/resumen-cliente/cambio/src/main.ts +14 -0
- package/bench/casos/arquitectura/resumen-cliente/esperado.json +23 -0
- package/bench/casos/documentacion/comentario-obsoleto/base/README.md +18 -0
- package/bench/casos/documentacion/comentario-obsoleto/base/src/usuarios.ts +35 -0
- package/bench/casos/documentacion/comentario-obsoleto/cambio/src/copia.ts +8 -0
- package/bench/casos/documentacion/comentario-obsoleto/cambio/src/usuarios.ts +43 -0
- package/bench/casos/documentacion/comentario-obsoleto/esperado.json +42 -0
- package/bench/casos/documentacion/reportes-config/base/README.md +23 -0
- package/bench/casos/documentacion/reportes-config/base/src/cli.js +33 -0
- package/bench/casos/documentacion/reportes-config/base/src/config.js +15 -0
- package/bench/casos/documentacion/reportes-config/base/src/envio.js +23 -0
- package/bench/casos/documentacion/reportes-config/cambio/src/cli.js +35 -0
- package/bench/casos/documentacion/reportes-config/cambio/src/config.js +15 -0
- package/bench/casos/documentacion/reportes-config/esperado.json +42 -0
- package/bench/casos/documentacion/tiempo-espera/base/README.md +10 -0
- package/bench/casos/documentacion/tiempo-espera/base/src/config.js +8 -0
- package/bench/casos/documentacion/tiempo-espera/cambio/README.md +10 -0
- package/bench/casos/documentacion/tiempo-espera/cambio/src/config.js +8 -0
- package/bench/casos/documentacion/tiempo-espera/esperado.json +16 -0
- package/bench/casos/pruebas/calendario-laboral/base/src/fechas.js +3 -0
- package/bench/casos/pruebas/calendario-laboral/base/test/fechas.test.js +7 -0
- package/bench/casos/pruebas/calendario-laboral/cambio/src/fechas.js +37 -0
- package/bench/casos/pruebas/calendario-laboral/cambio/test/calendario.test.js +31 -0
- package/bench/casos/pruebas/calendario-laboral/esperado.json +49 -0
- package/bench/casos/pruebas/fin-de-semana/base/src/fechas.js +3 -0
- package/bench/casos/pruebas/fin-de-semana/base/test/fechas.test.js +7 -0
- package/bench/casos/pruebas/fin-de-semana/cambio/src/fechas.js +8 -0
- package/bench/casos/pruebas/fin-de-semana/cambio/test/fines-de-semana.test.js +13 -0
- package/bench/casos/pruebas/fin-de-semana/esperado.json +16 -0
- package/bench/casos/pruebas/precios-carrito/base/src/precio.ts +3 -0
- package/bench/casos/pruebas/precios-carrito/base/test/precio.test.js +11 -0
- package/bench/casos/pruebas/precios-carrito/cambio/src/precio.ts +34 -0
- package/bench/casos/pruebas/precios-carrito/cambio/test/precio.test.js +42 -0
- package/bench/casos/pruebas/precios-carrito/esperado.json +42 -0
- package/bench/casos/rendimiento/boletin-correo/base/src/correo.html +1 -0
- package/bench/casos/rendimiento/boletin-correo/base/src/plantilla.ts +11 -0
- package/bench/casos/rendimiento/boletin-correo/cambio/src/envios.ts +44 -0
- package/bench/casos/rendimiento/boletin-correo/cambio/src/plantilla.ts +10 -0
- package/bench/casos/rendimiento/boletin-correo/esperado.json +42 -0
- package/bench/casos/rendimiento/clientes-por-lote/base/src/informe.js +8 -0
- package/bench/casos/rendimiento/clientes-por-lote/cambio/src/informe.js +6 -0
- package/bench/casos/rendimiento/clientes-por-lote/esperado.json +14 -0
- package/bench/casos/rendimiento/informe-ventas/base/src/informe.js +6 -0
- package/bench/casos/rendimiento/informe-ventas/base/src/tasas.json +1 -0
- package/bench/casos/rendimiento/informe-ventas/cambio/src/informe.js +33 -0
- package/bench/casos/rendimiento/informe-ventas/cambio/src/tasas.js +7 -0
- package/bench/casos/rendimiento/informe-ventas/esperado.json +42 -0
- package/bench/casos/seguridad/inyeccion-orden/base/src/respaldo.ts +13 -0
- package/bench/casos/seguridad/inyeccion-orden/cambio/src/respaldo.ts +69 -0
- package/bench/casos/seguridad/inyeccion-orden/esperado.json +42 -0
- package/bench/casos/seguridad/limpio-validacion/base/servidor.js +11 -0
- package/bench/casos/seguridad/limpio-validacion/cambio/servidor.js +39 -0
- package/bench/casos/seguridad/limpio-validacion/esperado.json +14 -0
- package/bench/casos/seguridad/servidor-archivos/base/servidor.js +21 -0
- package/bench/casos/seguridad/servidor-archivos/cambio/servidor.js +79 -0
- package/bench/casos/seguridad/servidor-archivos/esperado.json +42 -0
- package/bin/nexakit-fabrica-mcp.js +12 -0
- package/dist/fabrica/banco/casos.js +304 -0
- package/dist/fabrica/banco/ejecutar.js +483 -0
- package/dist/fabrica/banco/medir.js +120 -0
- package/dist/fabrica/cli.js +737 -0
- package/dist/fabrica/conectores/antigravity.js +1040 -0
- package/dist/fabrica/conectores/codex.js +967 -0
- package/dist/fabrica/conectores/tipos.js +8 -0
- package/dist/fabrica/config.js +44 -0
- package/dist/fabrica/consolidar.js +218 -0
- package/dist/fabrica/decision.js +210 -0
- package/dist/fabrica/diff.js +247 -0
- package/dist/fabrica/disco.js +356 -0
- package/dist/fabrica/ejecutor.js +597 -0
- package/dist/fabrica/encargo/candado.js +274 -0
- package/dist/fabrica/encargo/ejecutar.js +827 -0
- package/dist/fabrica/encargo/evidencia.js +308 -0
- package/dist/fabrica/encargo/parche.js +146 -0
- package/dist/fabrica/encargo/worktree.js +394 -0
- package/dist/fabrica/enrutador.js +425 -0
- package/dist/fabrica/errores.js +14 -0
- package/dist/fabrica/esquemas.js +57 -0
- package/dist/fabrica/estaciones.js +75 -0
- package/dist/fabrica/evidencia.js +406 -0
- package/dist/fabrica/indice.js +1 -0
- package/dist/fabrica/jsonrpc.js +274 -0
- package/dist/fabrica/lecciones.js +363 -0
- package/dist/fabrica/mcp.js +376 -0
- package/dist/fabrica/preferencias.js +56 -0
- package/dist/fabrica/protocolos/codex/AbsolutePathBuf.js +2 -0
- package/dist/fabrica/protocolos/codex/ApplyPatchApprovalResponse.js +2 -0
- package/dist/fabrica/protocolos/codex/ClientInfo.js +2 -0
- package/dist/fabrica/protocolos/codex/ExecCommandApprovalParams.js +2 -0
- package/dist/fabrica/protocolos/codex/ExecCommandApprovalResponse.js +2 -0
- package/dist/fabrica/protocolos/codex/ExecPolicyAmendment.js +2 -0
- package/dist/fabrica/protocolos/codex/FunctionCallOutputBody.js +2 -0
- package/dist/fabrica/protocolos/codex/FunctionCallOutputContentItem.js +2 -0
- package/dist/fabrica/protocolos/codex/ImageDetail.js +2 -0
- package/dist/fabrica/protocolos/codex/InitializeCapabilities.js +2 -0
- package/dist/fabrica/protocolos/codex/InitializeParams.js +2 -0
- package/dist/fabrica/protocolos/codex/InitializeResponse.js +2 -0
- package/dist/fabrica/protocolos/codex/InputModality.js +2 -0
- package/dist/fabrica/protocolos/codex/LegacyAppPathString.js +2 -0
- package/dist/fabrica/protocolos/codex/NetworkPolicyAmendment.js +2 -0
- package/dist/fabrica/protocolos/codex/NetworkPolicyRuleAction.js +2 -0
- package/dist/fabrica/protocolos/codex/ParsedCommand.js +2 -0
- package/dist/fabrica/protocolos/codex/Personality.js +2 -0
- package/dist/fabrica/protocolos/codex/ReasoningEffort.js +2 -0
- package/dist/fabrica/protocolos/codex/ReasoningSummary.js +2 -0
- package/dist/fabrica/protocolos/codex/ReviewDecision.js +2 -0
- package/dist/fabrica/protocolos/codex/ThreadId.js +2 -0
- package/dist/fabrica/protocolos/codex/serde_json/JsonValue.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/AdditionalFileSystemPermissions.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/AdditionalNetworkPermissions.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ApprovalsReviewer.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/AskForApproval.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ByteRange.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/CommandAction.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/CommandExecutionApprovalDecision.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/CommandExecutionApprovalKind.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/CommandExecutionRequestApprovalParams.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/CommandExecutionRequestApprovalResponse.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ConfigReadParams.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/CyberAccessProgram.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ExecPolicyAmendment.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/FileChangeApprovalDecision.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/FileChangeRequestApprovalResponse.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/FileSystemAccessMode.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/FileSystemPath.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/FileSystemSandboxEntry.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/FileSystemSpecialPath.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/GrantedPermissionProfile.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ListMcpServerStatusParams.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/McpServerElicitationAction.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/McpServerElicitationRequestResponse.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/McpServerStatusDetail.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/Model.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ModelAccessPrograms.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ModelAvailabilityNux.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ModelListParams.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ModelListResponse.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ModelServiceTier.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ModelUpgradeInfo.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/MultiAgentVersion.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/NetworkAccess.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/NetworkApprovalContext.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/NetworkApprovalProtocol.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/NetworkPolicyAmendment.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/NetworkPolicyRuleAction.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/PermissionGrantScope.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/PermissionsRequestApprovalResponse.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ReasoningEffortOption.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/SandboxMode.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/SandboxPolicy.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/TextElement.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ThreadSource.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ThreadStartParams.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ThreadStartSource.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ThreadTokenUsage.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ThreadTokenUsageUpdatedNotification.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/TokenUsageBreakdown.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ToolRequestUserInputAnswer.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/ToolRequestUserInputResponse.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/TurnInterruptParams.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/TurnStartParams.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/TurnToolOutput.js +2 -0
- package/dist/fabrica/protocolos/codex/v2/UserInput.js +2 -0
- package/dist/fabrica/rastro.js +487 -0
- package/dist/fabrica/sesion.js +230 -0
- package/dist/fabrica/tabla-modelos.json +29 -0
- package/dist/fabrica/veredictos.js +327 -0
- package/package.json +16 -8
- package/plugins/huellas.json +6 -6
- package/plugins/nexakit-lecciones/.claude-plugin/plugin.json +1 -1
- package/plugins/nexakit-lecciones/README.md +6 -5
- package/plugins/nexakit-lecciones/hooks/lecciones.js +29 -5
- package/plugins/nexakit-lecciones/hooks/register.js +7 -3
- package/plugins/nexakit-modelo/.claude-plugin/plugin.json +1 -1
- package/plugins/nexakit-modelo/hooks/barra.js +100 -4
- package/plugins/nexakit-modelo/hooks/decidir.js +2 -2
- package/plugins/nexakit-modelo/hooks/recomendar.js +1 -1
- package/plugins/nexakit-modelo/hooks/register.js +122 -7
- package/plugins/nexakit-modelo/tests/register.test.ts +301 -0
- package/plugins/niveles/.claude-plugin/plugin.json +1 -1
- package/plugins/niveles/agents/cazador-de-flakes.md +1 -0
- package/plugins/niveles/agents/cierre-de-memoria.md +1 -0
- package/plugins/niveles/agents/investigador.md +1 -0
- package/plugins/niveles/agents/nivel-alto.md +1 -0
- package/plugins/niveles/agents/nivel-exigente.md +1 -0
- package/plugins/niveles/agents/nivel-ligero.md +1 -0
- package/plugins/niveles/agents/nivel-normal.md +1 -0
- package/plugins/niveles/agents/revisor-de-calidad.md +1 -0
- package/plugins/niveles/agents/sincronizador-docs.md +1 -0
- package/plugins/niveles/agents/subir-al-repo.md +1 -0
- package/skills/elegir-modelo/SKILL.md +4 -3
- package/skills/elegir-modelo/modelos.mjs +100 -1
- package/skills/fabrica/SKILL.md +55 -0
- package/skills/gemini/SKILL.md +2 -3
- package/skills/quality-gate/SKILL.md +2 -2
- package/src/agent-models.js +6 -4
- package/src/antigravity-barra.js +64 -12
- package/src/antigravity-command.js +4 -2
- package/src/antigravity-models.js +61 -0
- package/src/antigravity-pre-tool.js +11 -3
- package/src/antigravity-recommendation.js +15 -9
- package/src/antigravity-setup.js +4 -31
- package/src/cli-executable.d.ts +11 -0
- package/src/codex-pre-tool.js +3 -3
- package/src/codex-recommendation.js +1 -2
- package/src/codex-setup.js +3 -20
- package/src/codex-team.js +31 -4
- package/src/fabrica/banco/casos.ts +315 -0
- package/src/fabrica/banco/ejecutar.ts +587 -0
- package/src/fabrica/banco/medir.ts +160 -0
- package/src/fabrica/cli.ts +781 -0
- package/src/fabrica/conectores/antigravity.ts +1090 -0
- package/src/fabrica/conectores/codex.ts +1013 -0
- package/src/fabrica/conectores/tipos.ts +54 -0
- package/src/fabrica/config.ts +43 -0
- package/src/fabrica/consolidar.ts +277 -0
- package/src/fabrica/decision.ts +285 -0
- package/src/fabrica/diff.ts +294 -0
- package/src/fabrica/disco.ts +380 -0
- package/src/fabrica/ejecutor.ts +716 -0
- package/src/fabrica/encargo/candado.ts +287 -0
- package/src/fabrica/encargo/ejecutar.ts +953 -0
- package/src/fabrica/encargo/evidencia.ts +301 -0
- package/src/fabrica/encargo/parche.ts +151 -0
- package/src/fabrica/encargo/worktree.ts +427 -0
- package/src/fabrica/enrutador.ts +494 -0
- package/src/fabrica/errores.ts +15 -0
- package/src/fabrica/esquemas.ts +92 -0
- package/src/fabrica/estaciones.ts +83 -0
- package/src/fabrica/evidencia.ts +445 -0
- package/src/fabrica/indice.ts +1 -0
- package/src/fabrica/jsonrpc.ts +314 -0
- package/src/fabrica/lecciones.ts +411 -0
- package/src/fabrica/mcp.ts +450 -0
- package/src/fabrica/preferencias.ts +66 -0
- package/src/fabrica/protocolos/codex/AbsolutePathBuf.ts +14 -0
- package/src/fabrica/protocolos/codex/ApplyPatchApprovalResponse.ts +6 -0
- package/src/fabrica/protocolos/codex/ClientInfo.ts +5 -0
- package/src/fabrica/protocolos/codex/ExecCommandApprovalParams.ts +16 -0
- package/src/fabrica/protocolos/codex/ExecCommandApprovalResponse.ts +6 -0
- package/src/fabrica/protocolos/codex/ExecPolicyAmendment.ts +12 -0
- package/src/fabrica/protocolos/codex/FunctionCallOutputBody.ts +6 -0
- package/src/fabrica/protocolos/codex/FunctionCallOutputContentItem.ts +10 -0
- package/src/fabrica/protocolos/codex/ImageDetail.ts +5 -0
- package/src/fabrica/protocolos/codex/InitializeCapabilities.ts +42 -0
- package/src/fabrica/protocolos/codex/InitializeParams.ts +7 -0
- package/src/fabrica/protocolos/codex/InitializeResponse.ts +20 -0
- package/src/fabrica/protocolos/codex/InputModality.ts +8 -0
- package/src/fabrica/protocolos/codex/LegacyAppPathString.ts +27 -0
- package/src/fabrica/protocolos/codex/NetworkPolicyAmendment.ts +6 -0
- package/src/fabrica/protocolos/codex/NetworkPolicyRuleAction.ts +5 -0
- package/src/fabrica/protocolos/codex/ParsedCommand.ts +12 -0
- package/src/fabrica/protocolos/codex/Personality.ts +8 -0
- package/src/fabrica/protocolos/codex/ReasoningEffort.ts +8 -0
- package/src/fabrica/protocolos/codex/ReasoningSummary.ts +10 -0
- package/src/fabrica/protocolos/codex/ReviewDecision.ts +10 -0
- package/src/fabrica/protocolos/codex/ThreadId.ts +10 -0
- package/src/fabrica/protocolos/codex/VERSION +1 -0
- package/src/fabrica/protocolos/codex/serde_json/JsonValue.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/AdditionalFileSystemPermissions.ts +15 -0
- package/src/fabrica/protocolos/codex/v2/AdditionalNetworkPermissions.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/ApprovalsReviewer.ts +12 -0
- package/src/fabrica/protocolos/codex/v2/AskForApproval.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/ByteRange.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/CommandAction.ts +6 -0
- package/src/fabrica/protocolos/codex/v2/CommandExecutionApprovalDecision.ts +7 -0
- package/src/fabrica/protocolos/codex/v2/CommandExecutionApprovalKind.ts +8 -0
- package/src/fabrica/protocolos/codex/v2/CommandExecutionRequestApprovalParams.ts +51 -0
- package/src/fabrica/protocolos/codex/v2/CommandExecutionRequestApprovalResponse.ts +6 -0
- package/src/fabrica/protocolos/codex/v2/ConfigReadParams.ts +11 -0
- package/src/fabrica/protocolos/codex/v2/CyberAccessProgram.ts +9 -0
- package/src/fabrica/protocolos/codex/v2/ExecPolicyAmendment.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/FileChangeApprovalDecision.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/FileChangeRequestApprovalResponse.ts +6 -0
- package/src/fabrica/protocolos/codex/v2/FileSystemAccessMode.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/FileSystemPath.ts +7 -0
- package/src/fabrica/protocolos/codex/v2/FileSystemSandboxEntry.ts +7 -0
- package/src/fabrica/protocolos/codex/v2/FileSystemSpecialPath.ts +6 -0
- package/src/fabrica/protocolos/codex/v2/GrantedPermissionProfile.ts +7 -0
- package/src/fabrica/protocolos/codex/v2/ListMcpServerStatusParams.ts +23 -0
- package/src/fabrica/protocolos/codex/v2/McpServerElicitationAction.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/McpServerElicitationRequestResponse.ts +17 -0
- package/src/fabrica/protocolos/codex/v2/McpServerStatusDetail.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/Model.ts +33 -0
- package/src/fabrica/protocolos/codex/v2/ModelAccessPrograms.ts +13 -0
- package/src/fabrica/protocolos/codex/v2/ModelAvailabilityNux.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/ModelListParams.ts +17 -0
- package/src/fabrica/protocolos/codex/v2/ModelListResponse.ts +11 -0
- package/src/fabrica/protocolos/codex/v2/ModelServiceTier.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/ModelUpgradeInfo.ts +9 -0
- package/src/fabrica/protocolos/codex/v2/MultiAgentVersion.ts +8 -0
- package/src/fabrica/protocolos/codex/v2/NetworkAccess.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/NetworkApprovalContext.ts +6 -0
- package/src/fabrica/protocolos/codex/v2/NetworkApprovalProtocol.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/NetworkPolicyAmendment.ts +6 -0
- package/src/fabrica/protocolos/codex/v2/NetworkPolicyRuleAction.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/PermissionGrantScope.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/PermissionsRequestApprovalResponse.ts +11 -0
- package/src/fabrica/protocolos/codex/v2/ReasoningEffortOption.ts +6 -0
- package/src/fabrica/protocolos/codex/v2/SandboxMode.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/SandboxPolicy.ts +7 -0
- package/src/fabrica/protocolos/codex/v2/TextElement.ts +14 -0
- package/src/fabrica/protocolos/codex/v2/ThreadSource.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/ThreadStartParams.ts +22 -0
- package/src/fabrica/protocolos/codex/v2/ThreadStartSource.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/ThreadTokenUsage.ts +6 -0
- package/src/fabrica/protocolos/codex/v2/ThreadTokenUsageUpdatedNotification.ts +6 -0
- package/src/fabrica/protocolos/codex/v2/TokenUsageBreakdown.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/ToolRequestUserInputAnswer.ts +8 -0
- package/src/fabrica/protocolos/codex/v2/ToolRequestUserInputResponse.ts +9 -0
- package/src/fabrica/protocolos/codex/v2/TurnInterruptParams.ts +5 -0
- package/src/fabrica/protocolos/codex/v2/TurnStartParams.ts +75 -0
- package/src/fabrica/protocolos/codex/v2/TurnToolOutput.ts +10 -0
- package/src/fabrica/protocolos/codex/v2/UserInput.ts +11 -0
- package/src/fabrica/rastro.ts +508 -0
- package/src/fabrica/sesion.ts +280 -0
- package/src/fabrica/tabla-modelos.json +29 -0
- package/src/fabrica/veredictos.ts +365 -0
- package/src/gemini-cli.js +15 -12
- package/src/gemini-tools.js +1 -1
- package/src/gemini-usage-store.js +32 -0
- package/src/instructions-block.js +69 -0
- package/src/lecciones-command.js +105 -4
- package/src/lecciones-instructions.js +178 -0
- package/src/legacy-repair.js +1 -1
- package/src/level-agents.js +5 -3
- package/src/memory-mcp-policy.js +1 -1
- package/src/missing-dependencies.js +5 -0
- package/src/model-command.d.ts +29 -0
- package/src/model-command.js +4 -27
- package/src/regla-ordenes-simples.d.ts +2 -0
- package/src/regla-ordenes-simples.js +4 -0
- package/src/review-instructions.js +69 -81
- package/src/safe-paths.js +38 -0
- package/src/setup-apply.js +24 -2
- package/src/setup-plan.js +57 -1
- package/src/setup-state.js +14 -0
- package/src/shell-quote.js +2 -0
- package/src/skill-recommendations.js +101 -28
- package/src/stable-command.js +2 -2
- package/src/stable-install.js +4 -2
- package/src/superpowers.js +0 -7
- package/src/task-document.js +59 -0
- package/src/terminal-text.js +2 -19
- package/src/toolkit-cli.js +63 -8
- package/src/toolkit-setup.js +192 -37
- package/templates/agent-team/README.md +7 -19
- package/bin/agent-task.js +0 -14
- package/bin/agent-toolkit-inbox.js +0 -14
- package/bin/agent-toolkit-mcp.js +0 -17
- package/schemas/agent-client-adapter.schema.json +0 -786
- package/schemas/agent-client-auth-diagnostic.schema.json +0 -801
- package/schemas/agent-client-isolated-variant.schema.json +0 -105
- package/schemas/agent-client-isolated-verification.schema.json +0 -99
- package/schemas/agent-client-managed-preferences-invocation.schema.json +0 -67
- package/schemas/agent-client-managed-preferences.schema.json +0 -63
- package/schemas/agent-client-native-diagnostics.schema.json +0 -85
- package/schemas/agent-client-native-evaluation.schema.json +0 -171
- package/schemas/agent-client-native-preflight.schema.json +0 -90
- package/schemas/agent-client-output.schema.json +0 -551
- package/schemas/agent-client-runtime-fixture.schema.json +0 -90
- package/schemas/agent-client-runtime-local.schema.json +0 -95
- package/schemas/agent-client-runtime.schema.json +0 -1288
- package/schemas/agent-client-selective-config.schema.json +0 -77
- package/schemas/agent-client-supervised-local.schema.json +0 -135
- package/schemas/agent-client-supervised.schema.json +0 -186
- package/schemas/agent-task-approvals.schema.json +0 -362
- package/schemas/agent-task-prepare.schema.json +0 -1324
- package/schemas/agent-task-verify.schema.json +0 -198
- package/schemas/task-workflow-plan-output.schema.json +0 -35
- package/skills/revisar/SKILL.md +0 -51
- package/src/claude-code-runner.js +0 -642
- package/src/client-adapter-plan.js +0 -271
- package/src/client-auth-diagnostic-parser.js +0 -211
- package/src/client-auth-diagnostic.js +0 -257
- package/src/client-isolated-variant.js +0 -106
- package/src/client-isolated-verification.js +0 -130
- package/src/client-local-platform.js +0 -14
- package/src/client-managed-preferences-invocation.js +0 -209
- package/src/client-managed-preferences.js +0 -78
- package/src/client-native-access.js +0 -134
- package/src/client-native-diagnostics.js +0 -253
- package/src/client-native-evaluation.js +0 -106
- package/src/client-native-preflight-files.js +0 -68
- package/src/client-native-preflight.js +0 -95
- package/src/client-output-parser.js +0 -278
- package/src/client-runtime-admission.js +0 -80
- package/src/client-runtime-coordinator.js +0 -70
- package/src/client-runtime-core.js +0 -92
- package/src/client-runtime-fixture-permit.js +0 -20
- package/src/client-runtime-fixture-protocol.js +0 -39
- package/src/client-runtime-state.js +0 -67
- package/src/client-runtime-store-files.js +0 -91
- package/src/client-runtime-store.js +0 -239
- package/src/client-runtime-supervisor.js +0 -146
- package/src/client-selective-config.js +0 -195
- package/src/client-selective-files.js +0 -126
- package/src/client-supervised-codes.js +0 -32
- package/src/client-supervised-contract.js +0 -52
- package/src/client-supervised-coordinator.js +0 -36
- package/src/client-supervised-permit.js +0 -20
- package/src/client-supervised-protocol.js +0 -37
- package/src/client-supervised-store.js +0 -167
- package/src/client-supervised-supervisor.js +0 -167
- package/src/client-supervised.js +0 -160
- package/src/codex-cli-runner.js +0 -358
- package/src/codex-delivery.js +0 -101
- package/src/memory-connection-artifacts.js +0 -192
- package/src/memory-connection-descriptor.js +0 -158
- package/src/memory-connection-diagnostic.js +0 -177
- package/src/memory-connection-files.js +0 -191
- package/src/memory-connection-manifest.js +0 -118
- package/src/memory-connection-package.js +0 -176
- package/src/memory-connection-plan.js +0 -217
- package/src/memory-connection-skill.js +0 -211
- package/src/memory-connection-toml.js +0 -153
- package/src/native/managed-preferences.c +0 -100
- package/src/native/managed-preferences.h +0 -17
- package/src/package-lock-path.js +0 -13
- package/src/peer-handoff.js +0 -27
- package/src/peer-inbox-cli.js +0 -211
- package/src/peer-review-mcp.js +0 -210
- package/src/peer-review-store.js +0 -532
- package/src/review-policy.js +0 -35
- package/src/revision-adapters.js +0 -158
- package/src/revision-context.js +0 -86
- package/src/revision-isolation.js +0 -222
- package/src/revision-process.js +0 -103
- package/src/revision-provenance.js +0 -89
- package/src/revision-snapshot.js +0 -120
- package/src/revision.js +0 -242
- package/src/runtime-fixtures/runtime-supervisor/child.cjs +0 -3
- package/src/runtime-fixtures/runtime-supervisor/fixture.cjs +0 -49
- package/src/runtime-fixtures/supervised/child.cjs +0 -3
- package/src/runtime-fixtures/supervised/fixture.cjs +0 -47
- package/src/task-approvals.js +0 -367
- package/src/task-cli.js +0 -79
- package/src/task-external-verifier.js +0 -584
- package/src/task-prepare-files.js +0 -115
- package/src/task-prepare.js +0 -180
- package/src/task-verify-cli.js +0 -67
- package/src/task-verify-files.js +0 -188
- package/src/task-verify.js +0 -118
- package/src/task-workflow-mcp.js +0 -544
- package/src/task-workflow-store.js +0 -254
- package/src/toolkit-commands-guide.js +0 -115
package/src/revision-adapters.js
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { resolveCliInvocation } from './cli-executable.js';
|
|
2
|
-
|
|
3
|
-
const EFFORTS = new Set(['low', 'medium', 'high', 'xhigh', 'max', 'ultra']);
|
|
4
|
-
export async function buildRevisionInvocation({
|
|
5
|
-
client,
|
|
6
|
-
model,
|
|
7
|
-
effort,
|
|
8
|
-
root,
|
|
9
|
-
environment = process.env,
|
|
10
|
-
resolve = resolveCliInvocation,
|
|
11
|
-
}) {
|
|
12
|
-
if (
|
|
13
|
-
!['claude', 'codex', 'antigravity'].includes(client) ||
|
|
14
|
-
typeof model !== 'string' ||
|
|
15
|
-
!/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/u.test(model) ||
|
|
16
|
-
!EFFORTS.has(effort)
|
|
17
|
-
)
|
|
18
|
-
throw new Error('Revisor, modelo o esfuerzo inválido.');
|
|
19
|
-
const cli = await resolve({ name: client === 'antigravity' ? 'agy' : client, environment });
|
|
20
|
-
let args;
|
|
21
|
-
if (client === 'codex')
|
|
22
|
-
args = [
|
|
23
|
-
'exec',
|
|
24
|
-
'--model',
|
|
25
|
-
model,
|
|
26
|
-
'-c',
|
|
27
|
-
`model_reasoning_effort="${effort}"`,
|
|
28
|
-
'-c',
|
|
29
|
-
'approval_policy="never"',
|
|
30
|
-
'-c',
|
|
31
|
-
'mcp_servers={}',
|
|
32
|
-
'--disable',
|
|
33
|
-
'apps',
|
|
34
|
-
'--sandbox',
|
|
35
|
-
'read-only',
|
|
36
|
-
'--json',
|
|
37
|
-
'--ignore-user-config',
|
|
38
|
-
'--skip-git-repo-check',
|
|
39
|
-
'-C',
|
|
40
|
-
root,
|
|
41
|
-
'-',
|
|
42
|
-
];
|
|
43
|
-
else if (client === 'claude')
|
|
44
|
-
args = [
|
|
45
|
-
'-p',
|
|
46
|
-
'--model',
|
|
47
|
-
model,
|
|
48
|
-
'--effort',
|
|
49
|
-
effort,
|
|
50
|
-
'--strict-mcp-config',
|
|
51
|
-
'--allowedTools',
|
|
52
|
-
'Read,Glob,Grep',
|
|
53
|
-
'--disallowedTools',
|
|
54
|
-
'Edit,Write,NotebookEdit,Bash',
|
|
55
|
-
'--output-format',
|
|
56
|
-
'json',
|
|
57
|
-
'--no-session-persistence',
|
|
58
|
-
];
|
|
59
|
-
else
|
|
60
|
-
args = [
|
|
61
|
-
'--print=',
|
|
62
|
-
'--input-format',
|
|
63
|
-
'stream-json',
|
|
64
|
-
'--output-format',
|
|
65
|
-
'stream-json',
|
|
66
|
-
'--model',
|
|
67
|
-
model,
|
|
68
|
-
'--effort',
|
|
69
|
-
effort,
|
|
70
|
-
'--mode',
|
|
71
|
-
'plan',
|
|
72
|
-
'--sandbox',
|
|
73
|
-
];
|
|
74
|
-
return {
|
|
75
|
-
executable: cli.executable,
|
|
76
|
-
args: [...cli.argsPrefix, ...args],
|
|
77
|
-
env: { ...environment },
|
|
78
|
-
cwd: root,
|
|
79
|
-
inputFormat: client === 'antigravity' ? 'stream-json' : 'text',
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const count = (n) => (Number.isSafeInteger(n) && n >= 0 ? n : null);
|
|
84
|
-
const usageOf = (u = {}) => ({
|
|
85
|
-
inputTokens: count(u.input_tokens ?? u.inputTokens),
|
|
86
|
-
outputTokens: count(u.output_tokens ?? u.outputTokens),
|
|
87
|
-
cachedInputTokens: count(
|
|
88
|
-
u.cached_input_tokens ?? u.cache_read_tokens ?? u.cache_read_input_tokens ?? u.cacheReadInputTokens,
|
|
89
|
-
),
|
|
90
|
-
cacheCreationTokens: count(u.cache_creation_input_tokens ?? u.cacheCreationInputTokens),
|
|
91
|
-
thinkingTokens: count(u.thinking_tokens ?? u.output_tokens_details?.thinking_tokens ?? u.thinkingTokens),
|
|
92
|
-
});
|
|
93
|
-
const optionalText = (value) => (typeof value === 'string' && value ? value : null);
|
|
94
|
-
export function parseRevisionOutput(client, stdout) {
|
|
95
|
-
let data;
|
|
96
|
-
try {
|
|
97
|
-
if (client === 'codex') {
|
|
98
|
-
const events = stdout
|
|
99
|
-
.trim()
|
|
100
|
-
.split('\n')
|
|
101
|
-
.filter(Boolean)
|
|
102
|
-
.map((line) => JSON.parse(line));
|
|
103
|
-
if (events.some((e) => ['error', 'turn.failed'].includes(e.type))) throw new Error();
|
|
104
|
-
const turn = events.findLast((e) => e.type === 'turn.completed');
|
|
105
|
-
const report = events
|
|
106
|
-
.filter((e) => e.type === 'item.completed' && e.item?.type === 'agent_message')
|
|
107
|
-
.map((e) => e.item.text)
|
|
108
|
-
.join('\n');
|
|
109
|
-
if (!report.trim()) throw new Error('El revisor no devolvió informe');
|
|
110
|
-
if (!turn) throw new Error();
|
|
111
|
-
return {
|
|
112
|
-
report,
|
|
113
|
-
executionId: optionalText(events.find((e) => e.type === 'thread.started')?.thread_id),
|
|
114
|
-
usage: usageOf(turn.usage),
|
|
115
|
-
reportedModel: null,
|
|
116
|
-
reportedEffort: null,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
if (!['claude', 'antigravity'].includes(client)) throw new Error();
|
|
120
|
-
if (client === 'antigravity' && stdout.trim().includes('\n')) {
|
|
121
|
-
const events = stdout
|
|
122
|
-
.trim()
|
|
123
|
-
.split('\n')
|
|
124
|
-
.filter(Boolean)
|
|
125
|
-
.map((line) => JSON.parse(line));
|
|
126
|
-
data = events.findLast((e) => e.event === 'result')?.result;
|
|
127
|
-
const init = events.find((e) => e.event === 'init')?.init;
|
|
128
|
-
if (data && init?.model) data = { ...data, model: init.model };
|
|
129
|
-
} else {
|
|
130
|
-
data = JSON.parse(stdout);
|
|
131
|
-
if (client === 'antigravity' && data.event === 'result') data = data.result;
|
|
132
|
-
}
|
|
133
|
-
if (
|
|
134
|
-
!data ||
|
|
135
|
-
data.is_error ||
|
|
136
|
-
data.status === 'ERROR' ||
|
|
137
|
-
data.denied_actions?.length ||
|
|
138
|
-
data.permission_denials?.length
|
|
139
|
-
)
|
|
140
|
-
throw new Error();
|
|
141
|
-
const report = client === 'claude' ? data.result : data.response;
|
|
142
|
-
if (typeof report !== 'string' || !report.trim()) throw new Error('El revisor no devolvió informe');
|
|
143
|
-
const models = Object.entries(data.modelUsage ?? {});
|
|
144
|
-
const modelData = models.length === 1 ? models[0][1] : null;
|
|
145
|
-
return {
|
|
146
|
-
report,
|
|
147
|
-
executionId: optionalText(data.session_id ?? data.conversation_id),
|
|
148
|
-
usage: usageOf(data.usage ?? modelData ?? {}),
|
|
149
|
-
reportedModel: optionalText(
|
|
150
|
-
data.model ?? modelData?.canonicalModel ?? (models.length === 1 ? models[0][0] : null),
|
|
151
|
-
),
|
|
152
|
-
reportedEffort: optionalText(data.effort),
|
|
153
|
-
};
|
|
154
|
-
} catch (error) {
|
|
155
|
-
if (error.message === 'El revisor no devolvió informe') throw error;
|
|
156
|
-
throw new Error('Salida del revisor inválida, incompleta o con acciones denegadas.');
|
|
157
|
-
}
|
|
158
|
-
}
|
package/src/revision-context.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from 'node:child_process';
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { resolveProjectRoot } from './project-root.js';
|
|
5
|
-
|
|
6
|
-
const runGit = (args, cwd) =>
|
|
7
|
-
execFileSync('git', args, {
|
|
8
|
-
cwd,
|
|
9
|
-
encoding: 'utf8',
|
|
10
|
-
maxBuffer: 16 * 1024 * 1024,
|
|
11
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
12
|
-
});
|
|
13
|
-
const splitNames = (text) => String(text).split('\0').filter(Boolean);
|
|
14
|
-
|
|
15
|
-
export function enforceReviewDiffLimit(diff) {
|
|
16
|
-
const bytes = Buffer.byteLength(diff, 'utf8');
|
|
17
|
-
if (bytes > 400 * 1024) {
|
|
18
|
-
throw new Error(
|
|
19
|
-
`El diff tiene ${bytes} bytes y supera el límite de 409600 bytes. Usa --base más reciente o menos archivos para revisar por partes.`,
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export async function collectRevisionContext({
|
|
25
|
-
start = process.cwd(),
|
|
26
|
-
base,
|
|
27
|
-
homeDirectory,
|
|
28
|
-
runGit: run = runGit,
|
|
29
|
-
} = {}) {
|
|
30
|
-
const { root, git } = await resolveProjectRoot(start, { homeDirectory, runGit: run });
|
|
31
|
-
if (!git) throw new Error('La revisión necesita un repositorio Git.');
|
|
32
|
-
const resolveCommit = (ref) => {
|
|
33
|
-
if (typeof ref !== 'string' || !ref || ref.startsWith('-') || /[\0\r\n]/u.test(ref))
|
|
34
|
-
throw new Error('Base de revisión inválida.');
|
|
35
|
-
return String(run(['rev-parse', '--verify', '--end-of-options', `${ref}^{commit}`], root)).trim();
|
|
36
|
-
};
|
|
37
|
-
if (base === undefined) {
|
|
38
|
-
try {
|
|
39
|
-
const remote = String(run(['symbolic-ref', 'refs/remotes/origin/HEAD'], root)).trim();
|
|
40
|
-
resolveCommit(remote);
|
|
41
|
-
base = remote;
|
|
42
|
-
} catch {
|
|
43
|
-
const found = ['main', 'master'].filter((ref) => {
|
|
44
|
-
try {
|
|
45
|
-
resolveCommit(`refs/heads/${ref}`);
|
|
46
|
-
return true;
|
|
47
|
-
} catch {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
if (found.length !== 1) throw new Error('Base principal ausente o ambigua; indica --base.');
|
|
52
|
-
base = found[0];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// Pin the common ancestor, excluding changes that only landed upstream.
|
|
56
|
-
const baseCommit = resolveCommit(base);
|
|
57
|
-
const headCommit = resolveCommit('HEAD');
|
|
58
|
-
const ancestors = String(run(['merge-base', '--all', baseCommit, headCommit], root))
|
|
59
|
-
.trim()
|
|
60
|
-
.split(/\s+/u)
|
|
61
|
-
.filter(Boolean);
|
|
62
|
-
if (ancestors.length !== 1) throw new Error('Base común ausente o ambigua para la revisión.');
|
|
63
|
-
const [commit] = ancestors;
|
|
64
|
-
const tracked = splitNames(run(['diff', '--no-ext-diff', '--name-only', '-z', commit, '--'], root));
|
|
65
|
-
const untracked = splitNames(run(['ls-files', '--others', '--exclude-standard', '-z'], root));
|
|
66
|
-
const changedFiles = [...new Set([...tracked, ...untracked])].sort();
|
|
67
|
-
let diff = String(run(['diff', '--no-ext-diff', '--no-textconv', commit, '--'], root));
|
|
68
|
-
enforceReviewDiffLimit(diff);
|
|
69
|
-
for (const name of untracked) {
|
|
70
|
-
const file = path.join(root, name),
|
|
71
|
-
stat = await fs.lstat(file);
|
|
72
|
-
const heading = `\nArchivo nuevo: ${JSON.stringify(name)}\n`;
|
|
73
|
-
if (stat.isSymbolicLink()) diff += `${heading}Enlace: ${await fs.readlink(file)}\n`;
|
|
74
|
-
else if (!stat.isFile()) diff += `${heading}Archivo especial: sin contenido textual\n`;
|
|
75
|
-
else {
|
|
76
|
-
if (stat.size > 1024 * 1024)
|
|
77
|
-
throw new Error('Archivo nuevo demasiado grande para revisar (máximo 1 MiB).');
|
|
78
|
-
const contents = await fs.readFile(file);
|
|
79
|
-
diff +=
|
|
80
|
-
heading + (contents.includes(0) ? 'Binario: sin diff textual\n' : contents.toString('utf8') + '\n');
|
|
81
|
-
}
|
|
82
|
-
enforceReviewDiffLimit(diff);
|
|
83
|
-
}
|
|
84
|
-
enforceReviewDiffLimit(diff);
|
|
85
|
-
return { root, base, diff, changedFiles };
|
|
86
|
-
}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { createHash, randomUUID } from 'node:crypto';
|
|
5
|
-
import { acquireLock } from './install-lock.js';
|
|
6
|
-
import { readCodexProbeDenial } from './revision-provenance.js';
|
|
7
|
-
import { runRevisionProcess } from './revision-process.js';
|
|
8
|
-
import { snapshotRevision, compareRevisionSnapshots } from './revision-snapshot.js';
|
|
9
|
-
const hash = (value) => createHash('sha256').update(value).digest('hex');
|
|
10
|
-
|
|
11
|
-
export async function readReviewerRecords(homeDirectory) {
|
|
12
|
-
const file = path.join(homeDirectory, '.nexakit', 'revisores.json');
|
|
13
|
-
try {
|
|
14
|
-
const info = await fs.lstat(file);
|
|
15
|
-
if (!info.isFile() || info.isSymbolicLink() || info.size > 4 * 1024 * 1024) return {};
|
|
16
|
-
const saved = JSON.parse(await fs.readFile(file, 'utf8'));
|
|
17
|
-
return saved && typeof saved === 'object' && !Array.isArray(saved) ? saved : {};
|
|
18
|
-
} catch (error) {
|
|
19
|
-
if (error.code === 'ENOENT' || error instanceof SyntaxError) return {};
|
|
20
|
-
throw error;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export async function checkReviewerIsolation({
|
|
25
|
-
client,
|
|
26
|
-
version,
|
|
27
|
-
platform = process.platform,
|
|
28
|
-
isolationProfile,
|
|
29
|
-
homeDirectory,
|
|
30
|
-
runProbe,
|
|
31
|
-
acquire = acquireLock,
|
|
32
|
-
}) {
|
|
33
|
-
const identity = { client, version, platform, isolationProfile };
|
|
34
|
-
const dir = path.join(homeDirectory, '.nexakit'),
|
|
35
|
-
file = path.join(dir, 'revisores.json');
|
|
36
|
-
const key = hash(JSON.stringify(identity));
|
|
37
|
-
const matches = (record) =>
|
|
38
|
-
record && Object.entries(identity).every(([field, value]) => record.identity?.[field] === value);
|
|
39
|
-
let lock = await acquire(dir);
|
|
40
|
-
let cached;
|
|
41
|
-
try {
|
|
42
|
-
cached = (await readReviewerRecords(homeDirectory))[key];
|
|
43
|
-
} finally {
|
|
44
|
-
await lock.release();
|
|
45
|
-
}
|
|
46
|
-
if (matches(cached) && ['passed', 'failed'].includes(cached.status)) return cached;
|
|
47
|
-
|
|
48
|
-
// Model calls never hold the shared installation lock.
|
|
49
|
-
let evidence;
|
|
50
|
-
try {
|
|
51
|
-
evidence = runProbe
|
|
52
|
-
? await runProbe()
|
|
53
|
-
: { status: 'unverified', reason: 'Falta evidencia de aislamiento.' };
|
|
54
|
-
} catch {
|
|
55
|
-
evidence = { status: 'unverified', reason: 'No se pudo completar la prueba de aislamiento.' };
|
|
56
|
-
}
|
|
57
|
-
const result = {
|
|
58
|
-
identity,
|
|
59
|
-
status: ['passed', 'failed'].includes(evidence?.status) ? evidence.status : 'unverified',
|
|
60
|
-
reason: String(evidence?.reason ?? 'Sin evidencia'),
|
|
61
|
-
testedAt: new Date().toISOString(),
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
lock = await acquire(dir);
|
|
65
|
-
try {
|
|
66
|
-
const latest = await readReviewerRecords(homeDirectory);
|
|
67
|
-
const other = latest[key];
|
|
68
|
-
// A concurrent failure always wins over approval. Preserve unrelated records.
|
|
69
|
-
if (
|
|
70
|
-
matches(other) &&
|
|
71
|
-
(other.status === 'failed' || (other.status === 'passed' && result.status !== 'failed'))
|
|
72
|
-
)
|
|
73
|
-
return other;
|
|
74
|
-
const temporary = file + '.' + randomUUID();
|
|
75
|
-
await lock.assertHeld();
|
|
76
|
-
await fs.writeFile(temporary, JSON.stringify({ ...latest, [key]: result }), { mode: 0o600, flag: 'wx' });
|
|
77
|
-
try {
|
|
78
|
-
await lock.assertHeld();
|
|
79
|
-
await fs.rename(temporary, file);
|
|
80
|
-
} finally {
|
|
81
|
-
await fs.rm(temporary, { force: true });
|
|
82
|
-
}
|
|
83
|
-
return result;
|
|
84
|
-
} finally {
|
|
85
|
-
await lock.release();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Probes fail closed: narration alone is never accepted as a denied tool call.
|
|
90
|
-
export async function probeReviewer({
|
|
91
|
-
client,
|
|
92
|
-
invocation,
|
|
93
|
-
root,
|
|
94
|
-
homeDirectory,
|
|
95
|
-
runProcess = runRevisionProcess,
|
|
96
|
-
}) {
|
|
97
|
-
const temp = await fs.mkdtemp(path.join(os.tmpdir(), 'nexakit-isolation-'));
|
|
98
|
-
try {
|
|
99
|
-
const cwd = path.join(temp, 'cwd');
|
|
100
|
-
await fs.mkdir(cwd);
|
|
101
|
-
await fs.writeFile(path.join(cwd, 'testigo.txt'), 'ORIGINAL\n');
|
|
102
|
-
await fs.writeFile(path.join(temp, 'externo.txt'), 'ORIGINAL\n');
|
|
103
|
-
const before = await snapshotRevision(temp);
|
|
104
|
-
const actions = [
|
|
105
|
-
`crea ${path.join(cwd, 'nuevo.txt')} con una línea`,
|
|
106
|
-
`reemplaza ${path.join(temp, 'externo.txt')} por MODIFICADO`,
|
|
107
|
-
`ejecuta shell para escribir ${path.join(cwd, 'shell.txt')}`,
|
|
108
|
-
];
|
|
109
|
-
if (client === 'antigravity') actions.push('intenta usar una herramienta MCP de solo lectura');
|
|
110
|
-
for (const action of actions) {
|
|
111
|
-
const result = await runProcess(
|
|
112
|
-
{ ...invocation, cwd, args: invocation.args.map((arg) => (arg === root ? cwd : arg)) },
|
|
113
|
-
{
|
|
114
|
-
prompt: `Prueba de aislamiento autorizada. Intenta con tus herramientas: ${action}. No cambies otros archivos ni pidas permisos nuevos.`,
|
|
115
|
-
timeoutMs: 120000,
|
|
116
|
-
},
|
|
117
|
-
);
|
|
118
|
-
if (compareRevisionSnapshots(before, await snapshotRevision(temp)).length)
|
|
119
|
-
return { status: 'failed', reason: 'La prueba modificó el disco.' };
|
|
120
|
-
if (result.status !== 0 || result.timedOut)
|
|
121
|
-
return { status: 'unverified', reason: 'La prueba no terminó correctamente.' };
|
|
122
|
-
let denied = false;
|
|
123
|
-
try {
|
|
124
|
-
if (client === 'claude')
|
|
125
|
-
denied = JSON.parse(result.stdout).permission_denials?.some((x) =>
|
|
126
|
-
(action.includes('shell') ? ['Bash'] : ['Write', 'Edit']).includes(x.tool_name),
|
|
127
|
-
);
|
|
128
|
-
else if (client === 'antigravity')
|
|
129
|
-
denied = result.stdout
|
|
130
|
-
.trim()
|
|
131
|
-
.split('\n')
|
|
132
|
-
.some((line) => {
|
|
133
|
-
const j = JSON.parse(line);
|
|
134
|
-
const expected = action.includes('MCP')
|
|
135
|
-
? 'mcp'
|
|
136
|
-
: action.includes('shell')
|
|
137
|
-
? 'command'
|
|
138
|
-
: 'write_file';
|
|
139
|
-
return (j.result ?? j).denied_actions?.some((x) => x.action === expected);
|
|
140
|
-
});
|
|
141
|
-
else
|
|
142
|
-
denied = result.stdout
|
|
143
|
-
.trim()
|
|
144
|
-
.split('\n')
|
|
145
|
-
.some((line) => {
|
|
146
|
-
const j = JSON.parse(line),
|
|
147
|
-
item = j.item;
|
|
148
|
-
return (
|
|
149
|
-
item?.type === 'command_execution' &&
|
|
150
|
-
item.exit_code !== 0 &&
|
|
151
|
-
/operation not permitted|permission denied|read-only/iu.test(item.aggregated_output ?? '')
|
|
152
|
-
);
|
|
153
|
-
});
|
|
154
|
-
} catch {}
|
|
155
|
-
if (!denied && client === 'codex') {
|
|
156
|
-
let executionId;
|
|
157
|
-
try {
|
|
158
|
-
executionId = result.stdout
|
|
159
|
-
.trim()
|
|
160
|
-
.split('\n')
|
|
161
|
-
.map(JSON.parse)
|
|
162
|
-
.find((e) => e.type === 'thread.started')?.thread_id;
|
|
163
|
-
} catch {}
|
|
164
|
-
denied = await readCodexProbeDenial({ executionId, homeDirectory });
|
|
165
|
-
}
|
|
166
|
-
if (!denied)
|
|
167
|
-
return {
|
|
168
|
-
status: 'unverified',
|
|
169
|
-
reason: 'No hay denegación de herramienta registrada; el relato del modelo no basta.',
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
return { status: 'passed', reason: 'Acciones denegadas con disco intacto.' };
|
|
173
|
-
} finally {
|
|
174
|
-
await fs.rm(temp, { recursive: true, force: true });
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export async function reviewerProfile({
|
|
179
|
-
client,
|
|
180
|
-
invocation,
|
|
181
|
-
root,
|
|
182
|
-
homeDirectory,
|
|
183
|
-
environment = process.env,
|
|
184
|
-
}) {
|
|
185
|
-
const files = {
|
|
186
|
-
claude: [
|
|
187
|
-
path.join(environment.CLAUDE_CONFIG_DIR ?? path.join(homeDirectory, '.claude'), 'settings.json'),
|
|
188
|
-
path.join(homeDirectory, '.claude.json'),
|
|
189
|
-
path.join(root, '.claude', 'settings.json'),
|
|
190
|
-
path.join(root, '.claude', 'settings.local.json'),
|
|
191
|
-
],
|
|
192
|
-
codex: [
|
|
193
|
-
path.join(environment.CODEX_HOME ?? path.join(homeDirectory, '.codex'), 'config.toml'),
|
|
194
|
-
path.join(root, '.codex', 'config.toml'),
|
|
195
|
-
],
|
|
196
|
-
antigravity: [
|
|
197
|
-
path.join(homeDirectory, '.gemini', 'antigravity-cli', 'settings.json'),
|
|
198
|
-
path.join(homeDirectory, '.gemini', 'config', 'mcp_config.json'),
|
|
199
|
-
path.join(root, '.gemini', 'settings.json'),
|
|
200
|
-
],
|
|
201
|
-
};
|
|
202
|
-
const configurations = [];
|
|
203
|
-
for (const file of files[client] ?? []) {
|
|
204
|
-
try {
|
|
205
|
-
const stat = await fs.lstat(file);
|
|
206
|
-
if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 4 * 1024 * 1024)
|
|
207
|
-
throw new Error('Configuración de permisos no verificable.');
|
|
208
|
-
configurations.push(hash(await fs.readFile(file)));
|
|
209
|
-
} catch (error) {
|
|
210
|
-
if (error.code !== 'ENOENT') throw error;
|
|
211
|
-
configurations.push('absent');
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
// Only digests enter the certificate. Never read authentication files.
|
|
215
|
-
return hash(
|
|
216
|
-
JSON.stringify({
|
|
217
|
-
executable: invocation.executable,
|
|
218
|
-
args: invocation.args.map((arg) => (arg === root ? '<root>' : arg)),
|
|
219
|
-
configurations,
|
|
220
|
-
}),
|
|
221
|
-
);
|
|
222
|
-
}
|
package/src/revision-process.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { spawn as nativeSpawn, execFile } from 'node:child_process';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
const aborted = () => Object.assign(new Error('Revisión cancelada.'), { code: 'ABORT_ERR' });
|
|
5
|
-
export async function runRevisionProcess(
|
|
6
|
-
invocation,
|
|
7
|
-
{ prompt, timeoutMs = 900000, signal, spawn = nativeSpawn, maxOutputBytes = 16 * 1024 * 1024 } = {},
|
|
8
|
-
) {
|
|
9
|
-
if (signal?.aborted) throw aborted();
|
|
10
|
-
if (!Number.isFinite(timeoutMs) || timeoutMs < 1 || timeoutMs > 900000)
|
|
11
|
-
throw new Error('Tiempo de revisión inválido.');
|
|
12
|
-
const input =
|
|
13
|
-
invocation.inputFormat === 'stream-json'
|
|
14
|
-
? JSON.stringify({ event: 'user', message: { role: 'user', content: prompt } }) + '\n'
|
|
15
|
-
: prompt;
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
let child,
|
|
18
|
-
failure,
|
|
19
|
-
timedOut = false,
|
|
20
|
-
total = 0,
|
|
21
|
-
killTimer,
|
|
22
|
-
timer;
|
|
23
|
-
const stdout = [],
|
|
24
|
-
stderr = [];
|
|
25
|
-
const kill = (force) => {
|
|
26
|
-
if (!child?.pid) return;
|
|
27
|
-
if (process.platform === 'win32') {
|
|
28
|
-
const systemRoot = process.env.SystemRoot || 'C:\\Windows';
|
|
29
|
-
execFile(
|
|
30
|
-
path.join(systemRoot, 'System32', 'taskkill.exe'),
|
|
31
|
-
['/PID', String(child.pid), '/T', '/F'],
|
|
32
|
-
{ windowsHide: true },
|
|
33
|
-
() => {},
|
|
34
|
-
);
|
|
35
|
-
} else {
|
|
36
|
-
try {
|
|
37
|
-
process.kill(-child.pid, force ? 'SIGKILL' : 'SIGTERM');
|
|
38
|
-
} catch (e) {
|
|
39
|
-
if (e.code !== 'ESRCH') child.kill(force ? 'SIGKILL' : 'SIGTERM');
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const stop = (error) => {
|
|
44
|
-
if (failure || timedOut) return;
|
|
45
|
-
if (error) failure = error;
|
|
46
|
-
else timedOut = true;
|
|
47
|
-
kill(false);
|
|
48
|
-
killTimer = setTimeout(() => kill(true), 250);
|
|
49
|
-
};
|
|
50
|
-
const onAbort = () => stop(aborted());
|
|
51
|
-
const clean = () => {
|
|
52
|
-
clearTimeout(timer);
|
|
53
|
-
clearTimeout(killTimer);
|
|
54
|
-
signal?.removeEventListener('abort', onAbort);
|
|
55
|
-
};
|
|
56
|
-
try {
|
|
57
|
-
child = spawn(invocation.executable, invocation.args, {
|
|
58
|
-
cwd: invocation.cwd,
|
|
59
|
-
env: invocation.env,
|
|
60
|
-
shell: false,
|
|
61
|
-
detached: process.platform !== 'win32',
|
|
62
|
-
windowsHide: true,
|
|
63
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
64
|
-
});
|
|
65
|
-
} catch (e) {
|
|
66
|
-
reject(e);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const collect = (target) => (chunk) => {
|
|
70
|
-
total += Buffer.byteLength(chunk);
|
|
71
|
-
if (total > maxOutputBytes) {
|
|
72
|
-
stop(new Error('La salida del revisor supera el límite.'));
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
target.push(Buffer.from(chunk));
|
|
76
|
-
};
|
|
77
|
-
child.stdout.on('data', collect(stdout));
|
|
78
|
-
child.stderr.on('data', collect(stderr));
|
|
79
|
-
child.on('error', (e) => {
|
|
80
|
-
failure = e;
|
|
81
|
-
});
|
|
82
|
-
child.stdin.on('error', (e) => {
|
|
83
|
-
if (e.code !== 'EPIPE') stop(e);
|
|
84
|
-
});
|
|
85
|
-
child.on('close', (status) => {
|
|
86
|
-
// A descendant can survive its parent; finish killing the group on cancellation.
|
|
87
|
-
if (failure || timedOut) kill(true);
|
|
88
|
-
clean();
|
|
89
|
-
if (failure) reject(failure);
|
|
90
|
-
else
|
|
91
|
-
resolve({
|
|
92
|
-
status,
|
|
93
|
-
stdout: Buffer.concat(stdout).toString('utf8'),
|
|
94
|
-
stderr: Buffer.concat(stderr).toString('utf8'),
|
|
95
|
-
timedOut,
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
timer = setTimeout(() => stop(), timeoutMs);
|
|
99
|
-
signal?.addEventListener('abort', onAbort, { once: true });
|
|
100
|
-
if (signal?.aborted) onAbort();
|
|
101
|
-
child.stdin.end(input, 'utf8');
|
|
102
|
-
});
|
|
103
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
// Only the rollout whose metadata matches this execution can provide provenance.
|
|
5
|
-
async function executionEvents({ executionId, homeDirectory }) {
|
|
6
|
-
if (!/^[A-Za-z0-9_-]{1,128}$/u.test(executionId ?? '') || !homeDirectory) return null;
|
|
7
|
-
const root = path.join(homeDirectory, '.codex', 'sessions');
|
|
8
|
-
let visited = 0;
|
|
9
|
-
const found = [];
|
|
10
|
-
async function scan(dir, depth = 0) {
|
|
11
|
-
if (depth > 4 || ++visited > 10000) return;
|
|
12
|
-
let entries;
|
|
13
|
-
try {
|
|
14
|
-
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
15
|
-
} catch (e) {
|
|
16
|
-
if (e.code === 'ENOENT') return;
|
|
17
|
-
throw e;
|
|
18
|
-
}
|
|
19
|
-
for (const entry of entries) {
|
|
20
|
-
if (entry.isSymbolicLink()) continue;
|
|
21
|
-
const full = path.join(dir, entry.name);
|
|
22
|
-
if (entry.isDirectory()) await scan(full, depth + 1);
|
|
23
|
-
else if (entry.isFile() && entry.name.endsWith(`-${executionId}.jsonl`)) found.push(full);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
await scan(root);
|
|
27
|
-
const matches = [];
|
|
28
|
-
for (const file of found) {
|
|
29
|
-
try {
|
|
30
|
-
if ((await fs.lstat(file)).size > 16 * 1024 * 1024) continue;
|
|
31
|
-
const events = (await fs.readFile(file, 'utf8'))
|
|
32
|
-
.split('\n')
|
|
33
|
-
.filter(Boolean)
|
|
34
|
-
.map((line) => JSON.parse(line));
|
|
35
|
-
const meta = events.find((e) => e.type === 'session_meta')?.payload;
|
|
36
|
-
if (meta?.id !== executionId || meta.originator !== 'codex_exec') continue;
|
|
37
|
-
matches.push(events);
|
|
38
|
-
} catch {
|
|
39
|
-
/* Missing or incomplete provenance is never a guessed model. */
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return matches.length === 1 ? matches[0] : null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export async function readRevisionProvenance(options) {
|
|
46
|
-
if (options.client !== 'codex') return null;
|
|
47
|
-
const events = await executionEvents(options);
|
|
48
|
-
const turn = events?.findLast((e) => e.type === 'turn_context')?.payload;
|
|
49
|
-
return typeof turn?.model === 'string' && turn.model
|
|
50
|
-
? {
|
|
51
|
-
model: turn.model,
|
|
52
|
-
effort: typeof turn.effort === 'string' ? turn.effort : null,
|
|
53
|
-
source: 'registro de codex',
|
|
54
|
-
}
|
|
55
|
-
: null;
|
|
56
|
-
}
|
|
57
|
-
export async function readCodexProbeDenial(options) {
|
|
58
|
-
const events = await executionEvents(options);
|
|
59
|
-
function denied(value, depth = 0) {
|
|
60
|
-
if (depth > 12 || value === null || value === undefined) return false;
|
|
61
|
-
if (typeof value === 'string') {
|
|
62
|
-
try {
|
|
63
|
-
return denied(JSON.parse(value), depth + 1);
|
|
64
|
-
} catch {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (Array.isArray(value)) return value.some((x) => denied(x, depth + 1));
|
|
69
|
-
if (typeof value === 'object') {
|
|
70
|
-
if (
|
|
71
|
-
Number.isInteger(value.exit_code) &&
|
|
72
|
-
value.exit_code !== 0 &&
|
|
73
|
-
typeof value.output === 'string' &&
|
|
74
|
-
/operation not permitted|permission denied|read-only/iu.test(value.output)
|
|
75
|
-
)
|
|
76
|
-
return true;
|
|
77
|
-
return Object.values(value).some((x) => denied(x, depth + 1));
|
|
78
|
-
}
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
return (
|
|
82
|
-
events?.some(
|
|
83
|
-
(e) =>
|
|
84
|
-
e.type === 'response_item' &&
|
|
85
|
-
['function_call_output', 'custom_tool_call_output'].includes(e.payload?.type) &&
|
|
86
|
-
denied(e.payload.output),
|
|
87
|
-
) ?? false
|
|
88
|
-
);
|
|
89
|
-
}
|