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
@@ -41,16 +41,9 @@
41
41
  import { createHash } from "node:crypto";
42
42
  import { existsSync, readFileSync } from "node:fs";
43
43
  import { resolve } from "node:path";
44
- import { version as cliVersion } from "../../package.json";
45
44
  import { packsDir, packsInstalledFile } from "./fp-home";
46
45
  import { resolveManagedPath } from "./cloud-managed-policies";
47
- import { authorityFieldsOf } from "./policy-authority";
48
- import { compareVersions } from "./semver-precedence";
49
- // Strings only, and the one semantic module this file may touch: it runs on
50
- // every hook event, and the predicate bodies pull in all sixteen of Jev's
51
- // prompts. See the header of `semantic/precondition-names.ts`.
52
- import { isPackPreconditionName, PACK_PRECONDITION_NAMES } from "./semantic/precondition-names";
53
- import type { SemanticPolicyDeclaration, SemanticProbeDeclaration, PolicyCatalogEntry } from "./policy-types";
46
+ import type { PolicyCatalogEntry } from "./policy-types";
54
47
  import type { PolicyEffect } from "./cloud-managed-policies";
55
48
 
56
49
  /** Manifest schemas this reader accepts. */
@@ -89,52 +82,6 @@ export const PACK_COMMIT_RE = /^[0-9a-f]{7,40}$/;
89
82
  */
90
83
  const PACK_POLICY_NAME_RE = /^[A-Za-z0-9._-]{1,128}$/;
91
84
 
92
- /**
93
- * A semantic probe's id. Lowercase and underscore only, because it is half of a
94
- * Jev question id (`<policy>.<probe>`) that `decide.ts` reads answers back by.
95
- */
96
- const PROBE_ID_RE = /^[a-z][a-z0-9_]{0,31}$/;
97
-
98
- /**
99
- * Probe ids `decide.ts` has already taken in the answer map: `<policy>.exempt`
100
- * is the documented-exception question and `<policy>.user_asked` is the "did the
101
- * human ask for this" one. A probe claiming either name would not collide
102
- * loudly — it would OVERWRITE that question in the compiled request, so the
103
- * exemption or the override silently becomes whatever the pack wrote.
104
- */
105
- const RESERVED_PROBE_IDS: ReadonlySet<string> = new Set(["exempt", "user_asked"]);
106
-
107
- const SEMANTIC_TOOL_CLASSES: ReadonlySet<string> = new Set(["shell", "write", "read", "network", "other"]);
108
-
109
- /**
110
- * Cheap count guards on the question set, applied where the manifest is read.
111
- *
112
- * They are NOT the real budget. Every probe is a question in one Jev request,
113
- * and what that request has to fit is a character budget
114
- * (`MAX_REQUEST_CHARS - MAX_STATE_CHARS`) — which these counts cannot express,
115
- * because a probe is between a sentence and a paragraph long. Counting to 24
116
- * and 6 here rejects the obviously abusive shapes for free, on the hook path,
117
- * without reaching a semantic module; `semantic/pack-policies.ts` owns the
118
- * budget that actually decides, measured the way `compile.ts` measures it.
119
- *
120
- * There is deliberately no total probe count across packs. An earlier draft had
121
- * one (80), and at the real average probe length that ceiling permits a question
122
- * set 23,032 characters over what one request can carry — a cap that reads as a
123
- * guarantee and is not one.
124
- */
125
- export const MAX_SEMANTIC_POLICIES_PER_PACK = 24;
126
- /** Per-policy conjunction width. The builtin set's widest policy uses three probes. */
127
- export const MAX_PROBES_PER_POLICY = 6;
128
- const MAX_TITLE_CHARS = 120;
129
- const MAX_INSTRUCTIONS_CHARS = 600;
130
- const MAX_CRITERION_CHARS = 300;
131
- const MAX_GUIDANCE_CHARS = 600;
132
-
133
- /** A semantic policy as a manifest carries it: validated, normalized, code-free. */
134
- export type SemanticManifestEntry = SemanticPolicyDeclaration & {
135
- probes: SemanticProbeDeclaration[];
136
- };
137
-
138
85
  export interface InstalledPackRecord {
139
86
  id: string;
140
87
  version: string;
@@ -147,25 +94,6 @@ export interface InstalledPackRecord {
147
94
  commit?: string;
148
95
  effect?: string;
149
96
  policies?: unknown;
150
- /**
151
- * The pack's semantic (Jev) policies, as the manifest declared them.
152
- *
153
- * `unknown` like `policies`, and optional like it is not: a pack published
154
- * before this field existed carries none, and every one of them must keep
155
- * parsing. A pack that declares at least one REPLACES the compiled-in
156
- * semantic set wholesale — see `semantic/pack-policies.ts`.
157
- */
158
- semantic?: unknown;
159
- /**
160
- * The oldest CLI that may run this pack, as a semver string.
161
- *
162
- * Optional, and the ordering of its release is the reason it has to exist at
163
- * all: a CLI with no support for this field ignores it AND ignores `semantic`,
164
- * so it installs a pack whose Jev half does nothing and says so nowhere. A
165
- * publisher can only protect against that by naming a minimum that the old
166
- * CLI cannot read — which is why this ships before any pack declares one.
167
- */
168
- minCliVersion?: string;
169
97
  /**
170
98
  * Which of the pack's policies to register. Absent means ALL of them.
171
99
  *
@@ -203,22 +131,6 @@ export interface ResolvedPack {
203
131
  effect: PolicyEffect;
204
132
  /** The pack's own catalog, in declared order. */
205
133
  policies: PolicyCatalogEntry[];
206
- /**
207
- * The pack's semantic policies, in declared order — EMPTY when it declared
208
- * none, which is what every pack published before this release says. Entries
209
- * that failed validation are not here; they were dropped, and the reason is in
210
- * `PackReadResult.warnings`.
211
- *
212
- * `readInstalledPacks` always sets it, so on a record that came from a
213
- * manifest this is an array. It is optional only so that a hand-built record —
214
- * the loader fixtures, `pack-failclosed`'s guards — does not have to name a
215
- * field it has no opinion about. Read it through {@link packSemantic} rather
216
- * than `?? []` at each site, so "absent" and "empty" cannot come to mean
217
- * different things.
218
- */
219
- semantic?: SemanticManifestEntry[];
220
- /** The minimum CLI this pack declared, once it has been checked against ours. */
221
- minCliVersion?: string;
222
134
  /** Selected policy names, or null when the user took the whole pack. */
223
135
  enabled: string[] | null;
224
136
  /** Agent CLIs this pack guards, or null for all of them. */
@@ -259,24 +171,6 @@ export interface PackReadResult {
259
171
  packs: ResolvedPack[];
260
172
  /** Every pack that was declared and refused, and why. Never silently dropped. */
261
173
  errors: PackError[];
262
- /**
263
- * What was dropped from a pack that LOADED anyway, and why: a malformed
264
- * semantic policy, an unknown precondition name, one entry past the cap, a
265
- * `minCliVersion` nobody can compare.
266
- *
267
- * A SEPARATE channel from `errors`, and it has to be. An entry in `errors`
268
- * means a pack was refused, and `pack-failclosed.ts` turns that into a deny
269
- * for every event the missing policies claimed. Everything here is the
270
- * opposite situation: the pack's regex policies are registered and enforcing,
271
- * and what was lost is a reviewer (so a deny can no longer be CLEARED) or an
272
- * unreadable version claim. Filing either as a pack failure would deny a
273
- * machine over a typo in the half of the system whose job is to let more real
274
- * work through.
275
- *
276
- * Absent rather than an empty array when there is nothing to say, so the
277
- * common result stays the exact shape it has always been.
278
- */
279
- warnings?: string[];
280
174
  }
281
175
 
282
176
  export function packsRoot(): string {
@@ -332,56 +226,14 @@ export function hasInstalledPacks(): boolean {
332
226
  }
333
227
  }
334
228
 
335
- export function installedFilePath(): string {
229
+ function installedFilePath(): string {
336
230
  return process.env.FAILPROOFAI_PACK_DIR
337
231
  ? resolve(process.env.FAILPROOFAI_PACK_DIR, "installed.json")
338
232
  : packsInstalledFile();
339
233
  }
340
234
 
341
-
342
- /** The param types a schema may declare. Mirrors {@link PolicyParamsSchema}. */
343
- const PARAM_TYPES: ReadonlySet<string> = new Set(["string", "number", "boolean", "string[]", "pattern[]"]);
344
-
345
- /**
346
- * Why a `params` schema cannot be used, or `undefined` when it can.
347
- *
348
- * A pack's schema is what `registerPolicy` stores and `evaluatePolicies` merges
349
- * the user's configured values ON TOP OF, so a malformed one is not cosmetic: it
350
- * decides what `ctx.params` contains, and a policy reading a param that is not
351
- * there falls back to whatever its own code says — usually the stricter thing.
352
- *
353
- * Validated as a whole rather than per param. A partial schema would leave one
354
- * param live and another silently absent inside the same policy, which is the
355
- * hardest version of this to diagnose from the outside.
356
- */
357
- function paramsSchemaProblem(value: unknown): string | undefined {
358
- if (!value || typeof value !== "object" || Array.isArray(value)) return "params is not an object";
359
- for (const [name, raw] of Object.entries(value as Record<string, unknown>)) {
360
- if (name.length === 0) return "params has an empty parameter name";
361
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) return `params.${name} is not an object`;
362
- const spec = raw as Record<string, unknown>;
363
- if (typeof spec.type !== "string" || !PARAM_TYPES.has(spec.type)) {
364
- return `params.${name} has type ${JSON.stringify(spec.type)}, which is not one of ${[...PARAM_TYPES].join(", ")}`;
365
- }
366
- if (typeof spec.description !== "string" || spec.description.length === 0) {
367
- return `params.${name} is missing a description`;
368
- }
369
- // The KEY has to be there, whatever it holds: an absent default and a
370
- // `default: undefined` merge the same way, but only one of them says the
371
- // author thought about it, and the merge is what the user's own value lands on.
372
- if (!("default" in spec)) return `params.${name} is missing a default`;
373
- }
374
- return undefined;
375
- }
376
-
377
235
  /** Validate one serialized catalog entry carried by a pack. */
378
- export function parsePackPolicy(
379
- packId: string,
380
- value: unknown,
381
- index: number,
382
- /** Where a DROPPED field is reported. Optional: most callers only care that the entry parsed. */
383
- warnings?: string[],
384
- ): PolicyCatalogEntry {
236
+ export function parsePackPolicy(packId: string, value: unknown, index: number): PolicyCatalogEntry {
385
237
  const where = `${packId} policy #${index}`;
386
238
  if (!value || typeof value !== "object") throw new Error(`${where} is not an object`);
387
239
  const raw = value as Record<string, unknown>;
@@ -422,320 +274,10 @@ export function parsePackPolicy(
422
274
  throw new Error(`${where} has a match.${key} that is not a list of names`);
423
275
  }
424
276
  }
425
- // Authority: whether Jev may clear this policy's verdict. Unlike `match`, a
426
- // malformed value is DROPPED rather than refused — refusing the pack fails it
427
- // closed and denies every tool call it covers, while dropping the field makes
428
- // this one policy `hard`, which is what an unreadable declaration means
429
- // anyway. A pack can only describe its OWN policies this way: the name above
430
- // cannot contain `/`, so no entry can reach a builtin or another pack's
431
- // policy. Absent fields stay absent, valid ones stay where they were, and an
432
- // entry with nothing to drop is returned as is.
433
- const valid = authorityFieldsOf(raw);
434
- const invalid = (["authority", "reviewedBy"] as const).filter((k) => k in raw && !(k in valid));
435
- // `params` follows the same rule, and is dropped for the same reason: refusing
436
- // the pack fails it closed and denies every tool call it covers, while dropping
437
- // the schema leaves the policy running on its own internal fallbacks. Recorded
438
- // rather than silent, because the drop is a change to what the policy DOES —
439
- // `block-sudo` without its `allowPatterns` is stricter than the user asked for,
440
- // and stricter is the direction nobody reports as a bug.
441
- if ("params" in raw) {
442
- const problem = paramsSchemaProblem(raw.params);
443
- if (problem) {
444
- warnings?.push(`${where} declares a params schema that was dropped: ${problem}`);
445
- invalid.push("params" as never);
446
- }
447
- }
448
- if (invalid.length > 0) {
449
- return Object.fromEntries(
450
- Object.entries(raw).filter(([k]) => !(invalid as readonly string[]).includes(k)),
451
- ) as unknown as PolicyCatalogEntry;
452
- }
453
277
  return raw as unknown as PolicyCatalogEntry;
454
278
  }
455
279
 
456
- /**
457
- * Why a `params` schema cannot be PUBLISHED, or `undefined` when it can.
458
- *
459
- * The build-time half of the rule above: at build time nothing is installed, so
460
- * refusing costs nobody anything, while shipping the schema means every machine
461
- * that installs the pack runs the policy without its parameters and says so only
462
- * in its own log.
463
- */
464
- export function packParamsProblem(params: unknown): string | undefined {
465
- return params === undefined ? undefined : paramsSchemaProblem(params);
466
- }
467
-
468
- /**
469
- * What this build makes of a pack's declared `minCliVersion`.
470
- *
471
- * Three outcomes, not two, because "the pack states no requirement" and "the
472
- * pack states one nobody can read" are different facts and only one of them is
473
- * worth saying out loud.
474
- */
475
- export type MinCliVerdict =
476
- /** Satisfied, or nothing was claimed. `declared` is present only when it was. */
477
- | { kind: "satisfied"; declared?: string }
478
- /** The field was there and unusable. It is DROPPED; the pack still loads. */
479
- | { kind: "unreadable"; reason: string }
480
- /** This CLI is genuinely older than the pack requires. The pack is refused. */
481
- | { kind: "too-old"; reason: string };
482
-
483
- /**
484
- * Judge one pack's `minCliVersion` against the running CLI — the ONE place that
485
- * decision is written down.
486
- *
487
- * ## Absent satisfies
488
- *
489
- * Every pack published before this release declares nothing, and those packs
490
- * work. Treating silence as an unmet requirement would refuse them all, and a
491
- * refused `enforce` pack denies every tool call its policies cover
492
- * (`pack-failclosed.ts`) — a machine-wide lockout produced by an upgrade.
493
- *
494
- * ## Unreadable also satisfies, and says so
495
- *
496
- * The rule `parsePackPolicy` already applies to a malformed `authority`: drop
497
- * the field, record it, do not refuse the pack. A publisher's typo in a version
498
- * string must not be able to fail somebody's machine closed. It is recorded
499
- * rather than ignored, because a requirement that quietly evaporates is how a
500
- * pack ends up enforcing less than its README says.
501
- *
502
- * This is the one place the two differ from each other, which is why neither is
503
- * a boolean: a caller reading `false` to refuse would ignore the typo, and one
504
- * reading `!== true` would refuse the world.
505
- *
506
- * ## Too old refuses, and that is the field's entire purpose
507
- *
508
- * A CLI too old to know this field ignores it AND ignores `semantic` with it,
509
- * installing a pack whose Jev half does nothing on a machine that reports
510
- * healthy. Only a build new enough to have this check can act on the
511
- * requirement, so here it acts. It rides the ordinary `PackError` path, which
512
- * carries `effect` and `clis`, so refusing an `observe` pack does not make the
513
- * machine deny on its behalf.
514
- */
515
- export function checkPackMinCliVersion(
516
- packId: string,
517
- declared: unknown,
518
- current: string = cliVersion,
519
- ): MinCliVerdict {
520
- if (declared === undefined) return { kind: "satisfied" };
521
- const ordered = compareVersions(current, declared);
522
- if (ordered === null) {
523
- return {
524
- kind: "unreadable",
525
- reason:
526
- `pack ${packId} declares minCliVersion ${JSON.stringify(declared)}, which is not a version this CLI can ` +
527
- `compare against its own (${current}) — the requirement was ignored`,
528
- };
529
- }
530
- if (ordered < 0) {
531
- return {
532
- kind: "too-old",
533
- reason:
534
- `pack ${packId} needs failproofai ${String(declared)} or newer and this is ${current} — ` +
535
- "run `npm i -g failproofai && failproofai update`",
536
- };
537
- }
538
- return { kind: "satisfied", declared: declared as string };
539
- }
540
-
541
- /** A bounded, non-empty string field. The cap is part of the envelope budget, not taste. */
542
- function boundedString(where: string, field: string, value: unknown, max: number): string {
543
- if (typeof value !== "string" || value.length === 0) {
544
- throw new Error(`${where} is missing ${field}`);
545
- }
546
- if (value.length > max) {
547
- throw new Error(`${where} has a ${field} of ${value.length} characters, over the ${max}-character cap`);
548
- }
549
- return value;
550
- }
551
-
552
- /**
553
- * One probe (or the `exempt` question), validated.
554
- *
555
- * `forcedId` is how `exempt` gets its id: the answer map keys it
556
- * `<policy>.exempt` whatever the manifest wrote, so the field is overwritten
557
- * rather than checked. Refusing a mismatch there would fail a pack over a
558
- * value that has no effect.
559
- */
560
- function parseSemanticProbe(where: string, value: unknown, forcedId: string | null): SemanticProbeDeclaration {
561
- if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`${where} is not an object`);
562
- const raw = value as Record<string, unknown>;
563
-
564
- let id: string;
565
- if (forcedId !== null) {
566
- id = forcedId;
567
- } else {
568
- if (typeof raw.id !== "string" || !PROBE_ID_RE.test(raw.id)) {
569
- throw new Error(`${where} has an unsafe id ${JSON.stringify(raw.id)}`);
570
- }
571
- if (RESERVED_PROBE_IDS.has(raw.id)) {
572
- throw new Error(`${where} uses the reserved probe id ${JSON.stringify(raw.id)}`);
573
- }
574
- id = raw.id;
575
- }
576
-
577
- const instructions = boundedString(where, "instructions", raw.instructions, MAX_INSTRUCTIONS_CHARS);
578
- if (raw.criteria === undefined) return { id, instructions };
579
- if (!raw.criteria || typeof raw.criteria !== "object" || Array.isArray(raw.criteria)) {
580
- throw new Error(`${where} has criteria that is not an object`);
581
- }
582
- const criteria = raw.criteria as Record<string, unknown>;
583
- // Both halves or neither. Jev answers the question as written, and a `true`
584
- // description with no `false` one is a question with only one side explained —
585
- // the authoring mistake the criteria exist to prevent.
586
- return {
587
- id,
588
- instructions,
589
- criteria: {
590
- true: boundedString(where, "criteria.true", criteria.true, MAX_CRITERION_CHARS),
591
- false: boundedString(where, "criteria.false", criteria.false, MAX_CRITERION_CHARS),
592
- },
593
- };
594
- }
595
-
596
- /**
597
- * Validate one serialized SEMANTIC policy carried by a pack. Sibling of
598
- * {@link parsePackPolicy}, and the rules are its rules where they overlap.
599
- *
600
- * It THROWS on every violation and the CALLER decides what a throw costs.
601
- * `readInstalledPacks` drops the one entry and records why, because a semantic
602
- * policy is what CLEARS a reviewable regex verdict: losing one leaves the regex
603
- * block standing, which is noisier and never weaker. `failproofai publish`
604
- * fails the whole build on the same throw, because nothing is installed yet and
605
- * refusing there costs nobody anything.
606
- *
607
- * The returned entry is NORMALIZED, unlike a regex entry — which is returned
608
- * as-is so a field this build does not know about survives into `params`. There
609
- * is no equivalent here: the entry's entire use is to be compiled into a
610
- * question set, so a field nothing reads is a field that would be published,
611
- * digest-pinned and then ignored.
612
- */
613
- export function parsePackSemanticPolicy(packId: string, value: unknown, index: number): SemanticManifestEntry {
614
- const where = `${packId} semantic policy #${index}`;
615
- if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`${where} is not an object`);
616
- const raw = value as Record<string, unknown>;
617
-
618
- const name = raw.name;
619
- if (typeof name !== "string" || !PACK_POLICY_NAME_RE.test(name)) {
620
- throw new Error(`${where} has an unsafe name ${JSON.stringify(name)}`);
621
- }
622
- if ("alwaysOn" in raw) {
623
- // The same refusal `parsePackPolicy` makes, for the same reason, and it has
624
- // to be restated rather than inherited: nothing else stops a semantic entry
625
- // from carrying the field, and a reader that ever honoured it would be
626
- // honouring it on a downloaded file no local command can switch off.
627
- throw new Error(`${where} declares alwaysOn, which packs may not set`);
628
- }
629
- const title = boundedString(`${packId} semantic policy ${name}`, "title", raw.title, MAX_TITLE_CHARS);
630
- const scope = `${packId} semantic policy ${name}`;
631
-
632
- if (!Array.isArray(raw.appliesTo) || raw.appliesTo.length === 0) {
633
- throw new Error(`${scope} has no appliesTo tool classes`);
634
- }
635
- const unknownClass = raw.appliesTo.find((c) => typeof c !== "string" || !SEMANTIC_TOOL_CLASSES.has(c));
636
- if (unknownClass !== undefined) {
637
- throw new Error(
638
- `${scope} applies to ${JSON.stringify(unknownClass)}, which is not a tool class ` +
639
- `(${[...SEMANTIC_TOOL_CLASSES].join(", ")})`,
640
- );
641
- }
642
-
643
- if (raw.mode !== "deny" && raw.mode !== "instruct") {
644
- throw new Error(`${scope} has mode ${JSON.stringify(raw.mode)}, which must be "deny" or "instruct"`);
645
- }
646
- // REQUIRED, with no default. It decides whether a prompt injection that talks
647
- // the human's words back at us can clear the policy, so a default here would
648
- // be a security decision made by absence — and the direction it fell would
649
- // depend on which of the two engines read the entry.
650
- if (typeof raw.userCanOverride !== "boolean") {
651
- throw new Error(`${scope} is missing userCanOverride, which has no default`);
652
- }
653
-
654
- if (!Array.isArray(raw.probes) || raw.probes.length === 0) {
655
- throw new Error(`${scope} declares no probes`);
656
- }
657
- if (raw.probes.length > MAX_PROBES_PER_POLICY) {
658
- throw new Error(`${scope} declares ${raw.probes.length} probes, over the cap of ${MAX_PROBES_PER_POLICY}`);
659
- }
660
- const probes = raw.probes.map((p, i) => parseSemanticProbe(`${scope} probe #${i}`, p, null));
661
- const ids = new Set<string>();
662
- for (const probe of probes) {
663
- if (ids.has(probe.id)) throw new Error(`${scope} declares probe ${probe.id} twice`);
664
- ids.add(probe.id);
665
- }
666
-
667
- const exempt = raw.exempt === undefined ? undefined : parseSemanticProbe(`${scope} exempt`, raw.exempt, "exempt");
668
-
669
- if (raw.precondition !== undefined && !isPackPreconditionName(raw.precondition)) {
670
- throw new Error(
671
- `${scope} names precondition ${JSON.stringify(raw.precondition)}, which this build does not have ` +
672
- `(${PACK_PRECONDITION_NAMES.join(", ")})`,
673
- );
674
- }
675
-
676
- const guidance = boundedString(scope, "guidance", raw.guidance, MAX_GUIDANCE_CHARS);
677
-
678
- return {
679
- name,
680
- title,
681
- appliesTo: raw.appliesTo as SemanticManifestEntry["appliesTo"],
682
- mode: raw.mode,
683
- userCanOverride: raw.userCanOverride,
684
- probes,
685
- ...(exempt ? { exempt } : {}),
686
- ...(raw.precondition !== undefined ? { precondition: raw.precondition } : {}),
687
- guidance,
688
- };
689
- }
690
-
691
- /** A pack's semantic entries. Absent and empty are the same answer: it declares none. */
692
- export function packSemantic(pack: Pick<ResolvedPack, "semantic">): ReadonlyArray<SemanticManifestEntry> {
693
- return pack.semantic ?? [];
694
- }
695
-
696
- /** The questions one entry compiles to: one per probe, plus one for the exemption. */
697
- export function semanticQuestions(
698
- entry: Pick<SemanticManifestEntry, "probes" | "exempt">,
699
- ): ReadonlyArray<SemanticProbeDeclaration> {
700
- return entry.exempt ? [...entry.probes, entry.exempt] : entry.probes;
701
- }
702
-
703
- /**
704
- * The semantic entries a pack declared, with the unusable ones dropped.
705
- *
706
- * Per ENTRY, not per pack: one malformed question set must not take the rest of
707
- * a publisher's semantic policies with it, for the same reason one malformed
708
- * pack does not take the other packs with it.
709
- */
710
- function parsePackSemantic(packId: string, value: unknown, warnings: string[]): SemanticManifestEntry[] {
711
- if (value === undefined) return [];
712
- if (!Array.isArray(value)) {
713
- warnings.push(`pack ${packId} semantic is not an array, so none of it was loaded`);
714
- return [];
715
- }
716
- const entries: SemanticManifestEntry[] = [];
717
- const names = new Set<string>();
718
- for (const [index, raw] of value.entries()) {
719
- if (entries.length >= MAX_SEMANTIC_POLICIES_PER_PACK) {
720
- warnings.push(
721
- `pack ${packId} declares more than ${MAX_SEMANTIC_POLICIES_PER_PACK} semantic policies; ` +
722
- `the ${value.length - MAX_SEMANTIC_POLICIES_PER_PACK} past that cap were dropped`,
723
- );
724
- break;
725
- }
726
- try {
727
- const entry = parsePackSemanticPolicy(packId, raw, index);
728
- if (names.has(entry.name)) throw new Error(`pack ${packId} declares semantic policy ${entry.name} twice`);
729
- names.add(entry.name);
730
- entries.push(entry);
731
- } catch (err) {
732
- warnings.push(errText(err));
733
- }
734
- }
735
- return entries;
736
- }
737
-
738
- function parsePack(root: string, value: unknown, warnings: string[]): ResolvedPack {
280
+ function parsePack(root: string, value: unknown): ResolvedPack {
739
281
  if (!value || typeof value !== "object") throw new Error("pack entry is not an object");
740
282
  const raw = value as InstalledPackRecord;
741
283
 
@@ -750,12 +292,6 @@ function parsePack(root: string, value: unknown, warnings: string[]): ResolvedPa
750
292
  // this pack was for.
751
293
  const effect = identity.effect;
752
294
 
753
- // Checked before the artifact is read: there is no point hashing bytes this
754
- // build may have just been told it must not run.
755
- const minCli = checkPackMinCliVersion(identity.id, raw.minCliVersion);
756
- if (minCli.kind === "too-old") throw new Error(minCli.reason);
757
- if (minCli.kind === "unreadable") warnings.push(minCli.reason);
758
-
759
295
  const path = resolveManagedPath(root, raw.entry);
760
296
  const actual = createHash("sha256").update(readFileSync(path)).digest("hex");
761
297
  if (actual !== raw.sha256) {
@@ -765,7 +301,7 @@ function parsePack(root: string, value: unknown, warnings: string[]): ResolvedPa
765
301
  }
766
302
 
767
303
  if (!Array.isArray(raw.policies)) throw new Error(`pack ${raw.id} policies is not an array`);
768
- const policies = raw.policies.map((p, i) => parsePackPolicy(raw.id, p, i, warnings));
304
+ const policies = raw.policies.map((p, i) => parsePackPolicy(raw.id, p, i));
769
305
  const names = new Set<string>();
770
306
  for (const p of policies) {
771
307
  if (names.has(p.name)) throw new Error(`pack ${raw.id} declares ${p.name} twice`);
@@ -804,8 +340,6 @@ function parsePack(root: string, value: unknown, warnings: string[]): ResolvedPa
804
340
  sha256: raw.sha256,
805
341
  effect,
806
342
  policies,
807
- semantic: parsePackSemantic(identity.id, raw.semantic, warnings),
808
- ...(minCli.kind === "satisfied" && minCli.declared ? { minCliVersion: minCli.declared } : {}),
809
343
  enabled,
810
344
  };
811
345
  }
@@ -854,7 +388,6 @@ export function readInstalledPacks(): PackReadResult {
854
388
  const root = packsRoot();
855
389
  const packs: ResolvedPack[] = [];
856
390
  const errors: PackError[] = [];
857
- const warnings: string[] = [];
858
391
  const seen = new Set<string>();
859
392
 
860
393
  for (const entry of manifest.packs) {
@@ -862,16 +395,11 @@ export function readInstalledPacks(): PackReadResult {
862
395
  entry && typeof entry === "object" && typeof (entry as InstalledPackRecord).id === "string"
863
396
  ? (entry as InstalledPackRecord).id
864
397
  : null;
865
- // Collected per pack and merged only on success. A pack that throws after
866
- // some of its semantic entries were dropped is refused whole, and reporting
867
- // the drops as well would describe a policy set that is not loaded at all.
868
- const packWarnings: string[] = [];
869
398
  try {
870
- const pack = parsePack(root, entry, packWarnings);
399
+ const pack = parsePack(root, entry);
871
400
  if (seen.has(pack.id)) throw new Error(`duplicate pack id ${pack.id}`);
872
401
  seen.add(pack.id);
873
402
  packs.push(pack);
874
- warnings.push(...packWarnings);
875
403
  } catch (err) {
876
404
  const rec = entry as InstalledPackRecord | null;
877
405
  const declaredEffect =
@@ -894,7 +422,7 @@ export function readInstalledPacks(): PackReadResult {
894
422
  });
895
423
  }
896
424
  }
897
- return { packs, errors, ...(warnings.length > 0 ? { warnings } : {}) };
425
+ return { packs, errors };
898
426
  }
899
427
 
900
428
  /** Policy entries that at least carry a name and a match, for narrowing a deny. */