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.
Files changed (479) hide show
  1. package/README.md +13 -6
  2. package/assets/runtime/package-lock.json +415 -6
  3. package/bench/casos/arquitectura/alta-usuarios/base/controladores/usuarios.js +16 -0
  4. package/bench/casos/arquitectura/alta-usuarios/base/db.js +14 -0
  5. package/bench/casos/arquitectura/alta-usuarios/base/docs/adr/0003-capas.md +15 -0
  6. package/bench/casos/arquitectura/alta-usuarios/base/errores.js +3 -0
  7. package/bench/casos/arquitectura/alta-usuarios/base/repositorios/usuarios.js +14 -0
  8. package/bench/casos/arquitectura/alta-usuarios/base/servicios/usuarios.js +20 -0
  9. package/bench/casos/arquitectura/alta-usuarios/cambio/controladores/usuarios.js +47 -0
  10. package/bench/casos/arquitectura/alta-usuarios/cambio/repositorios/usuarios.js +21 -0
  11. package/bench/casos/arquitectura/alta-usuarios/cambio/servicios/perfil.js +14 -0
  12. package/bench/casos/arquitectura/alta-usuarios/esperado.json +53 -0
  13. package/bench/casos/arquitectura/pedidos-facturacion/base/docs/adr/0001-capas.md +18 -0
  14. package/bench/casos/arquitectura/pedidos-facturacion/base/src/aplicacion/confirmar.ts +8 -0
  15. package/bench/casos/arquitectura/pedidos-facturacion/base/src/dominio/pedido.ts +15 -0
  16. package/bench/casos/arquitectura/pedidos-facturacion/base/src/dominio/puertos.ts +6 -0
  17. package/bench/casos/arquitectura/pedidos-facturacion/base/src/infra/db.ts +14 -0
  18. package/bench/casos/arquitectura/pedidos-facturacion/base/src/main.ts +9 -0
  19. package/bench/casos/arquitectura/pedidos-facturacion/cambio/src/aplicacion/facturar.ts +19 -0
  20. package/bench/casos/arquitectura/pedidos-facturacion/cambio/src/dominio/informe.ts +7 -0
  21. package/bench/casos/arquitectura/pedidos-facturacion/cambio/src/dominio/pedido.ts +21 -0
  22. package/bench/casos/arquitectura/pedidos-facturacion/cambio/src/infra/db.ts +22 -0
  23. package/bench/casos/arquitectura/pedidos-facturacion/esperado.json +53 -0
  24. package/bench/casos/arquitectura/resumen-cliente/base/docs/adr/0001-capas.md +18 -0
  25. package/bench/casos/arquitectura/resumen-cliente/base/src/aplicacion/confirmar.ts +8 -0
  26. package/bench/casos/arquitectura/resumen-cliente/base/src/dominio/pedido.ts +15 -0
  27. package/bench/casos/arquitectura/resumen-cliente/base/src/dominio/puertos.ts +6 -0
  28. package/bench/casos/arquitectura/resumen-cliente/base/src/infra/db.ts +14 -0
  29. package/bench/casos/arquitectura/resumen-cliente/base/src/main.ts +9 -0
  30. package/bench/casos/arquitectura/resumen-cliente/cambio/src/aplicacion/resumen.ts +6 -0
  31. package/bench/casos/arquitectura/resumen-cliente/cambio/src/dominio/pedido.ts +33 -0
  32. package/bench/casos/arquitectura/resumen-cliente/cambio/src/dominio/puertos.ts +7 -0
  33. package/bench/casos/arquitectura/resumen-cliente/cambio/src/infra/db.ts +18 -0
  34. package/bench/casos/arquitectura/resumen-cliente/cambio/src/main.ts +14 -0
  35. package/bench/casos/arquitectura/resumen-cliente/esperado.json +23 -0
  36. package/bench/casos/documentacion/comentario-obsoleto/base/README.md +18 -0
  37. package/bench/casos/documentacion/comentario-obsoleto/base/src/usuarios.ts +35 -0
  38. package/bench/casos/documentacion/comentario-obsoleto/cambio/src/copia.ts +8 -0
  39. package/bench/casos/documentacion/comentario-obsoleto/cambio/src/usuarios.ts +43 -0
  40. package/bench/casos/documentacion/comentario-obsoleto/esperado.json +42 -0
  41. package/bench/casos/documentacion/reportes-config/base/README.md +23 -0
  42. package/bench/casos/documentacion/reportes-config/base/src/cli.js +33 -0
  43. package/bench/casos/documentacion/reportes-config/base/src/config.js +15 -0
  44. package/bench/casos/documentacion/reportes-config/base/src/envio.js +23 -0
  45. package/bench/casos/documentacion/reportes-config/cambio/src/cli.js +35 -0
  46. package/bench/casos/documentacion/reportes-config/cambio/src/config.js +15 -0
  47. package/bench/casos/documentacion/reportes-config/esperado.json +42 -0
  48. package/bench/casos/documentacion/tiempo-espera/base/README.md +10 -0
  49. package/bench/casos/documentacion/tiempo-espera/base/src/config.js +8 -0
  50. package/bench/casos/documentacion/tiempo-espera/cambio/README.md +10 -0
  51. package/bench/casos/documentacion/tiempo-espera/cambio/src/config.js +8 -0
  52. package/bench/casos/documentacion/tiempo-espera/esperado.json +16 -0
  53. package/bench/casos/pruebas/calendario-laboral/base/src/fechas.js +3 -0
  54. package/bench/casos/pruebas/calendario-laboral/base/test/fechas.test.js +7 -0
  55. package/bench/casos/pruebas/calendario-laboral/cambio/src/fechas.js +37 -0
  56. package/bench/casos/pruebas/calendario-laboral/cambio/test/calendario.test.js +31 -0
  57. package/bench/casos/pruebas/calendario-laboral/esperado.json +49 -0
  58. package/bench/casos/pruebas/fin-de-semana/base/src/fechas.js +3 -0
  59. package/bench/casos/pruebas/fin-de-semana/base/test/fechas.test.js +7 -0
  60. package/bench/casos/pruebas/fin-de-semana/cambio/src/fechas.js +8 -0
  61. package/bench/casos/pruebas/fin-de-semana/cambio/test/fines-de-semana.test.js +13 -0
  62. package/bench/casos/pruebas/fin-de-semana/esperado.json +16 -0
  63. package/bench/casos/pruebas/precios-carrito/base/src/precio.ts +3 -0
  64. package/bench/casos/pruebas/precios-carrito/base/test/precio.test.js +11 -0
  65. package/bench/casos/pruebas/precios-carrito/cambio/src/precio.ts +34 -0
  66. package/bench/casos/pruebas/precios-carrito/cambio/test/precio.test.js +42 -0
  67. package/bench/casos/pruebas/precios-carrito/esperado.json +42 -0
  68. package/bench/casos/rendimiento/boletin-correo/base/src/correo.html +1 -0
  69. package/bench/casos/rendimiento/boletin-correo/base/src/plantilla.ts +11 -0
  70. package/bench/casos/rendimiento/boletin-correo/cambio/src/envios.ts +44 -0
  71. package/bench/casos/rendimiento/boletin-correo/cambio/src/plantilla.ts +10 -0
  72. package/bench/casos/rendimiento/boletin-correo/esperado.json +42 -0
  73. package/bench/casos/rendimiento/clientes-por-lote/base/src/informe.js +8 -0
  74. package/bench/casos/rendimiento/clientes-por-lote/cambio/src/informe.js +6 -0
  75. package/bench/casos/rendimiento/clientes-por-lote/esperado.json +14 -0
  76. package/bench/casos/rendimiento/informe-ventas/base/src/informe.js +6 -0
  77. package/bench/casos/rendimiento/informe-ventas/base/src/tasas.json +1 -0
  78. package/bench/casos/rendimiento/informe-ventas/cambio/src/informe.js +33 -0
  79. package/bench/casos/rendimiento/informe-ventas/cambio/src/tasas.js +7 -0
  80. package/bench/casos/rendimiento/informe-ventas/esperado.json +42 -0
  81. package/bench/casos/seguridad/inyeccion-orden/base/src/respaldo.ts +13 -0
  82. package/bench/casos/seguridad/inyeccion-orden/cambio/src/respaldo.ts +69 -0
  83. package/bench/casos/seguridad/inyeccion-orden/esperado.json +42 -0
  84. package/bench/casos/seguridad/limpio-validacion/base/servidor.js +11 -0
  85. package/bench/casos/seguridad/limpio-validacion/cambio/servidor.js +39 -0
  86. package/bench/casos/seguridad/limpio-validacion/esperado.json +14 -0
  87. package/bench/casos/seguridad/servidor-archivos/base/servidor.js +21 -0
  88. package/bench/casos/seguridad/servidor-archivos/cambio/servidor.js +79 -0
  89. package/bench/casos/seguridad/servidor-archivos/esperado.json +42 -0
  90. package/bin/nexakit-fabrica-mcp.js +12 -0
  91. package/dist/fabrica/banco/casos.js +304 -0
  92. package/dist/fabrica/banco/ejecutar.js +483 -0
  93. package/dist/fabrica/banco/medir.js +120 -0
  94. package/dist/fabrica/cli.js +737 -0
  95. package/dist/fabrica/conectores/antigravity.js +1040 -0
  96. package/dist/fabrica/conectores/codex.js +967 -0
  97. package/dist/fabrica/conectores/tipos.js +8 -0
  98. package/dist/fabrica/config.js +44 -0
  99. package/dist/fabrica/consolidar.js +218 -0
  100. package/dist/fabrica/decision.js +210 -0
  101. package/dist/fabrica/diff.js +247 -0
  102. package/dist/fabrica/disco.js +356 -0
  103. package/dist/fabrica/ejecutor.js +597 -0
  104. package/dist/fabrica/encargo/candado.js +274 -0
  105. package/dist/fabrica/encargo/ejecutar.js +827 -0
  106. package/dist/fabrica/encargo/evidencia.js +308 -0
  107. package/dist/fabrica/encargo/parche.js +146 -0
  108. package/dist/fabrica/encargo/worktree.js +394 -0
  109. package/dist/fabrica/enrutador.js +425 -0
  110. package/dist/fabrica/errores.js +14 -0
  111. package/dist/fabrica/esquemas.js +57 -0
  112. package/dist/fabrica/estaciones.js +75 -0
  113. package/dist/fabrica/evidencia.js +406 -0
  114. package/dist/fabrica/indice.js +1 -0
  115. package/dist/fabrica/jsonrpc.js +274 -0
  116. package/dist/fabrica/lecciones.js +363 -0
  117. package/dist/fabrica/mcp.js +376 -0
  118. package/dist/fabrica/preferencias.js +56 -0
  119. package/dist/fabrica/protocolos/codex/AbsolutePathBuf.js +2 -0
  120. package/dist/fabrica/protocolos/codex/ApplyPatchApprovalResponse.js +2 -0
  121. package/dist/fabrica/protocolos/codex/ClientInfo.js +2 -0
  122. package/dist/fabrica/protocolos/codex/ExecCommandApprovalParams.js +2 -0
  123. package/dist/fabrica/protocolos/codex/ExecCommandApprovalResponse.js +2 -0
  124. package/dist/fabrica/protocolos/codex/ExecPolicyAmendment.js +2 -0
  125. package/dist/fabrica/protocolos/codex/FunctionCallOutputBody.js +2 -0
  126. package/dist/fabrica/protocolos/codex/FunctionCallOutputContentItem.js +2 -0
  127. package/dist/fabrica/protocolos/codex/ImageDetail.js +2 -0
  128. package/dist/fabrica/protocolos/codex/InitializeCapabilities.js +2 -0
  129. package/dist/fabrica/protocolos/codex/InitializeParams.js +2 -0
  130. package/dist/fabrica/protocolos/codex/InitializeResponse.js +2 -0
  131. package/dist/fabrica/protocolos/codex/InputModality.js +2 -0
  132. package/dist/fabrica/protocolos/codex/LegacyAppPathString.js +2 -0
  133. package/dist/fabrica/protocolos/codex/NetworkPolicyAmendment.js +2 -0
  134. package/dist/fabrica/protocolos/codex/NetworkPolicyRuleAction.js +2 -0
  135. package/dist/fabrica/protocolos/codex/ParsedCommand.js +2 -0
  136. package/dist/fabrica/protocolos/codex/Personality.js +2 -0
  137. package/dist/fabrica/protocolos/codex/ReasoningEffort.js +2 -0
  138. package/dist/fabrica/protocolos/codex/ReasoningSummary.js +2 -0
  139. package/dist/fabrica/protocolos/codex/ReviewDecision.js +2 -0
  140. package/dist/fabrica/protocolos/codex/ThreadId.js +2 -0
  141. package/dist/fabrica/protocolos/codex/serde_json/JsonValue.js +2 -0
  142. package/dist/fabrica/protocolos/codex/v2/AdditionalFileSystemPermissions.js +2 -0
  143. package/dist/fabrica/protocolos/codex/v2/AdditionalNetworkPermissions.js +2 -0
  144. package/dist/fabrica/protocolos/codex/v2/ApprovalsReviewer.js +2 -0
  145. package/dist/fabrica/protocolos/codex/v2/AskForApproval.js +2 -0
  146. package/dist/fabrica/protocolos/codex/v2/ByteRange.js +2 -0
  147. package/dist/fabrica/protocolos/codex/v2/CommandAction.js +2 -0
  148. package/dist/fabrica/protocolos/codex/v2/CommandExecutionApprovalDecision.js +2 -0
  149. package/dist/fabrica/protocolos/codex/v2/CommandExecutionApprovalKind.js +2 -0
  150. package/dist/fabrica/protocolos/codex/v2/CommandExecutionRequestApprovalParams.js +2 -0
  151. package/dist/fabrica/protocolos/codex/v2/CommandExecutionRequestApprovalResponse.js +2 -0
  152. package/dist/fabrica/protocolos/codex/v2/ConfigReadParams.js +2 -0
  153. package/dist/fabrica/protocolos/codex/v2/CyberAccessProgram.js +2 -0
  154. package/dist/fabrica/protocolos/codex/v2/ExecPolicyAmendment.js +2 -0
  155. package/dist/fabrica/protocolos/codex/v2/FileChangeApprovalDecision.js +2 -0
  156. package/dist/fabrica/protocolos/codex/v2/FileChangeRequestApprovalResponse.js +2 -0
  157. package/dist/fabrica/protocolos/codex/v2/FileSystemAccessMode.js +2 -0
  158. package/dist/fabrica/protocolos/codex/v2/FileSystemPath.js +2 -0
  159. package/dist/fabrica/protocolos/codex/v2/FileSystemSandboxEntry.js +2 -0
  160. package/dist/fabrica/protocolos/codex/v2/FileSystemSpecialPath.js +2 -0
  161. package/dist/fabrica/protocolos/codex/v2/GrantedPermissionProfile.js +2 -0
  162. package/dist/fabrica/protocolos/codex/v2/ListMcpServerStatusParams.js +2 -0
  163. package/dist/fabrica/protocolos/codex/v2/McpServerElicitationAction.js +2 -0
  164. package/dist/fabrica/protocolos/codex/v2/McpServerElicitationRequestResponse.js +2 -0
  165. package/dist/fabrica/protocolos/codex/v2/McpServerStatusDetail.js +2 -0
  166. package/dist/fabrica/protocolos/codex/v2/Model.js +2 -0
  167. package/dist/fabrica/protocolos/codex/v2/ModelAccessPrograms.js +2 -0
  168. package/dist/fabrica/protocolos/codex/v2/ModelAvailabilityNux.js +2 -0
  169. package/dist/fabrica/protocolos/codex/v2/ModelListParams.js +2 -0
  170. package/dist/fabrica/protocolos/codex/v2/ModelListResponse.js +2 -0
  171. package/dist/fabrica/protocolos/codex/v2/ModelServiceTier.js +2 -0
  172. package/dist/fabrica/protocolos/codex/v2/ModelUpgradeInfo.js +2 -0
  173. package/dist/fabrica/protocolos/codex/v2/MultiAgentVersion.js +2 -0
  174. package/dist/fabrica/protocolos/codex/v2/NetworkAccess.js +2 -0
  175. package/dist/fabrica/protocolos/codex/v2/NetworkApprovalContext.js +2 -0
  176. package/dist/fabrica/protocolos/codex/v2/NetworkApprovalProtocol.js +2 -0
  177. package/dist/fabrica/protocolos/codex/v2/NetworkPolicyAmendment.js +2 -0
  178. package/dist/fabrica/protocolos/codex/v2/NetworkPolicyRuleAction.js +2 -0
  179. package/dist/fabrica/protocolos/codex/v2/PermissionGrantScope.js +2 -0
  180. package/dist/fabrica/protocolos/codex/v2/PermissionsRequestApprovalResponse.js +2 -0
  181. package/dist/fabrica/protocolos/codex/v2/ReasoningEffortOption.js +2 -0
  182. package/dist/fabrica/protocolos/codex/v2/SandboxMode.js +2 -0
  183. package/dist/fabrica/protocolos/codex/v2/SandboxPolicy.js +2 -0
  184. package/dist/fabrica/protocolos/codex/v2/TextElement.js +2 -0
  185. package/dist/fabrica/protocolos/codex/v2/ThreadSource.js +2 -0
  186. package/dist/fabrica/protocolos/codex/v2/ThreadStartParams.js +2 -0
  187. package/dist/fabrica/protocolos/codex/v2/ThreadStartSource.js +2 -0
  188. package/dist/fabrica/protocolos/codex/v2/ThreadTokenUsage.js +2 -0
  189. package/dist/fabrica/protocolos/codex/v2/ThreadTokenUsageUpdatedNotification.js +2 -0
  190. package/dist/fabrica/protocolos/codex/v2/TokenUsageBreakdown.js +2 -0
  191. package/dist/fabrica/protocolos/codex/v2/ToolRequestUserInputAnswer.js +2 -0
  192. package/dist/fabrica/protocolos/codex/v2/ToolRequestUserInputResponse.js +2 -0
  193. package/dist/fabrica/protocolos/codex/v2/TurnInterruptParams.js +2 -0
  194. package/dist/fabrica/protocolos/codex/v2/TurnStartParams.js +2 -0
  195. package/dist/fabrica/protocolos/codex/v2/TurnToolOutput.js +2 -0
  196. package/dist/fabrica/protocolos/codex/v2/UserInput.js +2 -0
  197. package/dist/fabrica/rastro.js +487 -0
  198. package/dist/fabrica/sesion.js +230 -0
  199. package/dist/fabrica/tabla-modelos.json +29 -0
  200. package/dist/fabrica/veredictos.js +327 -0
  201. package/package.json +16 -8
  202. package/plugins/huellas.json +6 -6
  203. package/plugins/nexakit-lecciones/.claude-plugin/plugin.json +1 -1
  204. package/plugins/nexakit-lecciones/README.md +6 -5
  205. package/plugins/nexakit-lecciones/hooks/lecciones.js +29 -5
  206. package/plugins/nexakit-lecciones/hooks/register.js +7 -3
  207. package/plugins/nexakit-modelo/.claude-plugin/plugin.json +1 -1
  208. package/plugins/nexakit-modelo/hooks/barra.js +100 -4
  209. package/plugins/nexakit-modelo/hooks/decidir.js +2 -2
  210. package/plugins/nexakit-modelo/hooks/recomendar.js +1 -1
  211. package/plugins/nexakit-modelo/hooks/register.js +122 -7
  212. package/plugins/nexakit-modelo/tests/register.test.ts +301 -0
  213. package/plugins/niveles/.claude-plugin/plugin.json +1 -1
  214. package/plugins/niveles/agents/cazador-de-flakes.md +1 -0
  215. package/plugins/niveles/agents/cierre-de-memoria.md +1 -0
  216. package/plugins/niveles/agents/investigador.md +1 -0
  217. package/plugins/niveles/agents/nivel-alto.md +1 -0
  218. package/plugins/niveles/agents/nivel-exigente.md +1 -0
  219. package/plugins/niveles/agents/nivel-ligero.md +1 -0
  220. package/plugins/niveles/agents/nivel-normal.md +1 -0
  221. package/plugins/niveles/agents/revisor-de-calidad.md +1 -0
  222. package/plugins/niveles/agents/sincronizador-docs.md +1 -0
  223. package/plugins/niveles/agents/subir-al-repo.md +1 -0
  224. package/skills/elegir-modelo/SKILL.md +4 -3
  225. package/skills/elegir-modelo/modelos.mjs +100 -1
  226. package/skills/fabrica/SKILL.md +55 -0
  227. package/skills/gemini/SKILL.md +2 -3
  228. package/skills/quality-gate/SKILL.md +2 -2
  229. package/src/agent-models.js +6 -4
  230. package/src/antigravity-barra.js +64 -12
  231. package/src/antigravity-command.js +4 -2
  232. package/src/antigravity-models.js +61 -0
  233. package/src/antigravity-pre-tool.js +11 -3
  234. package/src/antigravity-recommendation.js +15 -9
  235. package/src/antigravity-setup.js +4 -31
  236. package/src/cli-executable.d.ts +11 -0
  237. package/src/codex-pre-tool.js +3 -3
  238. package/src/codex-recommendation.js +1 -2
  239. package/src/codex-setup.js +3 -20
  240. package/src/codex-team.js +31 -4
  241. package/src/fabrica/banco/casos.ts +315 -0
  242. package/src/fabrica/banco/ejecutar.ts +587 -0
  243. package/src/fabrica/banco/medir.ts +160 -0
  244. package/src/fabrica/cli.ts +781 -0
  245. package/src/fabrica/conectores/antigravity.ts +1090 -0
  246. package/src/fabrica/conectores/codex.ts +1013 -0
  247. package/src/fabrica/conectores/tipos.ts +54 -0
  248. package/src/fabrica/config.ts +43 -0
  249. package/src/fabrica/consolidar.ts +277 -0
  250. package/src/fabrica/decision.ts +285 -0
  251. package/src/fabrica/diff.ts +294 -0
  252. package/src/fabrica/disco.ts +380 -0
  253. package/src/fabrica/ejecutor.ts +716 -0
  254. package/src/fabrica/encargo/candado.ts +287 -0
  255. package/src/fabrica/encargo/ejecutar.ts +953 -0
  256. package/src/fabrica/encargo/evidencia.ts +301 -0
  257. package/src/fabrica/encargo/parche.ts +151 -0
  258. package/src/fabrica/encargo/worktree.ts +427 -0
  259. package/src/fabrica/enrutador.ts +494 -0
  260. package/src/fabrica/errores.ts +15 -0
  261. package/src/fabrica/esquemas.ts +92 -0
  262. package/src/fabrica/estaciones.ts +83 -0
  263. package/src/fabrica/evidencia.ts +445 -0
  264. package/src/fabrica/indice.ts +1 -0
  265. package/src/fabrica/jsonrpc.ts +314 -0
  266. package/src/fabrica/lecciones.ts +411 -0
  267. package/src/fabrica/mcp.ts +450 -0
  268. package/src/fabrica/preferencias.ts +66 -0
  269. package/src/fabrica/protocolos/codex/AbsolutePathBuf.ts +14 -0
  270. package/src/fabrica/protocolos/codex/ApplyPatchApprovalResponse.ts +6 -0
  271. package/src/fabrica/protocolos/codex/ClientInfo.ts +5 -0
  272. package/src/fabrica/protocolos/codex/ExecCommandApprovalParams.ts +16 -0
  273. package/src/fabrica/protocolos/codex/ExecCommandApprovalResponse.ts +6 -0
  274. package/src/fabrica/protocolos/codex/ExecPolicyAmendment.ts +12 -0
  275. package/src/fabrica/protocolos/codex/FunctionCallOutputBody.ts +6 -0
  276. package/src/fabrica/protocolos/codex/FunctionCallOutputContentItem.ts +10 -0
  277. package/src/fabrica/protocolos/codex/ImageDetail.ts +5 -0
  278. package/src/fabrica/protocolos/codex/InitializeCapabilities.ts +42 -0
  279. package/src/fabrica/protocolos/codex/InitializeParams.ts +7 -0
  280. package/src/fabrica/protocolos/codex/InitializeResponse.ts +20 -0
  281. package/src/fabrica/protocolos/codex/InputModality.ts +8 -0
  282. package/src/fabrica/protocolos/codex/LegacyAppPathString.ts +27 -0
  283. package/src/fabrica/protocolos/codex/NetworkPolicyAmendment.ts +6 -0
  284. package/src/fabrica/protocolos/codex/NetworkPolicyRuleAction.ts +5 -0
  285. package/src/fabrica/protocolos/codex/ParsedCommand.ts +12 -0
  286. package/src/fabrica/protocolos/codex/Personality.ts +8 -0
  287. package/src/fabrica/protocolos/codex/ReasoningEffort.ts +8 -0
  288. package/src/fabrica/protocolos/codex/ReasoningSummary.ts +10 -0
  289. package/src/fabrica/protocolos/codex/ReviewDecision.ts +10 -0
  290. package/src/fabrica/protocolos/codex/ThreadId.ts +10 -0
  291. package/src/fabrica/protocolos/codex/VERSION +1 -0
  292. package/src/fabrica/protocolos/codex/serde_json/JsonValue.ts +5 -0
  293. package/src/fabrica/protocolos/codex/v2/AdditionalFileSystemPermissions.ts +15 -0
  294. package/src/fabrica/protocolos/codex/v2/AdditionalNetworkPermissions.ts +5 -0
  295. package/src/fabrica/protocolos/codex/v2/ApprovalsReviewer.ts +12 -0
  296. package/src/fabrica/protocolos/codex/v2/AskForApproval.ts +5 -0
  297. package/src/fabrica/protocolos/codex/v2/ByteRange.ts +5 -0
  298. package/src/fabrica/protocolos/codex/v2/CommandAction.ts +6 -0
  299. package/src/fabrica/protocolos/codex/v2/CommandExecutionApprovalDecision.ts +7 -0
  300. package/src/fabrica/protocolos/codex/v2/CommandExecutionApprovalKind.ts +8 -0
  301. package/src/fabrica/protocolos/codex/v2/CommandExecutionRequestApprovalParams.ts +51 -0
  302. package/src/fabrica/protocolos/codex/v2/CommandExecutionRequestApprovalResponse.ts +6 -0
  303. package/src/fabrica/protocolos/codex/v2/ConfigReadParams.ts +11 -0
  304. package/src/fabrica/protocolos/codex/v2/CyberAccessProgram.ts +9 -0
  305. package/src/fabrica/protocolos/codex/v2/ExecPolicyAmendment.ts +5 -0
  306. package/src/fabrica/protocolos/codex/v2/FileChangeApprovalDecision.ts +5 -0
  307. package/src/fabrica/protocolos/codex/v2/FileChangeRequestApprovalResponse.ts +6 -0
  308. package/src/fabrica/protocolos/codex/v2/FileSystemAccessMode.ts +5 -0
  309. package/src/fabrica/protocolos/codex/v2/FileSystemPath.ts +7 -0
  310. package/src/fabrica/protocolos/codex/v2/FileSystemSandboxEntry.ts +7 -0
  311. package/src/fabrica/protocolos/codex/v2/FileSystemSpecialPath.ts +6 -0
  312. package/src/fabrica/protocolos/codex/v2/GrantedPermissionProfile.ts +7 -0
  313. package/src/fabrica/protocolos/codex/v2/ListMcpServerStatusParams.ts +23 -0
  314. package/src/fabrica/protocolos/codex/v2/McpServerElicitationAction.ts +5 -0
  315. package/src/fabrica/protocolos/codex/v2/McpServerElicitationRequestResponse.ts +17 -0
  316. package/src/fabrica/protocolos/codex/v2/McpServerStatusDetail.ts +5 -0
  317. package/src/fabrica/protocolos/codex/v2/Model.ts +33 -0
  318. package/src/fabrica/protocolos/codex/v2/ModelAccessPrograms.ts +13 -0
  319. package/src/fabrica/protocolos/codex/v2/ModelAvailabilityNux.ts +5 -0
  320. package/src/fabrica/protocolos/codex/v2/ModelListParams.ts +17 -0
  321. package/src/fabrica/protocolos/codex/v2/ModelListResponse.ts +11 -0
  322. package/src/fabrica/protocolos/codex/v2/ModelServiceTier.ts +5 -0
  323. package/src/fabrica/protocolos/codex/v2/ModelUpgradeInfo.ts +9 -0
  324. package/src/fabrica/protocolos/codex/v2/MultiAgentVersion.ts +8 -0
  325. package/src/fabrica/protocolos/codex/v2/NetworkAccess.ts +5 -0
  326. package/src/fabrica/protocolos/codex/v2/NetworkApprovalContext.ts +6 -0
  327. package/src/fabrica/protocolos/codex/v2/NetworkApprovalProtocol.ts +5 -0
  328. package/src/fabrica/protocolos/codex/v2/NetworkPolicyAmendment.ts +6 -0
  329. package/src/fabrica/protocolos/codex/v2/NetworkPolicyRuleAction.ts +5 -0
  330. package/src/fabrica/protocolos/codex/v2/PermissionGrantScope.ts +5 -0
  331. package/src/fabrica/protocolos/codex/v2/PermissionsRequestApprovalResponse.ts +11 -0
  332. package/src/fabrica/protocolos/codex/v2/ReasoningEffortOption.ts +6 -0
  333. package/src/fabrica/protocolos/codex/v2/SandboxMode.ts +5 -0
  334. package/src/fabrica/protocolos/codex/v2/SandboxPolicy.ts +7 -0
  335. package/src/fabrica/protocolos/codex/v2/TextElement.ts +14 -0
  336. package/src/fabrica/protocolos/codex/v2/ThreadSource.ts +5 -0
  337. package/src/fabrica/protocolos/codex/v2/ThreadStartParams.ts +22 -0
  338. package/src/fabrica/protocolos/codex/v2/ThreadStartSource.ts +5 -0
  339. package/src/fabrica/protocolos/codex/v2/ThreadTokenUsage.ts +6 -0
  340. package/src/fabrica/protocolos/codex/v2/ThreadTokenUsageUpdatedNotification.ts +6 -0
  341. package/src/fabrica/protocolos/codex/v2/TokenUsageBreakdown.ts +5 -0
  342. package/src/fabrica/protocolos/codex/v2/ToolRequestUserInputAnswer.ts +8 -0
  343. package/src/fabrica/protocolos/codex/v2/ToolRequestUserInputResponse.ts +9 -0
  344. package/src/fabrica/protocolos/codex/v2/TurnInterruptParams.ts +5 -0
  345. package/src/fabrica/protocolos/codex/v2/TurnStartParams.ts +75 -0
  346. package/src/fabrica/protocolos/codex/v2/TurnToolOutput.ts +10 -0
  347. package/src/fabrica/protocolos/codex/v2/UserInput.ts +11 -0
  348. package/src/fabrica/rastro.ts +508 -0
  349. package/src/fabrica/sesion.ts +280 -0
  350. package/src/fabrica/tabla-modelos.json +29 -0
  351. package/src/fabrica/veredictos.ts +365 -0
  352. package/src/gemini-cli.js +15 -12
  353. package/src/gemini-tools.js +1 -1
  354. package/src/gemini-usage-store.js +32 -0
  355. package/src/instructions-block.js +69 -0
  356. package/src/lecciones-command.js +105 -4
  357. package/src/lecciones-instructions.js +178 -0
  358. package/src/legacy-repair.js +1 -1
  359. package/src/level-agents.js +5 -3
  360. package/src/memory-mcp-policy.js +1 -1
  361. package/src/missing-dependencies.js +5 -0
  362. package/src/model-command.d.ts +29 -0
  363. package/src/model-command.js +4 -27
  364. package/src/regla-ordenes-simples.d.ts +2 -0
  365. package/src/regla-ordenes-simples.js +4 -0
  366. package/src/review-instructions.js +69 -81
  367. package/src/safe-paths.js +38 -0
  368. package/src/setup-apply.js +24 -2
  369. package/src/setup-plan.js +57 -1
  370. package/src/setup-state.js +14 -0
  371. package/src/shell-quote.js +2 -0
  372. package/src/skill-recommendations.js +101 -28
  373. package/src/stable-command.js +2 -2
  374. package/src/stable-install.js +4 -2
  375. package/src/superpowers.js +0 -7
  376. package/src/task-document.js +59 -0
  377. package/src/terminal-text.js +2 -19
  378. package/src/toolkit-cli.js +63 -8
  379. package/src/toolkit-setup.js +192 -37
  380. package/templates/agent-team/README.md +7 -19
  381. package/bin/agent-task.js +0 -14
  382. package/bin/agent-toolkit-inbox.js +0 -14
  383. package/bin/agent-toolkit-mcp.js +0 -17
  384. package/schemas/agent-client-adapter.schema.json +0 -786
  385. package/schemas/agent-client-auth-diagnostic.schema.json +0 -801
  386. package/schemas/agent-client-isolated-variant.schema.json +0 -105
  387. package/schemas/agent-client-isolated-verification.schema.json +0 -99
  388. package/schemas/agent-client-managed-preferences-invocation.schema.json +0 -67
  389. package/schemas/agent-client-managed-preferences.schema.json +0 -63
  390. package/schemas/agent-client-native-diagnostics.schema.json +0 -85
  391. package/schemas/agent-client-native-evaluation.schema.json +0 -171
  392. package/schemas/agent-client-native-preflight.schema.json +0 -90
  393. package/schemas/agent-client-output.schema.json +0 -551
  394. package/schemas/agent-client-runtime-fixture.schema.json +0 -90
  395. package/schemas/agent-client-runtime-local.schema.json +0 -95
  396. package/schemas/agent-client-runtime.schema.json +0 -1288
  397. package/schemas/agent-client-selective-config.schema.json +0 -77
  398. package/schemas/agent-client-supervised-local.schema.json +0 -135
  399. package/schemas/agent-client-supervised.schema.json +0 -186
  400. package/schemas/agent-task-approvals.schema.json +0 -362
  401. package/schemas/agent-task-prepare.schema.json +0 -1324
  402. package/schemas/agent-task-verify.schema.json +0 -198
  403. package/schemas/task-workflow-plan-output.schema.json +0 -35
  404. package/skills/revisar/SKILL.md +0 -51
  405. package/src/claude-code-runner.js +0 -642
  406. package/src/client-adapter-plan.js +0 -271
  407. package/src/client-auth-diagnostic-parser.js +0 -211
  408. package/src/client-auth-diagnostic.js +0 -257
  409. package/src/client-isolated-variant.js +0 -106
  410. package/src/client-isolated-verification.js +0 -130
  411. package/src/client-local-platform.js +0 -14
  412. package/src/client-managed-preferences-invocation.js +0 -209
  413. package/src/client-managed-preferences.js +0 -78
  414. package/src/client-native-access.js +0 -134
  415. package/src/client-native-diagnostics.js +0 -253
  416. package/src/client-native-evaluation.js +0 -106
  417. package/src/client-native-preflight-files.js +0 -68
  418. package/src/client-native-preflight.js +0 -95
  419. package/src/client-output-parser.js +0 -278
  420. package/src/client-runtime-admission.js +0 -80
  421. package/src/client-runtime-coordinator.js +0 -70
  422. package/src/client-runtime-core.js +0 -92
  423. package/src/client-runtime-fixture-permit.js +0 -20
  424. package/src/client-runtime-fixture-protocol.js +0 -39
  425. package/src/client-runtime-state.js +0 -67
  426. package/src/client-runtime-store-files.js +0 -91
  427. package/src/client-runtime-store.js +0 -239
  428. package/src/client-runtime-supervisor.js +0 -146
  429. package/src/client-selective-config.js +0 -195
  430. package/src/client-selective-files.js +0 -126
  431. package/src/client-supervised-codes.js +0 -32
  432. package/src/client-supervised-contract.js +0 -52
  433. package/src/client-supervised-coordinator.js +0 -36
  434. package/src/client-supervised-permit.js +0 -20
  435. package/src/client-supervised-protocol.js +0 -37
  436. package/src/client-supervised-store.js +0 -167
  437. package/src/client-supervised-supervisor.js +0 -167
  438. package/src/client-supervised.js +0 -160
  439. package/src/codex-cli-runner.js +0 -358
  440. package/src/codex-delivery.js +0 -101
  441. package/src/memory-connection-artifacts.js +0 -192
  442. package/src/memory-connection-descriptor.js +0 -158
  443. package/src/memory-connection-diagnostic.js +0 -177
  444. package/src/memory-connection-files.js +0 -191
  445. package/src/memory-connection-manifest.js +0 -118
  446. package/src/memory-connection-package.js +0 -176
  447. package/src/memory-connection-plan.js +0 -217
  448. package/src/memory-connection-skill.js +0 -211
  449. package/src/memory-connection-toml.js +0 -153
  450. package/src/native/managed-preferences.c +0 -100
  451. package/src/native/managed-preferences.h +0 -17
  452. package/src/package-lock-path.js +0 -13
  453. package/src/peer-handoff.js +0 -27
  454. package/src/peer-inbox-cli.js +0 -211
  455. package/src/peer-review-mcp.js +0 -210
  456. package/src/peer-review-store.js +0 -532
  457. package/src/review-policy.js +0 -35
  458. package/src/revision-adapters.js +0 -158
  459. package/src/revision-context.js +0 -86
  460. package/src/revision-isolation.js +0 -222
  461. package/src/revision-process.js +0 -103
  462. package/src/revision-provenance.js +0 -89
  463. package/src/revision-snapshot.js +0 -120
  464. package/src/revision.js +0 -242
  465. package/src/runtime-fixtures/runtime-supervisor/child.cjs +0 -3
  466. package/src/runtime-fixtures/runtime-supervisor/fixture.cjs +0 -49
  467. package/src/runtime-fixtures/supervised/child.cjs +0 -3
  468. package/src/runtime-fixtures/supervised/fixture.cjs +0 -47
  469. package/src/task-approvals.js +0 -367
  470. package/src/task-cli.js +0 -79
  471. package/src/task-external-verifier.js +0 -584
  472. package/src/task-prepare-files.js +0 -115
  473. package/src/task-prepare.js +0 -180
  474. package/src/task-verify-cli.js +0 -67
  475. package/src/task-verify-files.js +0 -188
  476. package/src/task-verify.js +0 -118
  477. package/src/task-workflow-mcp.js +0 -544
  478. package/src/task-workflow-store.js +0 -254
  479. package/src/toolkit-commands-guide.js +0 -115
@@ -29,12 +29,14 @@ const FAMILY_ROLES = Object.freeze({
29
29
  terra: "uso diario",
30
30
  sol: "uso diario",
31
31
  sonnet: "uso diario",
32
+ hydrogen: "uso diario",
32
33
  astra: "el más capaz",
33
34
  argon: "el más capaz",
35
+ carbon: "el más capaz",
34
36
  opus: "el más capaz"
35
37
  });
36
38
 
37
- export function roleFromDescription(description = "") {
39
+ function roleFromDescription(description = "") {
38
40
  if (/\b(fast and (affordable|efficient)|easier tasks|lightweight)\b/iu.test(description)) return "ligero";
39
41
  if (/\b(frontier|most demanding)\b/iu.test(description)) return "el más capaz";
40
42
  if (/\b(workhorse|everyday|balanced|straightforward work)\b/iu.test(description)) return "uso diario";
@@ -43,13 +45,13 @@ export function roleFromDescription(description = "") {
43
45
 
44
46
  export function familyOfModel(slug = "") {
45
47
  const base = String(slug).replace(/-(?:low|medium|high|xhigh|max|ultra)$/iu, "");
46
- const known = base.match(/\b(luna|terra|sol|astra|flash|argon|haiku|sonnet|opus)\b/iu);
48
+ const known = base.match(/\b(luna|terra|sol|astra|flash|hydrogen|neon|argon|carbon|haiku|sonnet|opus)\b/iu);
47
49
  if (known) return known[1].toLowerCase();
48
50
  const family = base.match(/^(?:gpt|gemini|claude)-\d+(?:\.\d+)*-([a-z][a-z0-9]*)$/iu);
49
51
  return family ? family[1].toLowerCase() : null;
50
52
  }
51
53
 
52
- export function classifyModelRole(slug = "", description = "", familyRoles = new Map(Object.entries(FAMILY_ROLES))) {
54
+ function classifyModelRole(slug = "", description = "", familyRoles = new Map(Object.entries(FAMILY_ROLES))) {
53
55
  if (/\b(older|previous)\b/iu.test(description)) return "anterior";
54
56
  const direct = roleFromDescription(description);
55
57
  if (direct) return direct;
@@ -58,7 +60,7 @@ export function classifyModelRole(slug = "", description = "", familyRoles = new
58
60
  return "sin clasificar";
59
61
  }
60
62
 
61
- export function buildFamilyRoleMap(items = []) {
63
+ function buildFamilyRoleMap(items = []) {
62
64
  const map = new Map(Object.entries(FAMILY_ROLES));
63
65
  for (const item of items) {
64
66
  const family = familyOfModel(item.slug ?? item.model ?? "");
@@ -1,4 +1,7 @@
1
- import { etiquetaDeAgente, formatoReinicio, medidor, tono } from '../plugins/nexakit-modelo/hooks/barra.js';
1
+ import { closeSync, constants, fstatSync, lstatSync, openSync, readSync } from 'node:fs';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ import { activoDeTexto, datosDeFabrica, detalleDeFabrica, etiquetaDeAgente, formatoReinicio, formatoTokens, medidor, tono, tonoCache } from '../plugins/nexakit-modelo/hooks/barra.js';
2
5
  import { LIMITE_ALTO } from '../plugins/nexakit-modelo/hooks/decidir.js';
3
6
  import { parseAntigravityModel } from './antigravity-recommendation.js';
4
7
 
@@ -28,7 +31,6 @@ const ANSI = Object.freeze({
28
31
 
29
32
  const isNum = (v) => typeof v === 'number' && Number.isFinite(v);
30
33
  const clampPercent = (v) => Math.min(100, Math.max(0, v));
31
- const tonoCache = (p) => (p >= 80 ? 'success' : p >= 50 ? 'warning' : 'error');
32
34
  const fitText = (text, width) => (text.length > width ? `${text.slice(0, width - 1)}…` : text.padEnd(width));
33
35
 
34
36
  /** Extract highest active quota bucket usage percentage and ISO reset timestamp. */
@@ -102,14 +104,17 @@ function recommendationSegment(recommendation, current, quotaPercent) {
102
104
  return recommendation.label ? { text: ` → ${recommendation.label}`, color: 'suggestion' } : null;
103
105
  }
104
106
 
105
- function buildSubagentRows(subagents) {
106
- if (!Array.isArray(subagents) || subagents.length === 0) return [];
107
- const recent = subagents.slice(-MAX_FILAS);
107
+ function buildSubagentRows(subagents, stations = []) {
108
+ const recent = Array.isArray(subagents) ? subagents.slice(-MAX_FILAS) : [];
109
+ if (recent.length === 0 && stations.length === 0) return [];
108
110
  const labels = recent.map((entry) => etiquetaDeAgente(entry?.name));
109
111
  const roles = recent.map((entry) => (typeof entry?.role === 'string' ? entry.role.trim() : ''));
110
- const column = Math.min(MAX_ETIQUETA, Math.max(MIN_ETIQUETA, ...labels.map((label) => label.length))) + 2;
111
- const roleWidth = Math.min(MAX_ROL, Math.max(0, ...roles.map((role) => role.length)));
112
- return recent.map((entry, index) => {
112
+ const details = stations.map(detalleDeFabrica);
113
+ // Las estaciones de la fábrica comparten la columna del nombre y la del rol con los subagentes, para que
114
+ // el icono quede en la misma posición cuando conviven las dos clases de filas.
115
+ const column = Math.min(MAX_ETIQUETA, Math.max(MIN_ETIQUETA, ...labels.map((label) => label.length), ...stations.map((d) => d.estacion.length))) + 2;
116
+ const roleWidth = Math.min(MAX_ROL, Math.max(0, ...roles.map((role) => role.length), ...details.map((d) => d.length)));
117
+ const rows = recent.map((entry, index) => {
113
118
  const label = labels[index].length > MAX_ETIQUETA ? `${labels[index].slice(0, MAX_ETIQUETA - 1)}…` : labels[index];
114
119
  const role = roles[index];
115
120
  const statusKey = typeof entry?.status === 'string' ? entry.status.toLowerCase() : '';
@@ -120,10 +125,57 @@ function buildSubagentRows(subagents) {
120
125
  { text: icon, color },
121
126
  ];
122
127
  });
128
+ const stationRows = stations.map((d, index) => [
129
+ { text: ` ↳ ${fitText(d.estacion, MAX_ETIQUETA).trimEnd().padEnd(column)}`, dim: true },
130
+ { text: `${fitText(details[index], roleWidth)} `, color: 'antigravity' },
131
+ { text: d.icono, color: d.color },
132
+ ...(d.tokens > 0 ? [{ text: ` ${formatoTokens(d.tokens)} tokens` }] : []),
133
+ ]);
134
+ return [...rows, ...stationRows];
135
+ }
136
+
137
+ const TOPE_ACTIVO = 64 * 1024;
138
+
139
+ const pidVivo = (pid) => {
140
+ if (!Number.isInteger(pid) || pid <= 0) return true;
141
+ try {
142
+ process.kill(pid, 0);
143
+ return true;
144
+ } catch (error) {
145
+ return error?.code === 'EPERM';
146
+ }
147
+ };
148
+
149
+ /**
150
+ * Lee `~/.nexakit/fabrica/activo.json` (solo lectura, sin seguir enlaces, tope de 64 KiB). Falla en abierto:
151
+ * cualquier problema o un proceso que ya no vive devuelve null.
152
+ */
153
+ export function leerActivoDeFabrica(home = os.homedir()) {
154
+ try {
155
+ const base = path.join(home, '.nexakit', 'fabrica');
156
+ const carpeta = lstatSync(base, { throwIfNoEntry: false });
157
+ if (!carpeta || !carpeta.isDirectory() || carpeta.isSymbolicLink()) return null;
158
+ const archivo = path.join(base, 'activo.json');
159
+ const info = lstatSync(archivo, { throwIfNoEntry: false });
160
+ if (!info || !info.isFile() || info.size > TOPE_ACTIVO) return null;
161
+ const fd = openSync(archivo, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
162
+ try {
163
+ const { size } = fstatSync(fd);
164
+ if (size > TOPE_ACTIVO) return null;
165
+ const buffer = Buffer.alloc(size);
166
+ readSync(fd, buffer, 0, size, 0);
167
+ const activo = activoDeTexto(buffer.toString('utf8'));
168
+ return activo && pidVivo(activo.pid) ? activo : null;
169
+ } finally {
170
+ closeSync(fd);
171
+ }
172
+ } catch {
173
+ return null;
174
+ }
123
175
  }
124
176
 
125
177
  /** Build structured bar segments and subagent rows from an Antigravity statusLine payload. */
126
- export function buildAntigravityStatusSegments(payload, { recommendation = null, now = Date.now() } = {}) {
178
+ export function buildAntigravityStatusSegments(payload, { recommendation = null, now = Date.now(), fabrica = null } = {}) {
127
179
  const safe = payload && typeof payload === 'object' && !Array.isArray(payload) ? payload : {};
128
180
  const model = parseAntigravityModel(safe.model);
129
181
  const segments = [
@@ -159,7 +211,7 @@ export function buildAntigravityStatusSegments(payload, { recommendation = null,
159
211
  segments.push({ text: ' sandbox', dim: true });
160
212
  }
161
213
 
162
- return { segments, subagents: buildSubagentRows(safe.subagents) };
214
+ return { segments, subagents: buildSubagentRows(safe.subagents, datosDeFabrica(fabrica, now)) };
163
215
  }
164
216
 
165
217
  function renderSegment(segment, color) {
@@ -172,8 +224,8 @@ function renderSegment(segment, color) {
172
224
  }
173
225
 
174
226
  /** Render Antigravity statusLine payload as ANSI or plain text lines. */
175
- export function formatAntigravityStatusLine(payload, { recommendation = null, now = Date.now(), color = true } = {}) {
176
- const { segments, subagents } = buildAntigravityStatusSegments(payload, { recommendation, now });
227
+ export function formatAntigravityStatusLine(payload, { recommendation = null, now = Date.now(), color = true, fabrica = null } = {}) {
228
+ const { segments, subagents } = buildAntigravityStatusSegments(payload, { recommendation, now, fabrica });
177
229
  const renderRow = (row) => row.map((segment) => renderSegment(segment, color)).join('');
178
230
  return [renderRow(segments), ...subagents.map(renderRow)].join('\n');
179
231
  }
@@ -1,6 +1,7 @@
1
1
  import path from 'node:path';
2
2
  import {
3
3
  buildAntigravityStatusSegments,
4
+ leerActivoDeFabrica,
4
5
  extractContextPercent,
5
6
  extractQuotaSummary,
6
7
  formatAntigravityStatusLine,
@@ -82,12 +83,13 @@ async function handleBarra(flags, io, options) {
82
83
  options,
83
84
  );
84
85
 
86
+ const fabrica = leerActivoDeFabrica(options.environment?.HOME || undefined);
85
87
  if (flags['--json']) {
86
- await io.out(JSON.stringify(buildAntigravityStatusSegments(payload, { recommendation, now })) + '\n');
88
+ await io.out(JSON.stringify(buildAntigravityStatusSegments(payload, { recommendation, now, fabrica })) + '\n');
87
89
  return 0;
88
90
  }
89
91
  const color = !flags['--sin-color'] && !(options.environment?.NO_COLOR || process.env.NO_COLOR);
90
- const line = formatAntigravityStatusLine(payload, { recommendation, now, color });
92
+ const line = formatAntigravityStatusLine(payload, { recommendation, now, color, fabrica });
91
93
  if (line) await io.out(`${line}\n`);
92
94
  return 0;
93
95
  }
@@ -0,0 +1,61 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { resolveCliInvocation } from './cli-executable.js';
3
+
4
+ const EFFORT = /-(low|medium|high|xhigh|max)$/u;
5
+
6
+ // Ejecuta `agy models` una vez, sin shell, con tiempo y salida acotados.
7
+ function runAgyModels(invocation, { environment, timeoutMs, signal }) {
8
+ return new Promise((resolve, reject) => {
9
+ const child = execFile(
10
+ invocation.executable,
11
+ [...invocation.argsPrefix, 'models'],
12
+ { env: environment, timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024, windowsHide: true, shell: false, signal },
13
+ (error, stdout, stderr) => {
14
+ if (error?.code === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER') return reject(new Error('La salida de agy models supera el límite.'));
15
+ if (error && !Number.isInteger(error.code) && !error.killed) return reject(error);
16
+ resolve({
17
+ status: error ? (Number.isInteger(error.code) ? error.code : null) : 0,
18
+ stdout: String(stdout),
19
+ stderr: String(stderr),
20
+ timedOut: Boolean(error?.killed),
21
+ });
22
+ },
23
+ );
24
+ child.stdin?.end();
25
+ });
26
+ }
27
+
28
+ /** Parsea la salida de `agy models`: «id<TAB>etiqueta», con el esfuerzo al final del id. */
29
+ export function parseAntigravityModels(stdout) {
30
+ return String(stdout).split('\n').flatMap((line) => {
31
+ const [model, label] = line.split('\t');
32
+ const effort = model?.match(EFFORT)?.[1];
33
+ return model && label && effort
34
+ ? [{ model, description: label, efforts: [effort], defaultEffort: effort }]
35
+ : [];
36
+ });
37
+ }
38
+
39
+ /**
40
+ * Consulta los modelos de Antigravity. Devuelve `{ models, error }`; `error` es un texto
41
+ * en español si no se pudo consultar. `runCommand(nombre, args)` permite sustituir la ejecución.
42
+ */
43
+ export async function listAntigravityModels({
44
+ environment = process.env,
45
+ runCommand,
46
+ timeoutMs = 20000,
47
+ signal,
48
+ } = {}) {
49
+ try {
50
+ let result;
51
+ if (runCommand) result = await runCommand('agy', ['models']);
52
+ else {
53
+ const invocation = await resolveCliInvocation({ name: 'agy', environment });
54
+ result = await runAgyModels(invocation, { environment, timeoutMs, signal });
55
+ }
56
+ if (result.status !== 0 || result.timedOut) throw new Error('No se pudo consultar agy models.');
57
+ return { models: parseAntigravityModels(result.stdout), error: null };
58
+ } catch (e) {
59
+ return { models: [], error: e.message };
60
+ }
61
+ }
@@ -7,10 +7,13 @@ import { motivoBash, motivoEscritura } from '../plugins/nexakit-guardarrailes/ho
7
7
  import {
8
8
  claveDeComando,
9
9
  claveDeError,
10
+ esRegistroDeLeccion,
10
11
  esRutaDeMemoria,
11
12
  leerEventos,
13
+ notaRepeticion,
12
14
  podarEventos,
13
15
  sinGuardar,
16
+ textoSeguro,
14
17
  } from '../plugins/nexakit-lecciones/hooks/lecciones.js';
15
18
  import { mutateAntigravitySessionState, readAntigravitySessionState } from './antigravity-session.js';
16
19
  import { buildOutputWrapperCommand } from './codex-pre-tool.js';
@@ -200,12 +203,17 @@ export async function handleAntigravityPostToolUse(payload, options = {}) {
200
203
  }
201
204
 
202
205
  if (action?.kind === 'shell' && payload.conversationId) {
203
- const cmdKey = claveDeComando(unwrapAntigravityCommand(action.command));
206
+ const original = unwrapAntigravityCommand(action.command);
207
+ const cmdKey = claveDeComando(original);
204
208
  if (!failed) {
205
209
  await mutateAntigravitySessionState(payload.conversationId, (state) => {
206
210
  state.lecciones.fallidos = {};
207
211
  return state;
208
212
  }, options);
213
+ // Registrar la lección en el almacén común también guarda las correcciones pendientes.
214
+ if (esRegistroDeLeccion(original) && sinGuardar(await readAntigravityLessons(options)).length > 0) {
215
+ await appendAntigravityLesson({ tipo: 'guardada' }, options);
216
+ }
209
217
  return {};
210
218
  }
211
219
  const errText = payload.error;
@@ -219,12 +227,12 @@ export async function handleAntigravityPostToolUse(payload, options = {}) {
219
227
  if (count === TOPE_MISMO_ERROR) {
220
228
  triggeredRepetition = true;
221
229
  state.lecciones.pendingRepetitionNotice =
222
- `[nexakit: el mismo tipo de error salió ${count} veces en esta tarea («${errType}»). Para, explica la causa raíz antes de otro intento y cambia de enfoque; si es una lección que vale para el futuro, guárdala en tu memoria persistente.]`;
230
+ notaRepeticion(count, errType);
223
231
  }
224
232
  }
225
233
  return state;
226
234
  }, options);
227
- if (triggeredRepetition) await appendAntigravityLesson({ tipo: 'repeticion' }, options);
235
+ if (triggeredRepetition) await appendAntigravityLesson({ tipo: 'repeticion', clave: textoSeguro(errType) }, options);
228
236
  }
229
237
  return {};
230
238
  } catch {
@@ -1,18 +1,17 @@
1
1
  import { LIMITE_ALTO } from '../plugins/nexakit-modelo/hooks/decidir.js';
2
- import { recomendarPorTexto } from '../plugins/nexakit-modelo/hooks/recomendar.js';
2
+ import { CONFIRMACION as CONFIRMATION_RE, recomendarPorTexto } from '../plugins/nexakit-modelo/hooks/recomendar.js';
3
3
 
4
4
  const MAX_TASK_BYTES = 16 * 1024;
5
- const CONFIRMATION_RE = /^(?:¡?)(?:s[ií]|ok|okay|dale|listo|vale|perfecto|bien|contin[uú]a|sigue|hazlo|adelante|gracias|de una|claro|no)(?:[\s.!,¡]+(?:s[ií]|ok|okay|dale|listo|vale|perfecto|bien|contin[uú]a|sigue|hazlo|adelante|gracias|de una|claro|no))*[\s.!,]*$/iu;
6
5
  const EFFORT_SUFFIX_RE = /-(low|medium|high|xhigh|max)$/iu;
7
6
  const EFFORT_PAREN_RE = /\s*\((low|medium|high|xhigh|max)\)\s*$/iu;
8
- const KNOWN_FAMILY_RE = /\b(flash|hydrogen|argon|carbon|luna|terra|sol|astra|haiku|sonnet|opus)\b/iu;
7
+ const KNOWN_FAMILY_RE = /\b(flash|hydrogen|neon|argon|carbon|luna|terra|sol|astra|haiku|sonnet|opus)\b/iu;
9
8
  const SLUG_FAMILY_RE = /^(?:gpt|gemini|claude)-\d+(?:\.\d+)*-([a-z][a-z0-9]*)$/iu;
10
9
  const VALID_EFFORTS = new Set(['low', 'medium', 'high', 'xhigh', 'max']);
11
10
 
12
11
  const FAMILIES_BY_LEVEL = Object.freeze({
13
12
  Ligero: ['flash', 'hydrogen'],
14
13
  Normal: ['hydrogen', 'flash'],
15
- Exigente: ['hydrogen', 'argon', 'flash'],
14
+ Exigente: ['hydrogen', 'flash', 'argon'],
16
15
  Alto: ['carbon', 'argon'],
17
16
  });
18
17
 
@@ -26,6 +25,7 @@ const DEFAULT_FAMILY_BY_LEVEL = Object.freeze({
26
25
  const FAMILY_LABELS = Object.freeze({
27
26
  flash: 'Flash',
28
27
  hydrogen: 'Hydrogen',
28
+ neon: 'Neon',
29
29
  argon: 'Argon',
30
30
  carbon: 'Carbon',
31
31
  });
@@ -60,15 +60,21 @@ function resolveCatalogPick(catalog, level, effort) {
60
60
  if (!Array.isArray(catalog) || catalog.length === 0) return null;
61
61
  const families = FAMILIES_BY_LEVEL[level] ?? [];
62
62
  const valid = catalog.filter((entry) => entry && typeof entry.model === 'string' && entry.model.trim());
63
+ const exactFor = (family) => valid.find((entry) => {
64
+ const parsed = parseAntigravityModel(entry.model);
65
+ const efforts = Array.isArray(entry.efforts) && entry.efforts.length ? entry.efforts : parsed.effort ? [parsed.effort] : [];
66
+ return parsed.family === family && efforts.includes(effort);
67
+ });
63
68
  for (const family of families) {
64
- const exact = valid.find((entry) => {
65
- const parsed = parseAntigravityModel(entry.model);
66
- const efforts = Array.isArray(entry.efforts) && entry.efforts.length ? entry.efforts : parsed.effort ? [parsed.effort] : [];
67
- return parsed.family === family && efforts.includes(effort);
68
- });
69
+ if (family === 'argon') continue;
70
+ const exact = exactFor(family);
69
71
  if (exact) return { model: exact.model, family, effort };
70
72
  }
71
73
  for (const family of families) {
74
+ if (family === 'argon') {
75
+ const exact = exactFor(family);
76
+ if (exact) return { model: exact.model, family, effort };
77
+ }
72
78
  const fallback = valid.find((entry) => parseAntigravityModel(entry.model).family === family);
73
79
  if (fallback) {
74
80
  const parsed = parseAntigravityModel(fallback.model);
@@ -3,6 +3,8 @@ import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { renderAntigravityAgents } from './antigravity-agents.js';
6
+ import { assertNoSymlinkAncestors as assertNoSymlinkAncestorsBase, within } from './safe-paths.js';
7
+ import { shellQuote } from './shell-quote.js';
6
8
 
7
9
  const TOOL_MATCHER = 'run_command|write_file|write_to_file|edit_file|replace_file_content|multi_replace_file_content';
8
10
 
@@ -24,39 +26,10 @@ export function buildAntigravityCommand(subcommand, {
24
26
  }
25
27
  return `"${executable}" "${entrypoint}" antigravity ${subcommand}`;
26
28
  }
27
- const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
28
- return `${quote(executable)} ${quote(entrypoint)} antigravity ${subcommand}`;
29
+ return `${shellQuote(executable)} ${shellQuote(entrypoint)} antigravity ${subcommand}`;
29
30
  }
30
31
 
31
- async function isDarwinSystemLink(current) {
32
- if (process.platform !== 'darwin' || (current !== '/tmp' && current !== '/var')) return false;
33
- return (await fs.realpath(current).catch(() => null)) === `/private${current}`;
34
- }
35
-
36
- async function assertNoSymlinkAncestors(destination) {
37
- let current = destination;
38
- while (true) {
39
- try {
40
- const stat = await fs.lstat(current);
41
- if (stat.isSymbolicLink() && !(await isDarwinSystemLink(current))) {
42
- throw new Error('No se admiten enlaces simbólicos en el destino.');
43
- }
44
- if (current !== destination && !stat.isDirectory() && !(await isDarwinSystemLink(current))) {
45
- throw new Error('El padre no es una carpeta.');
46
- }
47
- } catch (error) {
48
- if (error.code !== 'ENOENT') throw error;
49
- }
50
- const parent = path.dirname(current);
51
- if (parent === current) break;
52
- current = parent;
53
- }
54
- }
55
-
56
- const within = (root, destination) => {
57
- const relative = path.relative(path.resolve(root), destination);
58
- return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
59
- };
32
+ const assertNoSymlinkAncestors = (destination) => assertNoSymlinkAncestorsBase(destination, { allowDarwinSystemLinks: true });
60
33
 
61
34
  /** Generate manual preview or write a valid standalone Antigravity CLI plugin + statusLine package. */
62
35
  export async function prepareAntigravity({
@@ -0,0 +1,11 @@
1
+ // Tipos de src/cli-executable.js para el código TypeScript de la fábrica.
2
+ export interface InvocacionCli {
3
+ executable: string;
4
+ argsPrefix: string[];
5
+ }
6
+
7
+ export function resolveCliInvocation(opciones: {
8
+ name: string;
9
+ override?: string;
10
+ environment?: NodeJS.ProcessEnv;
11
+ }): Promise<InvocacionCli>;
@@ -13,8 +13,8 @@ const NODE_VALUES = new Map([
13
13
  ['--test-skip-pattern', /^[A-Za-z0-9_./:@%+=,-]+$/u],
14
14
  ]);
15
15
  const isRecord = value => value !== null && typeof value === 'object' && !Array.isArray(value);
16
- export const quoteShell = token => `'${token.replaceAll("'", "'\"'\"'")}'`;
17
- export const safeAbsolutePath = value => typeof value === 'string' && posix.isAbsolute(value) &&
16
+ const quoteShell = token => `'${token.replaceAll("'", "'\"'\"'")}'`;
17
+ const safeAbsolutePath = value => typeof value === 'string' && posix.isAbsolute(value) &&
18
18
  value.length <= 4096 && !/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u.test(value);
19
19
 
20
20
  function nodeTests(argv) {
@@ -36,7 +36,7 @@ function nodeTests(argv) {
36
36
  return true;
37
37
  }
38
38
 
39
- export function approvedOutputCommand(argv) {
39
+ function approvedOutputCommand(argv) {
40
40
  // Conservative bypass: preserve interactive and structured-output commands intact.
41
41
  if (argv.some(token => /watch|inspect|interactive|tty|background/iu.test(token) ||
42
42
  /^(?:-w|-i|-t|-it|-ti|--ui|--open|--debug)(?:=|$)/u.test(token) ||
@@ -1,8 +1,7 @@
1
1
  import { inspectModels } from './model-command.js';
2
- import { recomendarPorTexto } from '../plugins/nexakit-modelo/hooks/recomendar.js';
2
+ import { CONFIRMACION as CONFIRMATION, recomendarPorTexto } from '../plugins/nexakit-modelo/hooks/recomendar.js';
3
3
 
4
4
  const ROLES = { haiku: 'ligero', sonnet: 'uso diario', opus: 'el más capaz' };
5
- const CONFIRMATION = /^(?:¡?)(?:s[ií]|ok|okay|dale|listo|vale|perfecto|bien|contin[uú]a|sigue|hazlo|adelante|gracias|de una|claro|no)(?:[\s.!,¡]+(?:s[ií]|ok|okay|dale|listo|vale|perfecto|bien|contin[uú]a|sigue|hazlo|adelante|gracias|de una|claro|no))*[\s.!,]*$/iu;
6
5
  const validModel = (value) => typeof value === 'string' && /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/u.test(value)
7
6
  && !/(?:claude|haiku|sonnet|opus)/iu.test(value);
8
7
  const validEffort = (value) => typeof value === 'string' && /^[a-z][a-z0-9_-]{0,23}$/u.test(value);
@@ -2,6 +2,8 @@ import fs from 'node:fs/promises';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
+ import { assertNoSymlinkAncestors, within } from './safe-paths.js';
6
+ import { shellQuote } from './shell-quote.js';
5
7
 
6
8
  export function buildCodexHookCommand({ executable = process.execPath,
7
9
  entrypoint = fileURLToPath(new URL('../bin/nexakit.js', import.meta.url)), platform = process.platform } = {}) {
@@ -15,28 +17,9 @@ export function buildCodexHookCommand({ executable = process.execPath,
15
17
  // Return shell command text; the runner owns cmd.exe's outer /s /c quotes.
16
18
  return `"${executable}" "${entrypoint}" codex hook`;
17
19
  }
18
- const quote = value => `'${value.replaceAll("'", "'\\''")}'`;
19
- return `${quote(executable)} ${quote(entrypoint)} codex hook`;
20
+ return `${shellQuote(executable)} ${shellQuote(entrypoint)} codex hook`;
20
21
  }
21
22
 
22
- async function assertNoSymlinkAncestors(destination) {
23
- let current = destination;
24
- while (true) {
25
- try {
26
- const stat = await fs.lstat(current);
27
- if (stat.isSymbolicLink()) throw new Error('No se admiten enlaces simbólicos en el destino.');
28
- if (current !== destination && !stat.isDirectory()) throw new Error('El padre no es una carpeta.');
29
- } catch (error) { if (error.code !== 'ENOENT') throw error; }
30
- const parent = path.dirname(current);
31
- if (parent === current) break;
32
- current = parent;
33
- }
34
- }
35
- const within = (root, destination) => {
36
- const relative = path.relative(path.resolve(root), destination);
37
- return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
38
- };
39
-
40
23
  export async function prepareCodex({ outputDirectory, apply = false, homeDirectory = os.homedir(),
41
24
  codexHome, projectRoot = process.cwd(), environment = process.env } = {}) {
42
25
  if (apply && !outputDirectory) throw new Error('--apply requiere --salida.');
package/src/codex-team.js CHANGED
@@ -6,6 +6,7 @@ import path from 'node:path';
6
6
  import { getStaticTOMLValue, parseTOML } from 'toml-eslint-parser';
7
7
  import { agentModels } from './agent-models.js';
8
8
  import { levelAgentPlan } from './level-agents.js';
9
+ import { REGLA_ORDENES_SIMPLES } from './regla-ordenes-simples.js';
9
10
 
10
11
  const MAX_BYTES = 128 * 1024;
11
12
  const MODEL = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$/u;
@@ -115,7 +116,7 @@ async function inspect(target) {
115
116
  }
116
117
 
117
118
  function native(name, description, instructions, pick) {
118
- return `# Generado por nexakit codex agentes\nname = ${JSON.stringify(name)}\ndescription = ${JSON.stringify(description)}\nmodel = ${JSON.stringify(pick.model)}\nmodel_reasoning_effort = ${JSON.stringify(pick.effort)}\ndeveloper_instructions = ${JSON.stringify(instructions)}\n`;
119
+ return `# Generado por \`nexakit codex agentes\`.\nname = ${JSON.stringify(name)}\ndescription = ${JSON.stringify(description)}\nmodel = ${JSON.stringify(pick.model)}\nmodel_reasoning_effort = ${JSON.stringify(pick.effort)}\ndeveloper_instructions = ${JSON.stringify(instructions)}\n`;
119
120
  }
120
121
  const permissions = 'Los permisos efectivos se heredan de la sesión principal/padre; estas instrucciones de solo lectura y presupuesto son orientativas, no restricciones técnicas. No amplíes permisos.';
121
122
  const common = `${permissions}\nRespeta AGENTS.md y las skills del proyecto. Haz solo el encargo; el principal decide, verifica el informe e integra. No solicites automáticamente revisiones a otra IA.`;
@@ -137,7 +138,7 @@ export async function teamPlan(options = {}) {
137
138
  const pick = selected?.model && MODEL.test(selected.model) ? selected : null;
138
139
  let content = null;
139
140
  if (pick && codex.available) {
140
- if (role) content = native(name, role.description, `${common}\nPresupuesto orientativo: ${role.steps} pasos; entrega avances y pendientes si se agota.\n${role.instructions}`, pick);
141
+ if (role) content = native(name, role.description, `${common}\nPresupuesto orientativo: ${role.steps} pasos; entrega avances y pendientes si se agota.\n${role.instructions}\n${REGLA_ORDENES_SIMPLES}`, pick);
141
142
  else if (legacy?.files[i]?.content) {
142
143
  const parsed = getStaticTOMLValue(parseTOML(legacy.files[i].content));
143
144
  content = native(name, parsed.description, `${parsed.developer_instructions.trim()}\n${common}\nPresupuesto orientativo: ${[15, 25, 30, 40][i]} pasos. Informe de máximo 200 palabras.`, pick);
@@ -153,6 +154,31 @@ export async function teamPlan(options = {}) {
153
154
  return plan;
154
155
  }
155
156
 
157
+ // First lines nexakit wrote before today's `# Generado por \`nexakit codex agentes\`.`. A profile that only differs from
158
+ // the planned one in that line is still nexakit's: `npx nexakit` brings it up to date (writeTeam with `names`). One
159
+ // with an old mark and other content is reported and never touched.
160
+ const OLD_MARKS = [
161
+ '# Generado por nexakit codex agentes',
162
+ '# Generado por `agent-toolkit-inbox agentes`. Ese comando nunca sobrescribe ni borra: lo anterior queda como .anterior-*.',
163
+ ];
164
+ export async function staleTeamMarks(plan) {
165
+ const migrable = [], different = [];
166
+ for (const file of plan.files) {
167
+ if (file.state !== 'distinto' || file.snapshot.type !== 'file') continue;
168
+ let current;
169
+ try { current = (await inspect(file.path)).content; } catch { continue; }
170
+ const newline = current?.indexOf('\n') ?? -1;
171
+ if (newline < 0 || !OLD_MARKS.includes(current.slice(0, newline))) continue;
172
+ const same = file.content && current.slice(newline) === file.content.slice(file.content.indexOf('\n'));
173
+ (same ? migrable : different).push(file.name);
174
+ }
175
+ return { migrable, different };
176
+ }
177
+ // Read-only: the profiles with an old mark, or null when they cannot be planned (no catalog, unreadable folder).
178
+ export async function teamMarks(options = {}) {
179
+ try { return await staleTeamMarks(await teamPlan(options)); } catch { return null; }
180
+ }
181
+
156
182
  export async function installedTeam(options = {}) {
157
183
  const codexHome = homeOf(options);
158
184
  if (!await directories(codexHome)) return [];
@@ -174,10 +200,11 @@ async function checkDirectories(home, expected) {
174
200
  return current;
175
201
  }
176
202
 
177
- export async function writeTeam(plan, { update = false } = {}) {
203
+ // `names` limits the write to those profiles (the migration of old marks updates only the ones it proved).
204
+ export async function writeTeam(plan, { update = false, names } = {}) {
178
205
  const trusted = plans.get(plan);
179
206
  if (!trusted || trusted.serialized !== JSON.stringify(plan)) throw fail('Plan inválido o modificado; genera otra vista previa con teamPlan.');
180
- const pending = plan.files.filter(file => file.state === 'nuevo' || (update && file.state === 'distinto'));
207
+ const pending = plan.files.filter(file => (!names || names.includes(file.name)) && (file.state === 'nuevo' || (update && file.state === 'distinto')));
181
208
  if (!pending.length) return plan;
182
209
  let dirs = await checkDirectories(plan.codexHome, trusted.dirs);
183
210
  // Preflight the entire known team before any mutation, including unchanged files.