failproofai 1.0.6-beta.1 → 1.0.7-beta.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 (258) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  6. package/.next/standalone/.next/server/app/_global-error/page.js +4 -4
  7. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  11. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
  12. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  13. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page.js +4 -4
  16. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
  20. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
  21. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +14 -14
  22. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/audit/run/route.js +8 -7
  25. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  33. package/.next/standalone/.next/server/app/audit/page.js +7 -5
  34. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/index.html +1 -1
  37. package/.next/standalone/.next/server/app/index.rsc +15 -15
  38. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +14 -14
  39. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
  40. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  41. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  42. package/.next/standalone/.next/server/app/page.js +6 -6
  43. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  45. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
  46. package/.next/standalone/.next/server/app/policies/page.js +13 -11
  47. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  50. package/.next/standalone/.next/server/app/project/[name]/page.js +8 -7
  51. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  54. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  55. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +7 -7
  56. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  58. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  59. package/.next/standalone/.next/server/app/projects/page.js +7 -6
  60. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  62. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +41 -8
  63. package/.next/standalone/.next/server/app/settings/page.js +12 -9
  64. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  66. package/.next/standalone/.next/server/chunks/{[externals]__1msfs-h._.js → [externals]__19_pzeq._.js} +1 -1
  67. package/.next/standalone/.next/server/chunks/{[externals]__1_bftcl._.js → [externals]__1j-zsg5._.js} +1 -1
  68. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
  69. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__1_r2rbg._.js → [root-of-the-server]__1bf34x4._.js} +5 -7
  70. package/.next/standalone/.next/server/chunks/_09dz7xv._.js +21 -21
  71. package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/_1ek68ln._.js +16 -16
  74. package/.next/standalone/.next/server/chunks/{_1c3k-8x._.js → _1q5i8mb._.js} +2 -2
  75. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +2 -2
  76. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +2 -2
  77. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/src_hooks_01frwmb._.js +5 -0
  79. package/.next/standalone/.next/server/chunks/src_hooks_18qtd42._.js +3 -0
  80. package/.next/standalone/.next/server/chunks/src_hooks_custom-hooks-loader_ts_0lnb3n3._.js +4 -2
  81. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01bmjsj._.js +3 -0
  82. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +4 -0
  83. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__02npjtd._.js → [root-of-the-server]__056wjo4._.js} +3 -3
  84. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0576iuy._.js +1 -1
  85. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__059yza8._.js +3 -0
  86. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0eip4_k._.js +22 -0
  87. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0p-5p8u._.js → [root-of-the-server]__0n0xg95._.js} +3 -3
  88. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qcb0mg._.js +3 -0
  89. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qxnccm._.js +5 -0
  90. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__013jr2b._.js → [root-of-the-server]__0rwtwpm._.js} +3 -3
  91. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s_yomn._.js +4 -0
  92. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0soxz2z._.js +3 -0
  93. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0yrsbd_._.js +3 -0
  94. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0da85px._.js → [root-of-the-server]__11mayhe._.js} +3 -3
  95. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13d-wb6._.js +3 -0
  96. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1dinjii._.js +3 -0
  97. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0cxe_2_._.js → [root-of-the-server]__1mf3zp6._.js} +3 -3
  98. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1x3j9mj._.js → [root-of-the-server]__1p28m0u._.js} +2 -2
  99. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ftmoxc._.js → [root-of-the-server]__1pprgri._.js} +3 -3
  100. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1p2otjt._.js → [root-of-the-server]__1q4p5b8._.js} +3 -3
  101. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qiz0e4._.js +3 -0
  102. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1v185mo._.js +1 -1
  103. package/.next/standalone/.next/server/chunks/ssr/_042cgl1._.js +3 -0
  104. package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +3 -0
  106. package/.next/standalone/.next/server/chunks/ssr/{_0qlygw6._.js → _0cf1olg._.js} +2 -2
  107. package/.next/standalone/.next/server/chunks/ssr/_0uyu3jf._.js +3 -0
  108. package/.next/standalone/.next/server/chunks/ssr/{_1_ddpm3._.js → _135-c3y._.js} +1 -1
  109. package/.next/standalone/.next/server/chunks/ssr/_1feuvhb._.js +5 -0
  110. package/.next/standalone/.next/server/chunks/ssr/{_1es2j7i._.js → _1gb0ifp._.js} +5 -5
  111. package/.next/standalone/.next/server/chunks/ssr/{_1_qswah._.js → _1q46vxx._.js} +2 -2
  112. package/.next/standalone/.next/server/chunks/ssr/{_0h_douw._.js → _1w_5l7t._.js} +1 -1
  113. package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
  114. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +4 -4
  115. package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +3 -0
  116. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
  117. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  118. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
  119. package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/ssr/lib_utils_ts_0az0sfq._.js +1 -1
  121. package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_0drixxt._.js → node_modules_next_dist_0w6mzq5._.js} +4 -4
  122. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_18_d8l1._.js +151 -0
  123. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +2 -2
  124. package/.next/standalone/.next/server/chunks/ssr/src_hooks_095a_79._.js +5 -0
  125. package/.next/standalone/.next/server/chunks/ssr/src_hooks_15t8kqj._.js +3 -0
  126. package/.next/standalone/.next/server/chunks/ssr/src_hooks_18k8rl0._.js +12 -0
  127. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1fm2w5z._.js +3 -0
  128. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1j0zy3v._.js +3 -0
  129. package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +1 -1
  130. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
  131. package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me65._.js +1 -1
  132. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  133. package/.next/standalone/.next/server/pages/404.html +1 -1
  134. package/.next/standalone/.next/server/pages/500.html +1 -1
  135. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  136. package/.next/standalone/.next/server/server-reference-manifest.json +56 -23
  137. package/.next/standalone/.next/static/chunks/{06fjx8-0_qufs.js → 00i9thnpht4l1.js} +1 -1
  138. package/.next/standalone/.next/static/chunks/{3ht0xsco46pul.js → 0289oapk24zql.js} +1 -1
  139. package/.next/standalone/.next/static/chunks/{1qf2uiipatr80.js → 0pyy9m5cm8zku.js} +1 -1
  140. package/.next/standalone/.next/static/chunks/15heikmy3yjzc.js +1 -0
  141. package/.next/standalone/.next/static/chunks/285spx855h_3r.css +2 -0
  142. package/.next/standalone/.next/static/chunks/{02vwr5js1x28j.js → 2plg9qae1yejv.js} +1 -1
  143. package/.next/standalone/.next/static/chunks/2qv4hshejedtx.css +1 -0
  144. package/.next/standalone/.next/static/chunks/{2x776s0x3n_tu.js → 2tqszh84mp_2l.js} +1 -1
  145. package/.next/standalone/.next/static/chunks/34jpdb2xjm-x7.js +1 -0
  146. package/.next/standalone/.next/static/chunks/3cdkxrukvlvul.js +1 -0
  147. package/.next/standalone/.next/static/chunks/3dnd-_29uiaj3.js +6 -0
  148. package/.next/standalone/.next/static/chunks/{0y227_ohdqwvn.js → 3vp7c3knkh8mr.js} +1 -1
  149. package/.next/standalone/.next/static/chunks/{27_bwbg8sv6vj.js → 3vwnzfx9q80yl.js} +1 -1
  150. package/.next/standalone/app/actions/get-jev-config.ts +409 -0
  151. package/.next/standalone/app/actions/pack-actions.ts +12 -0
  152. package/.next/standalone/app/actions/update-jev-config.ts +420 -0
  153. package/.next/standalone/app/components/jev-notices.tsx +96 -0
  154. package/.next/standalone/app/policies/hooks-client.tsx +9 -0
  155. package/.next/standalone/app/settings/jev-panel.tsx +469 -0
  156. package/.next/standalone/app/settings/page.tsx +20 -1
  157. package/.next/standalone/app/settings/settings-client.tsx +27 -1
  158. package/.next/standalone/app/settings/settings.css +79 -0
  159. package/.next/standalone/fp-cloud-cli/CHANGELOG.md +51 -3
  160. package/.next/standalone/fp-cloud-cli/README.md +1 -1
  161. package/.next/standalone/fp-cloud-cli/fp_cli/_version.py +1 -1
  162. package/.next/standalone/fp-cloud-cli/fp_cli/client.py +44 -0
  163. package/.next/standalone/fp-cloud-cli/fp_cli/commands/incidents_cmds.py +226 -5
  164. package/.next/standalone/fp-cloud-cli/fp_cli/models.py +11 -0
  165. package/.next/standalone/fp-cloud-cli/fp_cli/output.py +68 -1
  166. package/.next/standalone/fp-cloud-cli/pyproject.toml +1 -1
  167. package/.next/standalone/fp-cloud-cli/skill/SKILL.md +17 -2
  168. package/.next/standalone/fp-cloud-cli/skill/references/commands.md +7 -4
  169. package/.next/standalone/fp-cloud-cli/tests/test_alerting.py +184 -0
  170. package/.next/standalone/fp-cloud-cli/uv.lock +3 -3
  171. package/.next/standalone/package.json +11 -11
  172. package/.next/standalone/sdk/python/CHANGELOG.md +7 -0
  173. package/.next/standalone/sdk/python/failproofai_sdk/_version.py +1 -1
  174. package/.next/standalone/sdk/python/failproofai_sdk/evaluator/__init__.py +2 -0
  175. package/.next/standalone/sdk/python/failproofai_sdk/evaluator/authoring.py +24 -1
  176. package/.next/standalone/sdk/python/failproofai_sdk/evaluator/runtime.py +41 -6
  177. package/.next/standalone/sdk/python/tests/test_evaluator_runtime.py +88 -0
  178. package/.next/standalone/sdk/python/uv.lock +15 -15
  179. package/.next/standalone/server.js +1 -1
  180. package/bin/failproofai.mjs +115 -2
  181. package/dist/cli.mjs +10982 -3787
  182. package/dist/index.js +19 -1
  183. package/dist/worker.mjs +13761 -7834
  184. package/package.json +11 -11
  185. package/pi-extension/index.ts +11 -0
  186. package/scripts/build-policy-pack.mjs +39 -2
  187. package/src/hooks/builtin-policies.ts +21 -3
  188. package/src/hooks/cloud-enrollment-cli.ts +1 -1
  189. package/src/hooks/cloud-managed-policies.ts +22 -0
  190. package/src/hooks/custom-hooks-loader.ts +45 -7
  191. package/src/hooks/custom-hooks-registry.ts +45 -1
  192. package/src/hooks/daemon-client.ts +128 -50
  193. package/src/hooks/daemon-service.ts +30 -0
  194. package/src/hooks/effective-reviewers.ts +79 -0
  195. package/src/hooks/first-run-gate.ts +5 -0
  196. package/src/hooks/fp-home.ts +23 -0
  197. package/src/hooks/handler.ts +265 -6
  198. package/src/hooks/hook-activity-store.ts +105 -1
  199. package/src/hooks/hook-telemetry.ts +41 -0
  200. package/src/hooks/integrations.ts +3 -2
  201. package/src/hooks/jev-activity.ts +385 -0
  202. package/src/hooks/jev-cli.ts +1193 -0
  203. package/src/hooks/loader-utils.ts +6 -0
  204. package/src/hooks/manager.ts +4 -4
  205. package/src/hooks/pack-cli.ts +237 -11
  206. package/src/hooks/pack-manifest.ts +479 -7
  207. package/src/hooks/pack-store.ts +156 -10
  208. package/src/hooks/policy-authority.ts +333 -0
  209. package/src/hooks/policy-catalog.ts +65 -0
  210. package/src/hooks/policy-evaluator.ts +940 -796
  211. package/src/hooks/policy-registry.ts +25 -0
  212. package/src/hooks/policy-reviewability.ts +229 -0
  213. package/src/hooks/policy-types.ts +126 -0
  214. package/src/hooks/semantic/combine.ts +541 -0
  215. package/src/hooks/semantic/compile.ts +176 -0
  216. package/src/hooks/semantic/decide.ts +392 -0
  217. package/src/hooks/semantic/envelope.ts +1296 -0
  218. package/src/hooks/semantic/evaluator.ts +547 -0
  219. package/src/hooks/semantic/facts.ts +292 -0
  220. package/src/hooks/semantic/intent.ts +1190 -0
  221. package/src/hooks/semantic/jev-client.ts +643 -0
  222. package/src/hooks/semantic/jev-config.ts +594 -0
  223. package/src/hooks/semantic/jev-review.ts +374 -0
  224. package/src/hooks/semantic/jev-stats.ts +289 -0
  225. package/src/hooks/semantic/jev-throttle.ts +421 -0
  226. package/src/hooks/semantic/pack-policies.ts +251 -0
  227. package/src/hooks/semantic/policies.ts +596 -0
  228. package/src/hooks/semantic/precondition-names.ts +60 -0
  229. package/src/hooks/semantic/preconditions.ts +58 -0
  230. package/src/hooks/semantic/redact.ts +2910 -0
  231. package/src/hooks/semantic/types.ts +145 -0
  232. package/src/hooks/semver-precedence.ts +128 -0
  233. package/src/hooks/worker-server.ts +119 -26
  234. package/src/index.ts +6 -0
  235. package/.next/standalone/.next/server/chunks/src_hooks_0iu54mz._.js +0 -3
  236. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-_ki57._.js +0 -4
  237. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +0 -4
  238. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cg-bgc._.js +0 -5
  239. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cpu_mj._.js +0 -3
  240. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0u3w0ll._.js +0 -22
  241. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17d_ffl._.js +0 -3
  242. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__19d9tgz._.js +0 -5
  243. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ctpynv._.js +0 -3
  244. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1jiwfsj._.js +0 -3
  245. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1phc187._.js +0 -3
  246. package/.next/standalone/.next/server/chunks/ssr/_06imw3p._.js +0 -5
  247. package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +0 -3
  248. package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +0 -3
  249. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1cv9_c4._.js +0 -10
  250. package/.next/standalone/.next/static/chunks/0cbvytf8epn34.js +0 -1
  251. package/.next/standalone/.next/static/chunks/0qmsunv04x4na.css +0 -2
  252. package/.next/standalone/.next/static/chunks/1p4xauf-zu6zk.js +0 -1
  253. package/.next/standalone/.next/static/chunks/1uc_s_dftgxiq.js +0 -6
  254. package/.next/standalone/.next/static/chunks/2k9f4tyv04809.css +0 -1
  255. package/.next/standalone/.next/static/chunks/2lvr2pt70qn14.js +0 -1
  256. /package/.next/standalone/.next/static/{QCNYz2yCxxdeggg1k0iEq → qbVI48kgBOf9CTOKcFIk2}/_buildManifest.js +0 -0
  257. /package/.next/standalone/.next/static/{QCNYz2yCxxdeggg1k0iEq → qbVI48kgBOf9CTOKcFIk2}/_clientMiddlewareManifest.js +0 -0
  258. /package/.next/standalone/.next/static/{QCNYz2yCxxdeggg1k0iEq → qbVI48kgBOf9CTOKcFIk2}/_ssgManifest.js +0 -0
@@ -7,6 +7,8 @@
7
7
  */
8
8
  import type { HookEventType } from "./types";
9
9
  import type { PolicyFunction, PolicyMatcher, PolicyParamsSchema, RegisteredPolicy } from "./policy-types";
10
+ import { effectiveReviewerNames, forgetEffectiveReviewerNames } from "./effective-reviewers";
11
+ import { resolvePolicyAuthority, type AuthorityDeclaration } from "./policy-authority";
10
12
 
11
13
  const REGISTRY_KEY = "__FAILPROOFAI_POLICY_REGISTRY__";
12
14
  const INDEX_CACHE_KEY = "__FAILPROOFAI_POLICY_INDEX_CACHE__";
@@ -58,15 +60,34 @@ export function registerPolicy(
58
60
  match: PolicyMatcher,
59
61
  priority: number = 0,
60
62
  params?: PolicyParamsSchema,
63
+ /**
64
+ * The policy's authority declaration, as its source wrote it. Judged HERE,
65
+ * so the registry only ever holds an effective value: `reviewable` with a
66
+ * clean `reviewedBy`, or `hard`. See `resolvePolicyAuthority`.
67
+ *
68
+ * Absent means the caller declared nothing, and the entry then carries no
69
+ * authority field at all — which `effectiveAuthority` reads as hard.
70
+ */
71
+ meta?: AuthorityDeclaration,
61
72
  ): void {
62
73
  const canonical = normalizePolicyName(name);
63
74
  const registry = getRegistry();
64
75
  const idx = registry.findIndex((p) => p.name === canonical);
76
+ // Judged against the reviewers this MACHINE can ask, not against the ones this
77
+ // build compiled in. A pack that ships its own `semantic` set replaces the
78
+ // compiled one, so its policies name checks that exist here and nowhere in
79
+ // `SEMANTIC_POLICY_NAMES` — and judging them by the builtin list would
80
+ // downgrade the whole rewritten set to `hard` while reporting nothing but a
81
+ // warning. `effectiveReviewerNames` reads the manifest — already where a
82
+ // pack's `reviewedBy` itself comes from — once per registration pass.
83
+ const authority = meta ? resolvePolicyAuthority(meta, effectiveReviewerNames()) : undefined;
65
84
  const entry: RegisteredPolicy = {
66
85
  name: canonical, description, fn, match, priority,
67
86
  // Absent stays absent: `evaluatePolicies` distinguishes "declares a schema"
68
87
  // from "declares none", and a spread `params: undefined` is neither.
69
88
  ...(params ? { params } : {}),
89
+ ...(authority ? { authority: authority.authority } : {}),
90
+ ...(authority?.reviewedBy ? { reviewedBy: authority.reviewedBy } : {}),
70
91
  };
71
92
  if (idx >= 0) {
72
93
  registry[idx] = entry;
@@ -110,6 +131,10 @@ export function clearPolicies(): void {
110
131
  const g = globalThis as GlobalWithRegistry;
111
132
  g[REGISTRY_KEY] = [];
112
133
  setIndexCache(null);
134
+ // The reviewer set describes the policies that are about to be registered, so
135
+ // it is rebuilt with them. Dropping it here is also what keeps one read per
136
+ // evaluation instead of one per policy.
137
+ forgetEffectiveReviewerNames();
113
138
  }
114
139
 
115
140
  /**
@@ -0,0 +1,229 @@
1
+ /**
2
+ * How much of what this machine enforces Jev is allowed to CLEAR — the
3
+ * diagnostic half of `policy-authority.ts`, and nothing else.
4
+ *
5
+ * ## The silence this exists to break
6
+ *
7
+ * Authority decides one thing: whether Jev may clear a regex policy's deny or
8
+ * instruct (`combine.ts`, which returns early unless the authority is
9
+ * `reviewable`). Absent means `hard`, and that default is right — it is what
10
+ * keeps an unknown pack, cloud or custom policy from being weakened by a
11
+ * classifier nobody asked about it.
12
+ *
13
+ * It is also completely silent. `authority` and `reviewedBy` reach a pack
14
+ * through its manifest, and the only thing that writes them there is
15
+ * `scripts/build-policy-pack.mjs`, which ships WITH this release. So a pack
16
+ * published before it declares none, every policy in it resolves to `hard`
17
+ * with nothing downgraded, and `warnAuthority` — which only speaks when a
18
+ * `reviewable` declaration was not honored — has nothing to say. The result a
19
+ * customer gets is the deny half of the two-tier evaluator working exactly as
20
+ * documented, the clear half unable to fire once, and no diagnostic anywhere:
21
+ * `jev status` says `on`, the fallback rate says the calls are being answered,
22
+ * and `cleared` says `nothing` forever.
23
+ *
24
+ * This module counts. It changes no policy's authority and no verdict, it is
25
+ * never imported from the hook path, and a machine with no `jev.json` never
26
+ * reaches a caller of it.
27
+ *
28
+ * ## What "enabled" means here
29
+ *
30
+ * The same thing it means in `handler.ts`, read from the same files, without
31
+ * loading or executing a policy:
32
+ *
33
+ * - **Installed packs** — each pack's manifest entries, narrowed by its
34
+ * `enabled` selection (absent means the whole pack). A pack's `clis`
35
+ * narrowing is NOT applied: there is no agent CLI in a status command, and
36
+ * the honest answer to "what could Jev clear on this machine" spans all of
37
+ * them.
38
+ * - **Builtins** — this build's catalog, under the same migration shim the
39
+ * handler applies: they enforce only while no pack is installed. The
40
+ * `alwaysOn` guard is counted always, because it registers always (and is
41
+ * hard always, so it can only ever lower the ratio).
42
+ * - **Cloud assignments** — the active deployment's records, whose authority is
43
+ * declared by whoever deployed them. One record per assignment; an artifact
44
+ * that registers several hooks is still one central decision.
45
+ *
46
+ * Two things are deliberately NOT counted, and `customFiles` is what says so
47
+ * out loud when it matters:
48
+ *
49
+ * - **Policies from the user's own files.** A custom hook declares its
50
+ * authority inside the module, so counting one means importing and running
51
+ * somebody's JavaScript — from a settings page, on every read. The count of
52
+ * configured custom policy PATHS is reported instead, and the summary says
53
+ * in words that those policies were not counted.
54
+ * - **A session pause.** It suspends local policy for minutes, and a warning
55
+ * about a policy set that is coming back shortly would be noise.
56
+ */
57
+ import { readActiveCloudManagedPolicies } from "./cloud-managed-policies";
58
+ import { configuredCustomPolicyPaths, readMergedHooksConfig } from "./hooks-config";
59
+ import { hasInstalledPacks, packSemantic, readInstalledPacks } from "./pack-manifest";
60
+ import { resolvePolicyAuthority } from "./policy-authority";
61
+ import { POLICY_CATALOG } from "./policy-catalog";
62
+ import { normalizePolicyName } from "./policy-registry";
63
+ import type { HooksConfig } from "./policy-types";
64
+
65
+ /** Anything that carries an authority declaration: a catalog entry, a pack entry, a cloud record. */
66
+ export interface AuthorityRecord {
67
+ authority?: unknown;
68
+ reviewedBy?: unknown;
69
+ alwaysOn?: boolean;
70
+ }
71
+
72
+ export interface ReviewableCoverage {
73
+ /** Enabled policies whose authority could be read without running code. */
74
+ enabled: number;
75
+ /** Of those, the ones Jev may clear a deny or an instruct from. */
76
+ reviewable: number;
77
+ /** Configured custom policy paths, whose policies are not in the counts above. */
78
+ customFiles: number;
79
+ }
80
+
81
+ /** The command that replaces a pack with one built by this release. */
82
+ export const RETAKE_PACK_COMMAND = "failproofai policies add FailproofAI/policies";
83
+
84
+ /**
85
+ * Count a policy set by the authority it would REGISTER with —
86
+ * `resolvePolicyAuthority`, the rule `registerPolicy` applies — so this cannot
87
+ * report a clear that would not happen or hide one that would.
88
+ *
89
+ * Deliberately not `effectiveAuthority`, the looser §7 contract `jev-review.ts`
90
+ * asks at evaluation time. That one needs a single non-empty name and is right
91
+ * where it is asked, because by then the registry holds a `reviewedBy` that
92
+ * registration already cleaned, and on cleaned records the two rules agree.
93
+ * Nothing counted HERE has been through registration: these records are read
94
+ * straight off a pack manifest, this build's catalog and the cloud deployment.
95
+ * So a declaration naming a check this build does not have — `reviewedBy:
96
+ * ["future-check"]`, which is what a pack built against a NEWER semantic set
97
+ * looks like here — is reviewable to the loose rule and hard in the registry,
98
+ * and counting it would report a clear that can never happen while
99
+ * `reviewableProblem` stayed silent about the machine it exists to warn.
100
+ */
101
+ export function countReviewable(
102
+ policies: Iterable<AuthorityRecord>,
103
+ /**
104
+ * The semantic checks that can be asked on this machine. Defaults to the
105
+ * compiled-in set; `surveyReviewableCoverage` passes the pack's when one
106
+ * declares its own, because otherwise this diagnostic reports "0 of 11
107
+ * reviewable" on exactly the machines the feature was built for — the ones
108
+ * running a pack that carries both tiers.
109
+ */
110
+ knownReviewers?: ReadonlySet<string>,
111
+ ): {
112
+ enabled: number;
113
+ reviewable: number;
114
+ } {
115
+ let enabled = 0;
116
+ let reviewable = 0;
117
+ for (const p of policies) {
118
+ enabled += 1;
119
+ if (resolvePolicyAuthority(p, knownReviewers).authority === "reviewable") reviewable += 1;
120
+ }
121
+ return { enabled, reviewable };
122
+ }
123
+
124
+ /**
125
+ * What this machine's enabled policy set looks like to Jev. Reads three files
126
+ * and no policy: see the header for what is in the counts and what is not.
127
+ *
128
+ * Every source is wrapped, and an unreadable one contributes nothing rather
129
+ * than throwing — the same fail-open posture `handler.ts` takes for packs and
130
+ * cloud policies, for the same reason: this is a diagnostic, and one corrupt
131
+ * byte must not replace a settings page with an error boundary.
132
+ */
133
+ export function surveyReviewableCoverage(cwd?: string): ReviewableCoverage {
134
+ const records: AuthorityRecord[] = [];
135
+
136
+ let packsInstalled = false;
137
+ /**
138
+ * The reviewers a pack brought with it. Collected from the SAME read as the
139
+ * policies rather than through `effectiveReviewerNames()`, which would re-read
140
+ * and re-verify every artifact for an answer already in hand — and would, for
141
+ * one read of a manifest being rewritten underneath, be able to disagree with
142
+ * the records counted here.
143
+ *
144
+ * A pack's `enabled` selection is deliberately not applied: it narrows which
145
+ * of its REGEX policies register, and its semantic set is not selectable.
146
+ */
147
+ const packReviewers = new Set<string>();
148
+ try {
149
+ packsInstalled = hasInstalledPacks();
150
+ for (const pack of readInstalledPacks().packs) {
151
+ const selected = pack.enabled;
152
+ records.push(...(selected ? pack.policies.filter((p) => selected.includes(p.name)) : pack.policies));
153
+ for (const entry of packSemantic(pack)) packReviewers.add(entry.name);
154
+ }
155
+ } catch {
156
+ // An unreadable manifest enforces nothing; `readInstalledPacks` already
157
+ // reports that to the hook log on the path that cares.
158
+ }
159
+
160
+ let config: HooksConfig;
161
+ try {
162
+ config = readMergedHooksConfig(cwd);
163
+ } catch {
164
+ config = { enabledPolicies: [] };
165
+ }
166
+ // The migration shim, exactly as `handler.ts` applies it: this build's
167
+ // builtins enforce only until a pack is installed.
168
+ const legacyEnabled = new Set(packsInstalled ? [] : config.enabledPolicies.map(normalizePolicyName));
169
+ for (const policy of POLICY_CATALOG) {
170
+ if (policy.alwaysOn || legacyEnabled.has(normalizePolicyName(policy.name))) records.push(policy);
171
+ }
172
+
173
+ try {
174
+ for (const assignment of readActiveCloudManagedPolicies()) {
175
+ records.push({ authority: assignment.authority, reviewedBy: assignment.reviewedBy });
176
+ }
177
+ } catch {
178
+ // Same fail-open as the handler's own read of this file.
179
+ }
180
+
181
+ let customFiles = 0;
182
+ try {
183
+ customFiles = configuredCustomPolicyPaths(config).length;
184
+ } catch {
185
+ customFiles = 0;
186
+ }
187
+
188
+ return { ...countReviewable(records, packReviewers.size > 0 ? packReviewers : undefined), customFiles };
189
+ }
190
+
191
+ /**
192
+ * The one line both surfaces show: the count, in the words `jev status` and the
193
+ * dashboard panel must agree on. A non-zero count is worth saying too — it is
194
+ * how someone learns how much of their policy set Jev can act on at all.
195
+ */
196
+ export function reviewableSummary(coverage: ReviewableCoverage): string {
197
+ const { enabled, reviewable } = coverage;
198
+ // Said out loud rather than folded into the number, because a custom policy
199
+ // CAN be reviewable and this count would not know: reading that declaration
200
+ // means importing and running the file it lives in.
201
+ const tail = coverage.customFiles > 0 ? " (policies from your own files are not counted)" : "";
202
+ if (enabled === 0) return `No policies are enabled here, so there is nothing for Jev to clear${tail}.`;
203
+ const noun = enabled === 1 ? "1 enabled policy is" : `${enabled} enabled policies are`;
204
+ if (reviewable === 0) return `0 of ${noun} reviewable${tail}.`;
205
+ return `${reviewable} of ${noun} reviewable: Jev may clear a deny or an instruction from those, and from no others${tail}.`;
206
+ }
207
+
208
+ /**
209
+ * Why Jev can never clear anything here, and what fixes it — or null when it
210
+ * can clear something, which needs no explanation.
211
+ *
212
+ * It states the observation before naming the usual cause, because the cause is
213
+ * the usual one and not the only one: a machine can also reach zero by enabling
214
+ * only hard policies, or by having nothing but the self-protection guard. The
215
+ * remedy is the same in each case, and it is one command.
216
+ *
217
+ * Nothing is diagnosed for an empty policy set: there is no clear to lose, and
218
+ * an authority warning to someone who enforces nothing answers a question they
219
+ * did not ask.
220
+ */
221
+ export function reviewableProblem(coverage: ReviewableCoverage): string | null {
222
+ if (coverage.enabled === 0 || coverage.reviewable > 0) return null;
223
+ return (
224
+ "Jev can add a deny or an instruction on this machine, but it can never clear one. " +
225
+ "No enabled policy is marked reviewable — a policy pack published before this release carries no such marks — " +
226
+ `so re-take the pack (\`${RETAKE_PACK_COMMAND}\`) to get a marked copy, ` +
227
+ "or enforce this build's builtin policies, which carry them."
228
+ );
229
+ }
@@ -43,6 +43,52 @@ export interface RegisteredPolicy {
43
43
  * the user's OWN configured `policyParams` for it, not merely the defaults.
44
44
  */
45
45
  params?: PolicyParamsSchema;
46
+ /** Whether Jev may clear this policy's deny/instruct; see {@link effectiveAuthority}. */
47
+ authority?: PolicyAuthority;
48
+ /**
49
+ * The semantic policies (`src/hooks/semantic/policies.ts`) that must all be
50
+ * asked, and none of which may answer `deny`, before Jev clears this policy.
51
+ */
52
+ reviewedBy?: string[];
53
+ }
54
+
55
+ /**
56
+ * Who has the last word on a policy's deny or instruct when Jev is configured.
57
+ *
58
+ * - `hard`: final. Jev can never clear it.
59
+ * - `reviewable`: Jev may clear it, but only through the semantic policies
60
+ * named in `reviewedBy`, and only when every one of them was actually asked
61
+ * and none of them answered `deny` — a `none`, `overridden` or `instruct`
62
+ * answer clears it (`combine.ts`, "A warning-level answer clears the deny").
63
+ * A named check that was NOT asked always keeps the verdict standing.
64
+ */
65
+ export type PolicyAuthority = "hard" | "reviewable";
66
+
67
+ /**
68
+ * The authority a policy actually has. `reviewable` only when it is declared
69
+ * `reviewable`, names at least one semantic policy in `reviewedBy`, and is not
70
+ * `alwaysOn`. Anything else — absent, invalid, an empty `reviewedBy`, the
71
+ * self-protection guard — is `hard`, so an unknown custom, cloud or third-party
72
+ * policy can never be weakened by Jev.
73
+ *
74
+ * This is the §7 contract every task builds against, and it is deliberately
75
+ * the looser of two rules: one usable name is enough here. REGISTRATION is
76
+ * stricter — `resolvePolicyAuthority` in `policy-authority.ts` makes the whole
77
+ * declaration hard if any entry is malformed or is not a semantic policy this
78
+ * build has, and that is what `registerPolicy` stores. So a registered policy's
79
+ * `reviewedBy` is already clean, and the two rules agree on everything that
80
+ * reaches the registry.
81
+ */
82
+ export function effectiveAuthority(p: {
83
+ authority?: unknown;
84
+ reviewedBy?: unknown;
85
+ alwaysOn?: boolean;
86
+ }): PolicyAuthority {
87
+ if (p.alwaysOn === true) return "hard";
88
+ if (p.authority !== "reviewable") return "hard";
89
+ if (!Array.isArray(p.reviewedBy)) return "hard";
90
+ const named = p.reviewedBy.filter((n) => typeof n === "string" && n.length > 0);
91
+ return named.length > 0 ? "reviewable" : "hard";
46
92
  }
47
93
 
48
94
  export interface PolicyParamsSchema {
@@ -89,6 +135,10 @@ export interface BuiltinPolicyDefinition {
89
135
  * secondary line in the audit report. e.g. "Could leak code from neighboring
90
136
  * repos to the model." */
91
137
  impact?: string;
138
+ /** See {@link PolicyAuthority}. Absent means `hard`. */
139
+ authority?: PolicyAuthority;
140
+ /** See {@link RegisteredPolicy.reviewedBy}. */
141
+ reviewedBy?: string[];
92
142
  }
93
143
 
94
144
  export interface CustomHook {
@@ -98,6 +148,82 @@ export interface CustomHook {
98
148
  events?: HookEventType[];
99
149
  };
100
150
  fn: (ctx: PolicyContext) => PolicyResult | Promise<PolicyResult>;
151
+ /**
152
+ * See {@link PolicyAuthority}. Absent means `hard`.
153
+ *
154
+ * Honored for the user's own local policy files (explicit paths and
155
+ * `.failproofai/policies/`). For a pack policy the pack's MANIFEST decides,
156
+ * and for a cloud-managed one the cloud ARTIFACT record does — the same split
157
+ * as `params`, so the declaration a user reviewed in a listing is the one
158
+ * that takes effect.
159
+ */
160
+ authority?: PolicyAuthority;
161
+ /** See {@link RegisteredPolicy.reviewedBy}. */
162
+ reviewedBy?: string[];
163
+ }
164
+
165
+ /**
166
+ * The tool classes a semantic policy may be asked about.
167
+ *
168
+ * A structural copy of `ToolClass` in `src/hooks/semantic/types.ts`, and
169
+ * deliberately not an import of it. This module is the public API's type
170
+ * surface — every custom policy file and every pack entry imports it — and the
171
+ * semantic modules must stay off the import graph of a machine with no
172
+ * `jev.json` (see `precondition-names.ts` for what that costs when it slips).
173
+ * A type import would be erased, but the two lists still have to agree, so
174
+ * `__tests__/hooks/semantic/pack-semantic-registry.test.ts` pins them.
175
+ */
176
+ export type SemanticToolClass = "shell" | "write" | "read" | "network" | "other";
177
+
178
+ /** One yes/no question in a semantic policy, as a pack declares it. */
179
+ export interface SemanticProbeDeclaration {
180
+ /** Lowercase slug, unique within the policy. The answer map is keyed `<policy>.<id>`. */
181
+ id: string;
182
+ instructions: string;
183
+ criteria?: { true: string; false: string };
184
+ }
185
+
186
+ /**
187
+ * A semantic (Jev) policy as its author DECLARES it — a question set, not code.
188
+ *
189
+ * The compiled-in equivalent is `SemanticPolicy` in `semantic/types.ts`, and
190
+ * the one difference is the whole reason both exist: there, `precondition` is a
191
+ * function over the computed facts; here it is the NAME of one, because a
192
+ * declaration has to survive a trip through a JSON manifest and because a
193
+ * downloaded artifact must not hand this process an expression to evaluate on
194
+ * every tool call. `semantic/preconditions.ts` binds the name to its predicate.
195
+ *
196
+ * There is no `fn` and no `match`: a semantic policy never executes locally and
197
+ * is never selected by event or tool name — `appliesTo` and `precondition`
198
+ * decide what it is asked about, and Jev answers it. That is also why it is
199
+ * registered through `semanticPolicies`, its own namespace, rather than as a
200
+ * variant of `customPolicies.add`.
201
+ */
202
+ export interface SemanticPolicyDeclaration {
203
+ /** Short slug. Reported as `semantic/<name>`, and what a `reviewedBy` names. */
204
+ name: string;
205
+ /** Past-tense phrase for what was caught, e.g. "Deleted something irreplaceable". */
206
+ title: string;
207
+ appliesTo: SemanticToolClass[];
208
+ /** `deny` blocks on strong evidence and warns on moderate; `instruct` only ever warns. */
209
+ mode: "deny" | "instruct";
210
+ /**
211
+ * Whether the human's own explicit request may clear this policy.
212
+ *
213
+ * Required, with no default anywhere in the stack. It is the field that
214
+ * decides whether a prompt injection can talk its way past the policy, and a
215
+ * default for it would be a security decision made by absence — the author
216
+ * would never learn which way it went.
217
+ */
218
+ userCanOverride: boolean;
219
+ /** A name from `PACK_PRECONDITION_NAMES`. Absent, or `"always"`, means no precondition. */
220
+ precondition?: string;
221
+ /** Every probe must hold for the policy to fire (conjunction). 1–6 of them. */
222
+ probes: SemanticProbeDeclaration[];
223
+ /** If this holds, the policy does not fire — the documented exceptions. */
224
+ exempt?: SemanticProbeDeclaration;
225
+ /** Shown to the agent when the policy fires. */
226
+ guidance: string;
101
227
  }
102
228
 
103
229
  export interface LlmConfig {