failproofai 1.0.6 → 1.0.7-beta.1

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 (260) 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 +4 -4
  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]__056wjo4._.js +4 -0
  84. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__059yza8._.js +3 -0
  85. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0eip4_k._.js +22 -0
  86. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n0xg95._.js +4 -0
  87. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qcb0mg._.js +3 -0
  88. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qxnccm._.js +5 -0
  89. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rwtwpm._.js +4 -0
  90. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s_yomn._.js +4 -0
  91. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0soxz2z._.js +3 -0
  92. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0yrsbd_._.js +3 -0
  93. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1svlq8e._.js → [root-of-the-server]__0yxwl6j._.js} +2 -2
  94. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11mayhe._.js +4 -0
  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]__1b2dbet._.js +1 -1
  97. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1dinjii._.js +3 -0
  98. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0cxe_2_._.js → [root-of-the-server]__1mf3zp6._.js} +3 -3
  99. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +4 -0
  100. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1q4p5b8._.js +4 -0
  101. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qiz0e4._.js +3 -0
  102. package/.next/standalone/.next/server/chunks/ssr/_042cgl1._.js +3 -0
  103. package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
  104. package/.next/standalone/.next/server/chunks/ssr/{_0do6d26._.js → _0bn2oo8._.js} +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +3 -0
  106. package/.next/standalone/.next/server/chunks/ssr/_0uyu3jf._.js +3 -0
  107. package/.next/standalone/.next/server/chunks/ssr/_1feuvhb._.js +5 -0
  108. package/.next/standalone/.next/server/chunks/ssr/{_1es2j7i._.js → _1gb0ifp._.js} +5 -5
  109. package/.next/standalone/.next/server/chunks/ssr/{_1_qswah._.js → _1q46vxx._.js} +2 -2
  110. package/.next/standalone/.next/server/chunks/ssr/{_0h_douw._.js → _1w_5l7t._.js} +1 -1
  111. package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
  112. package/.next/standalone/.next/server/chunks/ssr/{_17o744m._.js → _214wgrp._.js} +2 -2
  113. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +2 -2
  114. package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +3 -0
  115. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
  116. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  117. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
  118. package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +3 -0
  119. package/.next/standalone/.next/server/chunks/ssr/lib_utils_ts_0az0sfq._.js +1 -1
  120. package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_0drixxt._.js → node_modules_next_dist_0w6mzq5._.js} +4 -4
  121. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_18_d8l1._.js +151 -0
  122. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +2 -2
  123. package/.next/standalone/.next/server/chunks/ssr/src_hooks_095a_79._.js +5 -0
  124. package/.next/standalone/.next/server/chunks/ssr/src_hooks_15t8kqj._.js +3 -0
  125. package/.next/standalone/.next/server/chunks/ssr/src_hooks_18k8rl0._.js +12 -0
  126. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1fm2w5z._.js +3 -0
  127. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1j0zy3v._.js +3 -0
  128. package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +1 -1
  129. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
  130. package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me65._.js +1 -1
  131. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  132. package/.next/standalone/.next/server/pages/404.html +1 -1
  133. package/.next/standalone/.next/server/pages/500.html +1 -1
  134. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  135. package/.next/standalone/.next/server/server-reference-manifest.json +56 -23
  136. package/.next/standalone/.next/static/chunks/0cd-_8-c-m1ea.js +6 -0
  137. package/.next/standalone/.next/static/chunks/{40-wncjnguy4e.js → 0qrbdkv9qmvli.js} +1 -1
  138. package/.next/standalone/.next/static/chunks/{3-6zhytp6adkk.js → 0uldbut9y2-e8.js} +1 -1
  139. package/.next/standalone/.next/static/chunks/{2y4ycwcwfjv4k.js → 0vmd180qfntfb.js} +1 -1
  140. package/.next/standalone/.next/static/chunks/{25m8mg7bosgip.js → 12tvm75t5ffui.js} +1 -1
  141. package/.next/standalone/.next/static/chunks/1u5zsejmgrir_.js +1 -0
  142. package/.next/standalone/.next/static/chunks/258668t68du6b.js +1 -0
  143. package/.next/standalone/.next/static/chunks/285spx855h_3r.css +2 -0
  144. package/.next/standalone/.next/static/chunks/{35pw7zxhh76n7.js → 29fql3nbnfc9q.js} +1 -1
  145. package/.next/standalone/.next/static/chunks/2qv4hshejedtx.css +1 -0
  146. package/.next/standalone/.next/static/chunks/{0bepqeawy72n6.js → 2vkvu9-opa_1z.js} +1 -1
  147. package/.next/standalone/.next/static/chunks/34jpdb2xjm-x7.js +1 -0
  148. package/.next/standalone/.next/static/chunks/37lhv7wa3ywt6.js +1 -0
  149. package/.next/standalone/app/actions/get-jev-config.ts +409 -0
  150. package/.next/standalone/app/actions/pack-actions.ts +12 -0
  151. package/.next/standalone/app/actions/update-jev-config.ts +420 -0
  152. package/.next/standalone/app/components/jev-notices.tsx +96 -0
  153. package/.next/standalone/app/policies/hooks-client.tsx +9 -0
  154. package/.next/standalone/app/settings/jev-panel.tsx +469 -0
  155. package/.next/standalone/app/settings/page.tsx +20 -1
  156. package/.next/standalone/app/settings/settings-client.tsx +27 -1
  157. package/.next/standalone/app/settings/settings.css +79 -0
  158. package/.next/standalone/fp-cloud-cli/CHANGELOG.md +51 -3
  159. package/.next/standalone/fp-cloud-cli/README.md +1 -1
  160. package/.next/standalone/fp-cloud-cli/fp_cli/_version.py +1 -1
  161. package/.next/standalone/fp-cloud-cli/fp_cli/client.py +44 -0
  162. package/.next/standalone/fp-cloud-cli/fp_cli/commands/incidents_cmds.py +226 -5
  163. package/.next/standalone/fp-cloud-cli/fp_cli/models.py +11 -0
  164. package/.next/standalone/fp-cloud-cli/fp_cli/output.py +68 -1
  165. package/.next/standalone/fp-cloud-cli/pyproject.toml +1 -1
  166. package/.next/standalone/fp-cloud-cli/skill/SKILL.md +17 -2
  167. package/.next/standalone/fp-cloud-cli/skill/references/commands.md +7 -4
  168. package/.next/standalone/fp-cloud-cli/tests/test_alerting.py +184 -0
  169. package/.next/standalone/fp-cloud-cli/uv.lock +3 -3
  170. package/.next/standalone/package.json +11 -11
  171. package/.next/standalone/sdk/python/CHANGELOG.md +7 -0
  172. package/.next/standalone/sdk/python/failproofai_sdk/_version.py +1 -1
  173. package/.next/standalone/sdk/python/failproofai_sdk/evaluator/__init__.py +2 -0
  174. package/.next/standalone/sdk/python/failproofai_sdk/evaluator/authoring.py +24 -1
  175. package/.next/standalone/sdk/python/failproofai_sdk/evaluator/runtime.py +41 -6
  176. package/.next/standalone/sdk/python/tests/test_evaluator_runtime.py +88 -0
  177. package/.next/standalone/sdk/python/uv.lock +15 -15
  178. package/.next/standalone/server.js +1 -1
  179. package/bin/failproofai.mjs +115 -2
  180. package/dist/cli.mjs +9299 -2151
  181. package/dist/index.js +19 -1
  182. package/dist/worker.mjs +13761 -7834
  183. package/package.json +11 -11
  184. package/pi-extension/index.ts +11 -0
  185. package/scripts/build-policy-pack.mjs +39 -2
  186. package/src/hooks/builtin-policies.ts +21 -3
  187. package/src/hooks/cloud-enrollment-cli.ts +1 -1
  188. package/src/hooks/cloud-managed-policies.ts +22 -0
  189. package/src/hooks/custom-hooks-loader.ts +45 -7
  190. package/src/hooks/custom-hooks-registry.ts +45 -1
  191. package/src/hooks/effective-reviewers.ts +79 -0
  192. package/src/hooks/first-run-gate.ts +5 -0
  193. package/src/hooks/fp-home.ts +23 -0
  194. package/src/hooks/handler.ts +265 -6
  195. package/src/hooks/hook-activity-store.ts +105 -1
  196. package/src/hooks/hook-telemetry.ts +41 -0
  197. package/src/hooks/jev-activity.ts +385 -0
  198. package/src/hooks/jev-cli.ts +1193 -0
  199. package/src/hooks/loader-utils.ts +6 -0
  200. package/src/hooks/pack-cli.ts +278 -17
  201. package/src/hooks/pack-manifest.ts +479 -7
  202. package/src/hooks/pack-store.ts +156 -10
  203. package/src/hooks/policy-authority.ts +333 -0
  204. package/src/hooks/policy-catalog.ts +65 -0
  205. package/src/hooks/policy-evaluator.ts +940 -796
  206. package/src/hooks/policy-registry.ts +25 -0
  207. package/src/hooks/policy-reviewability.ts +229 -0
  208. package/src/hooks/policy-types.ts +126 -0
  209. package/src/hooks/semantic/combine.ts +541 -0
  210. package/src/hooks/semantic/compile.ts +176 -0
  211. package/src/hooks/semantic/decide.ts +392 -0
  212. package/src/hooks/semantic/envelope.ts +1296 -0
  213. package/src/hooks/semantic/evaluator.ts +547 -0
  214. package/src/hooks/semantic/facts.ts +292 -0
  215. package/src/hooks/semantic/intent.ts +1190 -0
  216. package/src/hooks/semantic/jev-client.ts +643 -0
  217. package/src/hooks/semantic/jev-config.ts +594 -0
  218. package/src/hooks/semantic/jev-review.ts +374 -0
  219. package/src/hooks/semantic/jev-stats.ts +289 -0
  220. package/src/hooks/semantic/jev-throttle.ts +421 -0
  221. package/src/hooks/semantic/pack-policies.ts +251 -0
  222. package/src/hooks/semantic/policies.ts +596 -0
  223. package/src/hooks/semantic/precondition-names.ts +60 -0
  224. package/src/hooks/semantic/preconditions.ts +58 -0
  225. package/src/hooks/semantic/redact.ts +2910 -0
  226. package/src/hooks/semantic/types.ts +145 -0
  227. package/src/hooks/semver-precedence.ts +128 -0
  228. package/src/hooks/worker-server.ts +119 -26
  229. package/src/index.ts +6 -0
  230. package/.next/standalone/.next/server/chunks/src_hooks_0iu54mz._.js +0 -3
  231. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-_ki57._.js +0 -4
  232. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +0 -4
  233. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +0 -4
  234. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +0 -4
  235. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cg-bgc._.js +0 -5
  236. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cpu_mj._.js +0 -3
  237. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +0 -4
  238. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +0 -4
  239. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +0 -4
  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]__1p2otjt._.js +0 -4
  246. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1phc187._.js +0 -3
  247. package/.next/standalone/.next/server/chunks/ssr/_06imw3p._.js +0 -5
  248. package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +0 -3
  249. package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +0 -3
  250. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1cv9_c4._.js +0 -10
  251. package/.next/standalone/.next/static/chunks/0h-gz8e00478q.js +0 -1
  252. package/.next/standalone/.next/static/chunks/0qmsunv04x4na.css +0 -2
  253. package/.next/standalone/.next/static/chunks/2k9f4tyv04809.css +0 -1
  254. package/.next/standalone/.next/static/chunks/2lvr2pt70qn14.js +0 -1
  255. package/.next/standalone/.next/static/chunks/319c_91le7-h_.js +0 -1
  256. package/.next/standalone/.next/static/chunks/35m53kix7uaii.js +0 -6
  257. package/.next/standalone/.next/static/chunks/3xacd7qmuqlvs.js +0 -1
  258. /package/.next/standalone/.next/static/{LzR_etPlaZV9JZH09lEp3 → T8YAYM9h_64fKv705vug7}/_buildManifest.js +0 -0
  259. /package/.next/standalone/.next/static/{LzR_etPlaZV9JZH09lEp3 → T8YAYM9h_64fKv705vug7}/_clientMiddlewareManifest.js +0 -0
  260. /package/.next/standalone/.next/static/{LzR_etPlaZV9JZH09lEp3 → T8YAYM9h_64fKv705vug7}/_ssgManifest.js +0 -0
@@ -191,7 +191,13 @@ export async function createEsmShim(
191
191
  const shimCode = [
192
192
  `import _cjs from '${distUrl}';`,
193
193
  `export const customPolicies = _cjs.customPolicies;`,
194
+ // Every name a policy file may import has to be listed HERE as well as in
195
+ // `src/index.ts`: this shim is an ESM module, so importing a name it does not
196
+ // declare is a link-time error, not an undefined at runtime. A pack entry
197
+ // calling `semanticPolicies.add` would fail to load entirely.
198
+ `export const semanticPolicies = _cjs.semanticPolicies;`,
194
199
  `export const getCustomHooks = _cjs.getCustomHooks;`,
200
+ `export const getSemanticRegistrations = _cjs.getSemanticRegistrations;`,
195
201
  `export const clearCustomHooks = _cjs.clearCustomHooks;`,
196
202
  `export const allow = _cjs.allow;`,
197
203
  `export const deny = _cjs.deny;`,
@@ -13,7 +13,20 @@ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "nod
13
13
  import { INTEGRATION_TYPES } from "./types";
14
14
  import { PACK_COMMIT_RE, PACK_VERSION_RE } from "./pack-manifest";
15
15
  import { detectInstalledClis } from "./integrations";
16
- import { parsePackIdentity, parsePackPolicy, readInstalledPacks } from "./pack-manifest";
16
+ import {
17
+ packParamsProblem,
18
+ parsePackIdentity,
19
+ parsePackPolicy,
20
+ parsePackSemanticPolicy,
21
+ readInstalledPacks,
22
+ type SemanticManifestEntry,
23
+ } from "./pack-manifest";
24
+ import { parseSemver } from "./semver-precedence";
25
+ // The build step measures a pack's question set against the envelope's own
26
+ // budget, which means reaching the semantic side. This is a CLI module — loaded
27
+ // by `failproofai publish`, never by a hook — so the rule that keeps those
28
+ // modules off an unconfigured machine's hook path does not apply here.
29
+ import { MAX_PACK_QUESTION_CHARS, questionChars } from "./semantic/pack-policies";
17
30
  import {
18
31
  AmbiguousPackId,
19
32
  PACK_CHECKSUMS_ASSET,
@@ -30,6 +43,9 @@ import {
30
43
  } from "./pack-store";
31
44
  import type { PolicyEffect } from "./cloud-managed-policies";
32
45
  import { loadCustomHooks } from "./custom-hooks-loader";
46
+ import { getSemanticRegistrations } from "./custom-hooks-registry";
47
+ import { authorityFieldsOf, authorityProblem } from "./policy-authority";
48
+ import type { SemanticPolicyDeclaration } from "./policy-types";
33
49
  import type { MultiChoice, TTYIn, TTYOut } from "./tui";
34
50
  import {
35
51
  chip,
@@ -294,12 +310,23 @@ async function build(rest: string[]): Promise<PackCliResult> {
294
310
  const version = flag("version");
295
311
  const commit = flag("commit");
296
312
  const effect = flag("effect") ?? "enforce";
313
+ const minCliVersion = flag("min-cli-version");
297
314
  const outDir = resolve(flag("out") ?? "dist-pack");
298
315
 
299
316
  if (!entry || !id || !version) {
300
317
  return fail([
301
318
  "Usage: failproofai publish <entry.mjs> --repo <owner>/<repo> --version <version>",
302
- " [--out <dir>] [--effect enforce|observe]",
319
+ " [--out <dir>] [--effect enforce|observe] [--min-cli-version <version>]",
320
+ ]);
321
+ }
322
+ // Refused here rather than written and refused by every machine that installs
323
+ // it. A `minCliVersion` nobody can order is a requirement nobody can check,
324
+ // and the loader treats one as grounds to refuse the whole pack — so a typo
325
+ // published here is a pack that installs nowhere.
326
+ if (minCliVersion !== undefined && parseSemver(minCliVersion) === null) {
327
+ return fail([
328
+ `--min-cli-version ${JSON.stringify(minCliVersion)} is not a version that can be compared.`,
329
+ "It must be plain semver — 1.0.7, or 1.0.7-beta.0 for a pre-release.",
303
330
  ]);
304
331
  }
305
332
  let identity: { id: string; version: string; effect: PolicyEffect; commit?: string };
@@ -315,24 +342,34 @@ async function build(rest: string[]): Promise<PackCliResult> {
315
342
  // Refused rather than bundled: see the note above. A relative specifier is the
316
343
  // only kind that would be rewritten by the loader and left outside the digest.
317
344
  const source = readFileSync(entryPath, "utf8");
318
- const localImport = /(?:^|\n)\s*(?:import|export)[^;\n]*from\s+["'](\.[^"']*)["']/.exec(source);
345
+ const localImport = firstRelativeSpecifier(source);
319
346
  if (localImport) {
320
347
  return fail([
321
- `${entryPath} imports ${localImport[1]}, and only the entry file is digest-pinned.`,
348
+ `${entryPath} imports ${localImport}, and only the entry file is digest-pinned.`,
322
349
  "Bundle it to a single file first (esbuild, bun build, rollup), then build the pack from that.",
323
350
  ]);
324
351
  }
325
352
 
326
353
  let hooks;
354
+ let semanticDeclarations: SemanticPolicyDeclaration[];
327
355
  try {
328
356
  hooks = await loadCustomHooks(entryPath, { strict: true });
357
+ // Read AFTER the load, from the same registration pass `clearCustomHooks`
358
+ // resets: a semantic policy has no `fn`, so it never travels back through
359
+ // `loadCustomHooks`'s return value.
360
+ semanticDeclarations = [...getSemanticRegistrations()];
329
361
  } catch (err) {
330
362
  return fail([`Could not load ${entryPath}: ${err instanceof Error ? err.message : String(err)}`]);
331
363
  }
332
- if (hooks.length === 0) {
364
+ // BOTH registries, or a pack that ships only Jev questions — a legitimate
365
+ // thing to publish, since the regex floor may already be somebody else's pack
366
+ // — is refused for registering nothing.
367
+ if (hooks.length === 0 && semanticDeclarations.length === 0) {
333
368
  return fail([
334
369
  `${entryPath} registered no policies.`,
335
- "A pack entry calls customPolicies.add({ name, description, match, fn }) for each one.",
370
+ "A pack entry calls customPolicies.add({ name, description, match, fn }) for each one,",
371
+ "and semanticPolicies.add({ name, title, appliesTo, mode, userCanOverride, probes, guidance })",
372
+ "for each Jev question set.",
336
373
  ]);
337
374
  }
338
375
 
@@ -359,6 +396,66 @@ async function build(rest: string[]): Promise<PackCliResult> {
359
396
  ]);
360
397
  }
361
398
 
399
+ // The pack's Jev question sets, validated with the LOADER's own rules — the
400
+ // same deal `parsePackPolicy` gets above, so a semantic policy that could
401
+ // never load fails here, where the author can fix it.
402
+ const semantic: SemanticManifestEntry[] = [];
403
+ for (const [index, declaration] of semanticDeclarations.entries()) {
404
+ try {
405
+ const parsed = parsePackSemanticPolicy(identity.id, declaration, index);
406
+ // Same reason two regex policies cannot share a name, one layer over: the
407
+ // answer map is keyed `<policy>.<probe>`, so a duplicate would overwrite
408
+ // the first policy's questions in the compiled request.
409
+ if (semantic.some((s) => s.name === parsed.name)) {
410
+ throw new Error(`two semantic policies are called ${JSON.stringify(parsed.name)}`);
411
+ }
412
+ semantic.push(parsed);
413
+ } catch (err) {
414
+ return fail([err instanceof Error ? err.message : String(err)]);
415
+ }
416
+ }
417
+
418
+ // The question budget, checked against what one Jev request can carry. A pack
419
+ // over it installs and then has its overflow policies dropped one by one on
420
+ // the user's machine, in manifest order — a pack that enforces less than it
421
+ // says, which is the failure this whole lane is built to avoid.
422
+ const questionCost = semantic.reduce((total, entry) => total + questionChars(entry), 0);
423
+ if (questionCost > MAX_PACK_QUESTION_CHARS) {
424
+ return fail([
425
+ `This pack's ${semantic.length} semantic policies compile to ${questionCost} characters of questions, ` +
426
+ `over the ${MAX_PACK_QUESTION_CHARS} one Jev request has room for.`,
427
+ "Shorten the probe instructions and criteria, or ship fewer policies per pack.",
428
+ ]);
429
+ }
430
+
431
+ // An authority declaration the manifest would lose, or that registration
432
+ // would quietly downgrade to hard, is refused HERE. Every machine that
433
+ // installs the pack would otherwise make the policy hard with only a warning
434
+ // in its own log — the author's decision, silently not taking effect — while
435
+ // at build time nothing is installed yet and refusing costs nobody anything.
436
+ // The same rule `scripts/build-policy-pack.mjs` applies to the core pack.
437
+ //
438
+ // Judged against the reviewers the PACK SHIPS WITH, not this build's: a pack
439
+ // that carries both tiers replaces the compiled semantic set on every machine
440
+ // that installs it, so `reviewedBy: ["its-own-check"]` is exactly right and
441
+ // the builtin list would call it a name "this build does not have". A pack
442
+ // with no semantic entries still answers to the builtin set, which is what its
443
+ // machines will be running.
444
+ const reviewers = semantic.length > 0 ? new Set(semantic.map((s) => s.name)) : undefined;
445
+ const authorityProblems = hooks.flatMap((hook) => {
446
+ const problem = authorityProblem({ authority: hook.authority, reviewedBy: hook.reviewedBy }, reviewers);
447
+ return problem ? [` ${hook.name}: ${problem}`] : [];
448
+ });
449
+ if (authorityProblems.length > 0) {
450
+ return fail([
451
+ authorityProblems.length === 1
452
+ ? "One policy declares an authority this build cannot publish:"
453
+ : `${authorityProblems.length} policies declare an authority this build cannot publish:`,
454
+ ...authorityProblems,
455
+ 'Fix the declaration, or leave authority out and the policy is "hard". See https://docs.befailproof.ai/policies/authority',
456
+ ]);
457
+ }
458
+
362
459
  const policies: unknown[] = [];
363
460
  for (const [index, hook] of hooks.entries()) {
364
461
  // `category` and `defaultEnabled` are pack-manifest fields a plain custom
@@ -367,13 +464,36 @@ async function build(rest: string[]): Promise<PackCliResult> {
367
464
  // FALSE: a pack's declared defaults are what `pack add` switches on with no
368
465
  // flags, and switching on a stranger's every policy unattended is the
369
466
  // installer opinion this lane already refused once.
370
- const extra = hook as unknown as { category?: unknown; defaultEnabled?: unknown };
467
+ const extra = hook as unknown as { category?: unknown; defaultEnabled?: unknown; params?: unknown };
468
+ // `params` is read off the registration for the same reason, and leaving it
469
+ // out was not cosmetic: `registerPolicy` takes a pack policy's schema from the
470
+ // MANIFEST by name, so a pack published without it evaluates every one of its
471
+ // policies with `ctx.params = {}` — which discards the user's own configured
472
+ // values too, not just the defaults. Of the 38 builtins, 19 carry a schema:
473
+ // `prefer-package-manager` would have been inert, and `block-sudo`'s
474
+ // `allowPatterns`, `block-rm-rf`'s and `block-read-outside-cwd`'s `allowPaths`
475
+ // would all have stopped working — every one of them failing silently
476
+ // STRICTER, which is the direction users work around instead of reporting.
477
+ const paramsProblem = packParamsProblem(extra.params);
478
+ if (paramsProblem) {
479
+ return fail([
480
+ `${hook.name} declares a params schema this build cannot publish: ${paramsProblem}`,
481
+ "A machine reads the schema from the manifest, so an unusable one is a policy",
482
+ "that quietly runs without its parameters. Fix the declaration, or leave params out.",
483
+ ]);
484
+ }
371
485
  const candidate = {
372
486
  name: hook.name,
373
487
  description: hook.description ?? "",
374
488
  category: typeof extra.category === "string" && extra.category ? extra.category : "General",
375
489
  defaultEnabled: extra.defaultEnabled === true,
376
490
  match: hook.match ?? {},
491
+ ...(extra.params !== undefined ? { params: extra.params } : {}),
492
+ // Whether Jev may clear this policy's verdict. A pack's MANIFEST is what
493
+ // a machine reads it from, so a declaration left on the registration
494
+ // alone would be published as nothing — silently hard. Checked above, so
495
+ // everything declared here is shape-valid; absent stays absent.
496
+ ...authorityFieldsOf(hook as unknown as Record<string, unknown>),
377
497
  };
378
498
  try {
379
499
  policies.push(parsePackPolicy(identity.id, candidate, index));
@@ -386,14 +506,21 @@ async function build(rest: string[]): Promise<PackCliResult> {
386
506
  // The manifest is hashed and the hash is the pin, so every byte in here is
387
507
  // part of what a machine verifies — a field carrying "there was nothing to
388
508
  // say" earns none of that cost. Readers already treat absence as ordinary.
509
+ //
510
+ // `minCliVersion` and `semantic` follow the same rule, and for `semantic` it is
511
+ // load-bearing rather than tidy: an EMPTY array would still be "a pack that
512
+ // declares semantic entries" to a careless reader, and the replacement rule
513
+ // turns that into "this pack replaced the compiled-in set with nothing".
389
514
  const manifest =
390
515
  JSON.stringify(
391
516
  {
392
517
  id: identity.id,
393
518
  version: identity.version,
519
+ ...(minCliVersion ? { minCliVersion } : {}),
394
520
  effect: identity.effect,
395
521
  ...(identity.commit ? { commit: identity.commit } : {}),
396
522
  policies,
523
+ ...(semantic.length > 0 ? { semantic } : {}),
397
524
  },
398
525
  null,
399
526
  2,
@@ -413,6 +540,16 @@ async function build(rest: string[]): Promise<PackCliResult> {
413
540
  const on = policies.filter((p) => (p as { defaultEnabled?: boolean }).defaultEnabled).length;
414
541
  return ok([
415
542
  `Built ${identity.id}@${identity.version} — ${policies.length} policies, ${on} on by default.`,
543
+ // Said separately, and said at all, because this half replaces the compiled-in
544
+ // semantic set on every machine that installs the pack. An author who did not
545
+ // mean to ship it should find that out here.
546
+ ...(semantic.length > 0
547
+ ? [
548
+ ` ${semantic.length} semantic ${semantic.length === 1 ? "policy" : "policies"} for Jev ` +
549
+ `(${questionCost} characters of questions), replacing this build's own set where it installs.`,
550
+ ]
551
+ : []),
552
+ ...(minCliVersion ? [` Requires failproofai ${minCliVersion} or newer.`] : []),
416
553
  ` ${outDir}/${PACK_MANIFEST_ASSET}`,
417
554
  ` ${outDir}/${PACK_ENTRY_ASSET}`,
418
555
  ` ${outDir}/${PACK_CHECKSUMS_ASSET}`,
@@ -999,7 +1136,13 @@ function inferTaggedVersion(entryPath: string, sources?: string[]): string | nul
999
1136
  * Identified by CONTENT, not by filename. A name convention would either miss
1000
1137
  * `guards.mjs` or match an unrelated `policies.mjs` that configures something
1001
1138
  * else entirely; a file that imports `failproofai` and calls
1002
- * `customPolicies.add` is a policy file whatever it is called.
1139
+ * `customPolicies.add` — or `semanticPolicies.add` — is a policy file whatever
1140
+ * it is called.
1141
+ *
1142
+ * Both registries count, and leaving one out was not a cosmetic gap: a file that
1143
+ * registers only Jev questions was undiscoverable, so `failproofai publish` in
1144
+ * its own directory reported no policy file at all rather than reaching the
1145
+ * "registered no policies" check and explaining itself.
1003
1146
  *
1004
1147
  * Returns ALL of them. Splitting policies across files is the normal thing to
1005
1148
  * do past about three, and they are one pack — so several files is an answer,
@@ -1008,8 +1151,11 @@ function inferTaggedVersion(entryPath: string, sources?: string[]): string | nul
1008
1151
  *
1009
1152
  * Non-recursive on purpose. Walking the tree finds fixtures, examples and
1010
1153
  * anything vendored, and publishing those is the failure this avoids.
1154
+ *
1155
+ * Takes the directory rather than reading `process.cwd()` so the discovery rule
1156
+ * can be tested against a real folder without a `chdir`.
1011
1157
  */
1012
- function findEntry(dir: string): string[] {
1158
+ export function findEntry(dir: string): string[] {
1013
1159
  let names: string[];
1014
1160
  try {
1015
1161
  names = readdirSync(dir);
@@ -1025,7 +1171,10 @@ function findEntry(dir: string): string[] {
1025
1171
  // would be the expensive half of this scan.
1026
1172
  if (statSync(full).size > 512 * 1024) continue;
1027
1173
  const text = readFileSync(full, "utf8");
1028
- if (/from\s+["']failproofai["']/.test(text) && /customPolicies\s*\.\s*add\s*\(/.test(text)) {
1174
+ if (
1175
+ /from\s+["']failproofai["']/.test(text) &&
1176
+ /(?:customPolicies|semanticPolicies)\s*\.\s*add\s*\(/.test(text)
1177
+ ) {
1029
1178
  found.push(full);
1030
1179
  }
1031
1180
  } catch {
@@ -1727,8 +1876,46 @@ function bundleEntry(
1727
1876
  */
1728
1877
  const PUBLISH_VALUE_FLAGS = new Set([
1729
1878
  "--repo", "--version", "--id", "--tag", "--notes", "--out", "--effect", "--entry", "--init",
1730
- "--commit",
1879
+ "--commit", "--min-cli-version",
1731
1880
  ]);
1881
+ /**
1882
+ * The first relative specifier an entry imports, or null.
1883
+ *
1884
+ * Two callers read this and they must agree, because between them they are the
1885
+ * only two outcomes: `publish` bundles a multi-file entry into the one artifact
1886
+ * a pack has to be, and `build` REFUSES one, since only the entry file is
1887
+ * digest-pinned. A shape that neither recognises gets bundled by neither and
1888
+ * refused by neither, and the author sees whatever the loader's rewrite makes of
1889
+ * it — which is an esbuild parse error naming a token, not a file.
1890
+ *
1891
+ * Both sites previously used `[^;\n]*` between `import` and `from`, which cannot
1892
+ * cross a newline and requires a `from` clause to exist. So both missed:
1893
+ *
1894
+ * import "./policies/regex" // side-effect only: there is no `from`
1895
+ * import {
1896
+ * aLongList,
1897
+ * } from "./shared" // the `from` is on another line
1898
+ *
1899
+ * and a pack entry written either way — the natural way to write one whose
1900
+ * halves register at module scope — failed to publish with `Expected "from" but
1901
+ * found "{"`. Now `[^;]*?` spans newlines and stops at a statement end, and the
1902
+ * bare form is matched on its own. Over-reaching to a later `from` is harmless:
1903
+ * the answer is only ever used as "is there a relative import, and name one".
1904
+ */
1905
+ export function firstRelativeSpecifier(source: string): string | null {
1906
+ const patterns = [
1907
+ /(?:^|\n)\s*(?:import|export)\b[^;]*?\bfrom\s*["'](\.[^"']*)["']/,
1908
+ /(?:^|\n)\s*import\s*["'](\.[^"']*)["']/,
1909
+ /\bimport\s*\(\s*["'](\.[^"']*)["']\s*\)/,
1910
+ /\brequire\s*\(\s*["'](\.[^"']*)["']\s*\)/,
1911
+ ];
1912
+ for (const re of patterns) {
1913
+ const m = re.exec(source);
1914
+ if (m) return m[1];
1915
+ }
1916
+ return null;
1917
+ }
1918
+
1732
1919
  function publishEntryArg(rest: string[]): string | undefined {
1733
1920
  const consumed = new Set<number>();
1734
1921
  for (let i = 0; i < rest.length; i += 1) {
@@ -2106,10 +2293,7 @@ async function publish(rest: string[]): Promise<PackCliResult> {
2106
2293
  // a bundler for a step this tool already performs for its own pack.
2107
2294
  let entryToBuild = entry;
2108
2295
  const needsBundle =
2109
- discovered.length > 1 ||
2110
- /(?:^|\n)\s*(?:import|export)[^;\n]*from\s+["']\.[^"']*["']/.test(
2111
- readFileSync(entry, "utf8"),
2112
- );
2296
+ discovered.length > 1 || firstRelativeSpecifier(readFileSync(entry, "utf8")) !== null;
2113
2297
  if (needsBundle) {
2114
2298
  const sources = discovered.length > 1 ? discovered : [entry];
2115
2299
  const bundled = bundleEntry(sources, outDirEarly);
@@ -2129,6 +2313,7 @@ async function publish(rest: string[]): Promise<PackCliResult> {
2129
2313
  ...(provenance && !provenance.dirty ? ["--commit", provenance.sha] : []),
2130
2314
  ...outFlagFrom(rest),
2131
2315
  ...effectFlagFrom(rest),
2316
+ ...minCliVersionFlagFrom(rest),
2132
2317
  ]);
2133
2318
  if (built.exitCode !== 0) return built;
2134
2319
 
@@ -2292,6 +2477,18 @@ function effectFlagFrom(rest: string[]): string[] {
2292
2477
  if (i === -1) return [];
2293
2478
  return rest[i].includes("=") ? [rest[i]] : [rest[i], rest[i + 1]];
2294
2479
  }
2480
+ /**
2481
+ * Same again for `--min-cli-version`, and it has to be forwarded explicitly
2482
+ * because `publish` hands `build` a list it assembles rather than its own
2483
+ * `rest`. Left off, the flag parsed, validated, refused an uncomparable value —
2484
+ * and then never reached the manifest, so the field the whole ordering
2485
+ * constraint rests on was silently absent from the published artifact.
2486
+ */
2487
+ function minCliVersionFlagFrom(rest: string[]): string[] {
2488
+ const i = rest.findIndex((a) => a === "--min-cli-version" || a.startsWith("--min-cli-version="));
2489
+ if (i === -1) return [];
2490
+ return rest[i].includes("=") ? [rest[i]] : [rest[i], rest[i + 1]];
2491
+ }
2295
2492
 
2296
2493
  /** `failproofai publish` — exported for bin/failproofai.mjs and the tests. */
2297
2494
  export async function runPublishCommand(rest: string[]): Promise<PackCliResult> {
@@ -2345,11 +2542,35 @@ async function pickClis(
2345
2542
  * Returns null when the user cancelled, which must not be confused with an
2346
2543
  * empty selection: one means "install nothing", the other means "do nothing".
2347
2544
  */
2545
+ /**
2546
+ * How a pack's semantic half is named to a person: "3 Jev checks", never "3
2547
+ * semantic policies".
2548
+ *
2549
+ * They are not policies in the sense every other number on these screens uses —
2550
+ * nothing switches them on or off, `--policy` cannot name one, and they do not
2551
+ * appear in `failproofai policies`. Calling them policies would make every count
2552
+ * beside them read as the same kind of thing.
2553
+ */
2554
+ function semanticPhrase(count: number): string {
2555
+ return `${count} Jev ${count === 1 ? "check" : "checks"}`;
2556
+ }
2557
+
2348
2558
  async function pickFromSource(
2349
2559
  source: string,
2350
2560
  io: { stdin: TTYIn; stdout: TTYOut },
2351
2561
  ): Promise<string[] | null> {
2352
2562
  const preview = await fetchPackPreview(source);
2563
+ // Nothing to pick. A pack of Jev questions alone has no selectable policies —
2564
+ // its semantic set is not switchable per entry — so the picker would draw an
2565
+ // empty list and ask a question with no answers. `[]` rather than `null`: the
2566
+ // user cancelled nothing, there was simply nothing to choose.
2567
+ if (preview.policies.length === 0) {
2568
+ io.stdout.write(
2569
+ `\n ${preview.id}@${preview.version} carries no selectable policies` +
2570
+ `${preview.semantic.length > 0 ? `, only ${semanticPhrase(preview.semantic.length)}` : ""}.\n\n`,
2571
+ );
2572
+ return [];
2573
+ }
2353
2574
  const categories = [...new Set(preview.policies.map((p) => p.category))];
2354
2575
  const rows: MultiChoice<string>[] = [];
2355
2576
  for (const category of categories) {
@@ -2364,6 +2585,15 @@ async function pickFromSource(
2364
2585
  }
2365
2586
  }
2366
2587
  const on = preview.policies.filter((p) => p.defaultEnabled).length;
2588
+ // Said BEFORE the list, because the list cannot say it: a pack's Jev checks are
2589
+ // not rows here, they arrive whole, and they replace the ones this build ships.
2590
+ // Somebody ticking boxes should know that is part of what they are agreeing to.
2591
+ if (preview.semantic.length > 0) {
2592
+ io.stdout.write(
2593
+ `\n This pack also brings ${semanticPhrase(preview.semantic.length)}, which are not selectable —\n` +
2594
+ ` they replace the ones this build ships with. See: failproofai policies show ${source}\n\n`,
2595
+ );
2596
+ }
2367
2597
  const picked = await multiSelect<string>({
2368
2598
  message: `${preview.id}@${preview.version} — which of these should be on?`,
2369
2599
  choices: rows,
@@ -2480,9 +2710,25 @@ async function add(rest: string[]): Promise<PackCliResult> {
2480
2710
  // rendered as if something had gone missing.
2481
2711
  lines.push(
2482
2712
  result.enabled.length === 0
2483
- ? ` enabled (0/${result.available.length}, ${why}): none — the pack is installed and enforcing nothing`
2713
+ ? // "enforcing nothing" is only true when the pack brought nothing else.
2714
+ // A pack of Jev checks alone enforces through the semantic tier with no
2715
+ // regex policy enabled at all, and telling that user their install does
2716
+ // nothing is worse than saying nothing.
2717
+ ` enabled (0/${result.available.length}, ${why}): none` +
2718
+ (result.semantic > 0 ? "" : " — the pack is installed and enforcing nothing")
2484
2719
  : ` enabled (${result.enabled.length}/${result.available.length}, ${why}): ${summarise(result.enabled)}`,
2485
2720
  );
2721
+ // Counted separately, and without an on/off ratio, because there is none:
2722
+ // a pack's Jev checks arrive whole and REPLACE the ones this build ships.
2723
+ // Silence here was the shape of the original bug — the manifest's semantic
2724
+ // half was fetched, verified and then never written to `installed.json`, so
2725
+ // the half somebody installed did nothing and nothing said so.
2726
+ if (result.semantic > 0) {
2727
+ lines.push(
2728
+ ` ${semanticPhrase(result.semantic)} for Jev, replacing this build's own set. ` +
2729
+ "They apply only where you configured Jev (`failproofai jev status`).",
2730
+ );
2731
+ }
2486
2732
 
2487
2733
  if (skipped.length > 0) {
2488
2734
  lines.push(` not enabled (${skipped.length}): ${summarise(skipped)}`);
@@ -2774,7 +3020,8 @@ async function listRemote(source: string): Promise<PackCliResult> {
2774
3020
  stack(
2775
3021
  title(
2776
3022
  `${preview.id}@${preview.version}`,
2777
- `${preview.policies.length} policies · ${categories.length} categories`,
3023
+ `${preview.policies.length} policies · ${categories.length} categories` +
3024
+ (preview.semantic.length > 0 ? ` · ${semanticPhrase(preview.semantic.length)}` : ""),
2778
3025
  opts,
2779
3026
  ),
2780
3027
  note(
@@ -2782,6 +3029,20 @@ async function listRemote(source: string): Promise<PackCliResult> {
2782
3029
  (preview.effect === "observe" ? " This pack OBSERVES — it records and blocks nothing." : ""),
2783
3030
  opts,
2784
3031
  ),
3032
+ // The half that is not in the table below, said in words. It is not
3033
+ // selectable, so it has no rows; and it REPLACES this build's own question
3034
+ // set rather than adding to it, which is the part worth knowing before
3035
+ // installing rather than after.
3036
+ preview.semantic.length > 0
3037
+ ? note(
3038
+ `It also carries ${semanticPhrase(preview.semantic.length)} — ${preview.semantic
3039
+ .map((s) => s.name)
3040
+ .join(", ")}. They are not selectable, they apply only where you configured Jev, and they ` +
3041
+ "replace the checks this build ships with.",
3042
+ opts,
3043
+ )
3044
+ : null,
3045
+ preview.minCliVersion ? note(`Requires failproofai ${preview.minCliVersion} or newer.`, opts) : null,
2785
3046
  preview.resolvedFromLatest ? note(`Newest release: ${preview.source}`, opts) : null,
2786
3047
  table({ head: ["", "", ""], rows }, opts),
2787
3048
  nextStep(`failproofai policies add ${source}`, "Install the defaults with:", opts),