failproofai 0.0.6-beta.2 → 0.0.6-beta.4

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 (511) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +7 -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.nft.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  10. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  11. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  12. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  13. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  14. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  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 +2 -2
  19. package/.next/standalone/.next/server/app/_not-found.rsc +17 -17
  20. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +17 -17
  21. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  22. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
  23. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  24. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  25. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  26. package/.next/standalone/.next/server/app/index.html +1 -1
  27. package/.next/standalone/.next/server/app/index.rsc +16 -16
  28. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  29. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +16 -16
  30. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  31. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +11 -11
  32. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  33. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  34. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
  37. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  40. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  43. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  44. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  47. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
  50. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
  51. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
  52. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
  53. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
  54. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
  55. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
  56. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0i5kvry._.js → [root-of-the-server]__0om-5pe._.js} +2 -2
  57. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +2 -2
  58. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__05akje6._.js → [root-of-the-server]__111.vxi._.js} +2 -2
  59. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
  60. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
  61. package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
  62. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
  63. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
  64. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js +1 -1
  65. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  66. package/.next/standalone/.next/server/pages/404.html +2 -2
  67. package/.next/standalone/.next/server/pages/500.html +1 -1
  68. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/server-reference-manifest.json +9 -9
  70. package/.next/standalone/.next/static/chunks/{05j1px0r8yzh6.js → 02dqjyv6_9mhq.js} +2 -2
  71. package/.next/standalone/.next/static/chunks/{14cl9poem30dq.js → 070orfsl6.xal.js} +1 -1
  72. package/.next/standalone/.next/static/chunks/0mir9jdxn35~s.css +1 -0
  73. package/.next/standalone/.next/static/chunks/{00j0rr7rh8ef8.js → 0o547jv-k_k35.js} +1 -1
  74. package/.next/standalone/.next/static/chunks/{0ijk_kek9_wyx.js → 0pk2h2.mjxy.m.js} +1 -1
  75. package/.next/standalone/.next/static/chunks/{0xpl.oscrakvx.js → 0rcwkbh24w38b.js} +1 -1
  76. package/.next/standalone/.next/static/chunks/{1052sguyd-.ka.js → 140xx_tfr~lm_.js} +1 -1
  77. package/.next/standalone/.next/static/chunks/{0npb~873.wvg3.js → 169_e4dq~1~b6.js} +1 -1
  78. package/.next/standalone/.next/static/chunks/{0badv41uxa56..js → 17ne4p.1sw1jy.js} +1 -1
  79. package/.next/standalone/next.config.ts +6 -0
  80. package/.next/standalone/package.json +2 -2
  81. package/.next/standalone/server.js +1 -1
  82. package/bin/failproofai.mjs +91 -4
  83. package/dist/cli.mjs +1155 -54
  84. package/package.json +2 -2
  85. package/scripts/prune-standalone.mjs +128 -0
  86. package/src/auth/login.ts +104 -0
  87. package/src/auth/logout.ts +50 -0
  88. package/src/auth/token-store.ts +64 -0
  89. package/src/hooks/builtin-policies.ts +22 -20
  90. package/src/hooks/handler.ts +35 -15
  91. package/src/relay/daemon.ts +362 -0
  92. package/src/relay/pid.ts +76 -0
  93. package/src/relay/queue.ts +225 -0
  94. package/.next/standalone/.claude/settings.json +0 -316
  95. package/.next/standalone/.failproofai/policies/review-policies.mjs +0 -113
  96. package/.next/standalone/.failproofai/policies/workflow-policies.mjs +0 -63
  97. package/.next/standalone/.failproofai/policies-config.json +0 -39
  98. package/.next/standalone/.next/static/chunks/0gu_a.a80ritd.css +0 -1
  99. package/.next/standalone/AGENTS.md +0 -80
  100. package/.next/standalone/CHANGELOG.md +0 -151
  101. package/.next/standalone/CLAUDE.md +0 -165
  102. package/.next/standalone/CONTRIBUTING.md +0 -76
  103. package/.next/standalone/Dockerfile.docs +0 -12
  104. package/.next/standalone/LICENSE +0 -42
  105. package/.next/standalone/README.md +0 -301
  106. package/.next/standalone/bin/failproofai.mjs +0 -352
  107. package/.next/standalone/bun.lock +0 -1119
  108. package/.next/standalone/components.json +0 -23
  109. package/.next/standalone/dist/cli.mjs +0 -3595
  110. package/.next/standalone/dist/index.js +0 -80
  111. package/.next/standalone/docs/ar/architecture.mdx +0 -334
  112. package/.next/standalone/docs/ar/built-in-policies.mdx +0 -574
  113. package/.next/standalone/docs/ar/cli/dashboard.mdx +0 -28
  114. package/.next/standalone/docs/ar/cli/environment-variables.mdx +0 -34
  115. package/.next/standalone/docs/ar/cli/hook.mdx +0 -31
  116. package/.next/standalone/docs/ar/cli/install-policies.mdx +0 -48
  117. package/.next/standalone/docs/ar/cli/list-policies.mdx +0 -31
  118. package/.next/standalone/docs/ar/cli/remove-policies.mdx +0 -43
  119. package/.next/standalone/docs/ar/cli/version.mdx +0 -13
  120. package/.next/standalone/docs/ar/configuration.mdx +0 -223
  121. package/.next/standalone/docs/ar/custom-policies.mdx +0 -354
  122. package/.next/standalone/docs/ar/dashboard.mdx +0 -142
  123. package/.next/standalone/docs/ar/examples.mdx +0 -307
  124. package/.next/standalone/docs/ar/for-agents.mdx +0 -39
  125. package/.next/standalone/docs/ar/getting-started.mdx +0 -187
  126. package/.next/standalone/docs/ar/introduction.mdx +0 -58
  127. package/.next/standalone/docs/ar/package-aliases.mdx +0 -82
  128. package/.next/standalone/docs/ar/testing.mdx +0 -261
  129. package/.next/standalone/docs/architecture.mdx +0 -332
  130. package/.next/standalone/docs/built-in-policies.mdx +0 -574
  131. package/.next/standalone/docs/cli/dashboard.mdx +0 -28
  132. package/.next/standalone/docs/cli/environment-variables.mdx +0 -34
  133. package/.next/standalone/docs/cli/hook.mdx +0 -30
  134. package/.next/standalone/docs/cli/install-policies.mdx +0 -47
  135. package/.next/standalone/docs/cli/list-policies.mdx +0 -31
  136. package/.next/standalone/docs/cli/remove-policies.mdx +0 -43
  137. package/.next/standalone/docs/cli/version.mdx +0 -12
  138. package/.next/standalone/docs/configuration.mdx +0 -222
  139. package/.next/standalone/docs/custom-policies.mdx +0 -353
  140. package/.next/standalone/docs/dashboard.mdx +0 -142
  141. package/.next/standalone/docs/de/architecture.mdx +0 -332
  142. package/.next/standalone/docs/de/built-in-policies.mdx +0 -574
  143. package/.next/standalone/docs/de/cli/dashboard.mdx +0 -28
  144. package/.next/standalone/docs/de/cli/environment-variables.mdx +0 -34
  145. package/.next/standalone/docs/de/cli/hook.mdx +0 -30
  146. package/.next/standalone/docs/de/cli/install-policies.mdx +0 -47
  147. package/.next/standalone/docs/de/cli/list-policies.mdx +0 -31
  148. package/.next/standalone/docs/de/cli/remove-policies.mdx +0 -43
  149. package/.next/standalone/docs/de/cli/version.mdx +0 -12
  150. package/.next/standalone/docs/de/configuration.mdx +0 -222
  151. package/.next/standalone/docs/de/custom-policies.mdx +0 -353
  152. package/.next/standalone/docs/de/dashboard.mdx +0 -142
  153. package/.next/standalone/docs/de/examples.mdx +0 -307
  154. package/.next/standalone/docs/de/for-agents.mdx +0 -38
  155. package/.next/standalone/docs/de/getting-started.mdx +0 -186
  156. package/.next/standalone/docs/de/introduction.mdx +0 -57
  157. package/.next/standalone/docs/de/package-aliases.mdx +0 -82
  158. package/.next/standalone/docs/de/testing.mdx +0 -260
  159. package/.next/standalone/docs/docs.json +0 -1002
  160. package/.next/standalone/docs/es/architecture.mdx +0 -332
  161. package/.next/standalone/docs/es/built-in-policies.mdx +0 -574
  162. package/.next/standalone/docs/es/cli/dashboard.mdx +0 -28
  163. package/.next/standalone/docs/es/cli/environment-variables.mdx +0 -34
  164. package/.next/standalone/docs/es/cli/hook.mdx +0 -30
  165. package/.next/standalone/docs/es/cli/install-policies.mdx +0 -47
  166. package/.next/standalone/docs/es/cli/list-policies.mdx +0 -31
  167. package/.next/standalone/docs/es/cli/remove-policies.mdx +0 -43
  168. package/.next/standalone/docs/es/cli/version.mdx +0 -12
  169. package/.next/standalone/docs/es/configuration.mdx +0 -222
  170. package/.next/standalone/docs/es/custom-policies.mdx +0 -353
  171. package/.next/standalone/docs/es/dashboard.mdx +0 -142
  172. package/.next/standalone/docs/es/examples.mdx +0 -307
  173. package/.next/standalone/docs/es/for-agents.mdx +0 -38
  174. package/.next/standalone/docs/es/getting-started.mdx +0 -186
  175. package/.next/standalone/docs/es/introduction.mdx +0 -57
  176. package/.next/standalone/docs/es/package-aliases.mdx +0 -82
  177. package/.next/standalone/docs/es/testing.mdx +0 -260
  178. package/.next/standalone/docs/examples.mdx +0 -307
  179. package/.next/standalone/docs/favicon.ico +0 -0
  180. package/.next/standalone/docs/for-agents.mdx +0 -38
  181. package/.next/standalone/docs/fr/architecture.mdx +0 -332
  182. package/.next/standalone/docs/fr/built-in-policies.mdx +0 -574
  183. package/.next/standalone/docs/fr/cli/dashboard.mdx +0 -28
  184. package/.next/standalone/docs/fr/cli/environment-variables.mdx +0 -34
  185. package/.next/standalone/docs/fr/cli/hook.mdx +0 -30
  186. package/.next/standalone/docs/fr/cli/install-policies.mdx +0 -47
  187. package/.next/standalone/docs/fr/cli/list-policies.mdx +0 -31
  188. package/.next/standalone/docs/fr/cli/remove-policies.mdx +0 -43
  189. package/.next/standalone/docs/fr/cli/version.mdx +0 -12
  190. package/.next/standalone/docs/fr/configuration.mdx +0 -222
  191. package/.next/standalone/docs/fr/custom-policies.mdx +0 -353
  192. package/.next/standalone/docs/fr/dashboard.mdx +0 -142
  193. package/.next/standalone/docs/fr/examples.mdx +0 -307
  194. package/.next/standalone/docs/fr/for-agents.mdx +0 -38
  195. package/.next/standalone/docs/fr/getting-started.mdx +0 -186
  196. package/.next/standalone/docs/fr/introduction.mdx +0 -57
  197. package/.next/standalone/docs/fr/package-aliases.mdx +0 -82
  198. package/.next/standalone/docs/fr/testing.mdx +0 -260
  199. package/.next/standalone/docs/getting-started.mdx +0 -186
  200. package/.next/standalone/docs/he/architecture.mdx +0 -333
  201. package/.next/standalone/docs/he/built-in-policies.mdx +0 -574
  202. package/.next/standalone/docs/he/cli/dashboard.mdx +0 -28
  203. package/.next/standalone/docs/he/cli/environment-variables.mdx +0 -34
  204. package/.next/standalone/docs/he/cli/hook.mdx +0 -30
  205. package/.next/standalone/docs/he/cli/install-policies.mdx +0 -47
  206. package/.next/standalone/docs/he/cli/list-policies.mdx +0 -32
  207. package/.next/standalone/docs/he/cli/remove-policies.mdx +0 -43
  208. package/.next/standalone/docs/he/cli/version.mdx +0 -12
  209. package/.next/standalone/docs/he/configuration.mdx +0 -223
  210. package/.next/standalone/docs/he/custom-policies.mdx +0 -353
  211. package/.next/standalone/docs/he/dashboard.mdx +0 -142
  212. package/.next/standalone/docs/he/examples.mdx +0 -307
  213. package/.next/standalone/docs/he/for-agents.mdx +0 -38
  214. package/.next/standalone/docs/he/getting-started.mdx +0 -186
  215. package/.next/standalone/docs/he/introduction.mdx +0 -57
  216. package/.next/standalone/docs/he/package-aliases.mdx +0 -82
  217. package/.next/standalone/docs/he/testing.mdx +0 -260
  218. package/.next/standalone/docs/hi/architecture.mdx +0 -334
  219. package/.next/standalone/docs/hi/built-in-policies.mdx +0 -576
  220. package/.next/standalone/docs/hi/cli/dashboard.mdx +0 -28
  221. package/.next/standalone/docs/hi/cli/environment-variables.mdx +0 -34
  222. package/.next/standalone/docs/hi/cli/hook.mdx +0 -30
  223. package/.next/standalone/docs/hi/cli/install-policies.mdx +0 -47
  224. package/.next/standalone/docs/hi/cli/list-policies.mdx +0 -31
  225. package/.next/standalone/docs/hi/cli/remove-policies.mdx +0 -43
  226. package/.next/standalone/docs/hi/cli/version.mdx +0 -12
  227. package/.next/standalone/docs/hi/configuration.mdx +0 -222
  228. package/.next/standalone/docs/hi/custom-policies.mdx +0 -354
  229. package/.next/standalone/docs/hi/dashboard.mdx +0 -142
  230. package/.next/standalone/docs/hi/examples.mdx +0 -309
  231. package/.next/standalone/docs/hi/for-agents.mdx +0 -38
  232. package/.next/standalone/docs/hi/getting-started.mdx +0 -187
  233. package/.next/standalone/docs/hi/introduction.mdx +0 -57
  234. package/.next/standalone/docs/hi/package-aliases.mdx +0 -82
  235. package/.next/standalone/docs/hi/testing.mdx +0 -260
  236. package/.next/standalone/docs/i18n/README.ar.md +0 -312
  237. package/.next/standalone/docs/i18n/README.de.md +0 -307
  238. package/.next/standalone/docs/i18n/README.es.md +0 -307
  239. package/.next/standalone/docs/i18n/README.fr.md +0 -307
  240. package/.next/standalone/docs/i18n/README.he.md +0 -312
  241. package/.next/standalone/docs/i18n/README.hi.md +0 -307
  242. package/.next/standalone/docs/i18n/README.it.md +0 -307
  243. package/.next/standalone/docs/i18n/README.ja.md +0 -307
  244. package/.next/standalone/docs/i18n/README.ko.md +0 -307
  245. package/.next/standalone/docs/i18n/README.pt-br.md +0 -307
  246. package/.next/standalone/docs/i18n/README.ru.md +0 -308
  247. package/.next/standalone/docs/i18n/README.tr.md +0 -307
  248. package/.next/standalone/docs/i18n/README.vi.md +0 -307
  249. package/.next/standalone/docs/i18n/README.zh.md +0 -307
  250. package/.next/standalone/docs/introduction.mdx +0 -57
  251. package/.next/standalone/docs/it/architecture.mdx +0 -334
  252. package/.next/standalone/docs/it/built-in-policies.mdx +0 -574
  253. package/.next/standalone/docs/it/cli/dashboard.mdx +0 -28
  254. package/.next/standalone/docs/it/cli/environment-variables.mdx +0 -34
  255. package/.next/standalone/docs/it/cli/hook.mdx +0 -30
  256. package/.next/standalone/docs/it/cli/install-policies.mdx +0 -47
  257. package/.next/standalone/docs/it/cli/list-policies.mdx +0 -31
  258. package/.next/standalone/docs/it/cli/remove-policies.mdx +0 -43
  259. package/.next/standalone/docs/it/cli/version.mdx +0 -12
  260. package/.next/standalone/docs/it/configuration.mdx +0 -222
  261. package/.next/standalone/docs/it/custom-policies.mdx +0 -353
  262. package/.next/standalone/docs/it/dashboard.mdx +0 -142
  263. package/.next/standalone/docs/it/examples.mdx +0 -307
  264. package/.next/standalone/docs/it/for-agents.mdx +0 -38
  265. package/.next/standalone/docs/it/getting-started.mdx +0 -186
  266. package/.next/standalone/docs/it/introduction.mdx +0 -57
  267. package/.next/standalone/docs/it/package-aliases.mdx +0 -82
  268. package/.next/standalone/docs/it/testing.mdx +0 -260
  269. package/.next/standalone/docs/ja/architecture.mdx +0 -332
  270. package/.next/standalone/docs/ja/built-in-policies.mdx +0 -572
  271. package/.next/standalone/docs/ja/cli/dashboard.mdx +0 -28
  272. package/.next/standalone/docs/ja/cli/environment-variables.mdx +0 -34
  273. package/.next/standalone/docs/ja/cli/hook.mdx +0 -30
  274. package/.next/standalone/docs/ja/cli/install-policies.mdx +0 -47
  275. package/.next/standalone/docs/ja/cli/list-policies.mdx +0 -31
  276. package/.next/standalone/docs/ja/cli/remove-policies.mdx +0 -43
  277. package/.next/standalone/docs/ja/cli/version.mdx +0 -12
  278. package/.next/standalone/docs/ja/configuration.mdx +0 -222
  279. package/.next/standalone/docs/ja/custom-policies.mdx +0 -353
  280. package/.next/standalone/docs/ja/dashboard.mdx +0 -142
  281. package/.next/standalone/docs/ja/examples.mdx +0 -307
  282. package/.next/standalone/docs/ja/for-agents.mdx +0 -38
  283. package/.next/standalone/docs/ja/getting-started.mdx +0 -186
  284. package/.next/standalone/docs/ja/introduction.mdx +0 -57
  285. package/.next/standalone/docs/ja/package-aliases.mdx +0 -82
  286. package/.next/standalone/docs/ja/testing.mdx +0 -260
  287. package/.next/standalone/docs/ko/architecture.mdx +0 -332
  288. package/.next/standalone/docs/ko/built-in-policies.mdx +0 -572
  289. package/.next/standalone/docs/ko/cli/dashboard.mdx +0 -28
  290. package/.next/standalone/docs/ko/cli/environment-variables.mdx +0 -34
  291. package/.next/standalone/docs/ko/cli/hook.mdx +0 -30
  292. package/.next/standalone/docs/ko/cli/install-policies.mdx +0 -47
  293. package/.next/standalone/docs/ko/cli/list-policies.mdx +0 -31
  294. package/.next/standalone/docs/ko/cli/remove-policies.mdx +0 -43
  295. package/.next/standalone/docs/ko/cli/version.mdx +0 -12
  296. package/.next/standalone/docs/ko/configuration.mdx +0 -222
  297. package/.next/standalone/docs/ko/custom-policies.mdx +0 -353
  298. package/.next/standalone/docs/ko/dashboard.mdx +0 -142
  299. package/.next/standalone/docs/ko/examples.mdx +0 -307
  300. package/.next/standalone/docs/ko/for-agents.mdx +0 -38
  301. package/.next/standalone/docs/ko/getting-started.mdx +0 -186
  302. package/.next/standalone/docs/ko/introduction.mdx +0 -57
  303. package/.next/standalone/docs/ko/package-aliases.mdx +0 -82
  304. package/.next/standalone/docs/ko/testing.mdx +0 -260
  305. package/.next/standalone/docs/logo/dark.svg +0 -21
  306. package/.next/standalone/docs/logo/exosphere-dark.png +0 -0
  307. package/.next/standalone/docs/logo/exosphere-light.png +0 -0
  308. package/.next/standalone/docs/logo/light.svg +0 -21
  309. package/.next/standalone/docs/package-aliases.mdx +0 -82
  310. package/.next/standalone/docs/pt-br/architecture.mdx +0 -332
  311. package/.next/standalone/docs/pt-br/built-in-policies.mdx +0 -574
  312. package/.next/standalone/docs/pt-br/cli/dashboard.mdx +0 -28
  313. package/.next/standalone/docs/pt-br/cli/environment-variables.mdx +0 -34
  314. package/.next/standalone/docs/pt-br/cli/hook.mdx +0 -30
  315. package/.next/standalone/docs/pt-br/cli/install-policies.mdx +0 -47
  316. package/.next/standalone/docs/pt-br/cli/list-policies.mdx +0 -31
  317. package/.next/standalone/docs/pt-br/cli/remove-policies.mdx +0 -43
  318. package/.next/standalone/docs/pt-br/cli/version.mdx +0 -12
  319. package/.next/standalone/docs/pt-br/configuration.mdx +0 -222
  320. package/.next/standalone/docs/pt-br/custom-policies.mdx +0 -353
  321. package/.next/standalone/docs/pt-br/dashboard.mdx +0 -142
  322. package/.next/standalone/docs/pt-br/examples.mdx +0 -307
  323. package/.next/standalone/docs/pt-br/for-agents.mdx +0 -38
  324. package/.next/standalone/docs/pt-br/getting-started.mdx +0 -186
  325. package/.next/standalone/docs/pt-br/introduction.mdx +0 -57
  326. package/.next/standalone/docs/pt-br/package-aliases.mdx +0 -82
  327. package/.next/standalone/docs/pt-br/testing.mdx +0 -260
  328. package/.next/standalone/docs/ru/architecture.mdx +0 -333
  329. package/.next/standalone/docs/ru/built-in-policies.mdx +0 -574
  330. package/.next/standalone/docs/ru/cli/dashboard.mdx +0 -28
  331. package/.next/standalone/docs/ru/cli/environment-variables.mdx +0 -34
  332. package/.next/standalone/docs/ru/cli/hook.mdx +0 -30
  333. package/.next/standalone/docs/ru/cli/install-policies.mdx +0 -48
  334. package/.next/standalone/docs/ru/cli/list-policies.mdx +0 -32
  335. package/.next/standalone/docs/ru/cli/remove-policies.mdx +0 -43
  336. package/.next/standalone/docs/ru/cli/version.mdx +0 -12
  337. package/.next/standalone/docs/ru/configuration.mdx +0 -222
  338. package/.next/standalone/docs/ru/custom-policies.mdx +0 -354
  339. package/.next/standalone/docs/ru/dashboard.mdx +0 -142
  340. package/.next/standalone/docs/ru/examples.mdx +0 -309
  341. package/.next/standalone/docs/ru/for-agents.mdx +0 -38
  342. package/.next/standalone/docs/ru/getting-started.mdx +0 -186
  343. package/.next/standalone/docs/ru/introduction.mdx +0 -57
  344. package/.next/standalone/docs/ru/package-aliases.mdx +0 -82
  345. package/.next/standalone/docs/ru/testing.mdx +0 -260
  346. package/.next/standalone/docs/testing.mdx +0 -260
  347. package/.next/standalone/docs/tr/architecture.mdx +0 -333
  348. package/.next/standalone/docs/tr/built-in-policies.mdx +0 -574
  349. package/.next/standalone/docs/tr/cli/dashboard.mdx +0 -28
  350. package/.next/standalone/docs/tr/cli/environment-variables.mdx +0 -34
  351. package/.next/standalone/docs/tr/cli/hook.mdx +0 -30
  352. package/.next/standalone/docs/tr/cli/install-policies.mdx +0 -47
  353. package/.next/standalone/docs/tr/cli/list-policies.mdx +0 -31
  354. package/.next/standalone/docs/tr/cli/remove-policies.mdx +0 -44
  355. package/.next/standalone/docs/tr/cli/version.mdx +0 -12
  356. package/.next/standalone/docs/tr/configuration.mdx +0 -222
  357. package/.next/standalone/docs/tr/custom-policies.mdx +0 -353
  358. package/.next/standalone/docs/tr/dashboard.mdx +0 -142
  359. package/.next/standalone/docs/tr/examples.mdx +0 -308
  360. package/.next/standalone/docs/tr/for-agents.mdx +0 -38
  361. package/.next/standalone/docs/tr/getting-started.mdx +0 -186
  362. package/.next/standalone/docs/tr/introduction.mdx +0 -57
  363. package/.next/standalone/docs/tr/package-aliases.mdx +0 -82
  364. package/.next/standalone/docs/tr/testing.mdx +0 -260
  365. package/.next/standalone/docs/vi/architecture.mdx +0 -334
  366. package/.next/standalone/docs/vi/built-in-policies.mdx +0 -575
  367. package/.next/standalone/docs/vi/cli/dashboard.mdx +0 -28
  368. package/.next/standalone/docs/vi/cli/environment-variables.mdx +0 -34
  369. package/.next/standalone/docs/vi/cli/hook.mdx +0 -30
  370. package/.next/standalone/docs/vi/cli/install-policies.mdx +0 -47
  371. package/.next/standalone/docs/vi/cli/list-policies.mdx +0 -31
  372. package/.next/standalone/docs/vi/cli/remove-policies.mdx +0 -43
  373. package/.next/standalone/docs/vi/cli/version.mdx +0 -13
  374. package/.next/standalone/docs/vi/configuration.mdx +0 -222
  375. package/.next/standalone/docs/vi/custom-policies.mdx +0 -353
  376. package/.next/standalone/docs/vi/dashboard.mdx +0 -142
  377. package/.next/standalone/docs/vi/examples.mdx +0 -308
  378. package/.next/standalone/docs/vi/for-agents.mdx +0 -38
  379. package/.next/standalone/docs/vi/getting-started.mdx +0 -186
  380. package/.next/standalone/docs/vi/introduction.mdx +0 -57
  381. package/.next/standalone/docs/vi/package-aliases.mdx +0 -82
  382. package/.next/standalone/docs/vi/testing.mdx +0 -260
  383. package/.next/standalone/docs/zh/architecture.mdx +0 -332
  384. package/.next/standalone/docs/zh/built-in-policies.mdx +0 -572
  385. package/.next/standalone/docs/zh/cli/dashboard.mdx +0 -28
  386. package/.next/standalone/docs/zh/cli/environment-variables.mdx +0 -34
  387. package/.next/standalone/docs/zh/cli/hook.mdx +0 -30
  388. package/.next/standalone/docs/zh/cli/install-policies.mdx +0 -47
  389. package/.next/standalone/docs/zh/cli/list-policies.mdx +0 -31
  390. package/.next/standalone/docs/zh/cli/remove-policies.mdx +0 -43
  391. package/.next/standalone/docs/zh/cli/version.mdx +0 -12
  392. package/.next/standalone/docs/zh/configuration.mdx +0 -222
  393. package/.next/standalone/docs/zh/custom-policies.mdx +0 -353
  394. package/.next/standalone/docs/zh/dashboard.mdx +0 -142
  395. package/.next/standalone/docs/zh/examples.mdx +0 -307
  396. package/.next/standalone/docs/zh/for-agents.mdx +0 -38
  397. package/.next/standalone/docs/zh/getting-started.mdx +0 -186
  398. package/.next/standalone/docs/zh/introduction.mdx +0 -57
  399. package/.next/standalone/docs/zh/package-aliases.mdx +0 -82
  400. package/.next/standalone/docs/zh/testing.mdx +0 -260
  401. package/.next/standalone/eslint.config.mjs +0 -15
  402. package/.next/standalone/examples/convention-policies/security-policies.mjs +0 -40
  403. package/.next/standalone/examples/convention-policies/workflow-policies.mjs +0 -41
  404. package/.next/standalone/examples/policies-advanced/index.js +0 -103
  405. package/.next/standalone/examples/policies-advanced/utils.js +0 -35
  406. package/.next/standalone/examples/policies-basic.js +0 -77
  407. package/.next/standalone/examples/policies-notification.js +0 -104
  408. package/.next/standalone/node_modules/@img/colour/color.cjs +0 -1594
  409. package/.next/standalone/node_modules/@img/colour/index.cjs +0 -1
  410. package/.next/standalone/node_modules/@img/colour/package.json +0 -45
  411. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/README.md +0 -46
  412. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  413. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +0 -1
  414. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  415. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/package.json +0 -42
  416. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/versions.json +0 -30
  417. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +0 -46
  418. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  419. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +0 -1
  420. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  421. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +0 -42
  422. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +0 -30
  423. package/.next/standalone/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
  424. package/.next/standalone/node_modules/@img/sharp-linux-x64/package.json +0 -46
  425. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
  426. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/package.json +0 -46
  427. package/.next/standalone/node_modules/detect-libc/lib/detect-libc.js +0 -313
  428. package/.next/standalone/node_modules/detect-libc/lib/elf.js +0 -39
  429. package/.next/standalone/node_modules/detect-libc/lib/filesystem.js +0 -51
  430. package/.next/standalone/node_modules/detect-libc/lib/process.js +0 -24
  431. package/.next/standalone/node_modules/detect-libc/package.json +0 -44
  432. package/.next/standalone/node_modules/sharp/lib/channel.js +0 -177
  433. package/.next/standalone/node_modules/sharp/lib/colour.js +0 -195
  434. package/.next/standalone/node_modules/sharp/lib/composite.js +0 -212
  435. package/.next/standalone/node_modules/sharp/lib/constructor.js +0 -499
  436. package/.next/standalone/node_modules/sharp/lib/index.js +0 -16
  437. package/.next/standalone/node_modules/sharp/lib/input.js +0 -809
  438. package/.next/standalone/node_modules/sharp/lib/is.js +0 -143
  439. package/.next/standalone/node_modules/sharp/lib/libvips.js +0 -207
  440. package/.next/standalone/node_modules/sharp/lib/operation.js +0 -1016
  441. package/.next/standalone/node_modules/sharp/lib/output.js +0 -1666
  442. package/.next/standalone/node_modules/sharp/lib/resize.js +0 -595
  443. package/.next/standalone/node_modules/sharp/lib/sharp.js +0 -121
  444. package/.next/standalone/node_modules/sharp/lib/utility.js +0 -291
  445. package/.next/standalone/node_modules/sharp/node_modules/semver/classes/comparator.js +0 -143
  446. package/.next/standalone/node_modules/sharp/node_modules/semver/classes/range.js +0 -557
  447. package/.next/standalone/node_modules/sharp/node_modules/semver/classes/semver.js +0 -333
  448. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/cmp.js +0 -54
  449. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/coerce.js +0 -62
  450. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/compare.js +0 -7
  451. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/eq.js +0 -5
  452. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gt.js +0 -5
  453. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gte.js +0 -5
  454. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lt.js +0 -5
  455. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lte.js +0 -5
  456. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/neq.js +0 -5
  457. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/parse.js +0 -18
  458. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/satisfies.js +0 -12
  459. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/constants.js +0 -37
  460. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/debug.js +0 -11
  461. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/identifiers.js +0 -29
  462. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/lrucache.js +0 -42
  463. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/parse-options.js +0 -17
  464. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/re.js +0 -223
  465. package/.next/standalone/node_modules/sharp/node_modules/semver/package.json +0 -78
  466. package/.next/standalone/node_modules/sharp/package.json +0 -202
  467. package/.next/standalone/scripts/alias-proxy.js +0 -18
  468. package/.next/standalone/scripts/dev.ts +0 -3
  469. package/.next/standalone/scripts/install-telemetry.mjs +0 -108
  470. package/.next/standalone/scripts/launch.ts +0 -83
  471. package/.next/standalone/scripts/parse-script-args.ts +0 -87
  472. package/.next/standalone/scripts/postinstall.mjs +0 -121
  473. package/.next/standalone/scripts/preuninstall.mjs +0 -131
  474. package/.next/standalone/scripts/publish-aliases.mjs +0 -87
  475. package/.next/standalone/scripts/start.ts +0 -3
  476. package/.next/standalone/scripts/sync-hook-events-prompt.md +0 -60
  477. package/.next/standalone/scripts/translate-docs/cache.ts +0 -62
  478. package/.next/standalone/scripts/translate-docs/cli.ts +0 -357
  479. package/.next/standalone/scripts/translate-docs/config.ts +0 -248
  480. package/.next/standalone/scripts/translate-docs/mdx-translator.ts +0 -153
  481. package/.next/standalone/scripts/translate-docs/mintlify-nav.ts +0 -107
  482. package/.next/standalone/scripts/translate-docs/readme-translator.ts +0 -154
  483. package/.next/standalone/scripts/translate-docs/translator.ts +0 -68
  484. package/.next/standalone/scripts/translate-docs/types.ts +0 -43
  485. package/.next/standalone/src/cli-error.ts +0 -18
  486. package/.next/standalone/src/hooks/builtin-policies.ts +0 -1613
  487. package/.next/standalone/src/hooks/custom-hooks-loader.ts +0 -205
  488. package/.next/standalone/src/hooks/custom-hooks-registry.ts +0 -30
  489. package/.next/standalone/src/hooks/handler.ts +0 -202
  490. package/.next/standalone/src/hooks/hook-activity-store.ts +0 -349
  491. package/.next/standalone/src/hooks/hook-logger.ts +0 -133
  492. package/.next/standalone/src/hooks/hook-telemetry.ts +0 -43
  493. package/.next/standalone/src/hooks/hooks-config.ts +0 -166
  494. package/.next/standalone/src/hooks/install-prompt.ts +0 -357
  495. package/.next/standalone/src/hooks/llm-client.ts +0 -90
  496. package/.next/standalone/src/hooks/loader-utils.ts +0 -178
  497. package/.next/standalone/src/hooks/manager.ts +0 -692
  498. package/.next/standalone/src/hooks/policy-evaluator.ts +0 -224
  499. package/.next/standalone/src/hooks/policy-helpers.ts +0 -16
  500. package/.next/standalone/src/hooks/policy-registry.ts +0 -90
  501. package/.next/standalone/src/hooks/policy-types.ts +0 -77
  502. package/.next/standalone/src/hooks/types.ts +0 -63
  503. package/.next/standalone/src/index.ts +0 -19
  504. package/.next/standalone/src/posthog-key.ts +0 -5
  505. package/.next/standalone/tailwind.config.ts +0 -11
  506. package/.next/standalone/tsconfig.json +0 -42
  507. package/.next/standalone/vitest.config.e2e.mts +0 -24
  508. package/.next/standalone/vitest.config.mts +0 -23
  509. /package/.next/standalone/.next/static/{A9pNTZdoYJTVyPAYwQMx5 → wOkJXoch1UmRAmyIuKZWc}/_buildManifest.js +0 -0
  510. /package/.next/standalone/.next/static/{A9pNTZdoYJTVyPAYwQMx5 → wOkJXoch1UmRAmyIuKZWc}/_clientMiddlewareManifest.js +0 -0
  511. /package/.next/standalone/.next/static/{A9pNTZdoYJTVyPAYwQMx5 → wOkJXoch1UmRAmyIuKZWc}/_ssgManifest.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "failproofai",
3
- "version": "0.0.6-beta.2",
3
+ "version": "0.0.6-beta.4",
4
4
  "description": "The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",
5
5
  "bin": {
6
6
  "failproofai": "./dist/cli.mjs"
@@ -22,7 +22,7 @@
22
22
  "predev": "bun run build:cli && bun link",
23
23
  "dev": "FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020",
24
24
  "build:cli": "bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"",
25
- "build": "bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\"",
25
+ "build": "bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",
26
26
  "prestart": "bun run build:cli && bun link",
27
27
  "start": "FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",
28
28
  "test": "vitest",
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env node
2
+ // Prune .next/standalone to shrink the published npm tarball.
3
+ // Safe because (a) images.unoptimized: true in next.config.ts, so sharp never loads,
4
+ // and (b) we only touch .next/standalone/node_modules — server.js and app code untouched.
5
+
6
+ import { readdirSync, rmSync, statSync, unlinkSync } from "node:fs";
7
+ import { dirname, join, resolve } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+
10
+ const __dirname = dirname(fileURLToPath(import.meta.url));
11
+ const ROOT = resolve(__dirname, "..");
12
+ const STANDALONE = join(ROOT, ".next", "standalone");
13
+ const NM = join(STANDALONE, "node_modules");
14
+
15
+ function exists(p) {
16
+ try { statSync(p); return true; } catch { return false; }
17
+ }
18
+
19
+ function measure(dir) {
20
+ let bytes = 0, files = 0;
21
+ function walk(p) {
22
+ let entries;
23
+ try { entries = readdirSync(p, { withFileTypes: true }); } catch { return; }
24
+ for (const e of entries) {
25
+ const child = join(p, e.name);
26
+ if (e.isDirectory()) walk(child);
27
+ else if (e.isFile()) { bytes += statSync(child).size; files += 1; }
28
+ }
29
+ }
30
+ walk(dir);
31
+ return { bytes, files };
32
+ }
33
+
34
+ const JUNK_DIRS = new Set([
35
+ "test", "tests", "__tests__",
36
+ "doc", "docs",
37
+ "example", "examples",
38
+ ".github", ".vscode", ".idea",
39
+ ]);
40
+
41
+ const JUNK_FILE_BASENAMES = new Set([
42
+ ".npmignore", ".gitignore", ".gitattributes",
43
+ ".eslintrc", ".eslintrc.js", ".eslintrc.json", ".eslintrc.yml",
44
+ ".prettierrc", ".prettierrc.js", ".prettierrc.json",
45
+ ".editorconfig", ".travis.yml", ".nycrc",
46
+ "AUTHORS", "CONTRIBUTORS", "HISTORY", "HISTORY.md",
47
+ "CHANGELOG", "CHANGELOG.md", "CHANGES", "CHANGES.md",
48
+ ]);
49
+
50
+ function isJunkFile(name) {
51
+ const lower = name.toLowerCase();
52
+ if (JUNK_FILE_BASENAMES.has(name) || JUNK_FILE_BASENAMES.has(lower)) return true;
53
+ if (lower.endsWith(".md") || lower.endsWith(".markdown")) return true;
54
+ if (lower.endsWith(".map")) return true;
55
+ if (lower.endsWith(".ts.map")) return true;
56
+ return false;
57
+ }
58
+
59
+ function prune(dir) {
60
+ let entries;
61
+ try { entries = readdirSync(dir, { withFileTypes: true }); } catch { return; }
62
+ for (const e of entries) {
63
+ const p = join(dir, e.name);
64
+ if (e.isDirectory()) {
65
+ if (JUNK_DIRS.has(e.name)) {
66
+ rmSync(p, { recursive: true, force: true });
67
+ continue;
68
+ }
69
+ prune(p);
70
+ } else if (e.isFile()) {
71
+ if (isJunkFile(e.name)) {
72
+ try { unlinkSync(p); } catch { /* ignore */ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ if (!exists(STANDALONE)) {
79
+ console.error(`[prune-standalone] ${STANDALONE} does not exist — did you run \`next build\`?`);
80
+ process.exit(1);
81
+ }
82
+
83
+ const before = measure(STANDALONE);
84
+
85
+ // 1. Drop sharp — image optimization is disabled globally (next.config.ts).
86
+ for (const pkg of ["@img", "sharp"]) {
87
+ rmSync(join(NM, pkg), { recursive: true, force: true });
88
+ }
89
+
90
+ // 2. Strip docs / tests / sourcemaps from remaining node_modules.
91
+ if (exists(NM)) prune(NM);
92
+
93
+ // 3. Remove over-traced project artifacts from the standalone root.
94
+ // Next.js NFT pulls in too much (tracked warning: "whole project was traced
95
+ // unintentionally"). The Next server only actually needs server.js, .next/,
96
+ // node_modules/, package.json, public/, and the compiled app code — the rest
97
+ // is source/dev/docs that the runtime never reads.
98
+ const STANDALONE_ROOT_PRUNE = [
99
+ // Doc / dev directories
100
+ "docs", "examples", "design-docs", "__tests__",
101
+ ".claude", ".failproofai", ".github", ".vscode", ".idea",
102
+ // Failproofai CLI artifacts — the dashboard never loads these
103
+ "bin", "dist", "scripts", "src",
104
+ ];
105
+ const STANDALONE_ROOT_PRUNE_FILES = [
106
+ // Top-level markdown / licenses / docs
107
+ "README.md", "CHANGELOG.md", "CLAUDE.md", "AGENTS.md", "CONTRIBUTING.md",
108
+ "LICENSE", "Dockerfile.docs",
109
+ // Build / lint / test config (applied at build time, not runtime)
110
+ "tsconfig.json", "eslint.config.mjs", "tailwind.config.ts", "components.json",
111
+ "vitest.config.mts", "vitest.config.e2e.mts",
112
+ // Lockfiles
113
+ "bun.lock", "bun.lockb", "package-lock.json", "yarn.lock",
114
+ ];
115
+ for (const d of STANDALONE_ROOT_PRUNE) {
116
+ rmSync(join(STANDALONE, d), { recursive: true, force: true });
117
+ }
118
+ for (const f of STANDALONE_ROOT_PRUNE_FILES) {
119
+ try { unlinkSync(join(STANDALONE, f)); } catch { /* ignore */ }
120
+ }
121
+
122
+ const after = measure(STANDALONE);
123
+ const mb = (b) => (b / (1024 * 1024)).toFixed(2);
124
+ console.log(
125
+ `[prune-standalone] ${before.files} files / ${mb(before.bytes)} MB -> ` +
126
+ `${after.files} files / ${mb(after.bytes)} MB ` +
127
+ `(saved ${before.files - after.files} files / ${mb(before.bytes - after.bytes)} MB)`
128
+ );
@@ -0,0 +1,104 @@
1
+ import { spawn } from "node:child_process";
2
+ import { platform } from "node:os";
3
+ import { writeTokens, type AuthTokens } from "./token-store";
4
+
5
+ const DEFAULT_SERVER_URL = process.env.FAILPROOFAI_SERVER_URL ?? "https://api.befailproof.ai";
6
+ const HTTP_TIMEOUT_MS = 10_000;
7
+
8
+ interface DeviceCodeResponse {
9
+ device_code: string;
10
+ user_code: string;
11
+ verification_url: string;
12
+ expires_in: number;
13
+ interval: number;
14
+ }
15
+
16
+ interface TokenResponse {
17
+ access_token: string;
18
+ refresh_token: string;
19
+ expires_in: number;
20
+ user: { id: string; email: string; name?: string };
21
+ }
22
+
23
+ function openBrowser(url: string): void {
24
+ const os = platform();
25
+ try {
26
+ if (os === "darwin") {
27
+ spawn("open", [url], { detached: true, stdio: "ignore" }).unref();
28
+ } else if (os === "win32") {
29
+ // On cmd's `start`, the first quoted token is treated as a window
30
+ // title. Pass an empty title so URLs containing "&" or spaces are
31
+ // interpreted as the target, not the title.
32
+ spawn("cmd", ["/c", "start", "", url], { detached: true, stdio: "ignore" }).unref();
33
+ } else {
34
+ spawn("xdg-open", [url], { detached: true, stdio: "ignore" }).unref();
35
+ }
36
+ } catch {
37
+ // Fallback: the URL is already printed above.
38
+ }
39
+ }
40
+
41
+ async function postJson<T>(url: string, body: unknown, timeoutMs = HTTP_TIMEOUT_MS): Promise<T> {
42
+ const resp = await fetch(url, {
43
+ method: "POST",
44
+ headers: { "Content-Type": "application/json" },
45
+ body: JSON.stringify(body),
46
+ signal: AbortSignal.timeout(timeoutMs),
47
+ });
48
+ if (!resp.ok) {
49
+ throw new Error(`${url} → ${resp.status} ${resp.statusText}`);
50
+ }
51
+ return (await resp.json()) as T;
52
+ }
53
+
54
+ export async function login(): Promise<void> {
55
+ const serverUrl = DEFAULT_SERVER_URL;
56
+
57
+ console.log("Requesting device code...");
58
+ const dc = await postJson<DeviceCodeResponse>(`${serverUrl}/api/v1/auth/device-code`, {});
59
+
60
+ console.log(`\n Open this URL in your browser (will be opened automatically):`);
61
+ console.log(` ${dc.verification_url}\n`);
62
+ console.log(` Your code: ${dc.user_code}\n`);
63
+
64
+ openBrowser(dc.verification_url);
65
+
66
+ const deadline = Date.now() + dc.expires_in * 1000;
67
+ const intervalMs = dc.interval * 1000;
68
+
69
+ while (Date.now() < deadline) {
70
+ await new Promise((r) => setTimeout(r, intervalMs));
71
+ try {
72
+ const result = await postJson<TokenResponse | { status: string }>(
73
+ `${serverUrl}/api/v1/auth/device-token`,
74
+ { device_code: dc.device_code },
75
+ );
76
+ if ("access_token" in result) {
77
+ const tokens: AuthTokens = {
78
+ access_token: result.access_token,
79
+ refresh_token: result.refresh_token,
80
+ expires_at: Math.floor(Date.now() / 1000) + result.expires_in,
81
+ user_email: result.user.email,
82
+ user_id: result.user.id,
83
+ server_url: serverUrl,
84
+ };
85
+ writeTokens(tokens);
86
+ console.log(`Logged in as ${result.user.email}`);
87
+
88
+ // Auto-start relay daemon
89
+ try {
90
+ const { ensureRelayRunning } = await import("../relay/daemon");
91
+ ensureRelayRunning();
92
+ console.log("Relay daemon started.");
93
+ } catch (e) {
94
+ console.warn("Failed to auto-start relay daemon:", e);
95
+ }
96
+ return;
97
+ }
98
+ } catch {
99
+ // Pending or transient error — keep polling
100
+ }
101
+ }
102
+
103
+ throw new Error("Login timed out. Run `failproofai login` again.");
104
+ }
@@ -0,0 +1,50 @@
1
+ import { readTokens, clearTokens } from "./token-store";
2
+ import { stopRelay } from "../relay/pid";
3
+
4
+ const LOGOUT_TIMEOUT_MS = 3_000;
5
+
6
+ export async function logout(): Promise<void> {
7
+ const tokens = readTokens();
8
+ if (!tokens) {
9
+ console.log("Not logged in.");
10
+ return;
11
+ }
12
+
13
+ // Best-effort server revoke with a short timeout — the local logout
14
+ // must not block on a slow network.
15
+ try {
16
+ await fetch(`${tokens.server_url}/api/v1/auth/logout`, {
17
+ method: "POST",
18
+ headers: { "Content-Type": "application/json" },
19
+ body: JSON.stringify({ refresh_token: tokens.refresh_token }),
20
+ signal: AbortSignal.timeout(LOGOUT_TIMEOUT_MS),
21
+ });
22
+ } catch {
23
+ // Network or timeout — proceed to local clear anyway
24
+ }
25
+
26
+ try {
27
+ stopRelay();
28
+ } catch {
29
+ // Best-effort daemon stop
30
+ }
31
+
32
+ clearTokens();
33
+ console.log("Logged out.");
34
+ }
35
+
36
+ export function whoami(): void {
37
+ const tokens = readTokens();
38
+ if (!tokens) {
39
+ console.log("Not logged in. Run `failproofai login` to authenticate.");
40
+ process.exit(1);
41
+ }
42
+ console.log(`Logged in as ${tokens.user_email}`);
43
+ console.log(`Server: ${tokens.server_url}`);
44
+ const expiresIn = tokens.expires_at - Math.floor(Date.now() / 1000);
45
+ if (expiresIn > 0) {
46
+ console.log(`Access token expires in ${Math.floor(expiresIn / 60)} minutes`);
47
+ } else {
48
+ console.log(`Access token expired (will refresh on next use)`);
49
+ }
50
+ }
@@ -0,0 +1,64 @@
1
+ import {
2
+ readFileSync,
3
+ writeFileSync,
4
+ existsSync,
5
+ mkdirSync,
6
+ unlinkSync,
7
+ renameSync,
8
+ openSync,
9
+ closeSync,
10
+ } from "node:fs";
11
+ import { join } from "node:path";
12
+ import { homedir } from "node:os";
13
+
14
+ export interface AuthTokens {
15
+ access_token: string;
16
+ refresh_token: string;
17
+ expires_at: number;
18
+ user_email: string;
19
+ user_id: string;
20
+ server_url: string;
21
+ }
22
+
23
+ const AUTH_DIR = join(homedir(), ".failproofai");
24
+ const AUTH_FILE = join(AUTH_DIR, "auth.json");
25
+
26
+ function ensureAuthDir(): void {
27
+ if (!existsSync(AUTH_DIR)) mkdirSync(AUTH_DIR, { recursive: true, mode: 0o700 });
28
+ }
29
+
30
+ export function readTokens(): AuthTokens | null {
31
+ if (!existsSync(AUTH_FILE)) return null;
32
+ try {
33
+ const raw = readFileSync(AUTH_FILE, "utf8");
34
+ return JSON.parse(raw) as AuthTokens;
35
+ } catch {
36
+ return null;
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Write tokens atomically with 0600 permissions *from creation*.
42
+ * We open with O_WRONLY|O_CREAT|O_TRUNC and explicit mode 0600 so the
43
+ * file is never world-readable, not even briefly during the write.
44
+ * Then rename into place (atomic on POSIX).
45
+ */
46
+ export function writeTokens(tokens: AuthTokens): void {
47
+ ensureAuthDir();
48
+ const tmpPath = `${AUTH_FILE}.tmp`;
49
+ const fd = openSync(tmpPath, "w", 0o600);
50
+ try {
51
+ writeFileSync(fd, JSON.stringify(tokens, null, 2));
52
+ } finally {
53
+ closeSync(fd);
54
+ }
55
+ renameSync(tmpPath, AUTH_FILE);
56
+ }
57
+
58
+ export function clearTokens(): void {
59
+ if (existsSync(AUTH_FILE)) unlinkSync(AUTH_FILE);
60
+ }
61
+
62
+ export function isLoggedIn(): boolean {
63
+ return existsSync(AUTH_FILE);
64
+ }
@@ -171,7 +171,7 @@ function getCurrentBranch(cwd: string): string | null {
171
171
  if (branch === undefined) {
172
172
  branch = execSync("git rev-parse --abbrev-ref HEAD", {
173
173
  cwd,
174
- encoding: "utf8",
174
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
175
175
  timeout: 3000,
176
176
  }).trim();
177
177
  gitBranchCache.set(cwd, branch);
@@ -186,7 +186,7 @@ function getHeadSha(cwd: string): string | null {
186
186
  try {
187
187
  const sha = execSync("git rev-parse HEAD", {
188
188
  cwd,
189
- encoding: "utf8",
189
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
190
190
  timeout: 3000,
191
191
  }).trim();
192
192
  return sha || null;
@@ -214,7 +214,7 @@ function getThirdPartyCheckRuns(cwd: string, sha: string): CiCheck[] {
214
214
  ],
215
215
  {
216
216
  cwd,
217
- encoding: "utf8",
217
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
218
218
  timeout: 15000,
219
219
  },
220
220
  ).trim();
@@ -239,7 +239,7 @@ function getCommitStatuses(cwd: string, sha: string): CiCheck[] {
239
239
  ],
240
240
  {
241
241
  cwd,
242
- encoding: "utf8",
242
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
243
243
  timeout: 15000,
244
244
  },
245
245
  ).trim();
@@ -676,7 +676,9 @@ function extractAbsolutePaths(command: string): string[] {
676
676
  }
677
677
 
678
678
  function blockReadOutsideCwd(ctx: PolicyContext): PolicyResult {
679
- const cwd = ctx.session?.cwd;
679
+ // Prefer $CLAUDE_PROJECT_DIR (stable project root) over ctx.session.cwd,
680
+ // which tracks the live shell CWD and drifts when Claude `cd`s into a subdir.
681
+ const cwd = process.env.CLAUDE_PROJECT_DIR || ctx.session?.cwd;
680
682
  if (!cwd) return allow(); // Can't enforce without cwd
681
683
 
682
684
  const allowPaths = ((ctx.params?.allowPaths ?? []) as string[]);
@@ -964,7 +966,7 @@ function requireCommitBeforeStop(ctx: PolicyContext): PolicyResult {
964
966
  try {
965
967
  const status = execSync("git status --porcelain", {
966
968
  cwd,
967
- encoding: "utf8",
969
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
968
970
  timeout: 5000,
969
971
  }).trim();
970
972
 
@@ -986,7 +988,7 @@ function requirePushBeforeStop(ctx: PolicyContext): PolicyResult {
986
988
  try {
987
989
  const remotes = execSync("git remote", {
988
990
  cwd,
989
- encoding: "utf8",
991
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
990
992
  timeout: 3000,
991
993
  }).trim();
992
994
 
@@ -1009,7 +1011,7 @@ function requirePushBeforeStop(ctx: PolicyContext): PolicyResult {
1009
1011
  const ahead = execFileSync(
1010
1012
  "git",
1011
1013
  ["log", `${remote}/${baseBranch}..HEAD`, "--oneline"],
1012
- { cwd, encoding: "utf8", timeout: 5000 },
1014
+ { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 5000 },
1013
1015
  ).trim();
1014
1016
 
1015
1017
  if (!ahead) {
@@ -1022,7 +1024,7 @@ function requirePushBeforeStop(ctx: PolicyContext): PolicyResult {
1022
1024
  const diff = execFileSync(
1023
1025
  "git",
1024
1026
  ["diff", "--stat", `${remote}/${baseBranch}`, "HEAD"],
1025
- { cwd, encoding: "utf8", timeout: 5000 },
1027
+ { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 5000 },
1026
1028
  ).trim();
1027
1029
 
1028
1030
  if (!diff) {
@@ -1037,7 +1039,7 @@ function requirePushBeforeStop(ctx: PolicyContext): PolicyResult {
1037
1039
  try {
1038
1040
  execFileSync("git", ["rev-parse", "--verify", `${remote}/${branch}`], {
1039
1041
  cwd,
1040
- encoding: "utf8",
1042
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
1041
1043
  timeout: 3000,
1042
1044
  });
1043
1045
  hasTracking = true;
@@ -1055,7 +1057,7 @@ function requirePushBeforeStop(ctx: PolicyContext): PolicyResult {
1055
1057
  // Check for unpushed commits
1056
1058
  const unpushed = execFileSync("git", ["log", `${remote}/${branch}..HEAD`, "--oneline"], {
1057
1059
  cwd,
1058
- encoding: "utf8",
1060
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
1059
1061
  timeout: 5000,
1060
1062
  }).trim();
1061
1063
 
@@ -1080,7 +1082,7 @@ function requirePrBeforeStop(ctx: PolicyContext): PolicyResult {
1080
1082
  try {
1081
1083
  // Check if gh CLI is available
1082
1084
  try {
1083
- execSync("gh --version", { cwd, encoding: "utf8", timeout: 3000 });
1085
+ execSync("gh --version", { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 3000 });
1084
1086
  } catch {
1085
1087
  return allow("GitHub CLI (gh) not installed, skipping PR check.");
1086
1088
  }
@@ -1100,7 +1102,7 @@ function requirePrBeforeStop(ctx: PolicyContext): PolicyResult {
1100
1102
  const ahead = execFileSync(
1101
1103
  "git",
1102
1104
  ["log", `origin/${baseBranch}..HEAD`, "--oneline"],
1103
- { cwd, encoding: "utf8", timeout: 5000 },
1105
+ { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 5000 },
1104
1106
  ).trim();
1105
1107
 
1106
1108
  if (!ahead) {
@@ -1113,7 +1115,7 @@ function requirePrBeforeStop(ctx: PolicyContext): PolicyResult {
1113
1115
  const diff = execFileSync(
1114
1116
  "git",
1115
1117
  ["diff", "--stat", `origin/${baseBranch}`, "HEAD"],
1116
- { cwd, encoding: "utf8", timeout: 5000 },
1118
+ { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 5000 },
1117
1119
  ).trim();
1118
1120
 
1119
1121
  if (!diff) {
@@ -1128,7 +1130,7 @@ function requirePrBeforeStop(ctx: PolicyContext): PolicyResult {
1128
1130
  try {
1129
1131
  prJson = execSync("gh pr view --json number,url,state", {
1130
1132
  cwd,
1131
- encoding: "utf8",
1133
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
1132
1134
  timeout: 15000,
1133
1135
  }).trim();
1134
1136
  } catch {
@@ -1151,13 +1153,13 @@ function requirePrBeforeStop(ctx: PolicyContext): PolicyResult {
1151
1153
  try {
1152
1154
  execFileSync("git", ["fetch", "origin", `+refs/heads/${baseBranch}:refs/remotes/origin/${baseBranch}`], {
1153
1155
  cwd,
1154
- encoding: "utf8",
1156
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
1155
1157
  timeout: 10000,
1156
1158
  });
1157
1159
  const freshAhead = execFileSync(
1158
1160
  "git",
1159
1161
  ["log", `origin/${baseBranch}..HEAD`, "--oneline"],
1160
- { cwd, encoding: "utf8", timeout: 5000 },
1162
+ { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 5000 },
1161
1163
  ).trim();
1162
1164
  if (!freshAhead) {
1163
1165
  return allow(`PR #${pr.number} was merged; branch is up to date with ${baseBranch}.`);
@@ -1165,7 +1167,7 @@ function requirePrBeforeStop(ctx: PolicyContext): PolicyResult {
1165
1167
  const freshDiff = execFileSync(
1166
1168
  "git",
1167
1169
  ["diff", "--stat", `origin/${baseBranch}`, "HEAD"],
1168
- { cwd, encoding: "utf8", timeout: 5000 },
1170
+ { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 5000 },
1169
1171
  ).trim();
1170
1172
  if (!freshDiff) {
1171
1173
  return allow(`PR #${pr.number} was merged; no file changes vs ${baseBranch}.`);
@@ -1190,7 +1192,7 @@ function requireCiGreenBeforeStop(ctx: PolicyContext): PolicyResult {
1190
1192
  try {
1191
1193
  // Check if gh CLI is available
1192
1194
  try {
1193
- execSync("gh --version", { cwd, encoding: "utf8", timeout: 3000 });
1195
+ execSync("gh --version", { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 3000 });
1194
1196
  } catch {
1195
1197
  return allow("GitHub CLI (gh) not installed, skipping CI check.");
1196
1198
  }
@@ -1204,7 +1206,7 @@ function requireCiGreenBeforeStop(ctx: PolicyContext): PolicyResult {
1204
1206
  const runsJson = execFileSync(
1205
1207
  "gh",
1206
1208
  ["run", "list", "--branch", branch, "--limit", "5", "--json", "status,conclusion,name"],
1207
- { cwd, encoding: "utf8", timeout: 15000 },
1209
+ { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 15000 },
1208
1210
  ).trim();
1209
1211
 
1210
1212
  if (runsJson && runsJson !== "[]") {
@@ -148,26 +148,46 @@ export async function handleHookEvent(eventType: string): Promise<number> {
148
148
  }
149
149
 
150
150
  // Persist activity to disk (visible in /policies activity tab)
151
+ const activityEntry = {
152
+ timestamp: Date.now(),
153
+ eventType,
154
+ toolName: (parsed.tool_name as string) ?? null,
155
+ policyName: result.policyName,
156
+ policyNames: result.policyNames,
157
+ decision: result.decision,
158
+ reason: result.reason,
159
+ durationMs,
160
+ sessionId: session.sessionId,
161
+ transcriptPath: session.transcriptPath,
162
+ cwd: session.cwd,
163
+ permissionMode: session.permissionMode,
164
+ hookEventName: session.hookEventName,
165
+ };
151
166
  try {
152
- persistHookActivity({
153
- timestamp: Date.now(),
154
- eventType,
155
- toolName: (parsed.tool_name as string) ?? null,
156
- policyName: result.policyName,
157
- policyNames: result.policyNames,
158
- decision: result.decision,
159
- reason: result.reason,
160
- durationMs,
161
- sessionId: session.sessionId,
162
- transcriptPath: session.transcriptPath,
163
- cwd: session.cwd,
164
- permissionMode: session.permissionMode,
165
- hookEventName: session.hookEventName,
166
- });
167
+ persistHookActivity(activityEntry);
167
168
  } catch {
168
169
  hookLogWarn("activity persistence failed");
169
170
  }
170
171
 
172
+ // Enqueue for server relay — fire-and-forget, never blocks hook.
173
+ // queue.ts is a no-op if the user is not logged in (no auth.json), and
174
+ // sanitizes the entry before persisting (drops toolInput/transcriptPath,
175
+ // hashes cwd, redacts known secret patterns in `reason`).
176
+ try {
177
+ const { appendToServerQueue } = await import("../relay/queue");
178
+ appendToServerQueue(activityEntry);
179
+ } catch {
180
+ // Server queue is best-effort; fail-open
181
+ }
182
+
183
+ // Lazy-start relay daemon if user is logged in — ~1ms when already running
184
+ try {
185
+ const { ensureRelayRunning } = await import("../relay/daemon");
186
+ ensureRelayRunning();
187
+ } catch {
188
+ // Relay is best-effort; hook must succeed regardless
189
+ }
190
+
171
191
  // Fire PostHog telemetry for decisions that affect Claude's behavior
172
192
  if (result.decision === "deny" || result.decision === "instruct") {
173
193
  try {