failproofai 1.0.7-beta.1 → 1.0.7

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 (429) 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 +7 -8
  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 +5 -7
  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 +11 -13
  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 +7 -8
  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 +6 -7
  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 +8 -41
  63. package/.next/standalone/.next/server/app/settings/page.js +9 -12
  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]__1j-zsg5._.js → [externals]__1_bftcl._.js} +1 -1
  67. package/.next/standalone/.next/server/chunks/{[externals]__19_pzeq._.js → [externals]__1msfs-h._.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]__1bf34x4._.js → [root-of-the-server]__1_r2rbg._.js} +7 -5
  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/{_1q5i8mb._.js → _1c3k-8x._.js} +2 -2
  74. package/.next/standalone/.next/server/chunks/_1ek68ln._.js +16 -16
  75. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +1 -1
  76. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  77. package/.next/standalone/.next/server/chunks/src_hooks_0iu54mz._.js +3 -0
  78. package/.next/standalone/.next/server/chunks/src_hooks_custom-hooks-loader_ts_0lnb3n3._.js +2 -4
  79. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-_ki57._.js +4 -0
  80. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +4 -0
  81. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +4 -0
  82. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +4 -0
  83. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0yxwl6j._.js → [root-of-the-server]__0bd3mje._.js} +2 -2
  84. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cg-bgc._.js +5 -0
  85. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cpu_mj._.js +3 -0
  86. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1mf3zp6._.js → [root-of-the-server]__0cxe_2_._.js} +3 -3
  87. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +4 -0
  88. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +4 -0
  89. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +4 -0
  90. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0u3w0ll._.js +22 -0
  91. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17d_ffl._.js +3 -0
  92. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__19d9tgz._.js +5 -0
  93. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ctpynv._.js +3 -0
  94. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1jiwfsj._.js +3 -0
  95. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +4 -0
  96. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1phc187._.js +3 -0
  97. package/.next/standalone/.next/server/chunks/ssr/_06imw3p._.js +5 -0
  98. package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
  99. package/.next/standalone/.next/server/chunks/ssr/{_1w_5l7t._.js → _0h_douw._.js} +1 -1
  100. package/.next/standalone/.next/server/chunks/ssr/{_214wgrp._.js → _1-i_gzc._.js} +2 -2
  101. package/.next/standalone/.next/server/chunks/ssr/{_0bn2oo8._.js → _166t73i._.js} +1 -1
  102. package/.next/standalone/.next/server/chunks/ssr/{_1q46vxx._.js → _1_qswah._.js} +2 -2
  103. package/.next/standalone/.next/server/chunks/ssr/{_1gb0ifp._.js → _1es2j7i._.js} +5 -5
  104. package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +3 -0
  105. package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
  106. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +2 -2
  107. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
  108. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  109. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
  110. package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +3 -0
  111. package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_18_d8l1._.js → node_modules_next_dist_0drixxt._.js} +4 -4
  112. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1cv9_c4._.js +10 -0
  113. package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +1 -1
  114. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
  115. package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me65._.js +1 -1
  116. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  117. package/.next/standalone/.next/server/pages/404.html +1 -1
  118. package/.next/standalone/.next/server/pages/500.html +1 -1
  119. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  120. package/.next/standalone/.next/server/server-reference-manifest.json +23 -56
  121. package/.next/standalone/.next/static/chunks/094xgi4owxaqf.js +1 -0
  122. package/.next/standalone/.next/static/chunks/0__8a7m868fvf.js +1 -0
  123. package/.next/standalone/.next/static/chunks/{12tvm75t5ffui.js → 0o6qlkgubtoex.js} +1 -1
  124. package/.next/standalone/.next/static/chunks/13i7-9is-vhys.js +1 -0
  125. package/.next/standalone/.next/static/chunks/1rz20_pz828f3.js +6 -0
  126. package/.next/standalone/.next/static/chunks/2k9f4tyv04809.css +1 -0
  127. package/.next/standalone/.next/static/chunks/{0vmd180qfntfb.js → 2klitrtzpaoe0.js} +1 -1
  128. package/.next/standalone/.next/static/chunks/{258668t68du6b.js → 2mdh397ghgnvv.js} +1 -1
  129. package/.next/standalone/.next/static/chunks/2rshywgeqsyzk.css +2 -0
  130. package/.next/standalone/.next/static/chunks/3pzx4chkhko9k.js +1 -0
  131. package/.next/standalone/.next/static/chunks/{0qrbdkv9qmvli.js → 3rh5o7e16irrm.js} +1 -1
  132. package/.next/standalone/.next/static/chunks/{29fql3nbnfc9q.js → 43ufqrz8qo3h-.js} +1 -1
  133. package/.next/standalone/SECURITY.md +53 -0
  134. package/.next/standalone/app/actions/pack-actions.ts +0 -12
  135. package/.next/standalone/app/policies/hooks-client.tsx +0 -9
  136. package/.next/standalone/app/settings/page.tsx +1 -20
  137. package/.next/standalone/app/settings/settings-client.tsx +1 -27
  138. package/.next/standalone/app/settings/settings.css +0 -79
  139. package/.next/standalone/package.json +9 -9
  140. package/.next/standalone/sdk/python/skill/SKILL.md +60 -14
  141. package/.next/standalone/sdk/python/skill/agents/openai.yaml +2 -1
  142. package/.next/standalone/sdk/python/skill/references/evaluator.md +255 -0
  143. package/.next/standalone/sdk/python/skill/references/events.md +17 -8
  144. package/.next/standalone/sdk/python/skill/references/frameworks.md +3 -0
  145. package/.next/standalone/sdk/python/skill/references/install.md +3 -0
  146. package/.next/standalone/sdk/python/skill/references/integration.md +6 -2
  147. package/.next/standalone/sdk/python/skill/references/typescript.md +568 -0
  148. package/.next/standalone/sdk/typescript/CHANGELOG.md +133 -0
  149. package/.next/standalone/sdk/typescript/LICENSE +42 -0
  150. package/.next/standalone/sdk/typescript/README.md +552 -0
  151. package/.next/standalone/sdk/typescript/eslint.config.mjs +59 -0
  152. package/.next/standalone/sdk/typescript/examples/research-agent.ts +197 -0
  153. package/.next/standalone/sdk/typescript/integration/ai.test.ts +920 -0
  154. package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/agent.ts +337 -0
  155. package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/package-lock.json +261 -0
  156. package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/package.json +16 -0
  157. package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/surfaces.ts +605 -0
  158. package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/tsconfig.json +12 -0
  159. package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/tsconfig.surfaces.json +4 -0
  160. package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/agent.ts +342 -0
  161. package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/package-lock.json +156 -0
  162. package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/package.json +16 -0
  163. package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/surfaces.ts +628 -0
  164. package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/tsconfig.json +12 -0
  165. package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/tsconfig.surfaces.json +4 -0
  166. package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/agent.ts +346 -0
  167. package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/package-lock.json +156 -0
  168. package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/package.json +13 -0
  169. package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/surfaces.ts +651 -0
  170. package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/tsconfig.json +12 -0
  171. package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/tsconfig.surfaces.json +4 -0
  172. package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/agent.ts +350 -0
  173. package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/package-lock.json +153 -0
  174. package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/package.json +13 -0
  175. package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/surfaces.ts +651 -0
  176. package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/tsconfig.json +12 -0
  177. package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/tsconfig.surfaces.json +4 -0
  178. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/agent.ts +623 -0
  179. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/package-lock.json +344 -0
  180. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/package.json +19 -0
  181. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/tsconfig.json +12 -0
  182. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/agent-v1.ts +99 -0
  183. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/agent.ts +623 -0
  184. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/package-lock.json +336 -0
  185. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/package.json +15 -0
  186. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/tsconfig.json +12 -0
  187. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/agent.ts +96 -0
  188. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/package-lock.json +441 -0
  189. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/package.json +19 -0
  190. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/tsconfig.json +12 -0
  191. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/vendor/lc-weather-provider/index.cjs +53 -0
  192. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/vendor/lc-weather-provider/index.mjs +55 -0
  193. package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/vendor/lc-weather-provider/package.json +18 -0
  194. package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/agent.ts +659 -0
  195. package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/package-lock.json +635 -0
  196. package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/package.json +15 -0
  197. package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/tsconfig.json +12 -0
  198. package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/agent.ts +659 -0
  199. package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/package-lock.json +553 -0
  200. package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/package.json +15 -0
  201. package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/tsconfig.json +12 -0
  202. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/agent.ts +877 -0
  203. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/mcp-server.mjs +66 -0
  204. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/package-lock.json +6797 -0
  205. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/package.json +24 -0
  206. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/tsconfig.json +12 -0
  207. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/agent.ts +872 -0
  208. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/mcp-server.mjs +66 -0
  209. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package-lock.json +2540 -0
  210. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package.json +15 -0
  211. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/tsconfig.json +12 -0
  212. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/actions.ts +18 -0
  213. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/ai/route.ts +42 -0
  214. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/edge/route.ts +29 -0
  215. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/langgraph/route.ts +21 -0
  216. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/llamaindex/route.ts +11 -0
  217. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/mastra/route.ts +19 -0
  218. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/status/route.ts +7 -0
  219. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/layout.tsx +9 -0
  220. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/page.tsx +15 -0
  221. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/instrumentation.ts +15 -0
  222. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/ai.ts +61 -0
  223. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/langgraph.ts +68 -0
  224. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/llamaindex.ts +98 -0
  225. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/mastra.ts +90 -0
  226. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/next.config.ts +52 -0
  227. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/package-lock.json +4343 -0
  228. package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/package.json +28 -0
  229. package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/agent.ts +51 -0
  230. package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/deno-npm.ts +76 -0
  231. package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/package-lock.json +484 -0
  232. package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/package.json +15 -0
  233. package/.next/standalone/sdk/typescript/integration/fixtures/types/agent.ts +79 -0
  234. package/.next/standalone/sdk/typescript/integration/fixtures/types/package-lock.json +740 -0
  235. package/.next/standalone/sdk/typescript/integration/fixtures/types/package.json +11 -0
  236. package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/agent.ts +197 -0
  237. package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/package-lock.json +70 -0
  238. package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/package.json +12 -0
  239. package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/tsconfig.json +12 -0
  240. package/.next/standalone/sdk/typescript/integration/global-setup.ts +29 -0
  241. package/.next/standalone/sdk/typescript/integration/harness.ts +451 -0
  242. package/.next/standalone/sdk/typescript/integration/langchain.test.ts +682 -0
  243. package/.next/standalone/sdk/typescript/integration/llamaindex.test.ts +709 -0
  244. package/.next/standalone/sdk/typescript/integration/mastra-coverage.test.ts +386 -0
  245. package/.next/standalone/sdk/typescript/integration/mastra.test.ts +311 -0
  246. package/.next/standalone/sdk/typescript/integration/nextjs.test.ts +341 -0
  247. package/.next/standalone/sdk/typescript/integration/runtime-parity.ts +180 -0
  248. package/.next/standalone/sdk/typescript/integration/runtimes.bun.test.ts +15 -0
  249. package/.next/standalone/sdk/typescript/integration/runtimes.core.test.ts +113 -0
  250. package/.next/standalone/sdk/typescript/integration/runtimes.deno.test.ts +19 -0
  251. package/.next/standalone/sdk/typescript/integration/types.test.ts +141 -0
  252. package/.next/standalone/sdk/typescript/integration/vanilla.test.ts +255 -0
  253. package/.next/standalone/sdk/typescript/package-lock.json +2640 -0
  254. package/.next/standalone/sdk/typescript/package.json +401 -0
  255. package/.next/standalone/sdk/typescript/scripts/finalize-build.mjs +123 -0
  256. package/.next/standalone/sdk/typescript/scripts/release.mjs +177 -0
  257. package/.next/standalone/sdk/typescript/src/clock.ts +58 -0
  258. package/.next/standalone/sdk/typescript/src/context.ts +214 -0
  259. package/.next/standalone/sdk/typescript/src/edge/adapter.ts +18 -0
  260. package/.next/standalone/sdk/typescript/src/edge/ai.ts +116 -0
  261. package/.next/standalone/sdk/typescript/src/edge/index.ts +238 -0
  262. package/.next/standalone/sdk/typescript/src/edge/langchain.ts +18 -0
  263. package/.next/standalone/sdk/typescript/src/edge/llamaindex.ts +12 -0
  264. package/.next/standalone/sdk/typescript/src/edge/mastra.ts +17 -0
  265. package/.next/standalone/sdk/typescript/src/edge/notice.ts +33 -0
  266. package/.next/standalone/sdk/typescript/src/environment.ts +75 -0
  267. package/.next/standalone/sdk/typescript/src/evaluator/authoring.ts +480 -0
  268. package/.next/standalone/sdk/typescript/src/evaluator/cli.ts +96 -0
  269. package/.next/standalone/sdk/typescript/src/evaluator/client.ts +421 -0
  270. package/.next/standalone/sdk/typescript/src/evaluator/expression.ts +1292 -0
  271. package/.next/standalone/sdk/typescript/src/evaluator/index.ts +144 -0
  272. package/.next/standalone/sdk/typescript/src/evaluator/protocol.ts +747 -0
  273. package/.next/standalone/sdk/typescript/src/evaluator/runtime.ts +930 -0
  274. package/.next/standalone/sdk/typescript/src/evaluator/sandbox-worker.ts +171 -0
  275. package/.next/standalone/sdk/typescript/src/evaluator/source-limits.ts +27 -0
  276. package/.next/standalone/sdk/typescript/src/evaluator/source.ts +509 -0
  277. package/.next/standalone/sdk/typescript/src/events.ts +879 -0
  278. package/.next/standalone/sdk/typescript/src/exit.ts +117 -0
  279. package/.next/standalone/sdk/typescript/src/index.ts +186 -0
  280. package/.next/standalone/sdk/typescript/src/integrations/ai.ts +1566 -0
  281. package/.next/standalone/sdk/typescript/src/integrations/compat.ts +322 -0
  282. package/.next/standalone/sdk/typescript/src/integrations/core.ts +1321 -0
  283. package/.next/standalone/sdk/typescript/src/integrations/index.ts +355 -0
  284. package/.next/standalone/sdk/typescript/src/integrations/langchain.ts +2340 -0
  285. package/.next/standalone/sdk/typescript/src/integrations/llamaindex.ts +2111 -0
  286. package/.next/standalone/sdk/typescript/src/integrations/mastra.ts +1802 -0
  287. package/.next/standalone/sdk/typescript/src/logger.ts +98 -0
  288. package/.next/standalone/sdk/typescript/src/next.ts +115 -0
  289. package/.next/standalone/sdk/typescript/src/node-require.ts +446 -0
  290. package/.next/standalone/sdk/typescript/src/redact.ts +305 -0
  291. package/.next/standalone/sdk/typescript/src/resolver.ts +120 -0
  292. package/.next/standalone/sdk/typescript/src/runtime.ts +29 -0
  293. package/.next/standalone/sdk/typescript/src/schema.ts +410 -0
  294. package/.next/standalone/sdk/typescript/src/scopes.ts +701 -0
  295. package/.next/standalone/sdk/typescript/src/shared.ts +33 -0
  296. package/.next/standalone/sdk/typescript/src/version.ts +5 -0
  297. package/.next/standalone/sdk/typescript/src/writer.ts +934 -0
  298. package/.next/standalone/sdk/typescript/test/adapters.test.ts +397 -0
  299. package/.next/standalone/sdk/typescript/test/ai.test.ts +1076 -0
  300. package/.next/standalone/sdk/typescript/test/copies.test.ts +204 -0
  301. package/.next/standalone/sdk/typescript/test/edge.test.ts +183 -0
  302. package/.next/standalone/sdk/typescript/test/evaluator-client.test.ts +234 -0
  303. package/.next/standalone/sdk/typescript/test/evaluator-protocol.test.ts +225 -0
  304. package/.next/standalone/sdk/typescript/test/events.test.ts +193 -0
  305. package/.next/standalone/sdk/typescript/test/expression.test.ts +181 -0
  306. package/.next/standalone/sdk/typescript/test/global-setup.ts +26 -0
  307. package/.next/standalone/sdk/typescript/test/helpers.ts +130 -0
  308. package/.next/standalone/sdk/typescript/test/integrations.test.ts +369 -0
  309. package/.next/standalone/sdk/typescript/test/langchain-copies.test.ts +204 -0
  310. package/.next/standalone/sdk/typescript/test/langchain.test.ts +999 -0
  311. package/.next/standalone/sdk/typescript/test/llamaindex.test.ts +1760 -0
  312. package/.next/standalone/sdk/typescript/test/mastra-coverage.test.ts +501 -0
  313. package/.next/standalone/sdk/typescript/test/mastra-lifecycle.test.ts +479 -0
  314. package/.next/standalone/sdk/typescript/test/mastra.test.ts +285 -0
  315. package/.next/standalone/sdk/typescript/test/next.test.ts +109 -0
  316. package/.next/standalone/sdk/typescript/test/packaging.test.ts +312 -0
  317. package/.next/standalone/sdk/typescript/test/redaction.test.ts +171 -0
  318. package/.next/standalone/sdk/typescript/test/runtimes.test.ts +101 -0
  319. package/.next/standalone/sdk/typescript/test/sandbox.test.ts +189 -0
  320. package/.next/standalone/sdk/typescript/test/scopes.test.ts +271 -0
  321. package/.next/standalone/sdk/typescript/test/setup.ts +19 -0
  322. package/.next/standalone/sdk/typescript/test/skill-snippets.test.ts +73 -0
  323. package/.next/standalone/sdk/typescript/test/spool-contract.test.ts +124 -0
  324. package/.next/standalone/sdk/typescript/test/tracker-bounds.test.ts +191 -0
  325. package/.next/standalone/sdk/typescript/test/wire-format.test.ts +214 -0
  326. package/.next/standalone/sdk/typescript/test/writer.test.ts +407 -0
  327. package/.next/standalone/sdk/typescript/tsconfig.build.json +15 -0
  328. package/.next/standalone/sdk/typescript/tsconfig.cjs.json +19 -0
  329. package/.next/standalone/sdk/typescript/tsconfig.json +28 -0
  330. package/.next/standalone/sdk/typescript/vitest.config.ts +33 -0
  331. package/.next/standalone/sdk/typescript/vitest.integration.config.ts +23 -0
  332. package/.next/standalone/server.js +1 -1
  333. package/bin/failproofai.mjs +2 -115
  334. package/dist/cli.mjs +6538 -13686
  335. package/dist/index.js +1 -19
  336. package/dist/worker.mjs +2085 -8012
  337. package/package.json +9 -9
  338. package/pi-extension/index.ts +0 -11
  339. package/scripts/build-policy-pack.mjs +2 -39
  340. package/src/hooks/builtin-policies.ts +3 -21
  341. package/src/hooks/cloud-enrollment-cli.ts +1 -1
  342. package/src/hooks/cloud-managed-policies.ts +0 -22
  343. package/src/hooks/custom-hooks-loader.ts +7 -45
  344. package/src/hooks/custom-hooks-registry.ts +1 -45
  345. package/src/hooks/first-run-gate.ts +0 -5
  346. package/src/hooks/fp-home.ts +0 -23
  347. package/src/hooks/handler.ts +6 -265
  348. package/src/hooks/hook-activity-store.ts +1 -105
  349. package/src/hooks/hook-telemetry.ts +0 -41
  350. package/src/hooks/loader-utils.ts +0 -6
  351. package/src/hooks/pack-cli.ts +17 -278
  352. package/src/hooks/pack-manifest.ts +7 -479
  353. package/src/hooks/pack-store.ts +10 -156
  354. package/src/hooks/policy-catalog.ts +0 -65
  355. package/src/hooks/policy-evaluator.ts +796 -940
  356. package/src/hooks/policy-registry.ts +0 -25
  357. package/src/hooks/policy-types.ts +0 -126
  358. package/src/hooks/worker-server.ts +26 -119
  359. package/src/index.ts +0 -6
  360. package/.next/standalone/.next/server/chunks/src_hooks_01frwmb._.js +0 -5
  361. package/.next/standalone/.next/server/chunks/src_hooks_18qtd42._.js +0 -3
  362. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01bmjsj._.js +0 -3
  363. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +0 -4
  364. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__056wjo4._.js +0 -4
  365. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__059yza8._.js +0 -3
  366. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0eip4_k._.js +0 -22
  367. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n0xg95._.js +0 -4
  368. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qcb0mg._.js +0 -3
  369. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qxnccm._.js +0 -5
  370. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rwtwpm._.js +0 -4
  371. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s_yomn._.js +0 -4
  372. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0soxz2z._.js +0 -3
  373. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0yrsbd_._.js +0 -3
  374. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11mayhe._.js +0 -4
  375. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13d-wb6._.js +0 -3
  376. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1dinjii._.js +0 -3
  377. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +0 -4
  378. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1q4p5b8._.js +0 -4
  379. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qiz0e4._.js +0 -3
  380. package/.next/standalone/.next/server/chunks/ssr/_042cgl1._.js +0 -3
  381. package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +0 -3
  382. package/.next/standalone/.next/server/chunks/ssr/_0uyu3jf._.js +0 -3
  383. package/.next/standalone/.next/server/chunks/ssr/_1feuvhb._.js +0 -5
  384. package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +0 -3
  385. package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +0 -3
  386. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0w6mzq5._.js +0 -151
  387. package/.next/standalone/.next/server/chunks/ssr/src_hooks_095a_79._.js +0 -5
  388. package/.next/standalone/.next/server/chunks/ssr/src_hooks_15t8kqj._.js +0 -3
  389. package/.next/standalone/.next/server/chunks/ssr/src_hooks_18k8rl0._.js +0 -12
  390. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1fm2w5z._.js +0 -3
  391. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1j0zy3v._.js +0 -3
  392. package/.next/standalone/.next/static/chunks/0cd-_8-c-m1ea.js +0 -6
  393. package/.next/standalone/.next/static/chunks/0uldbut9y2-e8.js +0 -1
  394. package/.next/standalone/.next/static/chunks/1u5zsejmgrir_.js +0 -1
  395. package/.next/standalone/.next/static/chunks/285spx855h_3r.css +0 -2
  396. package/.next/standalone/.next/static/chunks/2qv4hshejedtx.css +0 -1
  397. package/.next/standalone/.next/static/chunks/2vkvu9-opa_1z.js +0 -1
  398. package/.next/standalone/.next/static/chunks/37lhv7wa3ywt6.js +0 -1
  399. package/.next/standalone/app/actions/get-jev-config.ts +0 -409
  400. package/.next/standalone/app/actions/update-jev-config.ts +0 -420
  401. package/.next/standalone/app/components/jev-notices.tsx +0 -96
  402. package/.next/standalone/app/settings/jev-panel.tsx +0 -469
  403. package/src/hooks/effective-reviewers.ts +0 -79
  404. package/src/hooks/jev-activity.ts +0 -385
  405. package/src/hooks/jev-cli.ts +0 -1193
  406. package/src/hooks/policy-authority.ts +0 -333
  407. package/src/hooks/policy-reviewability.ts +0 -229
  408. package/src/hooks/semantic/combine.ts +0 -541
  409. package/src/hooks/semantic/compile.ts +0 -176
  410. package/src/hooks/semantic/decide.ts +0 -392
  411. package/src/hooks/semantic/envelope.ts +0 -1296
  412. package/src/hooks/semantic/evaluator.ts +0 -547
  413. package/src/hooks/semantic/facts.ts +0 -292
  414. package/src/hooks/semantic/intent.ts +0 -1190
  415. package/src/hooks/semantic/jev-client.ts +0 -643
  416. package/src/hooks/semantic/jev-config.ts +0 -594
  417. package/src/hooks/semantic/jev-review.ts +0 -374
  418. package/src/hooks/semantic/jev-stats.ts +0 -289
  419. package/src/hooks/semantic/jev-throttle.ts +0 -421
  420. package/src/hooks/semantic/pack-policies.ts +0 -251
  421. package/src/hooks/semantic/policies.ts +0 -596
  422. package/src/hooks/semantic/precondition-names.ts +0 -60
  423. package/src/hooks/semantic/preconditions.ts +0 -58
  424. package/src/hooks/semantic/redact.ts +0 -2910
  425. package/src/hooks/semantic/types.ts +0 -145
  426. package/src/hooks/semver-precedence.ts +0 -128
  427. /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → PgeWCHmyVbjRznv2VO7KF}/_buildManifest.js +0 -0
  428. /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → PgeWCHmyVbjRznv2VO7KF}/_clientMiddlewareManifest.js +0 -0
  429. /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → PgeWCHmyVbjRznv2VO7KF}/_ssgManifest.js +0 -0
@@ -24,26 +24,18 @@ import {
24
24
  OPENCLAW_EVENT_MAP,
25
25
  ANTIGRAVITY_EVENT_MAP,
26
26
  } from "./types";
27
- import { existsSync } from "node:fs";
28
27
  import { canonicalizeToolName, canonicalizeToolInput } from "./tool-name-canonicalize";
29
28
  import { normalizeCliPayload } from "./normalize-cli-payload";
30
29
  import type { PolicyFunction, PolicyResult, HooksConfig } from "./policy-types";
31
30
  import { readMergedHooksConfig } from "./hooks-config";
32
31
  import { registerBuiltinPolicies } from "./builtin-policies";
33
32
  import { evaluatePolicies } from "./policy-evaluator";
34
- // Types only: the semantic (Jev) modules are loaded with a dynamic import, and
35
- // only once a Jev config exists, so an unconfigured machine never loads them.
36
- import type { TwoTierReview } from "./semantic/combine";
37
- import type { JevActivityFields } from "./semantic/combine";
38
- import type { JevConfig } from "./semantic/jev-config";
39
33
  import { clearPolicies, registerPolicy, getPoliciesForEvent } from "./policy-registry";
40
34
  import { loadAllCustomHooks } from "./custom-hooks-loader";
41
- import { authorityDeclarationFor, resolvePolicyAuthority, warnAuthority } from "./policy-authority";
42
35
  import type { CustomHook } from "./policy-types";
43
36
  import { persistHookActivity } from "./hook-activity-store";
44
37
  import { deliveryHealth, deliveryHealthLine } from "./delivery-health";
45
38
  import { trackHookEvent, flushHookTelemetry } from "./hook-telemetry";
46
- import * as hookTelemetry from "./hook-telemetry";
47
39
  import { resolveCwd } from "./resolve-cwd";
48
40
  import { resolvePermissionMode } from "./resolve-permission-mode";
49
41
  import { resolveTranscriptPath } from "./resolve-transcript-path";
@@ -54,7 +46,6 @@ import { readActiveCloudManagedPolicies, type CloudManagedPolicyArtifact } from
54
46
  import { hasInstalledPacks, readInstalledPacks, type PackError, type ResolvedPack } from "./pack-manifest";
55
47
  import { missingGuards, packFailureReason, combinedGuardMatch, guardsCover } from "./pack-failclosed";
56
48
  import { readActivePause, type ActivePause } from "./session-pause";
57
- import { jevConfigFile } from "./fp-home";
58
49
  import { layoutWarningForHook } from "./fp-reset";
59
50
 
60
51
  /**
@@ -162,16 +153,6 @@ export interface EvaluateHookEventOptions {
162
153
  * written for.
163
154
  */
164
155
  fallbackCwd?: string;
165
- /**
166
- * The warm worker's hook into its request queue. Called at most once, and
167
- * only on the two-tier path, at the point this evaluation stops reading the
168
- * process-global policy registry and starts waiting on Jev's network answer
169
- * — so the next queued hook can run instead of every hook on the machine
170
- * queueing behind that round trip. After it is called nothing in this
171
- * evaluation reads the registry again. The one-shot path has no queue and
172
- * leaves it unset.
173
- */
174
- releaseRegistry?: () => void;
175
156
  }
176
157
 
177
158
  /**
@@ -205,211 +186,6 @@ async function runObserved(
205
186
  }
206
187
  }
207
188
 
208
- // ── Two-tier (Jev) opt-in ────────────────────────────────────────────────────
209
- //
210
- // Jev reviews a call only when ALL of these hold, and the regex engine runs
211
- // alone — exactly as it did before two tiers existed — otherwise:
212
- //
213
- // - a valid BYOK config exists (`~/.failproofai/jev.json`, global only);
214
- // - `FAILPROOFAI_EVALUATOR` is not `legacy` (see "Turning Jev off" below);
215
- // - this is not the fail-closed `forceDecision` path and no session pause is
216
- // active — a pause suspends local policy, and Jev must not become a way to
217
- // evaluate what the pause switched off;
218
- // - the event is a gate (`PreToolUse` / `PermissionRequest`) for a named tool
219
- // that the AGENT requested (see `isHumanAuthoredGate`).
220
- //
221
- // There is no cloud-deployment exclusion: cloud policies default to `hard`, so
222
- // Jev can only make a centrally managed machine stricter, never weaker.
223
- //
224
- // Turning Jev off. The switch that works everywhere is the config file itself:
225
- // it is read on every event, here, in whichever process evaluates — the
226
- // daemon's warm worker included — so `failproofai jev remove` (or a `mode:
227
- // "shadow"` config, which keeps enforcing the regex result) applies from the
228
- // next tool call, with no restart. `FAILPROOFAI_EVALUATOR=legacy` is the dev
229
- // escape hatch, read from the EVALUATING process's environment: it covers a
230
- // one-shot hook (no daemon) and a worker whose own environment sets it, but
231
- // not a variable exported in a shell on a daemon machine — the daemon
232
- // forwards a hook's event, cli, stdin and cwd to the worker, never the hook
233
- // process's environment. `failproofai jev status` says so when it sees the
234
- // variable. A per-session switch for daemon machines would be a new field in
235
- // the daemon protocol; there is none today.
236
-
237
- /** The two gate events Jev reviews. Everything else is regex-only. */
238
- const JEV_GATE_EVENTS: ReadonlySet<string> = new Set(["PreToolUse", "PermissionRequest"]);
239
-
240
- /**
241
- * A gate event that carries a command the HUMAN typed, not one the agent
242
- * requested: Pi's `user_bash` (`!cmd` at Pi's prompt) canonicalizes to
243
- * `PreToolUse` like an agent's `tool_call`. Jev judges an agent's request
244
- * against what the human asked for, and says so to the model ("A coding agent
245
- * has REQUESTED the tool call"); the human's own command is the human asking,
246
- * and never appears in `user_said`, so Jev would judge it as an unrequested
247
- * agent action and could block the human's own command. The regex policies
248
- * still run on it exactly as they always have.
249
- */
250
- function isHumanAuthoredGate(rawEventType: string | undefined, cli: IntegrationType): boolean {
251
- return cli === "pi" && rawEventType === "user_bash";
252
- }
253
-
254
- function jevForcedOff(opts: EvaluateHookEventOptions | undefined): boolean {
255
- return process.env.FAILPROOFAI_EVALUATOR === "legacy" || !!opts?.forceDecision;
256
- }
257
-
258
- /**
259
- * The BYOK config (with the build's default mode, D2), or null (Jev off). A
260
- * config that cannot be read is off, never a failure. Logged at info, like
261
- * every configured-but-broken Jev path: warn-level lines reach the hook's
262
- * stderr, which is the deny text itself on some CLIs (Factory's exit 2).
263
- * `failproofai jev status` is where a broken config is made visible.
264
- *
265
- * The file is checked for BEFORE the import, and that order is the point. With
266
- * no `jev.json` the answer is null however the module would have read it — so
267
- * the stat decides it, and a machine that never configured Jev never evaluates
268
- * a line of the semantic modules to be told what their absence already says.
269
- * The same stat-rather-than-load trade `warnAuthority` makes, for the same
270
- * reason. It short-circuits nothing but a null `loadJevConfig` would have
271
- * returned itself: that function reads this path, and an absent file, an
272
- * unreadable directory above it and a path that is not a file are all null
273
- * there too.
274
- */
275
- async function readJevConfig(): Promise<{ config: JevConfig; defaultMode: TwoTierReview["mode"] } | null> {
276
- try {
277
- if (!existsSync(jevConfigFile())) return null;
278
- const { loadJevConfig, DEFAULT_JEV_MODE } = await import("./semantic/jev-config");
279
- const config = loadJevConfig();
280
- return config ? { config, defaultMode: DEFAULT_JEV_MODE } : null;
281
- } catch (err) {
282
- hookLogInfo(
283
- `Jev config could not be read (${err instanceof Error ? err.message : String(err)}); the regex engine decides alone`,
284
- );
285
- return null;
286
- }
287
- }
288
-
289
- /**
290
- * Start Jev's review of this call — before the regex policies run, so the two
291
- * proceed in parallel — or return null for the regex-only path.
292
- */
293
- async function startTwoTier(
294
- canonicalEventType: string,
295
- parsed: Record<string, unknown>,
296
- session: SessionMetadata,
297
- cli: IntegrationType,
298
- opts: EvaluateHookEventOptions | undefined,
299
- activePause: ActivePause | null,
300
- ): Promise<TwoTierReview | null> {
301
- if (!JEV_GATE_EVENTS.has(canonicalEventType)) return null;
302
- if (isHumanAuthoredGate(session.rawHookEventName, cli)) return null;
303
- if (typeof parsed.tool_name !== "string" || parsed.tool_name.length === 0) return null;
304
- if (jevForcedOff(opts) || activePause) return null;
305
- const loaded = await readJevConfig();
306
- if (!loaded) return null;
307
- const cfg = loaded.config;
308
- try {
309
- const { startJevReview } = await import("./semantic/jev-review");
310
- return startJevReview(cfg, {
311
- eventType: canonicalEventType,
312
- toolName: parsed.tool_name,
313
- toolInput: parsed.tool_input,
314
- cwd: session.cwd,
315
- permissionMode: session.permissionMode,
316
- sessionId: session.sessionId,
317
- cli,
318
- });
319
- } catch (err) {
320
- // Configured but unable to start: that is a fallback, and it is recorded
321
- // as one — every regex verdict hard, the regex result final. Recorded as
322
- // `error`, one of the reason codes the activity store and the collector
323
- // know (T8's closed list); an unknown code would ship as `other`. Logged
324
- // at info, off the hook's stderr (see `readJevConfig`); the activity row
325
- // carries the fallback.
326
- hookLogInfo(`Jev review could not start (${err instanceof Error ? err.message : String(err)})`);
327
- return {
328
- mode: cfg.mode === "shadow" || cfg.mode === "enforce" ? cfg.mode : loaded.defaultMode,
329
- review: Promise.resolve({ kind: "fallback", reason: "error", latencyMs: null, model: null }),
330
- abort: () => {},
331
- authorityOf: () => ({ authority: "hard", reviewedBy: [] }),
332
- };
333
- }
334
- }
335
-
336
- /**
337
- * The Jev properties for `hook_policy_triggered`, from T8's
338
- * `jevTelemetryProperties` (decisions, reason codes, policy and model names,
339
- * a latency — never command or prompt text). `{}` when the two-tier path did
340
- * not run, so an unconfigured machine's event is unchanged, and `{}` when the
341
- * helper is not in this build (it is T8's, not a §7 contract) or throws:
342
- * telemetry never costs a hook its answer.
343
- *
344
- * Only its `jev_`-prefixed keys are kept. These are spread into an event whose
345
- * core properties (`decision`, `policy_name`, `event_type`, …) are what the
346
- * rollout is read from, and a helper owned by another task must not be able to
347
- * overwrite one of them — silently, and only on two-tier machines — by
348
- * emitting a key of that name. The helper is treated as untrusted in every
349
- * other respect (absent, non-object, throwing); this is the same guard for
350
- * what it returns.
351
- */
352
- function jevTelemetry(activity: JevActivityFields | undefined): Record<string, unknown> {
353
- if (!activity) return {};
354
- try {
355
- const build = (hookTelemetry as unknown as { jevTelemetryProperties?: (entry: JevActivityFields) => unknown })
356
- .jevTelemetryProperties;
357
- const props = typeof build === "function" ? build(activity) : null;
358
- if (!props || typeof props !== "object" || Array.isArray(props)) return {};
359
- return Object.fromEntries(Object.entries(props as Record<string, unknown>).filter(([key]) => key.startsWith("jev_")));
360
- } catch {
361
- return {};
362
- }
363
- }
364
-
365
- /**
366
- * Record what the human just typed, for Jev to judge later calls against.
367
- * Only when Jev is configured. Every canonical `UserPromptSubmit` is passed,
368
- * except a prompt a policy denied on a CLI where that deny is known to hold
369
- * (`ENFORCEMENT_CAPABILITY` says `block`): the agent never receives that
370
- * prompt, so it cannot be what the agent is working on. Where a prompt deny
371
- * is only observed — Goose, OpenCode, Antigravity — or not verified, the
372
- * agent does get the prompt, and it is passed like any other. Which CLIs'
373
- * prompt events count as human is decided inside `captureIntent` (T4).
374
- * Never throws; a failure is logged at info (see `readJevConfig`).
375
- *
376
- * `captureIntent` gets the whole normalized payload (`payload`): the prompt
377
- * text is in a different field on some harnesses (Goose: `message`), and the
378
- * marks that tell a human's prompt from a subagent's or an extension's are
379
- * elsewhere in it. `prompt` is §7's original field, still read by the
380
- * contract stub; T4's implementation reads `payload` and ignores it.
381
- */
382
- async function captureJevIntent(
383
- canonicalEventType: string,
384
- decision: "allow" | "deny" | "instruct",
385
- parsed: Record<string, unknown>,
386
- session: SessionMetadata,
387
- cli: IntegrationType,
388
- opts: EvaluateHookEventOptions | undefined,
389
- ): Promise<void> {
390
- if (canonicalEventType !== "UserPromptSubmit" || jevForcedOff(opts)) return;
391
- try {
392
- if (!(await readJevConfig())) return;
393
- if (decision === "deny") {
394
- const { ENFORCEMENT_CAPABILITY } = await import("./enforcement-capability");
395
- if (ENFORCEMENT_CAPABILITY[cli]?.UserPromptSubmit === "block") return;
396
- }
397
- const { captureIntent } = await import("./semantic/intent");
398
- // Built first, then passed: the one object satisfies §7's shape and T4's.
399
- const event = {
400
- eventType: canonicalEventType,
401
- sessionId: session.sessionId,
402
- transcriptPath: session.transcriptPath,
403
- cli,
404
- payload: parsed,
405
- prompt: parsed.prompt,
406
- };
407
- captureIntent(event);
408
- } catch (err) {
409
- hookLogInfo(`Jev intent capture failed: ${err instanceof Error ? err.message : String(err)}`);
410
- }
411
- }
412
-
413
189
  /**
414
190
  * The core hook-evaluation logic, decoupled from process stdin/stdout so it
415
191
  * can be called repeatedly inside a long-lived process (the daemon's warm
@@ -785,14 +561,6 @@ export async function evaluateHookEvent(
785
561
  ...(cloudManaged ? { cloudPolicyId: cloudManaged.id, cloudVersion: cloudManaged.version } : {}),
786
562
  ...(pack ? { packId: pack.id, packVersion: pack.version } : {}),
787
563
  });
788
- // Whether Jev may clear this policy's verdict. The cloud assignment or
789
- // the pack manifest declares it for those routes, the hook itself only
790
- // for the user's own files; anything unclear registers as hard. Said
791
- // aloud when a `reviewable` claim is refused and Jev is configured, so
792
- // an author is not left wondering why Jev never clears it.
793
- const authority = authorityDeclarationFor(hook, { cloudManaged, pack });
794
- const refused = resolvePolicyAuthority(authority).downgraded;
795
- if (refused) warnAuthority(`${registeredName} asks to be reviewable, but ${refused} — it stays hard`);
796
564
  registerPolicy(
797
565
  registeredName,
798
566
  hook.description ?? "",
@@ -804,7 +572,6 @@ export async function evaluateHookEvent(
804
572
  // configured. Matched by the pack's own name for the policy, which is
805
573
  // the name before the `pack/<id>@<version>/` prefix is applied.
806
574
  pack?.policies.find((p) => p.name === hook.name)?.params,
807
- authority,
808
575
  );
809
576
  }
810
577
 
@@ -893,40 +660,19 @@ export async function evaluateHookEvent(
893
660
  );
894
661
  }
895
662
 
896
- // Two-tier: when a Jev config exists and this is a gate, Jev's request
897
- // starts HERE, before any regex policy runs, and evaluatePolicies combines
898
- // the two (see semantic/combine.ts). Otherwise this is null and the call
899
- // below is exactly the regex-only evaluation it always was.
900
- const twoTier = await startTwoTier(canonicalEventType, parsed, session, cli, opts, activePause);
901
- // On the two-tier path the registry is read for the activity row BEFORE
902
- // evaluating, because evaluatePolicies may hand the registry back to the
903
- // warm worker's queue (`releaseRegistry`) while it waits on Jev, and the
904
- // next request's clearPolicies() could then run under this one. Same
905
- // cached lookup, same answer: nothing between here and there registers.
906
- const matchedBeforeRelease = twoTier
907
- ? getPoliciesForEvent(canonicalEventType, parsed.tool_name as string | undefined).map((p) => p.name)
908
- : null;
909
-
910
663
  // Evaluate policies (use canonical PascalCase event type)
911
- const result = twoTier
912
- ? await evaluatePolicies(canonicalEventType, parsed, session, config, {
913
- ...twoTier,
914
- releaseRegistry: opts?.releaseRegistry,
915
- })
916
- : await evaluatePolicies(canonicalEventType, parsed, session, config);
664
+ const result = await evaluatePolicies(canonicalEventType, parsed, session, config);
917
665
  const durationMs = Math.round(performance.now() - startTime);
918
666
  hookLogInfo(`result=${result.decision} policy=${result.policyName ?? "none"} duration=${durationMs}ms`);
919
667
 
920
- await captureJevIntent(canonicalEventType, result.decision, parsed, session, cli, opts);
921
-
922
668
  // Which policies actually ran for this event, regardless of how they
923
669
  // decided. `result.policyName` names only the decider — null on a plain
924
670
  // allow — so without this a row cannot tell "your policy ran and allowed"
925
671
  // from "no policy covers this event". The lookup is the same cached call
926
672
  // the evaluator already made, so it costs nothing.
927
- const matchedPolicies =
928
- matchedBeforeRelease ??
929
- getPoliciesForEvent(canonicalEventType, parsed.tool_name as string | undefined).map((p) => p.name);
673
+ const matchedPolicies = getPoliciesForEvent(canonicalEventType, parsed.tool_name as string | undefined).map(
674
+ (p) => p.name,
675
+ );
930
676
 
931
677
  // Persist activity to disk (visible in /policies activity tab)
932
678
  const activityEntry = {
@@ -940,8 +686,6 @@ export async function evaluateHookEvent(
940
686
  decision: result.decision,
941
687
  reason: result.reason,
942
688
  durationMs,
943
- // How Jev took part (§7 fields). Absent unless the two-tier path ran.
944
- ...(result.twoTier ? result.twoTier.activity : {}),
945
689
  sessionId: session.sessionId,
946
690
  transcriptPath: session.transcriptPath,
947
691
  cwd: session.cwd,
@@ -949,10 +693,8 @@ export async function evaluateHookEvent(
949
693
  hookEventName: session.hookEventName,
950
694
  // Attribution. A builtin is anything registered that is not in the map,
951
695
  // so its absence is meaningful rather than missing — but only when a
952
- // policy actually decided; a plain allow names nobody. When Jev's own
953
- // verdict decided, no registered policy did: `evaluator` + `jevDecision`
954
- // say so, and claiming "builtin" here would be false.
955
- ...(result.policyName && !result.twoTier?.decidedByJev
696
+ // policy actually decided; a plain allow names nobody.
697
+ ...(result.policyName
956
698
  ? (() => {
957
699
  const attribution = policyAttribution.get(result.policyName);
958
700
  return {
@@ -1009,7 +751,6 @@ export async function evaluateHookEvent(
1009
751
  convention_scope: conventionScope,
1010
752
  has_custom_params: hasCustomParams,
1011
753
  param_keys_overridden: paramKeysOverridden,
1012
- ...jevTelemetry(result.twoTier?.activity),
1013
754
  });
1014
755
  // Deny/instruct is exactly the response the daemon's warm worker
1015
756
  // needs to return fast — a live network POST to PostHog on this path
@@ -24,7 +24,6 @@ import {
24
24
  import { join } from "node:path";
25
25
  import type { IntegrationType } from "./types";
26
26
  import { hookActivityDir } from "./fp-home";
27
- import { sanitizeJevActivity } from "./jev-activity";
28
27
 
29
28
  export const PAGE_SIZE = 25;
30
29
 
@@ -77,36 +76,6 @@ export interface HookActivityEntry {
77
76
  matchedPolicies?: string[];
78
77
  decision: "allow" | "deny" | "instruct";
79
78
  reason: string | null;
80
- /**
81
- * The Jev (two-tier) fields. Present only when a Jev config (BYOK) exists and
82
- * the call was a PreToolUse / PermissionRequest gate. Absent means the regex
83
- * engine decided alone, exactly as before these fields existed.
84
- *
85
- * `evaluator`: `jev` (the two-tier path ran) or `jev-fallback` (Jev was
86
- * unavailable, truncated or mismatched, so the regex result stood;
87
- * `jevFallbackReason` says why). `jev` alone does NOT mean Jev answered:
88
- * when a hard policy denies, Jev is aborted and the row carries
89
- * `{ evaluator: "jev", jevMode }` and no other Jev field; when no semantic
90
- * policy applies to the call, no request is sent and the row carries
91
- * `{ evaluator: "jev", jevDecision: "allow", jevMode }`. Read a row with
92
- * `jevOutcome` (`jev-activity.ts`): answered, fallback, not-consulted or
93
- * no-request.
94
- *
95
- * Validated on write by `persistHookActivity` (see `jev-activity.ts`): an
96
- * invalid value is dropped field by field, and `jevFallbackReason` is stored
97
- * as a known code (`timeout`, `http-429`, `error`, …) or `other`, never free
98
- * text. The collector ships these fields to FailproofAI Cloud.
99
- */
100
- evaluator?: "jev" | "jev-fallback";
101
- /** Jev's own verdict, before combining with the regex results. */
102
- jevDecision?: "allow" | "instruct" | "deny";
103
- /** Reviewable policies whose deny/instruct Jev cleared. */
104
- jevCleared?: string[];
105
- jevFallbackReason?: string;
106
- jevLatencyMs?: number;
107
- jevModel?: string;
108
- /** `shadow` logs Jev but enforces the regex result; `enforce` applies the combine rules. */
109
- jevMode?: "shadow" | "enforce";
110
79
  durationMs: number;
111
80
  sessionId?: string;
112
81
  transcriptPath?: string;
@@ -225,13 +194,7 @@ function releaseLock(): void {
225
194
 
226
195
  // ── Writing (synchronous — hook handler is short-lived) ──
227
196
 
228
- export function persistHookActivity(input: HookActivityEntry): void {
229
- // The Jev fields are validated here, at the one door every row passes
230
- // through, rather than trusted from the caller: they are shipped off the
231
- // machine by the collector, and a fallback reason is the one field that can
232
- // carry free text (see jev-activity.ts). A row with no Jev fields is written
233
- // exactly as given.
234
- const entry = sanitizeJevActivity(input);
197
+ export function persistHookActivity(entry: HookActivityEntry): void {
235
198
  ensureDir();
236
199
  acquireLock();
237
200
  try {
@@ -434,72 +397,6 @@ export function getAllHookActivityEntries(): HookActivityEntry[] {
434
397
  return [...currentEntries, ...archiveEntries];
435
398
  }
436
399
 
437
- /** See {@link getHookActivityEntriesSince}. */
438
- export const ROTATION_CLOCK_SLACK_MS = 10 * 60 * 1000;
439
-
440
- /**
441
- * Every entry stamped at or after `sinceMs`, newest first — without reading the
442
- * whole history.
443
- *
444
- * Pages are never pruned, so a long-lived machine has hundreds of them, and a
445
- * windowed question ("how did Jev do in the last day") should not pay for all
446
- * of them. It does not have to: an entry's timestamp is taken before it is
447
- * appended, and a page is only renamed to `page-<rotatedAt>-<seq>` after its
448
- * last append, so every entry in a page is at or before `rotatedAt`. Archives
449
- * are listed newest first, so once one was rotated before the window opened,
450
- * it and every older page lie wholly outside it and reading stops there.
451
- *
452
- * `current.jsonl` and the newest pages can still hold entries just outside the
453
- * window (two hook processes race to append), hence the per-entry filter.
454
- * The stop is taken with {@link ROTATION_CLOCK_SLACK_MS} to spare, so a clock
455
- * stepped back a few minutes between two writes costs one extra page read
456
- * rather than silently dropping rows from the window.
457
- *
458
- * No row is returned twice, although this reads without the writers' lock. A
459
- * hook process can rotate `current.jsonl` into a new page between this reading
460
- * `current.jsonl` and listing the pages, and that page then holds the rows just
461
- * read. So the pages are listed once before `current.jsonl` is read; a page
462
- * that appears only in the second listing was rotated during the read, and any
463
- * of its rows that were also in `current.jsonl` are skipped. (A page rotated
464
- * before the read holds none of them: `current.jsonl` was fresh by then.)
465
- */
466
- export function getHookActivityEntriesSince(sinceMs: number): HookActivityEntry[] {
467
- ensureDir();
468
- const dir = storeDirValue();
469
- const inWindow = (e: HookActivityEntry) => typeof e.timestamp === "number" && e.timestamp >= sinceMs;
470
- const listedBefore = new Set(getArchiveFiles());
471
- sinceReadProbe?.("before-current");
472
- const current = readJsonlFile(join(dir, CURRENT_FILE));
473
- sinceReadProbe?.("after-current");
474
- const readFromCurrent = new Map<string, number>();
475
- for (const e of current) {
476
- const key = JSON.stringify(e);
477
- readFromCurrent.set(key, (readFromCurrent.get(key) ?? 0) + 1);
478
- }
479
- const notReadYet = (e: HookActivityEntry): boolean => {
480
- const key = JSON.stringify(e);
481
- const n = readFromCurrent.get(key) ?? 0;
482
- if (n === 0) return true;
483
- readFromCurrent.set(key, n - 1);
484
- return false;
485
- };
486
- const out = current.reverse().filter(inWindow);
487
- for (const file of getArchiveFiles()) {
488
- const rotatedAt = parseInt(file.slice(5, -6).split("-")[0], 10);
489
- if (Number.isFinite(rotatedAt) && rotatedAt < sinceMs - ROTATION_CLOCK_SLACK_MS) break;
490
- let entries = readJsonlFile(join(dir, file));
491
- if (!listedBefore.has(file)) entries = entries.filter(notReadYet);
492
- out.push(...entries.reverse().filter(inWindow));
493
- }
494
- return out;
495
- }
496
-
497
- /** Test-only: runs between the reads of {@link getHookActivityEntriesSince}, to land a rotation exactly there. */
498
- let sinceReadProbe: ((phase: "before-current" | "after-current") => void) | null = null;
499
- export function _setSinceReadProbeForTest(probe: ((phase: "before-current" | "after-current") => void) | null): void {
500
- sinceReadProbe = probe;
501
- }
502
-
503
400
 
504
401
  export function searchHookActivity(
505
402
  filters: HookActivityFilters,
@@ -622,7 +519,6 @@ function getArchiveFiles(): string[] {
622
519
 
623
520
  export function _resetForTest(testDir?: string): void {
624
521
  rotateSeq = 0;
625
- sinceReadProbe = null;
626
522
  // null, not the default path: clearing the override lets the getter re-read
627
523
  // FAILPROOFAI_HOME, which a test may have changed since this module loaded.
628
524
  storeDirOverride = testDir ?? null;
@@ -8,7 +8,6 @@
8
8
  import { version } from "../../package.json";
9
9
  import { POSTHOG_API_KEY, POSTHOG_PRODUCT } from "../posthog-key";
10
10
  import { isTelemetryEnabled } from "../../lib/telemetry-enabled";
11
- import { jevOutcome, sanitizeJevActivity, type JevActivityFields } from "./jev-activity";
12
11
 
13
12
  const API_KEY = POSTHOG_API_KEY;
14
13
  const CAPTURE_URL = "https://us.i.posthog.com/capture/";
@@ -87,43 +86,3 @@ export async function flushHookTelemetry(): Promise<void> {
87
86
  await Promise.allSettled([...pending]);
88
87
  }
89
88
  }
90
-
91
- /**
92
- * The Jev (two-tier evaluator) properties for a hook telemetry event, built
93
- * from the activity row's Jev fields — or `{}` when Jev was not involved, so
94
- * spreading this into an event changes nothing on an unconfigured machine.
95
- *
96
- * Same rule as every other hook property: decisions, reason codes, policy and
97
- * model names, and a latency — never command or prompt text. The row's fields
98
- * go through the same normaliser the activity store applies on write, so a
99
- * free-text fallback reason is reduced to its code here too.
100
- *
101
- * A call a hard policy denied before Jev's answer was read carries
102
- * `jev_outcome: "not-consulted"`, and a call no semantic policy applied to (no
103
- * request sent) `jev_outcome: "no-request"`; neither carries a Jev verdict,
104
- * clears, latency or model: `jev_evaluator: "jev"` alone does not mean Jev
105
- * answered (see `jevOutcome`).
106
- *
107
- * Meant to be spread into `hook_policy_triggered` by the handler:
108
- * `{ ...existingProps, ...jevTelemetryProperties(activityEntry) }`.
109
- */
110
- export function jevTelemetryProperties(entry: JevActivityFields): Record<string, unknown> {
111
- const e = sanitizeJevActivity(entry);
112
- const outcome = jevOutcome(e);
113
- if (outcome === null) return {};
114
- const props: Record<string, unknown> = { jev_evaluator: e.evaluator };
115
- if (e.jevMode) props.jev_mode = e.jevMode;
116
- if (outcome === "not-consulted" || outcome === "no-request") {
117
- props.jev_outcome = outcome;
118
- return props;
119
- }
120
- if (e.jevDecision) props.jev_decision = e.jevDecision;
121
- if (e.jevCleared) {
122
- props.jev_cleared = e.jevCleared;
123
- props.jev_cleared_count = e.jevCleared.length;
124
- }
125
- if (e.jevFallbackReason) props.jev_fallback_reason = e.jevFallbackReason;
126
- if (e.jevLatencyMs !== undefined) props.jev_latency_ms = e.jevLatencyMs;
127
- if (e.jevModel) props.jev_model = e.jevModel;
128
- return props;
129
- }
@@ -191,13 +191,7 @@ 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;`,
199
194
  `export const getCustomHooks = _cjs.getCustomHooks;`,
200
- `export const getSemanticRegistrations = _cjs.getSemanticRegistrations;`,
201
195
  `export const clearCustomHooks = _cjs.clearCustomHooks;`,
202
196
  `export const allow = _cjs.allow;`,
203
197
  `export const deny = _cjs.deny;`,