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
@@ -1,257 +0,0 @@
1
- import { supportsAuthHost } from "./client-local-platform.js";
2
- import fs from "node:fs/promises";
3
- import { constants } from "node:fs";
4
- import path from "node:path";
5
- import { spawn as systemSpawn } from "node:child_process";
6
- import { createHash } from "node:crypto";
7
- import { types } from "node:util";
8
- import Ajv2020 from "ajv/dist/2020.js";
9
- import { copyInertJson, copyBytes } from "./client-output-json.js";
10
- import { hash } from "./client-runtime-core.js";
11
- import { createStoreFiles } from "./client-runtime-store-files.js";
12
- import { createAuthDiagnosticParser, AUTH_DIAGNOSTIC_ID } from "./client-auth-diagnostic-parser.js";
13
-
14
- const SCHEMA_ID = AUTH_DIAGNOSTIC_ID;
15
- const permits = new WeakMap(), monotonic = () => Number(process.hrtime.bigint() / 1000000n);
16
- const environmentIdentity = () => hash({ home: process.env.HOME, uid: process.getuid?.() ?? null, profile: "auth-status-minimal-v1" });
17
- const physicalName = p => typeof p === "string" && path.isAbsolute(p) && path.normalize(p) === p &&
18
- !/[\x00-\x1f\x7f]/.test(p) && Buffer.from(p, "utf8").toString("utf8") === p;
19
- const signature = s => JSON.stringify([s.dev, s.ino, s.uid, s.mode, s.nlink, s.size, s.mtimeMs, s.ctimeMs]);
20
- const chunkLength = b => {
21
- if (types.isProxy(b) || !types.isUint8Array(b)) throw Error("chunk");
22
- return Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), "length").get.call(b);
23
- };
24
-
25
- /** Trusted orchestration must obtain human approval first. JSON/hash is not consent. */
26
- export function createAuthDiagnosticPermit(schema, configuration) {
27
- let cfg;
28
- try {
29
- cfg = copyInertJson(configuration);
30
- validateConfiguration(schema, cfg);
31
- } catch { throw Error("Invalid auth diagnostic permission configuration"); }
32
- const handle = Object.freeze(Object.create(null)), issuedAt = monotonic();
33
- permits.set(handle, { binding: hash(cfg), environment: environmentIdentity(), issuedAt, expiresAt: issuedAt + cfg.limits.permitLifetimeMs, live: true, used: false });
34
- return handle;
35
- }
36
- export function revokeAuthDiagnosticPermit(handle) {
37
- if (types.isProxy(handle)) return;
38
- const p = permits.get(handle); if (p) p.live = false;
39
- }
40
-
41
- async function verifyArtifact(cfg, io, files, deadline, now) {
42
- const pin = cfg.artifact, link = cfg.entryLink;
43
- const verifyLink = async () => {
44
- await files.physical(path.dirname(link.path));
45
- const s = await io.lstat(link.path);
46
- if (!s.isSymbolicLink() || s.dev !== link.dev || s.ino !== link.ino || s.uid !== link.uid ||
47
- (s.mode & 4095) !== link.mode || s.size !== link.size || s.mtimeMs !== link.mtimeMs || s.ctimeMs !== link.ctimeMs ||
48
- path.resolve(path.dirname(link.path), await io.readlink(link.path)) !== pin.path) throw Error("link");
49
- };
50
- await verifyLink();
51
- await files.physical(pin.path);
52
- const before = await io.lstat(pin.path);
53
- if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1 || before.dev !== pin.dev || before.ino !== pin.ino ||
54
- before.uid !== pin.uid || (before.mode & 4095) !== pin.mode || !(pin.mode & 0o100) || pin.mode & 0o7022 || before.size !== pin.size ||
55
- before.mtimeMs !== pin.mtimeMs || before.ctimeMs !== pin.ctimeMs) throw Error("artifact");
56
- const handle = await io.open(pin.path, constants.O_RDONLY | constants.O_NOFOLLOW), digest = createHash("sha256");
57
- try {
58
- if (signature(before) !== signature(await handle.stat())) throw Error("artifact");
59
- const buffer = Buffer.alloc(65536); let offset = 0;
60
- while (offset < pin.size) {
61
- if (now() >= deadline) throw Error("deadline");
62
- const length = Math.min(buffer.length, pin.size - offset, 536870912 - offset);
63
- const { bytesRead } = await handle.read(buffer, 0, length, offset); if (!bytesRead) throw Error("artifact");
64
- offset += bytesRead; if (offset > pin.size || offset > 536870912) throw Error("artifact"); digest.update(buffer.subarray(0, bytesRead));
65
- }
66
- if (offset !== pin.size || digest.digest("hex") !== pin.sha256 || signature(before) !== signature(await handle.stat()) ||
67
- signature(before) !== signature(await io.lstat(pin.path))) throw Error("artifact");
68
- await files.physical(pin.path); await verifyLink();
69
- } finally { await handle.close(); }
70
- }
71
-
72
- /** Hash binding for a trusted review; computing it is NOT evidence of safe startup. */
73
- export function authDiagnosticReviewBinding(configuration) {
74
- const c = copyInertJson(configuration);
75
- return hash({ source: c.source, recipe: c.recipe, version: c.version, artifact: c.artifact, entryLink: c.entryLink,
76
- workspaceParent: c.workspaceParent, excludedRoots: c.excludedRoots, environment: environmentIdentity() });
77
- }
78
- function validateConfiguration(schema, cfg) {
79
- const s = copyInertJson(schema);
80
- if (s.$id !== SCHEMA_ID) throw Error();
81
- const ajv = new Ajv2020({ strict: true, allErrors: true }); ajv.addSchema(s);
82
- if (!ajv.compile({ $ref: SCHEMA_ID + "#/$defs/configuration" })(cfg) ||
83
- ![cfg.artifact.path, cfg.entryLink.path, cfg.workspaceParent.path, ...cfg.excludedRoots].every(physicalName) ||
84
- cfg.artifact.path === cfg.entryLink.path || cfg.workspaceParent.path === path.parse(cfg.workspaceParent.path).root ||
85
- cfg.limits.graceMs + cfg.limits.confirmationMs + 20 >= cfg.limits.processTimeoutMs ||
86
- cfg.limits.processTimeoutMs > cfg.limits.totalTimeoutMs) throw Error();
87
- return { schema: s, validReport: ajv.compile({ $ref: SCHEMA_ID + "#/$defs/report" }) };
88
- }
89
- function reviewed(cfg) {
90
- const b = authDiagnosticReviewBinding(cfg);
91
- return cfg.identityReview.state === "reviewed" && cfg.identityReview.bindingSha256 === b &&
92
- cfg.startupReview.state === "reviewed" && cfg.startupReview.bindingSha256 === b &&
93
- cfg.startupReview.effectsEnumerated && !cfg.startupReview.unresolvedEffects;
94
- }
95
-
96
- /** Only trusted orchestration may supply assessment/consent/dependencies. No model JSON is proof. */
97
- export function createAuthDiagnosticCollector(schema, configuration, authorization, dependencies = {}) {
98
- let cfg, validReport, parserSchema;
99
- try {
100
- cfg = copyInertJson(configuration);
101
- const validated = validateConfiguration(schema, cfg);
102
- parserSchema = validated.schema; validReport = validated.validReport;
103
- createAuthDiagnosticParser(parserSchema, { maxBytes: cfg.limits.maxOutputBytes, blockBytes: cfg.limits.maxOutputBytes,
104
- maxDepth: 32, maxNodes: 20000, maxKeyBytes: 256, maxKeys: 4096 });
105
- } catch { throw Error("Invalid auth diagnostic configuration"); }
106
- const limits = cfg.limits, io = { ...fs, ...dependencies.io }, files = createStoreFiles(dependencies.io);
107
- const spawn = dependencies.spawn ?? systemSpawn, kill = dependencies.kill ?? process.kill.bind(process), now = dependencies.monotonic ?? monotonic;
108
- let invoked = false;
109
- return Object.freeze({ async run(...args) {
110
- const began = now(), deadline = began + limits.totalTimeoutMs;
111
- const r = { scope: "auth-status-only", source: cfg.source, state: "blocked-before-start", spawnAttempts: 0,
112
- processStarted: false, nativeExecuted: false, artifactMatchedBefore: false, artifactMatchedAfter: false,
113
- terminationConfirmed: true, cleanupRequired: false, stdoutBytes: 0, stderrBytes: 0, elapsedMs: 0, projection: null, reasons: [],
114
- inferenceRequested: false, runtimeReady: false, verifiedAdmission: false,
115
- externalBillingVerified: false, remoteCancellationVerified: false, actualModelCalls: null };
116
- let workspace, owned, parent, permission, claimed = false;
117
- const add = code => { if (!r.reasons.includes(code)) r.reasons.push(code); };
118
- try {
119
- if (invoked) throw Error("permission"); invoked = true;
120
- permission = !types.isProxy(authorization) && permits.get(authorization);
121
- if (!permission || !permission.live || permission.used || permission.binding !== hash(cfg) ||
122
- permission.environment !== environmentIdentity() ||
123
- began < permission.issuedAt || began >= permission.expiresAt) { add("auth-permission-rejected"); return r; }
124
- permission.used = true; claimed = true;
125
- if (args.length) { add("auth-input-forbidden"); return r; }
126
- if (!reviewed(cfg)) { add("auth-startup-not-reviewed"); return r; }
127
- if (!supportsAuthHost(process.platform, cfg.source) || cfg.artifact.uid !== process.getuid() || cfg.workspaceParent.uid !== process.getuid()) throw Error("identity");
128
- if (dependencies.signal?.aborted) { r.state = "canceled"; add("auth-canceled"); return r; }
129
- const home = process.env.HOME;
130
- if (!physicalName(home) || cfg.workspaceParent.path === home || /(CloudStorage|Mobile Documents|Dropbox|OneDrive|iCloud|Obsidian)/i.test(cfg.workspaceParent.path) ||
131
- cfg.excludedRoots.some(root => cfg.workspaceParent.path === root || cfg.workspaceParent.path.startsWith(root + path.sep))) throw Error("parent");
132
- parent = await files.directory(cfg.workspaceParent.path);
133
- if (parent.dev !== cfg.workspaceParent.dev || parent.ino !== cfg.workspaceParent.ino || parent.uid !== cfg.workspaceParent.uid ||
134
- (parent.mode & 4095) !== cfg.workspaceParent.mode) throw Error("parent");
135
- for (let dir = cfg.workspaceParent.path; ; dir = path.dirname(dir)) {
136
- for (const marker of [".git", ".obsidian"]) {
137
- try { await io.lstat(path.join(dir, marker)); throw Error("project"); } catch (e) { if (e.code !== "ENOENT") throw e; }
138
- }
139
- if (dir === path.parse(dir).root) break;
140
- }
141
- await verifyArtifact(cfg, io, files, deadline, now); r.artifactMatchedBefore = true;
142
- workspace = await io.mkdtemp(path.join(cfg.workspaceParent.path, "auth-work-")); await io.chmod(workspace, 0o700); owned = await files.directory(workspace);
143
- const stream = createAuthDiagnosticParser(parserSchema, { maxBytes: limits.maxOutputBytes, blockBytes: limits.maxOutputBytes,
144
- maxDepth: 32, maxNodes: 20000, maxKeyBytes: 256, maxKeys: 4096 });
145
- if (!permission.live || dependencies.signal?.aborted || environmentIdentity() !== permission.environment ||
146
- now() >= Math.min(deadline, permission.expiresAt) - limits.graceMs - limits.confirmationMs) throw Error("pre-start");
147
- const processDeadline = Math.min(deadline, now() + limits.processTimeoutMs);
148
- const env = { HOME: home, TMPDIR: workspace, PATH: "/usr/bin:/bin", LANG: "C", LC_ALL: "C" };
149
- r.spawnAttempts = 1; r.terminationConfirmed = false;
150
- let child;
151
- try { child = spawn(cfg.entryLink.path, ["auth", "status"], { shell: false, detached: true, cwd: workspace, env, stdio: ["ignore", "pipe", "pipe"] }); }
152
- catch { r.terminationConfirmed = true; add("auth-spawn-failed"); throw Error("spawn"); }
153
- await new Promise(resolve => {
154
- let done = false, stopped = false, stoppedAt = null, forced = false, gone = false, failedSpawn = false, pid = null;
155
- let exited = false, closed = false, outClosed = false, errClosed = false, exitCode = null, timer, hard;
156
- const send = signal => {
157
- if (pid === null || gone) return;
158
- try { kill(-pid, signal); } catch (e) { if (e.code === "ESRCH") gone = true; else add("auth-signal-unconfirmed"); }
159
- };
160
- const alive = () => {
161
- if (gone || failedSpawn) return false;
162
- if (pid === null) return true;
163
- try { kill(-pid, 0); return true; } catch (e) { if (e.code === "ESRCH") { gone = true; return false; } add("auth-group-unconfirmed"); return true; }
164
- };
165
- const stop = (code, state = "failed") => {
166
- if (done) return; add(code);
167
- if (stopped) return;
168
- stopped = true; stoppedAt = now(); r.state = state; stream.abort(); send("SIGTERM");
169
- };
170
- const finish = uncertain => {
171
- if (done) return; done = true; clearInterval(timer); clearTimeout(hard); dependencies.signal?.removeEventListener("abort", abort);
172
- r.terminationConfirmed = failedSpawn || exited && closed && outClosed && errClosed && gone;
173
- if (uncertain || !r.terminationConfirmed || now() > deadline) { r.state = "indeterminate"; add("auth-termination-unconfirmed"); stream.abort(); }
174
- else if (failedSpawn) r.state = "failed";
175
- else if (!stopped) {
176
- const projection = stream.finish(exitCode);
177
- if (projection.state === "invalid") { r.state = "failed"; add("auth-protocol-invalid"); }
178
- else { r.projection = projection.projection; r.state = "observation-complete"; }
179
- }
180
- if (stopped || uncertain || failedSpawn) stream.finish(null);
181
- child.stdout.destroy(); child.stderr.destroy(); resolve();
182
- };
183
- const poll = () => {
184
- if (done) return;
185
- if (!permission.live || now() >= permission.expiresAt) stop("auth-permission-revoked", "canceled");
186
- if (now() >= processDeadline - limits.graceMs - limits.confirmationMs && !stopped) stop("auth-deadline", "timed-out");
187
- if (stopped && !forced && now() - stoppedAt >= limits.graceMs) { forced = true; send("SIGKILL"); }
188
- const live = alive();
189
- if (exited && closed && outClosed && errClosed && !live) finish(false);
190
- else if (exited && live && !stopped) stop("auth-descendants-unconfirmed");
191
- if (failedSpawn && closed) finish(false);
192
- if (!done && stopped && forced && now() - stoppedAt >= limits.graceMs + limits.confirmationMs) finish(true);
193
- };
194
- const abort = () => stop("auth-canceled", "canceled");
195
- child.on("spawn", () => {
196
- if (done) {
197
- // A late transport callback cannot mutate an already returned report.
198
- if (!gone && Number.isSafeInteger(child.pid) && child.pid > 1) {
199
- // Best effort only: no new reason or termination claim after delivery.
200
- try { kill(-child.pid, "SIGKILL"); } catch { /* Keep the delivered uncertainty intact. */ }
201
- }
202
- return;
203
- }
204
- r.processStarted = true; r.nativeExecuted = cfg.source === "native-client-declaration";
205
- if (!Number.isSafeInteger(child.pid) || child.pid <= 1) { stop("auth-pid-unavailable"); return; }
206
- pid = child.pid;
207
- if (stopped) send("SIGTERM");
208
- });
209
- child.on("error", () => { if (done) return; if (!r.processStarted) { failedSpawn = true; add("auth-spawn-failed"); } else stop("auth-process-error"); });
210
- child.on("exit", code => { exited = true; exitCode = code; poll(); }); child.on("close", () => { closed = true; poll(); });
211
- child.stdout.on("close", () => { outClosed = true; poll(); }); child.stderr.on("close", () => { errClosed = true; poll(); });
212
- child.stdout.on("error", () => stop("auth-stream-error")); child.stderr.on("error", () => stop("auth-stream-error"));
213
- child.stdout.on("data", chunk => {
214
- if (done || stopped) return;
215
- try {
216
- r.stdoutBytes += chunkLength(chunk);
217
- if (r.stdoutBytes > limits.maxOutputBytes) stop("auth-output-limit");
218
- else if (stream.push(copyBytes(chunk, limits.maxOutputBytes)).state === "invalid") stop("auth-output-invalid");
219
- } catch { stop("auth-output-invalid"); }
220
- });
221
- child.stderr.on("data", chunk => {
222
- if (done || stopped) return;
223
- try { const size = chunkLength(chunk); r.stderrBytes += size; if (size) stop(r.stderrBytes > limits.maxErrorBytes ? "auth-stderr-limit" : "auth-stderr-not-empty"); }
224
- catch { stop("auth-stderr-invalid"); }
225
- });
226
- dependencies.signal?.addEventListener("abort", abort, { once: true }); if (dependencies.signal?.aborted) abort();
227
- timer = setInterval(poll, 10);
228
- hard = setTimeout(() => { send("SIGKILL"); poll(); if (!done) finish(true); }, Math.max(1, deadline - now()));
229
- });
230
- if (r.state === "observation-complete") {
231
- await verifyArtifact(cfg, io, files, deadline, now); r.artifactMatchedAfter = true;
232
- if (!permission.live || dependencies.signal?.aborted || now() >= permission.expiresAt ||
233
- environmentIdentity() !== permission.environment) throw Error("revoked");
234
- }
235
- } catch {
236
- r.state = r.processStarted ? "indeterminate" : r.spawnAttempts ? "failed" : "blocked-before-start";
237
- r.projection = null; add("auth-local-check-failed");
238
- } finally {
239
- if (workspace) {
240
- if (r.terminationConfirmed && owned) try { await files.directory(cfg.workspaceParent.path, parent); await files.directory(workspace, owned); await io.rmdir(workspace); }
241
- catch { r.state = "indeterminate"; r.cleanupRequired = true; add("auth-workspace-cleanup-required"); }
242
- else { r.cleanupRequired = true; add("auth-workspace-retained"); }
243
- }
244
- r.elapsedMs = Math.max(0, Math.ceil(now() - began));
245
- if (claimed && r.state === "observation-complete" && (!permission.live || dependencies.signal?.aborted ||
246
- now() >= permission.expiresAt || environmentIdentity() !== permission.environment)) {
247
- r.state = "canceled"; add("auth-permission-revoked");
248
- }
249
- if (claimed) revokeAuthDiagnosticPermit(authorization);
250
- if (r.elapsedMs > limits.totalTimeoutMs) { r.state = "indeterminate"; add("auth-deadline"); }
251
- if (r.state !== "observation-complete") r.projection = null;
252
- if (!r.reasons.length) add(r.state === "observation-complete" ? "auth-observation-complete" : "auth-failed");
253
- r.reasons.sort(); if (!validReport(r)) throw Error("Auth diagnostic report invariant failed");
254
- }
255
- return r;
256
- } });
257
- }
@@ -1,106 +0,0 @@
1
- import Ajv2020 from "ajv/dist/2020.js";
2
- import { types } from "node:util";
3
- import { copyInertJson, copyBytes, decode, parseEventJson, fail } from "./client-output-json.js";
4
- import { hash } from "./client-runtime-core.js";
5
-
6
- export const ISOLATED_VARIANT_ID = "claude-subscription-text-v1";
7
- export const ISOLATED_SCHEMA_ID = "https://agent-toolkit.local/schemas/agent-client-isolated-variant.schema.json";
8
- // Semantic constraints, deliberately not flags, settings, commands or guarantees.
9
- export const ISOLATED_MECHANISMS = Object.freeze([
10
- ["tools-empty-denied", "empty-tools-and-total-denial"],
11
- ["restricted-settings", "restricted-session-and-limited-setting-sources"],
12
- ["local-personalizations-excluded", "local-personalizations-excluded-without-editing"],
13
- ["session-hooks-disabled", "session-hook-exclusion-not-managed-hook-proof"],
14
- ["managed-sources-excluded", "managed-and-host-sources-require-separate-proof"],
15
- ["strict-empty-mcp", "strict-owned-empty-mcp-with-managed-conflict-check"],
16
- ["connectors-disabled", "cloud-connector-discovery-excluded"],
17
- ["browser-ide-excluded", "browser-and-ide-not-enabled"],
18
- ["skills-plugins-delegation-excluded", "skills-plugins-and-delegation-excluded"],
19
- ["minimal-environment", "explicit-minimal-environment-without-api-or-helper"],
20
- ["updates-nonessential-traffic-disabled", "updates-and-nonessential-traffic-excluded"],
21
- ["resume-persistence-fallback-excluded", "no-resume-persistence-or-requested-fallback"]
22
- ].map(([id, constraint]) => Object.freeze({ id, constraint, definitionSha256: hash({ id, constraint, revision: 1 }) })));
23
- const ids = ISOLATED_MECHANISMS.map(m => m.id);
24
- const definitions = new Map(ISOLATED_MECHANISMS.map(m => [m.id, m.definitionSha256]));
25
- const basis = Object.freeze({ documented: "documentation", "local-structure-observation": "structure", "operator-attested": "attestation", "native-variant-tested": "native-test" });
26
- const utc = v => typeof v === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(v) && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v.replace(/Z$/, ".000Z");
27
-
28
- function strictJson(input) {
29
- if (types.isProxy(input)) fail("isolated-invalid-input");
30
- const d = typeof input === "string" || types.isUint8Array(input)
31
- ? parseEventJson(decode(copyBytes(input, 32768))) : copyInertJson(input);
32
- return copyInertJson(parseEventJson(decode(copyBytes(JSON.stringify(d), 32768))));
33
- }
34
- const sortById = values => [...values].sort((a, b) => a.mechanismId < b.mechanismId ? -1 : a.mechanismId > b.mechanismId ? 1 : 0);
35
-
36
- /** Checks consistency of unverified declarations; cannot issue a native permit. */
37
- export function createIsolatedVariantEvaluator(schema, trustedPolicy) {
38
- let validators, policy;
39
- try {
40
- const s = copyInertJson(schema);
41
- if (s.$id !== ISOLATED_SCHEMA_ID || hash(s.$defs.mechanismId.enum) !== hash(ids)) throw Error();
42
- const ajv = new Ajv2020({ strict: true, allErrors: true });
43
- ajv.addFormat("date-time", { type: "string", validate: utc }); ajv.addSchema(s);
44
- validators = Object.fromEntries(["input", "policy", "report"].map(n => [n, ajv.compile({ $ref: `${ISOLATED_SCHEMA_ID}#/$defs/${n}` })]));
45
- policy = strictJson(trustedPolicy);
46
- if (!validators.policy(policy)) throw Error();
47
- } catch { throw Error("Invalid isolated-variant schema or policy"); }
48
- const revoked = new Set(policy.revokedReferences);
49
- const normalizedPolicy = { ...policy, revokedReferences: [...policy.revokedReferences].sort(), allowedVariants: [...policy.allowedVariants].sort() };
50
- return input => {
51
- const r = { scope: "isolated-variant-claims-only", state: "invalid", reasons: [], unresolvedMechanisms: [],
52
- descriptionSha256: null, scopeSha256: null, executed: false, runtimeReady: false, verifiedAdmission: false,
53
- externalBillingVerified: false, effectiveIsolationVerified: false };
54
- try {
55
- const d = strictJson(input);
56
- if (!validators.input(d)) fail("isolated-invalid-input");
57
- const blocked = new Set(), missing = new Set(), unresolved = new Set();
58
- const description = { schemaVersion: d.schemaVersion, variantId: d.variantId, candidate: d.candidate,
59
- mode: d.mode, role: d.role, mechanisms: [...d.mechanisms].sort(), observations: sortById(d.observations) };
60
- r.descriptionSha256 = hash(description);
61
- r.scopeSha256 = hash({ description, policy: normalizedPolicy, definitions: ISOLATED_MECHANISMS });
62
- if (!policy.allowedVariants.includes(d.variantId)) blocked.add("isolated-variant-not-allowed");
63
- if (["api", "bare"].includes(d.candidate.authentication)) blocked.add("isolated-authentication-incompatible");
64
- if (d.candidate.authentication === "unknown") missing.add("isolated-authentication-unresolved");
65
- const unique = (values, key) => {
66
- if (new Set(values.map(key)).size !== values.length) blocked.add("isolated-duplicate-mechanism");
67
- };
68
- unique(d.mechanisms, v => v); unique(d.observations, v => v.mechanismId); unique(d.assessments, v => v.mechanismId);
69
- const fresh = (time, ref) => {
70
- if (revoked.has(ref)) { blocked.add("isolated-evidence-revoked"); return false; }
71
- const age = Date.parse(d.now) - Date.parse(time);
72
- if (age < 0) { blocked.add("isolated-evidence-future"); return false; }
73
- if (age > policy.maxEvidenceAgeSeconds * 1000) { blocked.add("isolated-evidence-expired"); return false; }
74
- return true;
75
- };
76
- for (const id of ids) {
77
- if (!d.mechanisms.includes(id)) { missing.add("isolated-mechanism-missing"); unresolved.add(id); }
78
- const o = d.observations.find(v => v.mechanismId === id);
79
- if (!o) { missing.add("isolated-observation-missing"); unresolved.add(id); }
80
- else if (!fresh(o.observedAt, o.referenceId) || o.state === "unknown") {
81
- missing.add("isolated-observation-unresolved"); unresolved.add(id);
82
- }
83
- const a = d.assessments.find(v => v.mechanismId === id);
84
- if (!a || a.provenance === "pending") { missing.add("isolated-assessment-missing"); unresolved.add(id); continue; }
85
- const current = fresh(a.observedAt, a.referenceId);
86
- if (a.scopeSha256 !== r.scopeSha256 || a.definitionSha256 !== definitions.get(id)) {
87
- blocked.add("isolated-evidence-binding-mismatch"); unresolved.add(id);
88
- }
89
- if (a.provenance === "rejected" || a.outcome === "incompatible") { blocked.add("isolated-mechanism-incompatible"); unresolved.add(id); }
90
- if (a.provenance !== "rejected" && a.basis !== basis[a.provenance]) { blocked.add("isolated-provenance-mismatch"); unresolved.add(id); }
91
- if (!current || a.provenance !== "native-variant-tested" || a.basis !== "native-test" || a.outcome !== "supported") {
92
- missing.add("isolated-effectiveness-unresolved"); unresolved.add(id);
93
- }
94
- }
95
- r.state = blocked.size ? "blocked" : missing.size ? "incomplete" : "ready-for-variant-review";
96
- r.reasons = [...new Set([...blocked, ...missing])].sort();
97
- if (!r.reasons.length) r.reasons = ["isolated-claims-ready-for-review"];
98
- r.unresolvedMechanisms = [...unresolved].sort();
99
- } catch {
100
- r.state = "invalid"; r.reasons = ["isolated-invalid-input"]; r.unresolvedMechanisms = [];
101
- r.descriptionSha256 = null; r.scopeSha256 = null;
102
- }
103
- if (!validators.report(r)) throw Error("Isolated-variant report invariant failed");
104
- return r;
105
- };
106
- }
@@ -1,130 +0,0 @@
1
- import Ajv2020 from "ajv/dist/2020.js";
2
- import { types } from "node:util";
3
- import { copyInertJson, copyBytes, decode, parseEventJson, fail } from "./client-output-json.js";
4
- import { hash } from "./client-runtime-core.js";
5
- import { createIsolatedVariantEvaluator, ISOLATED_MECHANISMS, ISOLATED_SCHEMA_ID } from "./client-isolated-variant.js";
6
-
7
- export const VERIFICATION_SCHEMA_ID = "https://agent-toolkit.local/schemas/agent-client-isolated-verification.schema.json";
8
- const phases = Object.freeze(["pre-start", "session", "shutdown"]);
9
- const coverage = [
10
- ["session"], ["pre-start", "session"], ["pre-start"], phases, phases,
11
- ["pre-start", "session"], ["pre-start", "session"], ["pre-start", "session"], phases,
12
- ["pre-start"], phases, phases
13
- ];
14
- // Closed semantic methods, not executable recipes or authenticated capabilities.
15
- export const ISOLATED_VERIFICATION_CHECKS = Object.freeze(ISOLATED_MECHANISMS.map((m, i) => Object.freeze({
16
- mechanismId: m.id, definitionSha256: m.definitionSha256,
17
- allowedMethods: Object.freeze(["documentation-review", ...(m.id === "tools-empty-denied" ? [] : ["structure-review"]),
18
- ...(m.id === "managed-sources-excluded" ? [] : ["fixture-test"]), "native-test"]),
19
- requiredCoverage: Object.freeze([...coverage[i]])
20
- })));
21
- const provenanceBasis = Object.freeze({ documented: "documentation", "local-structure-observation": "structure",
22
- "operator-attested": "attestation", "fixture-claim": "fixture-test", "native-claim": "native-test" });
23
- const methodBasis = Object.freeze({ "documentation-review": "documentation", "structure-review": "structure", "fixture-test": "fixture-test", "native-test": "native-test" });
24
- const utc = v => typeof v === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(v) && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v.replace(/Z$/, ".000Z");
25
- const byId = values => [...values].sort((a, b) => a.mechanismId < b.mechanismId ? -1 : a.mechanismId > b.mechanismId ? 1 : 0);
26
- function strictJson(input) {
27
- if (types.isProxy(input)) fail("verification-invalid-input");
28
- const d = typeof input === "string" || types.isUint8Array(input)
29
- ? parseEventJson(decode(copyBytes(input, 32768))) : copyInertJson(input);
30
- return copyInertJson(parseEventJson(decode(copyBytes(JSON.stringify(d), 32768))));
31
- }
32
- const emptyRow = c => ({ mechanismId: c.mechanismId, methodId: null, state: "unresolved",
33
- requiredCoverage: [...c.requiredCoverage], missingCoverage: [...c.requiredCoverage],
34
- missingEvidence: ["planning-check", "native-effectiveness-evidence", "trusted-provenance"], reasons: [], evidenceAuthenticated: false });
35
-
36
- /** Pure planning. Even a complete plan cannot authorize or authenticate a native run. */
37
- export function createIsolatedVerificationPlanner(schema, trustedCatalog) {
38
- let valid, catalog, evaluateVariant;
39
- try {
40
- const s = copyInertJson(schema); catalog = strictJson(trustedCatalog);
41
- if (s.$id !== VERIFICATION_SCHEMA_ID || catalog.variantSchema?.$id !== ISOLATED_SCHEMA_ID) throw Error();
42
- evaluateVariant = createIsolatedVariantEvaluator(catalog.variantSchema, catalog.variantPolicy);
43
- const ajv = new Ajv2020({ strict: true, allErrors: true }); ajv.addFormat("date-time", { type: "string", validate: utc });
44
- ajv.addSchema(catalog.variantSchema); ajv.addSchema(s);
45
- valid = Object.fromEntries(["input", "catalog", "report"].map(n => [n, ajv.compile({ $ref: `${VERIFICATION_SCHEMA_ID}#/$defs/${n}` })]));
46
- if (!valid.catalog(catalog)) throw Error();
47
- const normalized = byId(catalog.checks).map(c => ({ ...c, allowedMethods: [...c.allowedMethods].sort(), requiredCoverage: [...c.requiredCoverage].sort() }));
48
- const expected = byId(ISOLATED_VERIFICATION_CHECKS).map(c => ({ ...c, allowedMethods: [...c.allowedMethods].sort(), requiredCoverage: [...c.requiredCoverage].sort() }));
49
- if (hash(normalized) !== hash(expected)) throw Error();
50
- } catch { throw Error("Invalid isolated-verification schema or catalog"); }
51
- const revoked = new Set(catalog.variantPolicy.revokedReferences);
52
- const catalogSha256 = hash({ catalogId: catalog.catalogId, checks: ISOLATED_VERIFICATION_CHECKS, variantSchema: catalog.variantSchema });
53
- return input => {
54
- const r = { scope: "isolated-verification-plan-only", state: "invalid", decision: "no-native-start",
55
- matrix: ISOLATED_VERIFICATION_CHECKS.map(emptyRow), reasons: [], planSha256: null, variantScopeSha256: null,
56
- executed: false, runtimeReady: false, verifiedAdmission: false, externalBillingVerified: false, effectiveIsolationVerified: false };
57
- try {
58
- const d = strictJson(input); if (!valid.input(d)) fail("verification-invalid-input");
59
- const v = evaluateVariant(d.variant); if (v.state === "invalid") fail("verification-invalid-input");
60
- r.variantScopeSha256 = v.scopeSha256;
61
- r.planSha256 = hash({ variantScopeSha256: v.scopeSha256, catalogSha256,
62
- checks: byId(d.checks).map(c => ({ mechanismId: c.mechanismId, methodId: c.methodId, coverage: [...c.coverage].sort(), containment: c.containment })) });
63
- const blocked = new Set(), reasons = new Set();
64
- if (v.state === "blocked") blocked.add("verification-variant-blocked");
65
- if (v.state === "incomplete") reasons.add("verification-variant-evidence-unresolved");
66
- if (d.variant.candidate.authentication === "unknown") blocked.add("verification-authentication-unresolved");
67
- if (new Set(d.checks.map(c => c.mechanismId)).size !== d.checks.length) blocked.add("verification-duplicate-check");
68
- for (let i = 0; i < r.matrix.length; i++) {
69
- const row = r.matrix[i], template = ISOLATED_VERIFICATION_CHECKS[i];
70
- const c = d.checks.find(x => x.mechanismId === row.mechanismId), rowBlocked = new Set(), rowReasons = new Set();
71
- const observation = d.variant.observations.find(o => o.mechanismId === row.mechanismId);
72
- if (!d.variant.mechanisms.includes(row.mechanismId)) {
73
- rowBlocked.add("verification-variant-mechanism-missing"); row.missingEvidence.push("variant-mechanism-selection");
74
- }
75
- if (!observation || observation.state === "unknown") {
76
- rowReasons.add("verification-variant-observation-unresolved"); row.missingEvidence.push("variant-structural-reference");
77
- }
78
- if (row.mechanismId === "managed-sources-excluded" && (!observation || observation.state === "unknown")) {
79
- rowBlocked.add("verification-managed-policy-unresolved"); row.missingEvidence.push("effective-managed-policy");
80
- }
81
- if (!c) rowBlocked.add("verification-check-missing");
82
- else {
83
- row.methodId = c.methodId; row.missingEvidence = row.missingEvidence.filter(x => x !== "planning-check");
84
- row.missingCoverage = template.requiredCoverage.filter(p => !c.coverage.includes(p));
85
- if (!template.allowedMethods.includes(c.methodId)) rowBlocked.add("verification-method-not-allowed");
86
- if (new Set(c.coverage).size !== c.coverage.length) rowBlocked.add("verification-duplicate-coverage");
87
- if (row.missingCoverage.length || ["unknown", "prohibited-effect-required"].includes(c.containment)) {
88
- row.state = "not-observable-in-scope"; rowBlocked.add("verification-effect-or-coverage-unresolved");
89
- }
90
- const reviewOnly = ["documentation-review", "structure-review"].includes(c.methodId);
91
- if (reviewOnly && c.containment !== "not-needed" || !reviewOnly && c.containment === "not-needed") rowBlocked.add("verification-containment-inconsistent");
92
- const e = c.evidence;
93
- if (!e) { row.missingEvidence.push("current-scoped-reference"); rowReasons.add("verification-evidence-pending"); }
94
- else {
95
- const age = Date.parse(d.variant.now) - Date.parse(e.observedAt);
96
- if (revoked.has(e.referenceId)) rowBlocked.add("verification-evidence-revoked");
97
- if (age < 0) rowBlocked.add("verification-evidence-future");
98
- if (age > catalog.variantPolicy.maxEvidenceAgeSeconds * 1000) rowBlocked.add("verification-evidence-expired");
99
- if (e.scopeSha256 !== r.planSha256 || e.definitionSha256 !== template.definitionSha256) rowBlocked.add("verification-binding-mismatch");
100
- if (e.provenance === "rejected" || e.outcome === "incompatible") { row.state = "incompatible"; rowBlocked.add("verification-evidence-incompatible"); }
101
- else if (e.basis !== provenanceBasis[e.provenance]) rowBlocked.add("verification-provenance-mismatch");
102
- if (e.provenance === "native-claim") rowBlocked.add("verification-native-provenance-unverified");
103
- if (e.provenance === "operator-attested") rowReasons.add("verification-attestation-not-proof");
104
- else if (e.basis !== methodBasis[c.methodId]) rowBlocked.add("verification-method-evidence-mismatch");
105
- if (e.outcome === "unknown") { row.missingEvidence.push("current-scoped-reference"); rowReasons.add("verification-evidence-unresolved"); }
106
- if (!rowBlocked.size && row.state === "unresolved" && e.outcome === "supported") {
107
- if (e.provenance === "documented") row.state = "documented-only";
108
- if (e.provenance === "local-structure-observation") row.state = "structure-only";
109
- if (e.provenance === "fixture-claim") row.state = "test-scoped";
110
- }
111
- }
112
- }
113
- if (rowBlocked.size && !["incompatible", "not-observable-in-scope"].includes(row.state)) row.state = "unresolved";
114
- // Every native claim still lacks a trusted collector, regardless of apparent consistency.
115
- rowReasons.add("verification-native-effectiveness-pending");
116
- row.missingEvidence = [...new Set(row.missingEvidence)].sort();
117
- row.reasons = [...new Set([...rowBlocked, ...rowReasons])].sort();
118
- for (const reason of rowBlocked) blocked.add(reason);
119
- for (const reason of rowReasons) reasons.add(reason);
120
- }
121
- r.state = blocked.size ? "blocked" : "plan-review-required";
122
- r.reasons = [...new Set([...blocked, ...reasons])].sort();
123
- } catch {
124
- r.state = "invalid"; r.matrix = ISOLATED_VERIFICATION_CHECKS.map(emptyRow);
125
- r.reasons = ["verification-invalid-input"]; r.planSha256 = null; r.variantScopeSha256 = null;
126
- }
127
- if (!valid.report(r)) throw Error("Isolated-verification report invariant failed");
128
- return r;
129
- };
130
- }
@@ -1,14 +0,0 @@
1
- // Platform selection is separate from authorization, ownership and process checks.
2
- export const supportsLocalPosix = platform => platform === "darwin" || platform === "linux";
3
-
4
- // A trusted test harness must identify its synthetic spawn explicitly. The normal
5
- // native-client route retains its original macOS ARM64 restriction.
6
- export const supportsDiagnosticHost = (platform, architecture, dependencies) =>
7
- platform === "darwin" && architecture === "arm64" ||
8
- supportsLocalPosix(platform) && dependencies.syntheticFixture === true && typeof dependencies.spawn === "function";
9
-
10
- export const supportsPreferenceHost = (platform, source) =>
11
- platform === "darwin" || platform === "linux" && source === "synthetic";
12
-
13
- export const supportsAuthHost = (platform, source) =>
14
- platform === "darwin" || platform === "linux" && source === "synthetic-fixture";