failproofai 1.0.10 → 1.0.11-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +6 -6
  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/build-manifest.json +3 -3
  6. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page.js +4 -4
  8. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  9. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.meta +8 -0
  12. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  13. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
  14. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  15. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
  17. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  18. package/.next/standalone/.next/server/app/_not-found/page.js +4 -4
  19. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  21. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  22. package/.next/standalone/.next/server/app/_not-found.meta +8 -0
  23. package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
  24. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  25. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
  26. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  27. package/.next/standalone/.next/server/app/api/audit/invite/route.js +4 -4
  28. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/audit/run/route.js +4 -4
  30. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/audit/status/route.js +1 -1
  32. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/auth/login-request/route.js +2 -2
  34. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +4 -4
  36. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/auth/logout/route.js +3 -3
  38. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/auth/status/route.js +3 -3
  40. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +1 -1
  42. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/audit/page/build-manifest.json +3 -3
  44. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  45. package/.next/standalone/.next/server/app/audit/page.js +4 -4
  46. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  48. package/.next/standalone/.next/server/app/index.html +1 -1
  49. package/.next/standalone/.next/server/app/index.meta +8 -0
  50. package/.next/standalone/.next/server/app/index.rsc +14 -14
  51. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
  52. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
  53. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  54. package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
  55. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  56. package/.next/standalone/.next/server/app/page.js +4 -4
  57. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  59. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +3 -3
  60. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
  61. package/.next/standalone/.next/server/app/policies/page.js +8 -8
  62. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  64. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +3 -3
  65. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  66. package/.next/standalone/.next/server/app/project/[name]/page.js +5 -5
  67. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +3 -3
  70. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  71. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  72. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +5 -5
  73. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +3 -3
  76. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  77. package/.next/standalone/.next/server/app/projects/page.js +5 -5
  78. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  80. package/.next/standalone/.next/server/app/settings/page/build-manifest.json +3 -3
  81. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +8 -8
  82. package/.next/standalone/.next/server/app/settings/page.js +9 -9
  83. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  84. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  85. package/.next/standalone/.next/server/chunks/{[externals]__0qxhecv._.js → [externals]__0d7i9ea._.js} +2 -2
  86. package/.next/standalone/.next/server/chunks/{[externals]__0sg9-3p._.js → [externals]__0hjaw70._.js} +1 -1
  87. package/.next/standalone/.next/server/chunks/[externals]__1_9ze9b._.js +3 -0
  88. package/.next/standalone/.next/server/chunks/[externals]__1oenfmn._.js +3 -0
  89. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08dchfu._.js +1 -1
  90. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ga9hs7._.js +3 -0
  91. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l3yhx4._.js +2 -2
  92. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0moxohc._.js +22 -0
  93. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
  94. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z2ll-a._.js +3 -0
  95. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1adacul._.js +11 -11
  96. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1autwno._.js +3 -0
  97. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1v25n-6._.js +3 -0
  98. package/.next/standalone/.next/server/chunks/_09dz7xv._.js +1 -1
  99. package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
  100. package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
  101. package/.next/standalone/.next/server/chunks/_1ek68ln._.js +2 -2
  102. package/.next/standalone/.next/server/chunks/_1fz8m31._.js +1 -1
  103. package/.next/standalone/.next/server/chunks/_1jrv3hg._.js +3 -0
  104. package/.next/standalone/.next/server/chunks/_1nx8fim._.js +3 -0
  105. package/.next/standalone/.next/server/chunks/_1ogwigf._.js +1 -1
  106. package/.next/standalone/.next/server/chunks/{_1q5i8mb._.js → _1q27azx._.js} +2 -2
  107. package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw._.js +1 -1
  108. package/.next/standalone/.next/server/chunks/{node_modules_posthog-node_dist_entrypoints_index_node_mjs_0el6rg8._.js → node_modules_posthog-node_dist_entrypoints_index_node_mjs_0ol5pa3._.js} +2 -2
  109. package/.next/standalone/.next/server/chunks/{node_modules_posthog-node_dist_entrypoints_index_node_mjs_04op_ou._.js → node_modules_posthog-node_dist_entrypoints_index_node_mjs_1rqmk27._.js} +2 -2
  110. package/.next/standalone/.next/server/chunks/{node_modules_posthog-node_dist_entrypoints_index_node_mjs_0dr20uz._.js → node_modules_posthog-node_dist_entrypoints_index_node_mjs_1w7tiq4._.js} +2 -2
  111. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  112. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0oqrl71._.js → [root-of-the-server]__042u-jn._.js} +2 -2
  113. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +2 -2
  114. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1-bm5zf._.js → [root-of-the-server]__0502lat._.js} +1 -1
  115. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0_gn5iz._.js +4 -0
  116. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0f765xr._.js +4 -0
  117. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__01bmjsj._.js → [root-of-the-server]__0h38gzz._.js} +1 -1
  118. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hoaz1g._.js +4 -0
  119. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1ouobn4._.js → [root-of-the-server]__0mxmwtx._.js} +1 -1
  120. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__19evfi8._.js → [root-of-the-server]__0uescqv._.js} +1 -1
  121. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13d-wb6._.js +1 -1
  122. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1484zv2._.js +3 -0
  123. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1mf3zp6._.js → [root-of-the-server]__19dutr7._.js} +4 -4
  124. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1u6sn69._.js → [root-of-the-server]__1ab4ifb._.js} +1 -1
  125. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1fbrk56._.js +4 -0
  126. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +2 -2
  127. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1um4yxn._.js +4 -0
  128. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1wb4yt2._.js +4 -0
  129. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1y3n3cn._.js +4 -0
  130. package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
  131. package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +1 -1
  132. package/.next/standalone/.next/server/chunks/ssr/{_0yq5_3a._.js → _1ffxwxz._.js} +1 -1
  133. package/.next/standalone/.next/server/chunks/ssr/_1gb0ifp._.js +2 -2
  134. package/.next/standalone/.next/server/chunks/ssr/{_042cgl1._.js → _1o95rf0._.js} +2 -2
  135. package/.next/standalone/.next/server/chunks/ssr/{_1zopuov._.js → _1thr5rf._.js} +2 -2
  136. package/.next/standalone/.next/server/chunks/ssr/{_16pa9ht._.js → _1v1o2ya._.js} +2 -2
  137. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +12 -14
  138. package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +1 -1
  139. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
  140. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  141. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
  142. package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +1 -1
  143. package/.next/standalone/.next/server/chunks/ssr/node_modules_1hl81y4._.js +1 -1
  144. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0nkkbfv._.js +6 -0
  145. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589g._.js +1 -1
  146. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
  147. package/.next/standalone/.next/server/middleware-build-manifest.js +6 -6
  148. package/.next/standalone/.next/server/middleware.js +1 -1
  149. package/.next/standalone/.next/server/pages/404.html +1 -1
  150. package/.next/standalone/.next/server/pages/500.html +1 -1
  151. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  152. package/.next/standalone/.next/server/server-reference-manifest.json +23 -23
  153. package/.next/standalone/.next/static/chunks/08tmc_7n-rba1.js +1 -0
  154. package/.next/standalone/.next/static/chunks/{3mjfvng11xnoo.js → 09tlrmucn6oq3.js} +1 -1
  155. package/.next/standalone/.next/static/chunks/{078dofaxvjgpd.js → 0i69k917myh7b.js} +1 -1
  156. package/.next/standalone/.next/static/chunks/{03h3b-uomi7_d.js → 0u_nhsujkactp.js} +1 -1
  157. package/.next/standalone/.next/static/chunks/{2j92xul6y24_v.js → 0zp51hzx62i-u.js} +1 -1
  158. package/.next/standalone/.next/static/chunks/{3u1s8dsqiean5.js → 1fz7q0gtnmeod.js} +1 -1
  159. package/.next/standalone/.next/static/chunks/{3ob2161ap37ul.js → 1j75le8wln-26.js} +1 -1
  160. package/.next/standalone/.next/static/chunks/{2kj826h1w9r47.js → 1z4km7tw0_50h.js} +1 -1
  161. package/.next/standalone/.next/static/chunks/{1fqukzzowjflt.js → 239ay_80-xr8z.js} +1 -1
  162. package/.next/standalone/.next/static/chunks/{3nkc2jlgyygda.js → 2c9pc5xco6rnu.js} +1 -1
  163. package/.next/standalone/.next/static/chunks/{3i8rg2fv9nd6e.js → 3n46e45atic-m.js} +1 -1
  164. package/.next/standalone/.next/static/chunks/{0542cuk_va8g1.js → 3sg07wnn969xq.js} +1 -1
  165. package/.next/standalone/.next/static/chunks/{turbopack-11dn2pegmg9_9.js → turbopack-1opxka4dtjbc5.js} +1 -1
  166. package/.next/standalone/app/actions/install-hooks-web.ts +10 -2
  167. package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
  168. package/.next/standalone/node_modules/@next/env/package.json +1 -1
  169. package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
  170. package/.next/standalone/node_modules/next/dist/compiled/hash.js/sha256/256.js +1 -0
  171. package/.next/standalone/node_modules/next/dist/compiled/hash.js/sha256/package.json +1 -0
  172. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +17 -17
  173. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +18 -18
  174. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +3 -3
  175. package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +13 -13
  176. package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
  177. package/.next/standalone/node_modules/next/dist/server/base-server.js +1 -2
  178. package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
  179. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +2 -2
  180. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
  181. package/.next/standalone/node_modules/next/dist/server/image-optimizer.js +265 -53
  182. package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
  183. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +177 -19
  184. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/index.js +36 -17
  185. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/shared-cache-controls.external.js +14 -6
  186. package/.next/standalone/node_modules/next/dist/server/lib/match-next-data-pathname.js +3 -1
  187. package/.next/standalone/node_modules/next/dist/server/lib/node-fs-methods.js +14 -0
  188. package/.next/standalone/node_modules/next/dist/server/lib/route-cache-key.js +77 -0
  189. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/block-cross-site-dev.js +9 -11
  190. package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
  191. package/.next/standalone/node_modules/next/dist/server/mcp/get-mcp-middleware.js +4 -2
  192. package/.next/standalone/node_modules/next/dist/server/next-server.js +7 -3
  193. package/.next/standalone/node_modules/next/dist/server/response-cache/index.js +32 -16
  194. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/app-page-route-matcher-provider.js +2 -2
  195. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/pages-handler.js +6 -1
  196. package/.next/standalone/node_modules/next/dist/server/route-modules/route-module.js +9 -2
  197. package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-wrapper.js +30 -29
  198. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/app-paths.js +18 -1
  199. package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  200. package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  201. package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
  202. package/.next/standalone/node_modules/next/package.json +10 -10
  203. package/.next/standalone/package.json +14 -11
  204. package/.next/standalone/sdk/python/README.md +41 -0
  205. package/.next/standalone/sdk/python/docs/README.md +1 -0
  206. package/.next/standalone/sdk/python/docs/otel/README.md +36 -0
  207. package/.next/standalone/sdk/python/docs/otel/examples/agent_trace.py +30 -0
  208. package/.next/standalone/sdk/python/docs/otel/examples/quickstart.py +22 -0
  209. package/.next/standalone/sdk/python/failproofai_sdk/__init__.py +8 -0
  210. package/.next/standalone/sdk/python/failproofai_sdk/integrations/__init__.py +3 -0
  211. package/.next/standalone/sdk/python/failproofai_sdk/integrations/otel.py +189 -0
  212. package/.next/standalone/sdk/python/pyproject.toml +2 -1
  213. package/.next/standalone/sdk/python/tests/test_docs.py +16 -3
  214. package/.next/standalone/sdk/python/tests/test_integrations.py +1 -1
  215. package/.next/standalone/sdk/python/tests/test_otel.py +147 -0
  216. package/.next/standalone/sdk/python/tests/test_zero_dependencies.py +4 -1
  217. package/.next/standalone/sdk/python/uv.lock +258 -147
  218. package/.next/standalone/sdk/typescript/README.md +43 -0
  219. package/.next/standalone/sdk/typescript/integration/ai.test.ts +9 -2
  220. package/.next/standalone/sdk/typescript/package-lock.json +57 -5
  221. package/.next/standalone/sdk/typescript/package.json +2 -0
  222. package/.next/standalone/sdk/typescript/src/edge/index.ts +9 -0
  223. package/.next/standalone/sdk/typescript/src/index.ts +2 -0
  224. package/.next/standalone/sdk/typescript/src/integrations/index.ts +4 -1
  225. package/.next/standalone/sdk/typescript/src/integrations/otel.ts +204 -0
  226. package/.next/standalone/sdk/typescript/test/integrations.test.ts +1 -1
  227. package/.next/standalone/sdk/typescript/test/otel.test.ts +125 -0
  228. package/.next/standalone/server.js +1 -1
  229. package/bin/failproofai.mjs +653 -1077
  230. package/dist/cli.mjs +8174 -3930
  231. package/dist/worker.mjs +170 -62
  232. package/hermes-plugin/plugin.yaml +1 -1
  233. package/package.json +14 -11
  234. package/scripts/launch-facts.ts +157 -0
  235. package/scripts/launch-ready.ts +228 -0
  236. package/scripts/launch-screen.ts +202 -0
  237. package/scripts/launch.ts +106 -49
  238. package/scripts/skew-log-filter.ts +42 -0
  239. package/src/audit/cli-login.ts +39 -59
  240. package/src/audit/cli.ts +308 -228
  241. package/src/audit/index.ts +45 -2
  242. package/src/audit/schedule-cli.ts +83 -120
  243. package/src/audit/types.ts +31 -0
  244. package/src/hooks/agent-selection.ts +155 -0
  245. package/src/hooks/backfill-cli.ts +151 -137
  246. package/src/hooks/backfill-request.ts +149 -0
  247. package/src/hooks/cloud-connection.ts +1 -1
  248. package/src/hooks/cloud-enrollment-cli.ts +78 -28
  249. package/src/hooks/cloud-introspect.ts +3 -0
  250. package/src/hooks/collector-config.ts +10 -1
  251. package/src/hooks/config-status.ts +606 -0
  252. package/src/hooks/configure-wizard.ts +915 -989
  253. package/src/hooks/daemon-service.ts +16 -6
  254. package/src/hooks/did-you-mean.ts +185 -0
  255. package/src/hooks/flush-cli.ts +33 -7
  256. package/src/hooks/fp-config.ts +96 -0
  257. package/src/hooks/fp-home.ts +11 -0
  258. package/src/hooks/fp-reset.ts +102 -95
  259. package/src/hooks/handler.ts +4 -0
  260. package/src/hooks/harness-cli.ts +87 -138
  261. package/src/hooks/install-prompt.ts +38 -477
  262. package/src/hooks/integrations.ts +1 -1
  263. package/src/hooks/jev-cli.ts +183 -196
  264. package/src/hooks/manager.ts +554 -358
  265. package/src/hooks/onboarding-attempt.ts +11 -9
  266. package/src/hooks/otel-cli.ts +344 -0
  267. package/src/hooks/otel-output.ts +24 -0
  268. package/src/hooks/otel-writers.ts +225 -0
  269. package/src/hooks/pack-cli.ts +219 -204
  270. package/src/hooks/report-body.ts +50 -0
  271. package/src/hooks/safe-config-write.ts +4 -2
  272. package/src/hooks/session-pause-cli.ts +93 -73
  273. package/src/hooks/tui.ts +849 -389
  274. package/src/hooks/uninstall-cli.ts +136 -149
  275. package/src/hooks/untraced-note.ts +52 -0
  276. package/.next/standalone/.next/server/chunks/[externals]__19_pzeq._.js +0 -3
  277. package/.next/standalone/.next/server/chunks/[externals]__20kzpkf._.js +0 -3
  278. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01eqny5._.js +0 -3
  279. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05ja_05._.js +0 -3
  280. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0igxt32._.js +0 -3
  281. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zyc_nm._.js +0 -3
  282. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ttrwnd._.js +0 -22
  283. package/.next/standalone/.next/server/chunks/_0bs-v8p._.js +0 -3
  284. package/.next/standalone/.next/server/chunks/_185gyk9._.js +0 -3
  285. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__056wjo4._.js +0 -4
  286. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n0xg95._.js +0 -4
  287. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rwtwpm._.js +0 -4
  288. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0yrsbd_._.js +0 -3
  289. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11mayhe._.js +0 -4
  290. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15578wp._.js +0 -4
  291. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1m_svbe._.js +0 -4
  292. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1q4p5b8._.js +0 -4
  293. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_1n3w9lb._.js +0 -6
  294. package/.next/standalone/.next/static/chunks/1lyg_puttohbc.js +0 -1
  295. /package/.next/standalone/.next/static/{ECs8__hcNabYV58WfDh-3 → UZKCiP4Q2TeU8zOB-h9Xj}/_buildManifest.js +0 -0
  296. /package/.next/standalone/.next/static/{ECs8__hcNabYV58WfDh-3 → UZKCiP4Q2TeU8zOB-h9Xj}/_clientMiddlewareManifest.js +0 -0
  297. /package/.next/standalone/.next/static/{ECs8__hcNabYV58WfDh-3 → UZKCiP4Q2TeU8zOB-h9Xj}/_ssgManifest.js +0 -0
@@ -47,6 +47,7 @@ import {
47
47
  import { listInstallableIds, getIntegration } from "./integrations";
48
48
  import type { IntegrationType } from "./types";
49
49
  import { removeHooks } from "./manager";
50
+ import { optsFor, screenKit, type RenderOpts } from "./tui";
50
51
 
51
52
  export interface UninstallOptions {
52
53
  /** Also delete ~/.failproofai (config, credentials, state, audit cache, daemon binary). */
@@ -58,30 +59,24 @@ export interface UninstallOptions {
58
59
  /** Project/local scopes are read relative to here. */
59
60
  cwd?: string;
60
61
  /**
61
- * Injected so the decision is testable without a TTY. Absent means "no
62
- * confirmation available", which is a REFUSAL rather than an assumed yes —
63
- * see the non-interactive branch.
64
- */
65
- confirm?: (lines: string[]) => Promise<boolean>;
66
- /**
67
- * Asked, on a plain uninstall only, whether the daemon service should go too.
62
+ * The ONE question (D17): handed the plan — which says exactly what goes —
63
+ * and answering yes removes all of it, the daemon service included, exactly
64
+ * as `--yes` does. Injected so the decision is testable without a TTY.
65
+ * Absent means "no confirmation available", which is a REFUSAL rather than
66
+ * an assumed yes — see the non-interactive branch.
68
67
  *
69
- * A plain uninstall removes the hooks and leaves the machine otherwise intact,
70
- * so the daemon is a genuine choice: someone clearing hooks before reinstalling
71
- * has no reason to tear down a system service and re-enter their password for
72
- * it. Absent means "could not ask" and the daemon is KEPT — declining to remove
73
- * a service is the recoverable half of that decision, and removing one nobody
74
- * asked about is not.
75
- *
76
- * NOT consulted under `--purge`. See `removeDaemon` in the implementation for
77
- * why purge cannot leave it behind.
68
+ * There used to be a second question, whether to keep the service. Keeping
69
+ * the daemon while removing the hooks is `failproofai policies --uninstall`,
70
+ * which takes the hooks out and leaves everything else alone.
78
71
  */
79
- confirmDaemon?: () => Promise<boolean>;
72
+ confirm?: (lines: string[]) => Promise<boolean>;
80
73
  /**
81
74
  * Ask for the sudo password before removing the service. Injected for tests;
82
75
  * defaults to `primeElevation`.
83
76
  */
84
77
  elevate?: () => boolean;
78
+ /** How to draw the lines. Defaults to what stdout can show. */
79
+ render?: RenderOpts;
85
80
  }
86
81
 
87
82
  export interface UninstallResult {
@@ -160,6 +155,10 @@ function survey(cwd?: string): Leftovers {
160
155
 
161
156
  export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<UninstallResult> {
162
157
  const found = survey(opts.cwd);
158
+ const kit = screenKit(opts.render ?? optsFor(process.stdout));
159
+ const home = failproofaiHome();
160
+ const many = (n: number, one: string) => `${n} ${one}${n === 1 ? "" : "s"}`;
161
+ const errText = (err: unknown) => (err instanceof Error ? err.message : String(err));
163
162
  const lines: string[] = [];
164
163
 
165
164
  const nothingToDo =
@@ -170,53 +169,53 @@ export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<
170
169
  exitCode: 0,
171
170
  planLines: 0,
172
171
  purged: false,
173
- lines: [
174
- "Nothing to uninstall — no hook entries, no daemon service, and nothing configured.",
175
- ...(found.homeExists && !opts.purge
176
- ? [``, `${failproofaiHome()} still holds settings and audit history.`,
177
- `Remove it with \`failproofai uninstall --purge\`.`]
178
- : []),
179
- ],
172
+ lines: kit.notice(
173
+ "ok",
174
+ "Nothing to uninstall: no hooks, no failproofaid service, and nothing configured." +
175
+ (found.homeExists && !opts.purge
176
+ ? `\n${home} still holds settings and history. Delete it with \`failproofai uninstall --purge\``
177
+ : ""),
178
+ ),
180
179
  };
181
180
  }
182
181
 
183
- // The plan is shown before anything happens and is the same text the
184
- // confirmation asks about, so what is agreed to and what is done cannot drift.
185
- const plan: string[] = [];
182
+ // The plan is the question (D17), and it is the same text the confirmation
183
+ // shows, so what is agreed to and what is done cannot drift. It names every
184
+ // thing the steps below remove, read off them rather than summarised:
185
+ // `removeHooks(undefined, "all", …)` also resets the policy settings in
186
+ // policies-config.json, which "settings survive a reinstall" used to hide.
187
+ const purging = Boolean(opts.purge && found.homeExists);
188
+ const removals: string[] = [];
189
+ if (found.clis.length > 0) removals.push(`failproofai's hooks from ${many(found.clis.length, "agent")}`);
190
+ if (found.serviceInstalled) removals.push("the failproofaid service (needs sudo)");
191
+ if (purging) removals.push(home);
192
+ const releasesDaemon = found.daemonConfigured && !found.serviceInstalled;
193
+ const listed =
194
+ removals.length <= 1 ? removals.join("") : `${removals.slice(0, -1).join(", ")} and ${removals[removals.length - 1]}`;
195
+ const lead =
196
+ removals.length === 0
197
+ ? "This stops this machine requiring the failproofaid daemon."
198
+ : `This removes ${listed}${releasesDaemon ? ", and stops this machine requiring the failproofaid daemon" : ""}.`;
199
+ const details: string[] = [];
186
200
  if (found.clis.length > 0) {
187
- plan.push(
188
- ` • remove failproofai hook entries from ${found.clis.length} agent CLI${found.clis.length === 1 ? "" : "s"}: ` +
189
- found.clis.map((id) => getIntegration(id).displayName ?? id).join(", "),
190
- );
191
- }
192
- if (found.daemonConfigured) {
193
- plan.push(` • stop requiring the daemon (policies go back to evaluating in-process)`);
194
- }
195
- if (found.serviceInstalled) {
196
- plan.push(
197
- opts.purge || opts.yes
198
- ? ` • stop, disable and delete the service at ${found.servicePath} — needs sudo`
199
- : ` • ask whether to remove the service at ${found.servicePath} (kept unless you say so)`,
201
+ details.push(
202
+ `Agents: ${found.clis.map((id) => getIntegration(id).displayName ?? id).join(", ")}`,
203
+ "Also resets enabled policies, custom policy paths and policy parameters in policies-config.json.",
200
204
  );
201
205
  }
202
- let purged = false;
203
- if (opts.purge && found.homeExists) {
204
- plan.push(` • delete ${failproofaiHome()} — settings, credentials, audit history and the daemon binary`);
206
+ if (purging) details.push(`${home} holds your settings, credentials, audit history and the daemon binary.`);
207
+ else if (found.homeExists) {
208
+ details.push(`${found.clis.length > 0 ? "The rest of " : ""}${home} is kept unless you add --purge.`);
205
209
  }
206
210
 
207
- lines.push("failproofai uninstall will:", ...plan);
208
- if (!opts.purge && found.homeExists) {
209
- lines.push(
210
- ``,
211
- `${failproofaiHome()} is KEPT (settings and audit history survive a reinstall).`,
212
- `Add --purge to delete it too.`,
213
- );
214
- }
211
+ // `--yes` asks nothing, so it has no question to show: what it did follows.
212
+ // A dry run IS the plan, and a refusal says what it would have removed.
213
+ if (opts.dryRun || !opts.yes) lines.push(...kit.notice("caution", [lead, ...details].join("\n")));
215
214
  // Everything pushed so far IS the plan; `confirm` is shown exactly this.
216
215
  const planLines = lines.length;
217
216
 
218
217
  if (opts.dryRun) {
219
- lines.push(``, `--dry-run: nothing was changed.`);
218
+ lines.push("", kit.ok("Dry run: nothing was changed."));
220
219
  return { exitCode: 0, lines, planLines, purged: false };
221
220
  }
222
221
 
@@ -225,16 +224,24 @@ export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<
225
224
  // This runs in scripts and CI, where a prompt that cannot be answered would
226
225
  // otherwise read as consent to delete a root-owned service.
227
226
  if (!opts.confirm) {
228
- lines.push(``, `Refusing to uninstall without confirmation. Re-run with --yes.`);
227
+ lines.push(
228
+ "",
229
+ ...kit.notice(
230
+ "fail",
231
+ "Nothing was removed: there is no terminal to confirm on.\n" +
232
+ `Re-run with --yes to go ahead: \`failproofai uninstall${opts.purge ? " --purge" : ""} --yes\``,
233
+ ),
234
+ );
229
235
  return { exitCode: 1, lines, planLines, purged: false };
230
236
  }
231
237
  if (!(await opts.confirm(lines))) {
232
- return { exitCode: 1, planLines, purged: false, lines: [...lines, ``, `Cancelled — nothing was changed.`] };
238
+ return { exitCode: 1, planLines, purged: false, lines: [...lines, "", "Cancelled. Nothing was changed."] };
233
239
  }
234
240
  }
235
241
 
236
- lines.push(``);
242
+ if (lines.length > 0) lines.push("");
237
243
  const failures: string[] = [];
244
+ let purged = false;
238
245
 
239
246
  // STEP 1, and it must stay step 1. See the header: from here the machine can
240
247
  // only fail open, so every remaining step is cleanup rather than a step that
@@ -242,7 +249,7 @@ export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<
242
249
  if (found.daemonConfigured) {
243
250
  try {
244
251
  setDaemonConfigured(false);
245
- lines.push(`✓ policies now evaluate in-process (this machine no longer requires the daemon)`);
252
+ lines.push(kit.ok("This machine no longer requires the daemon; policies evaluate in-process."));
246
253
  } catch (err) {
247
254
  // Uniquely fatal: everything after this assumes the flag is down. Removing
248
255
  // the service while it is still up is the lockout this command exists to
@@ -253,10 +260,12 @@ export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<
253
260
  purged: false,
254
261
  lines: [
255
262
  ...lines,
256
- `✗ could not update ${failproofaiHome()}/config.json: ${err instanceof Error ? err.message : String(err)}`,
257
- ``,
258
- `Stopped before touching the service. Removing it while this machine still`,
259
- `requires it would deny every tool call. Fix the file's permissions and re-run.`,
263
+ ...kit.notice(
264
+ "fail",
265
+ `Could not update ${home}/config.json: ${errText(err)}\n` +
266
+ "Stopped before the service: removing it while this machine requires it would deny every tool call.\n" +
267
+ "Fix the file's permissions, then run `failproofai uninstall` again.",
268
+ ),
260
269
  ],
261
270
  };
262
271
  }
@@ -268,109 +277,87 @@ export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<
268
277
  // named. `removeCustomHooks` clears the configured custom-policy paths as
269
278
  // well; leaving them behind would point a reinstall at files this command
270
279
  // may be about to purge.
280
+ // Silent: the line below says what happened, under the question, and
281
+ // `removeHooks`' own `policies --uninstall` rows would land between them.
271
282
  await removeHooks(undefined, "all", opts.cwd, {
272
283
  cli: found.clis,
273
284
  removeCustomHooks: true,
274
285
  source: "uninstall_command",
286
+ silent: true,
275
287
  });
276
- lines.push(`✓ removed hook entries from ${found.clis.length} agent CLI${found.clis.length === 1 ? "" : "s"}`);
288
+ lines.push(kit.ok(`Removed hooks from ${many(found.clis.length, "agent")}.`));
277
289
  } catch (err) {
278
290
  failures.push(
279
- `hook entries: ${err instanceof Error ? err.message : String(err)} ` +
280
- `(finish with \`failproofai policies --uninstall --scope all\`)`,
291
+ `Could not remove the hooks: ${errText(err)}\n` +
292
+ "Finish with `failproofai policies --uninstall --scope all`",
281
293
  );
282
294
  }
283
295
  }
284
296
 
285
297
  if (found.serviceInstalled) {
286
- // PURGE ALWAYS REMOVES IT, and is not asked. `--purge` deletes
287
- // `~/.failproofai`, which is where the daemon BINARY lives
288
- // (`bin/failproofaid-<version>`) — so keeping an enabled unit whose ExecStart
289
- // has just been deleted leaves the machine crash-looping the service at every
290
- // boot. "Keep the daemon" is not an option purge can offer, because purge has
291
- // already destroyed what the daemon needs to run.
292
- //
293
- // A plain uninstall is the opposite: the home survives, the binary survives,
294
- // and someone clearing hooks before a reinstall has no reason to tear down a
295
- // system service and re-type their password. So it asks, and a missing answer
296
- // means KEEP — declining to remove a service is recoverable, removing one
297
- // nobody asked about is not.
298
- //
299
- // `--yes` also removes it, and that is deliberate rather than incidental: the
300
- // flag means "yes to the plan", the plan has always included the service, and
301
- // scripted uninstalls rely on it. Making `--yes` keep the daemon would silently
302
- // start leaving a service behind on every automated run — a behaviour change
303
- // nobody asked for, in the direction of leaving more behind.
298
+ // Every run that gets here agreed to the whole plan, and the plan names the
299
+ // service: `--yes` is yes to the plan, an interactive yes is the same answer
300
+ // to the same text (D17), and `--purge` cannot leave it behind anyway — it
301
+ // deletes `~/.failproofai`, where the daemon BINARY lives
302
+ // (`bin/failproofaid-<version>`), so an enabled unit left pointing at it
303
+ // would crash-loop at every boot.
304
304
  //
305
- // So the only case that keeps it is an INTERACTIVE run where the person said no
306
- // (or could not be asked).
307
- const removeDaemon =
308
- opts.purge || opts.yes ? true : ((await opts.confirmDaemon?.()) ?? false);
309
-
310
- if (!removeDaemon) {
311
- lines.push(
312
- `• kept the daemon service at ${found.servicePath}`,
313
- ` Remove it later with: failproofai uninstall --purge`,
314
- );
315
- } else {
316
- // Ask for the password BEFORE trying, rather than failing on `sudo -n` and
317
- // printing a unit file to delete by hand. `uninstallDaemonService()` is
318
- // deliberately non-interactive — the wizard cannot prompt from under a
319
- // full-screen TUI — but this command is plain line output and has a person
320
- // in front of it, which is the same reasoning `failproofai update` follows.
321
- // Best-effort: a refused or absent sudo still falls through to the existing
322
- // "still there, here are the commands" path below.
323
- const elevate = opts.elevate ?? primeElevation;
324
- try {
325
- elevate();
326
- } catch {
327
- // A failed prompt is not a reason to skip the attempt; `sudo -n` inside
328
- // the removal will simply fail the same way it would have anyway.
329
- }
330
- try {
331
- await uninstallDaemonService();
332
- // uninstallDaemonService is best-effort by contract — it warns and
333
- // returns rather than throwing when it cannot elevate — so the unit file
334
- // is what gets believed here, not the absence of an exception.
335
- if (found.servicePath && existsSync(found.servicePath)) {
336
- failures.push(
337
- `the service at ${found.servicePath} is still there (most often: no sudo). ` +
338
- `Remove it with the commands below.`,
339
- );
340
- } else {
341
- lines.push(`✓ stopped and removed the daemon service`);
342
- }
343
- } catch (err) {
344
- failures.push(`daemon service: ${err instanceof Error ? err.message : String(err)}`);
305
+ // Ask for the password BEFORE trying, rather than failing on `sudo -n` and
306
+ // printing a unit file to delete by hand. `uninstallDaemonService()` is
307
+ // deliberately non-interactive — the wizard cannot prompt from under a
308
+ // full-screen TUI — but this command is plain line output and has a person
309
+ // in front of it, which is the same reasoning `failproofai update` follows.
310
+ // Best-effort: a refused or absent sudo still falls through to the
311
+ // "still there, here is what to run as root" path below.
312
+ const elevate = opts.elevate ?? primeElevation;
313
+ try {
314
+ elevate();
315
+ } catch {
316
+ // A failed prompt is not a reason to skip the attempt; `sudo -n` inside
317
+ // the removal will simply fail the same way it would have anyway.
318
+ }
319
+ // What to run as root when the removal could not elevate, and where to look.
320
+ const byHand = (servicePath: string): string =>
321
+ "\nRemove it as root:\n" +
322
+ manualServiceRemoval(servicePath).map((step) => ` \`${step}\``).join("\n") +
323
+ (daemonStatusCommand() ? `\nCheck it with \`${daemonStatusCommand()}\`` : "");
324
+ try {
325
+ await uninstallDaemonService();
326
+ // uninstallDaemonService is best-effort by contract — it warns and
327
+ // returns rather than throwing when it cannot elevate — so the unit file
328
+ // is what gets believed here, not the absence of an exception.
329
+ if (found.servicePath && existsSync(found.servicePath)) {
330
+ failures.push(
331
+ "The failproofaid service is still there, most often because sudo was not available." +
332
+ byHand(found.servicePath),
333
+ );
334
+ } else {
335
+ lines.push(kit.ok("Stopped and removed the failproofaid service."));
345
336
  }
337
+ } catch (err) {
338
+ failures.push(
339
+ `Could not remove the failproofaid service: ${errText(err)}` +
340
+ (found.servicePath && existsSync(found.servicePath) ? byHand(found.servicePath) : ""),
341
+ );
346
342
  }
347
343
  }
348
344
 
349
- if (opts.purge && found.homeExists) {
345
+ if (purging) {
350
346
  // Last, and only after the service is down: the daemon binary and its
351
347
  // socket live here, and deleting them out from under a running unit is how
352
348
  // a clean uninstall turns into a restart loop.
353
349
  try {
354
- rmSync(failproofaiHome(), { recursive: true, force: true });
350
+ rmSync(home, { recursive: true, force: true });
355
351
  purged = true;
356
- lines.push(`✓ deleted ${failproofaiHome()}`);
352
+ lines.push(kit.ok(`Deleted ${home}.`));
357
353
  } catch (err) {
358
- failures.push(`${failproofaiHome()}: ${err instanceof Error ? err.message : String(err)}`);
354
+ failures.push(`Could not delete ${home}: ${errText(err)}`);
359
355
  }
360
356
  }
361
357
 
362
358
  if (failures.length > 0) {
363
- lines.push(``, `Not everything could be removed:`);
364
- for (const f of failures) lines.push(` ✗ ${f}`);
365
- if (found.servicePath && existsSync(found.servicePath)) {
366
- lines.push(
367
- ``,
368
- `To remove the service by hand:`,
369
- ...manualServiceRemoval(found.servicePath),
370
- ``,
371
- `(\`${daemonStatusCommand()}\` shows its current state.)`,
372
- );
373
- }
359
+ lines.push("");
360
+ for (const failure of failures) lines.push(...kit.notice("fail", failure));
374
361
  // Exit 1, not 0: enforcement is off (step 1 succeeded, or there was nothing
375
362
  // to clear), but something durable is still installed and the operator has
376
363
  // to act. A 0 here is what makes people believe a machine is clean when a
@@ -378,30 +365,30 @@ export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<
378
365
  return { exitCode: 1, lines, planLines, purged };
379
366
  }
380
367
 
368
+ // npm runs no uninstall script, which is why this command exists — and why
369
+ // the package itself is still there for npm to remove.
381
370
  lines.push(
382
- ``,
383
- `Done. failproofai no longer enforces anything on this machine.`,
384
- ``,
385
- `The npm package itself is still installed — npm runs no uninstall script, which`,
386
- `is why this command exists. Remove it with:`,
387
- ` npm rm -g failproofai`,
371
+ "",
372
+ ...kit.notice(
373
+ "ok",
374
+ "failproofai no longer enforces anything on this machine.\n" +
375
+ "Remove the npm package too: `npm rm -g failproofai`" +
376
+ (!opts.purge && found.homeExists ? `\n${home} was kept. Delete it with \`failproofai uninstall --purge\`` : ""),
377
+ ),
388
378
  );
389
- if (!opts.purge && found.homeExists) {
390
- lines.push(``, `${failproofaiHome()} was kept. Delete it with \`failproofai uninstall --purge\`.`);
391
- }
392
379
  return { exitCode: 0, lines, planLines, purged };
393
380
  }
394
381
 
395
382
  /** The exact commands to finish a service removal that could not elevate. */
396
383
  function manualServiceRemoval(servicePath: string): string[] {
397
384
  if (process.platform === "darwin") {
398
- return [` sudo launchctl unload -w ${servicePath}`, ` sudo rm -f ${servicePath}`];
385
+ return [`sudo launchctl unload -w ${servicePath}`, `sudo rm -f ${servicePath}`];
399
386
  }
400
387
  const unit = servicePath.split("/").pop() ?? servicePath;
401
388
  return [
402
- ` sudo systemctl disable --now ${unit}`,
403
- ` sudo rm -f ${servicePath}`,
404
- ` sudo systemctl daemon-reload`,
389
+ `sudo systemctl disable --now ${unit}`,
390
+ `sudo rm -f ${servicePath}`,
391
+ `sudo systemctl daemon-reload`,
405
392
  ];
406
393
  }
407
394
 
@@ -0,0 +1,52 @@
1
+ /**
2
+ * A hook event from an agent that `failproofai config` does not trace.
3
+ *
4
+ * A NOTE, never a decision. Hooks for an untraced agent can exist on purpose:
5
+ * committed to a repository's project scope, left in another checkout, or read
6
+ * by VS Code's agent mode from a file another integration wrote. Allowing such
7
+ * a call because the agent is unticked in setup would turn a guard somebody did
8
+ * install into a hole, so the event is evaluated exactly as usual and the log
9
+ * says, once per session, where it came from.
10
+ *
11
+ * "Once per session" needs a record on disk: on the in-process path every hook
12
+ * is its own process. The record is one small file of recent keys, bounded, so
13
+ * it never grows with the number of sessions. Nothing here may throw on the hook
14
+ * path.
15
+ */
16
+ import { existsSync, readFileSync } from "node:fs";
17
+
18
+ import { writeJsonAtomically } from "../../lib/atomic-write";
19
+ import { isAgentTraced, readConfig, type FpConfig } from "./fp-config";
20
+ import { stateDir } from "./fp-home";
21
+ import { hookLogInfo } from "./hook-logger";
22
+ import { join } from "node:path";
23
+
24
+ /** How many session keys the record keeps; the oldest go first. */
25
+ const UNTRACED_NOTE_KEEP = 200;
26
+
27
+ export function untracedNotePath(home?: string): string {
28
+ return join(stateDir(home), "untraced-notes.json");
29
+ }
30
+
31
+ /** True when this call logged the note — for tests. */
32
+ export function noteUntracedAgent(cli: string, sessionId: string | undefined, config?: FpConfig): boolean {
33
+ try {
34
+ if (isAgentTraced(cli, config ?? readConfig())) return false;
35
+ const key = `${cli}:${sessionId ?? "no-session"}`;
36
+ const path = untracedNotePath();
37
+ let seen: string[] = [];
38
+ if (existsSync(path)) {
39
+ const parsed: unknown = JSON.parse(readFileSync(path, "utf8"));
40
+ if (Array.isArray(parsed)) seen = parsed.filter((k): k is string => typeof k === "string");
41
+ }
42
+ if (seen.includes(key)) return false;
43
+ writeJsonAtomically(path, [...seen, key].slice(-UNTRACED_NOTE_KEEP));
44
+ hookLogInfo(
45
+ `${cli} is not one of the agents failproofai config traces, but a hook for it fired` +
46
+ `${sessionId ? ` (session ${sessionId})` : ""}. Its calls are evaluated as usual: a hook somebody installed keeps enforcing.`,
47
+ );
48
+ return true;
49
+ } catch {
50
+ return false;
51
+ }
52
+ }
@@ -1,3 +0,0 @@
1
- module.exports=[54799,(r,e,o)=>{e.exports=r.x("crypto",()=>require("crypto"))},60815,r=>{r.v(r=>Promise.resolve().then(()=>r(24868)))},57764,(r,e,o)=>{e.exports=r.x("node:url",()=>require("node:url"))},92509,(r,e,o)=>{e.exports=r.x("url",()=>require("url"))}];
2
-
3
- //# sourceMappingURL=%5Bexternals%5D__19_pzeq._.js.map
@@ -1,3 +0,0 @@
1
- module.exports=[874,(e,r,o)=>{r.exports=e.x("buffer",()=>require("buffer"))},54799,(e,r,o)=>{r.exports=e.x("crypto",()=>require("crypto"))},60815,e=>{e.v(e=>Promise.resolve().then(()=>e(24868)))},1457,(e,r,o)=>{r.exports=e.x("node:readline",()=>require("node:readline"))},57764,(e,r,o)=>{r.exports=e.x("node:url",()=>require("node:url"))},5365,(e,r,o)=>{r.exports=e.x("process",()=>require("process"))},92509,(e,r,o)=>{r.exports=e.x("url",()=>require("url"))}];
2
-
3
- //# sourceMappingURL=%5Bexternals%5D__20kzpkf._.js.map
@@ -1,3 +0,0 @@
1
- module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},94930,e=>{"use strict";var t=e.i(2157),r=e.i(50227),s=e.i(66680);e.s(["writeJsonAtomically",0,function(e,n,o={}){let i=o.mode??384,a=o.dirMode??448,c=(0,r.dirname)(e);(0,t.existsSync)(c)||(0,t.mkdirSync)(c,{recursive:!0,mode:a});let u=`${e}.${process.pid}.${(0,s.randomBytes)(6).toString("hex")}.tmp`;try{(0,t.writeFileSync)(u,JSON.stringify(n,null,2),{mode:i});try{(63&(0,t.statSync)(u).mode)!=0&&(0,t.chmodSync)(u,i)}catch{}(0,t.renameSync)(u,e);try{(63&(0,t.statSync)(e).mode)!=0&&(0,t.chmodSync)(e,i)}catch{}}catch(e){try{(0,t.rmSync)(u,{force:!0})}catch{}throw e}}])},6375,e=>{"use strict";var t=e.i(46501);function r(){return(process.env.FAILPROOF_API_URL??process.env.FAILPROOFAI_API_URL??"https://api.befailproof.ai").replace(/\/+$/,"")}class s extends Error{status;code;retryAfterSecs;constructor(e,t,r,s){super(r),this.status=e,this.code=t,this.retryAfterSecs=s,this.name="AuthApiError"}}async function n(e){let t={};try{t=await e.json()}catch{}let r=t.code??`http_${e.status}`,n=t.message??t.detail??e.statusText??"request failed",o=t.retry_after_secs;if(void 0===o){let t=e.headers.get("retry-after");if(t){let e=Number(t);Number.isFinite(e)&&(o=e)}}return void 0!==o&&(o=Math.max(0,Math.min(86400,o))),new s(e.status,r,n,o)}async function o(e,r){try{return await fetch(e,{...r,signal:function(e){let t=AbortSignal.timeout(1e4);if(!e)return t;let r=AbortSignal.any;if(r)return r([t,e]);let s=new AbortController;if(t.aborted)s.abort(t.reason);else t.addEventListener("abort",()=>s.abort(t.reason),{once:!0});if(e.aborted)s.abort(e.reason);else e.addEventListener("abort",()=>s.abort(e.reason),{once:!0});return s.signal}(r.signal??void 0)})}catch(o){let n=function(e){if(null===e||"object"!=typeof e)return!1;let t=e.name;return"AbortError"===t||"TimeoutError"===t}(o);if((0,t.trackEvent)("api_server_unreachable",{kind:n?"timeout":"network",path:function(e){try{return new URL(e).pathname}catch{return e}}(e),method:"string"==typeof r.method?r.method:"GET"}),n)throw new s(0,"timeout",`request to ${e} timed out after 10000ms`);throw o}}async function i(e,t,s){let i={"content-type":"application/json"};s?.accessToken&&(i.authorization=`Bearer ${s.accessToken}`);let a=await o(`${r()}${e}`,{method:"POST",headers:i,body:JSON.stringify(t)});if(204!==a.status){if(!a.ok)throw await n(a);return await a.json()}}async function a(e,t){let s=await o(`${r()}${e}`,{method:"GET",headers:{authorization:`Bearer ${t}`}});if(!s.ok)throw await n(s);return await s.json()}async function c(e){return i("/v0/auth/login/request",{email:e})}async function u(e,t){return i("/v0/auth/login/verify",{email:e,code:t})}async function l(e){return i("/v0/auth/token/refresh",{refresh_token:e})}async function f(e,t){await i("/v0/auth/logout",{refresh_token:t},{accessToken:e})}async function p(e){return a("/v0/auth/me",e)}async function d(e,t,r){return i("/v0/invite",void 0===r?{to:t}:{to:t,score:r},{accessToken:e})}e.s(["AuthApiError",0,s,"fetchMe",0,p,"logoutSession",0,f,"refreshAccessToken",0,l,"requestLoginCode",0,c,"sendInvites",0,d,"verifyLoginCode",0,u],6375)},17707,e=>{"use strict";var t=e.i(2157),r=e.i(50227),s=e.i(94930),n=e.i(79857),o=e.i(6375);function i(){let e=process.env.FAILPROOFAI_AUTH_DIR;return e?(0,r.join)(e,"session.json"):(0,n.auditSessionFile)()}function a(){let e=i();if(!(0,t.existsSync)(e))return null;try{let r=(0,t.readFileSync)(e,"utf-8"),s=JSON.parse(r);if("string"!=typeof s.access_token||"string"!=typeof s.refresh_token||"number"!=typeof s.access_expires_at||"object"!=typeof s.user||!s.user||"string"!=typeof s.user.id||"string"!=typeof s.user.email)return null;return{access_token:s.access_token,refresh_token:s.refresh_token,access_expires_at:s.access_expires_at,refresh_expires_at:"number"==typeof s.refresh_expires_at?s.refresh_expires_at:s.access_expires_at,user:{id:s.user.id,email:s.user.email}}}catch{return null}}function c(e){(0,s.writeJsonAtomically)(i(),e)}function u(){let e=i();(0,t.existsSync)(e)&&(0,t.rmSync)(e,{force:!0});try{let e=(0,n.migrationsDir)();if(!(0,t.existsSync)(e))return;for(let s of(0,t.readdirSync)(e)){if(!s.startsWith("backup-layout"))continue;let n=(0,r.resolve)(e,s,"auth.json");(0,t.existsSync)(n)&&(0,t.rmSync)(n,{force:!0})}}catch{}}function l(e,t){let r=Math.floor(Date.now()/1e3),s=e.user??t;if(!s)throw Error("authFromTokenResponse: missing user identity");return{access_token:e.access_token,refresh_token:e.refresh_token,access_expires_at:r+e.access_expires_in,refresh_expires_at:r+e.refresh_expires_in,user:s}}let f=new Map;async function p(e){let t=f.get(e.refresh_token);if(t)return t;let r=(async()=>{let t=l(await (0,o.refreshAccessToken)(e.refresh_token),e.user);return c(t),t})();f.set(e.refresh_token,r);try{return await r}finally{f.delete(e.refresh_token)}}async function d(){let e=a();if(!e)return null;let t=Math.floor(Date.now()/1e3);if(e.access_expires_at-t>60)return e;try{return await p(e)}catch(e){return e instanceof o.AuthApiError&&401===e.status&&u(),null}}async function h(){let e=await d();if(!e)return null;try{return{me:await (0,o.fetchMe)(e.access_token),auth:e}}catch(e){if(e instanceof o.AuthApiError&&401===e.status){let e=a();if(!e)return null;try{let t=await p(e);return{me:await (0,o.fetchMe)(t.access_token),auth:t}}catch(e){e instanceof o.AuthApiError&&401===e.status&&u()}}return null}}e.s(["authFromTokenResponse",0,l,"deleteAuth",0,u,"readAuth",0,a,"whoAmI",0,h,"writeAuth",0,c])},46501,e=>{"use strict";var t=e.i(10659),r=e.i(17694),s=e.i(24214),n=e.i(28067);let o=n.POSTHOG_API_KEY;async function i(){try{if(!(0,r.isTelemetryEnabled)()||globalThis.__FAILPROOFAI_POSTHOG__)return;let t=await e.A(78081),s=process.env.FAILPROOFAI_POSTHOG_KEY??o,n=process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com";globalThis.__FAILPROOFAI_POSTHOG__=new t.PostHog(s,{host:n,flushAt:1,flushInterval:1e4,requestTimeout:1e4,fetchRetryCount:3,fetchRetryDelay:3e3});let i=!1,a=()=>{i||(i=!0,globalThis.__FAILPROOFAI_POSTHOG__?.shutdown().catch(()=>{}))};process.on("beforeExit",a),process.on("SIGTERM",a),process.on("SIGINT",a)}catch(e){console.warn("[failproofai:telemetry] init failed:",e instanceof Error?e.message:e)}}e.s(["initTelemetry",0,i,"trackEvent",0,function(e,o){if(!(0,r.isTelemetryEnabled)())return;let i=globalThis.__FAILPROOFAI_POSTHOG__;i&&i.capture({distinctId:(0,t.getInstanceId)(),event:e,properties:{...o,$lib:"failproofai",failproofai_version:s.version,product:n.POSTHOG_PRODUCT}})}])}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__01eqny5._.js.map
@@ -1,3 +0,0 @@
1
- module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},48480,e=>{"use strict";let t={running:!1,error:null};e.s(["finishRun",0,function(e){t.running=!1,t.startedAt=void 0,t.error=e},"getRunState",0,function(){return{...t}},"tryAcquireRun",0,function(){return!t.running&&(t.running=!0,t.startedAt=Date.now(),t.error=null,!0)}])},6095,e=>{"use strict";var t=e.i(89171),r=e.i(47756),n=e.i(29095),a=e.i(48480);async function i(){let e=(0,a.getRunState)(),i=(0,r.readDashboardCache)(),s=(0,n.readActiveAuditLock)(),o=null!==s&&s.pid!==process.pid;return t.NextResponse.json({running:e.running||o,startedAt:e.startedAt??null,cachedAt:i?.cachedAt??null,error:e.error})}e.s(["GET",0,i,"dynamic",0,"force-dynamic"])},56799,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),u=e.i(16795),c=e.i(87718),l=e.i(95169),d=e.i(47587),p=e.i(66012),h=e.i(70101),x=e.i(26937),y=e.i(10372),f=e.i(93695);e.i(52474);var m=e.i(220);let v=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/audit/status/route",pathname:"/api/audit/status",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/audit/status/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(6095),...{}}),{workAsyncStorage:R,workUnitAsyncStorage:g,serverHooks:S}=v;async function w(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),v.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let R="/api/audit/status/route";R=R.replace(/\/index$/,"")||"/";let g=await v.prepare(e,t,{srcPage:R,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:S,deploymentId:w,params:A,nextConfig:E,parsedUrl:C,isDraftMode:b,prerenderManifest:k,routerServerContext:q,isOnDemandRevalidate:N,revalidateOnlyGenerated:T,resolvedPathname:P,clientReferenceManifest:O,serverActionsManifest:j}=g,D=(0,o.normalizeAppPath)(R),_=!!(k.dynamicRoutes[D]||k.routes[P]),H=async()=>((null==q?void 0:q.render404)?await q.render404(e,t,C,!1):t.end("This page could not be found"),null);if(_&&!b){let e=!!k.routes[P],t=k.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await H();throw new f.NoFallbackError}}let I=null;!_||v.isDev||b||(I="/index"===(I=P)?"/":I);let M=!0===v.isDev||!_,F=_&&!M;j&&O&&(0,s.setManifestsSingleton)({page:R,clientReferenceManifest:O,serverActionsManifest:j});let U=e.method||"GET",L=(0,i.getTracer)(),$=L.getActiveScopeSpan(),B=!!(null==q?void 0:q.isWrappedByNextServer),K=!!(0,a.getRequestMeta)(e,"minimalMode"),G=(0,a.getRequestMeta)(e,"incrementalCache")||await v.getIncrementalCache(e,E,k,K);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let J={params:A,previewProps:k.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts,useCacheTimeout:E.experimental.useCacheTimeout},cacheComponents:!!E.cacheComponents,validationLevel:E.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:G,hmrRefreshHash:(0,a.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:E.cacheLife,staticPageGenerationTimeout:E.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>v.onRequestError(e,t,n,a,q)},sharedContext:{buildId:S,deploymentId:w}},V=new u.NodeNextRequest(e),X=new u.NodeNextResponse(t),W=c.NextRequestAdapter.fromNodeNextRequest(V,(0,c.signalFromNodeResponse)(t)),z=async({previousCacheEntry:r})=>{try{if(!K&&N&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await v.handle(W,J);e.fetchMetrics=J.renderOpts.fetchMetrics;let i=J.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let s=J.renderOpts.collectedTags;if(!_)return await (0,p.sendResponse)(V,X,a,i),null;{let e=await a.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(a.headers);s&&(t[y.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==J.renderOpts.collectedRevalidate&&!(J.renderOpts.collectedRevalidate>=y.INFINITE_CACHE)&&J.renderOpts.collectedRevalidate,n=void 0===J.renderOpts.collectedExpire||J.renderOpts.collectedExpire>=y.INFINITE_CACHE?!1!==r&&r>0?E.expireTime:void 0:J.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await v.onRequestError(e,t,{routerKind:"App Router",routePath:R,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:N})},!1,q),t}},Z=async(a,s)=>{try{var o,u;let a=await v.handleResponse({req:e,nextConfig:E,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:k,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:T,responseGenerator:z,waitUntil:n.waitUntil,isMinimalMode:K});if(!_)return;if((null==a||null==(o=a.value)?void 0:o.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==a||null==(u=a.value)?void 0:u.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",N?"REVALIDATED":a.isMiss?"MISS":a.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,h.fromNodeOutgoingHttpHeaders)(a.value.headers);K&&_||i.delete(y.NEXT_CACHE_TAGS_HEADER),!a.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,x.getCacheControlHeader)(a.cacheControl)),await (0,p.sendResponse)(V,X,new Response(a.value.body,{headers:i,status:a.value.status||200}));return}catch(t){if(t instanceof f.NoFallbackError||await v.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:N})},!1,q),_)throw t;await (0,p.sendResponse)(V,X,new Response(null,{status:500}));return}finally{(()=>{if(!a)return;let e=t.statusCode;a.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(a.setStatus({code:i.SpanStatusCode.ERROR}),a.setAttribute("error.type",e.toString()));let r=L.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==l.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route")||D,o=`${U} ${n}`;a.setAttributes({"next.route":n,"http.route":n,"next.span_name":o}),a.updateName(o),s&&s!==a&&(s.setAttribute("http.route",n),s.updateName(o))})()}};if(B&&$)await Z($,void 0);else{let t=L.getActiveScopeSpan();await L.withPropagatedContext(e.headers,()=>L.trace(l.BaseServerSpan.handleRequest,{spanName:`${U} ${R}`,kind:i.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},e=>Z(e,t)),void 0,!B)}}e.s(["handler",0,w,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:R,workUnitAsyncStorage:g})},"routeModule",0,v,"serverHooks",0,S,"workAsyncStorage",0,R,"workUnitAsyncStorage",0,g])},94930,e=>{"use strict";var t=e.i(2157),r=e.i(50227),n=e.i(66680);e.s(["writeJsonAtomically",0,function(e,a,i={}){let s=i.mode??384,o=i.dirMode??448,u=(0,r.dirname)(e);(0,t.existsSync)(u)||(0,t.mkdirSync)(u,{recursive:!0,mode:o});let c=`${e}.${process.pid}.${(0,n.randomBytes)(6).toString("hex")}.tmp`;try{(0,t.writeFileSync)(c,JSON.stringify(a,null,2),{mode:s});try{(63&(0,t.statSync)(c).mode)!=0&&(0,t.chmodSync)(c,s)}catch{}(0,t.renameSync)(c,e);try{(63&(0,t.statSync)(e).mode)!=0&&(0,t.chmodSync)(e,s)}catch{}}catch(e){try{(0,t.rmSync)(c,{force:!0})}catch{}throw e}}])},29095,e=>{"use strict";var t=e.i(2157),r=e.i(79857);function n(e,t){return!(e&&function(e){if(!Number.isInteger(e)||e<=0)return!1;try{return process.kill(e,0),!0}catch(e){return"EPERM"===e.code}}(e.pid))||t-e.startedAt>36e5}function a(e,r){let n=!1,a=()=>{if(n)return;n=!0,process.removeListener("exit",a);let s=i(e);if(!s||s.pid===r.pid)try{(0,t.unlinkSync)(e)}catch{}};return process.once("exit",a),{info:r,release:a}}function i(e){try{let r=JSON.parse((0,t.readFileSync)(e,"utf8"));if("number"!=typeof r?.pid||"number"!=typeof r?.startedAt)return null;return{pid:r.pid,startedAt:r.startedAt,source:r.source??"cli"}}catch{return null}}function s(e,r){let n=JSON.stringify(r),a=`${e}.${process.pid}.tmp`;try{(0,t.writeFileSync)(a,n,{mode:384})}catch{return!1}try{return(0,t.linkSync)(a,e),!0}catch(a){let r;if("EEXIST"===a.code)return!1;var i=e,s=n;try{return r=(0,t.openSync)(i,"wx",384),(0,t.writeSync)(r,s),!0}catch{return!1}finally{if(void 0!==r)try{(0,t.closeSync)(r)}catch{}}}finally{try{(0,t.unlinkSync)(a)}catch{}}}e.s(["acquireAuditLock",0,function(e,o=Date.now()){let u=(0,r.auditLockFile)(),c={pid:process.pid,startedAt:o,source:e};try{(0,t.mkdirSync)((0,r.failproofaiHome)(),{recursive:!0}),(0,t.mkdirSync)((0,r.runDir)(),{recursive:!0,mode:448})}catch{return{ok:!1,heldBy:null}}if(s(u,c))return{ok:!0,lock:a(u,c)};let l=i(u);if(!n(l,o))return{ok:!1,heldBy:l};try{(0,t.unlinkSync)(u)}catch{}return s(u,c)?{ok:!0,lock:a(u,c)}:{ok:!1,heldBy:i(u)}},"readActiveAuditLock",0,function(e=Date.now()){let t=i((0,r.auditLockFile)());return n(t,e)?null:t}])},47756,e=>{"use strict";var t=e.i(2157),r=e.i(94930),n=e.i(79857);function a(){return(0,n.auditDashboardFile)()}e.s(["readDashboardCache",0,function(){let e=a();if(!(0,t.existsSync)(e))return null;try{let r=(0,t.readFileSync)(e,"utf-8"),n=JSON.parse(r);if(!n||"object"!=typeof n||"string"!=typeof n.cachedAt||!n.params||"object"!=typeof n.params||!n.result||"object"!=typeof n.result||2!==n.schemaVersion||function(e,t=30){let r=new Date(e).getTime();return!!Number.isNaN(r)||Date.now()-r>6e4*t}(n.cachedAt,10080))return null;return n}catch{return null}},"writeDashboardCache",0,function(e,t){try{let n={schemaVersion:2,cachedAt:new Date().toISOString(),params:e,result:t};return(0,r.writeJsonAtomically)(a(),n),!0}catch{return!1}}])}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__05ja_05._.js.map
@@ -1,3 +0,0 @@
1
- module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},61403,e=>{"use strict";var t=e.i(89171),r=e.i(6375),a=e.i(46501);async function s(e){await (0,a.initTelemetry)();let s={};try{s=await e.json()}catch{return(0,a.trackEvent)("audit_otp_requested",{status:"validation_error",source:"dashboard",reason:"invalid_json"}),t.NextResponse.json({code:"validation_error",message:"Invalid JSON body"},{status:400})}if("string"!=typeof s.email||!s.email.trim())return(0,a.trackEvent)("audit_otp_requested",{status:"validation_error",source:"dashboard",reason:"missing_email"}),t.NextResponse.json({code:"validation_error",message:"email is required"},{status:400});let n=s.email.trim().toLowerCase();try{let e=await (0,r.requestLoginCode)(s.email);return(0,a.trackEvent)("audit_otp_requested",{status:"success",email:n,source:"dashboard",expires_in:e.expires_in,resend_available_in:e.resend_available_in}),t.NextResponse.json({status:e.status,expires_in:e.expires_in,resend_available_in:e.resend_available_in},{status:200})}catch(s){if(s instanceof r.AuthApiError){(0,a.trackEvent)("audit_otp_requested",{status:"failed",email:n,source:"dashboard",error_code:s.code,http_status:s.status,retry_after_secs:s.retryAfterSecs??null});let e=s.status>=200&&s.status<600?s.status:504;return t.NextResponse.json({code:s.code,message:s.message,...void 0!==s.retryAfterSecs?{retry_after_secs:s.retryAfterSecs}:{}},{status:e})}let e=s instanceof Error?s.message:String(s);return(0,a.trackEvent)("audit_otp_requested",{status:"failed",email:n,source:"dashboard",error_code:"upstream_unreachable",error_message:e.slice(0,200)}),t.NextResponse.json({code:"upstream_unreachable",message:`api-server unreachable: ${e}`},{status:502})}}e.s(["POST",0,s,"dynamic",0,"force-dynamic"])},51481,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),s=e.i(59756),n=e.i(61916),o=e.i(74677),i=e.i(69741),u=e.i(16795),l=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),f=e.i(26937),v=e.i(10372),x=e.i(93695);e.i(52474);var m=e.i(220);let _=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/auth/login-request/route",pathname:"/api/auth/login-request",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/auth/login-request/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(61403),...{}}),{workAsyncStorage:g,workUnitAsyncStorage:y,serverHooks:R}=_;async function b(e,t,a){a.requestMeta&&(0,s.setRequestMeta)(e,a.requestMeta),_.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/auth/login-request/route";g=g.replace(/\/index$/,"")||"/";let y=await _.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,deploymentId:b,params:w,nextConfig:A,parsedUrl:E,isDraftMode:T,prerenderManifest:O,routerServerContext:S,isOnDemandRevalidate:q,revalidateOnlyGenerated:P,resolvedPathname:C,clientReferenceManifest:I,serverActionsManifest:k}=y,N=(0,i.normalizeAppPath)(g),j=!!(O.dynamicRoutes[N]||O.routes[C]),H=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,E,!1):t.end("This page could not be found"),null);if(j&&!T){let e=!!O.routes[C],t=O.dynamicRoutes[N];if(t&&!1===t.fallback&&!e){if(A.adapterPath)return await H();throw new x.NoFallbackError}}let F=null;!j||_.isDev||T||(F="/index"===(F=C)?"/":F);let L=!0===_.isDev||!j,M=j&&!L;k&&I&&(0,o.setManifestsSingleton)({page:g,clientReferenceManifest:I,serverActionsManifest:k});let U=e.method||"GET",$=(0,n.getTracer)(),G=$.getActiveScopeSpan(),D=!!(null==S?void 0:S.isWrappedByNextServer),K=!!(0,s.getRequestMeta)(e,"minimalMode"),B=(0,s.getRequestMeta)(e,"incrementalCache")||await _.getIncrementalCache(e,A,O,K);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let z={params:w,previewProps:O.preview,renderOpts:{experimental:{authInterrupts:!!A.experimental.authInterrupts,useCacheTimeout:A.experimental.useCacheTimeout},cacheComponents:!!A.cacheComponents,validationLevel:A.experimental.instantInsights.validationLevel,supportsDynamicResponse:L,incrementalCache:B,hmrRefreshHash:(0,s.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:A.cacheLife,staticPageGenerationTimeout:A.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,s)=>_.onRequestError(e,t,a,s,S)},sharedContext:{buildId:R,deploymentId:b}},V=new u.NodeNextRequest(e),X=new u.NodeNextResponse(t),J=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(t)),W=async({previousCacheEntry:r})=>{try{if(!K&&q&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await _.handle(J,z);e.fetchMetrics=z.renderOpts.fetchMetrics;let n=z.renderOpts.pendingWaitUntil;n&&a.waitUntil&&(a.waitUntil(n),n=void 0);let o=z.renderOpts.collectedTags;if(!j)return await (0,p.sendResponse)(V,X,s,n),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);o&&(t[v.NEXT_CACHE_TAGS_HEADER]=o),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,a=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=v.INFINITE_CACHE?!1!==r&&r>0?A.expireTime:void 0:z.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await _.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:q})},!1,S),t}},Y=async(s,o)=>{try{var i,u;let s=await _.handleResponse({req:e,nextConfig:A,cacheKey:F,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:q,revalidateOnlyGenerated:P,responseGenerator:W,waitUntil:a.waitUntil,isMinimalMode:K});if(!j)return;if((null==s||null==(i=s.value)?void 0:i.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==s||null==(u=s.value)?void 0:u.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",q?"REVALIDATED":s.isMiss?"MISS":s.isStale?"STALE":"HIT"),T&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let n=(0,h.fromNodeOutgoingHttpHeaders)(s.value.headers);K&&j||n.delete(v.NEXT_CACHE_TAGS_HEADER),!s.cacheControl||t.getHeader("Cache-Control")||n.get("Cache-Control")||n.set("Cache-Control",(0,f.getCacheControlHeader)(s.cacheControl)),await (0,p.sendResponse)(V,X,new Response(s.value.body,{headers:n,status:s.value.status||200}));return}catch(t){if(t instanceof x.NoFallbackError||await _.onRequestError(e,t,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:q})},!1,S),j)throw t;await (0,p.sendResponse)(V,X,new Response(null,{status:500}));return}finally{(()=>{if(!s)return;let e=t.statusCode;s.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(s.setStatus({code:n.SpanStatusCode.ERROR}),s.setAttribute("error.type",e.toString()));let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route")||N,i=`${U} ${a}`;s.setAttributes({"next.route":a,"http.route":a,"next.span_name":i}),s.updateName(i),o&&o!==s&&(o.setAttribute("http.route",a),o.updateName(i))})()}};if(D&&G)await Y(G,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${U} ${g}`,kind:n.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},e=>Y(e,t)),void 0,!D)}}e.s(["handler",0,b,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:g,workUnitAsyncStorage:y})},"routeModule",0,_,"serverHooks",0,R,"workAsyncStorage",0,g,"workUnitAsyncStorage",0,y])},6375,e=>{"use strict";var t=e.i(46501);function r(){return(process.env.FAILPROOF_API_URL??process.env.FAILPROOFAI_API_URL??"https://api.befailproof.ai").replace(/\/+$/,"")}class a extends Error{status;code;retryAfterSecs;constructor(e,t,r,a){super(r),this.status=e,this.code=t,this.retryAfterSecs=a,this.name="AuthApiError"}}async function s(e){let t={};try{t=await e.json()}catch{}let r=t.code??`http_${e.status}`,s=t.message??t.detail??e.statusText??"request failed",n=t.retry_after_secs;if(void 0===n){let t=e.headers.get("retry-after");if(t){let e=Number(t);Number.isFinite(e)&&(n=e)}}return void 0!==n&&(n=Math.max(0,Math.min(86400,n))),new a(e.status,r,s,n)}async function n(e,r){try{return await fetch(e,{...r,signal:function(e){let t=AbortSignal.timeout(1e4);if(!e)return t;let r=AbortSignal.any;if(r)return r([t,e]);let a=new AbortController;if(t.aborted)a.abort(t.reason);else t.addEventListener("abort",()=>a.abort(t.reason),{once:!0});if(e.aborted)a.abort(e.reason);else e.addEventListener("abort",()=>a.abort(e.reason),{once:!0});return a.signal}(r.signal??void 0)})}catch(n){let s=function(e){if(null===e||"object"!=typeof e)return!1;let t=e.name;return"AbortError"===t||"TimeoutError"===t}(n);if((0,t.trackEvent)("api_server_unreachable",{kind:s?"timeout":"network",path:function(e){try{return new URL(e).pathname}catch{return e}}(e),method:"string"==typeof r.method?r.method:"GET"}),s)throw new a(0,"timeout",`request to ${e} timed out after 10000ms`);throw n}}async function o(e,t,a){let o={"content-type":"application/json"};a?.accessToken&&(o.authorization=`Bearer ${a.accessToken}`);let i=await n(`${r()}${e}`,{method:"POST",headers:o,body:JSON.stringify(t)});if(204!==i.status){if(!i.ok)throw await s(i);return await i.json()}}async function i(e,t){let a=await n(`${r()}${e}`,{method:"GET",headers:{authorization:`Bearer ${t}`}});if(!a.ok)throw await s(a);return await a.json()}async function u(e){return o("/v0/auth/login/request",{email:e})}async function l(e,t){return o("/v0/auth/login/verify",{email:e,code:t})}async function d(e){return o("/v0/auth/token/refresh",{refresh_token:e})}async function c(e,t){await o("/v0/auth/logout",{refresh_token:t},{accessToken:e})}async function p(e){return i("/v0/auth/me",e)}async function h(e,t,r){return o("/v0/invite",void 0===r?{to:t}:{to:t,score:r},{accessToken:e})}e.s(["AuthApiError",0,a,"fetchMe",0,p,"logoutSession",0,c,"refreshAccessToken",0,d,"requestLoginCode",0,u,"sendInvites",0,h,"verifyLoginCode",0,l],6375)},46501,e=>{"use strict";var t=e.i(10659),r=e.i(17694),a=e.i(24214),s=e.i(28067);let n=s.POSTHOG_API_KEY;async function o(){try{if(!(0,r.isTelemetryEnabled)()||globalThis.__FAILPROOFAI_POSTHOG__)return;let t=await e.A(78081),a=process.env.FAILPROOFAI_POSTHOG_KEY??n,s=process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com";globalThis.__FAILPROOFAI_POSTHOG__=new t.PostHog(a,{host:s,flushAt:1,flushInterval:1e4,requestTimeout:1e4,fetchRetryCount:3,fetchRetryDelay:3e3});let o=!1,i=()=>{o||(o=!0,globalThis.__FAILPROOFAI_POSTHOG__?.shutdown().catch(()=>{}))};process.on("beforeExit",i),process.on("SIGTERM",i),process.on("SIGINT",i)}catch(e){console.warn("[failproofai:telemetry] init failed:",e instanceof Error?e.message:e)}}e.s(["initTelemetry",0,o,"trackEvent",0,function(e,n){if(!(0,r.isTelemetryEnabled)())return;let o=globalThis.__FAILPROOFAI_POSTHOG__;o&&o.capture({distinctId:(0,t.getInstanceId)(),event:e,properties:{...n,$lib:"failproofai",failproofai_version:a.version,product:s.POSTHOG_PRODUCT}})}])}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__0igxt32._.js.map
@@ -1,3 +0,0 @@
1
- module.exports=[22734,(e,r,t)=>{r.exports=e.x("fs",()=>require("fs"))},24868,(e,r,t)=>{r.exports=e.x("fs/promises",()=>require("fs/promises"))},70406,(e,r,t)=>{r.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,r,t)=>{r.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},20635,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},56704,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,r,t)=>{r.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,r,t)=>{r.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,r,t)=>{r.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,r,t)=>{r.exports=e.x("node:path",()=>require("node:path"))},81111,(e,r,t)=>{r.exports=e.x("node:stream",()=>require("node:stream"))},46786,(e,r,t)=>{r.exports=e.x("os",()=>require("os"))},14747,(e,r,t)=>{r.exports=e.x("path",()=>require("path"))},91301,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1qb590j._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(30441)))},16341,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1shcqgr._.js"].map(r=>e.l(r))).then(()=>r(93114)))},37352,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1jm9fw6._.js"].map(r=>e.l(r))).then(()=>r(36203)))},18944,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__17g9wh7._.js","server/chunks/src_hooks_fp-home_ts_09kv0bn._.js"].map(r=>e.l(r))).then(()=>r(57232)))},71809,e=>{"use strict";async function r(e,r){let t=Array(e.length),s=0;async function o(){for(;s<e.length;){let r=s++;try{t[r]={status:"fulfilled",value:await e[r]()}}catch(e){t[r]={status:"rejected",reason:e}}}}let a=Array.from({length:Math.min(r,e.length)},()=>o());return await Promise.all(a),t}e.s(["batchAll",0,r])},5807,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1w9zl9-._.js"].map(r=>e.l(r))).then(()=>r(55851)))},21476,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1legmza._.js"].map(r=>e.l(r))).then(()=>r(78166)))},97452,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1ou2ehh._.js"].map(r=>e.l(r))).then(()=>r(46413)))},23414,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0rv7m0k._.js"].map(r=>e.l(r))).then(()=>r(72094)))},52400,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0g6bbuw._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(79364)))},53229,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1ffkmds._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(40375)))},62998,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0q0qzx1._.js"].map(r=>e.l(r))).then(()=>r(69391)))},95231,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0--lkk6._.js"].map(r=>e.l(r))).then(()=>r(28246)))},28557,e=>{"use strict";e.s(["formatDate",0,function(e){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).format(e)}])},31854,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__08w4wmd._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(69164)))},49081,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1xuedea._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(36618)))},67347,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1anxb5k._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(64828)))},32359,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0zlqo2t._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(3605)))},40911,e=>{"use strict";let r={info:0,warn:1,error:2};function t(e){return r[e]>=r.warn}function s(e){return`[failproofai${new Date().toISOString()}] ${e}`}e.s(["logActivity",0,function(e,r,o){if(!t("info"))return;let a=[`user=${e}`,`action=${r}`];o&&a.push(o),console.log(s("ACTIVITY"),a.join(" "))},"logError",0,function(e,r){void 0!==r?console.error(s("ERROR"),e,r):console.error(s("ERROR"),e)},"logWarn",0,function(e,r){t("warn")&&(void 0!==r?console.warn(s("WARN"),e,r):console.warn(s("WARN"),e))}])},3959,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0faqz9x._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(96878)))},38978,e=>{e.v(r=>Promise.all(["server/chunks/lib_openclaw-projects_ts_0gc-p24._.js","server/chunks/_1vslkoe._.js","server/chunks/[root-of-the-server]__1l71g3y._.js"].map(r=>e.l(r))).then(()=>r(90624)))},26435,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__1l71g3y._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(64199)))},82978,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__03r-lqq._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(35435)))},82859,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__12021ot._.js","server/chunks/_1vslkoe._.js"].map(r=>e.l(r))).then(()=>r(99440)))},81580,e=>{"use strict";var r=e.i(46786),t=e.i(14747);e.s(["decodeFolderName",0,function(e){return/^[A-Za-z]--/.test(e)?e[0]+":/"+e.slice(3).replace(/-/g,"/"):e.replace(/-/g,"/")},"encodeFolderName",0,function(e){let r=/^([A-Za-z]):[\\/](.*)$/.exec(e);return r?r[1]+"--"+r[2].replace(/[\\/]/g,"-"):e.replace(/[\\/]/g,"-")},"getClaudeProjectsPath",0,function(){let e=process.env.CLAUDE_PROJECTS_PATH;return e||(0,t.join)((0,r.homedir)(),".claude","projects")}])},45093,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0f7mikp._.js"].map(r=>e.l(r))).then(()=>r(19791)))},41330,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0q-v9z2._.js"].map(r=>e.l(r))).then(()=>r(85116)))},56936,e=>{"use strict";var r=e.i(12714),t=e.i(50227),s=e.i(81580),o=e.i(83534),a=e.i(71809),n=e.i(40911),i=e.i(28557);let l=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;async function c(e,t){try{return(await (0,r.stat)(e)).mtime}catch(e){return(0,n.logWarn)(`Failed to stat ${t}:`,e),new Date(0)}}async function u(e){try{if(!(await (0,r.stat)(e)).isDirectory())return null;return await (0,r.readdir)(e,{withFileTypes:!0})}catch{return null}}async function h(){try{let e=(0,s.getClaudeProjectsPath)(),r=await u(e);if(!r)return[];let o=(await (0,a.batchAll)(r.filter(e=>e.isDirectory()).map(r=>async()=>{let s=(0,t.join)(e,r.name),o=await c(s,r.name);return{name:r.name,path:s,isDirectory:!0,lastModified:o,lastModifiedFormatted:(0,i.formatDate)(o),cli:["claude"]}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return o.sort((e,r)=>r.lastModified.getTime()-e.lastModified.getTime()),o}catch(e){return(0,n.logError)("Error reading Claude project folders:",e),[]}}async function v(){let[{getCodexProjects:r},{getCopilotProjects:t},{getCursorProjects:s},{getOpenCodeProjects:o},{getPiProjects:a},{getHermesProjects:i},{getOpenClawProjects:l},{getFactoryProjects:c},{getDevinProjects:u},{getAntigravityProjects:v},{getGooseProjects:m}]=await Promise.all([e.A(37352),e.A(5807),e.A(97452),e.A(82978),e.A(45093),e.A(67347),e.A(38978),e.A(62998),e.A(52400),e.A(91301),e.A(31854)]),[d,f,p,_,j,g,x,k,w,y,P,E]=await Promise.all([h(),r().catch(e=>((0,n.logError)("Error reading Codex projects:",e),[])),t().catch(e=>((0,n.logError)("Error reading Copilot projects:",e),[])),s().catch(e=>((0,n.logError)("Error reading Cursor projects:",e),[])),o().catch(e=>((0,n.logError)("Error reading OpenCode projects:",e),[])),a().catch(e=>((0,n.logError)("Error reading Pi projects:",e),[])),i().catch(e=>((0,n.logError)("Error reading Hermes projects:",e),[])),l().catch(e=>((0,n.logError)("Error reading OpenClaw projects:",e),[])),c().catch(e=>((0,n.logError)("Error reading Factory projects:",e),[])),u().catch(e=>((0,n.logError)("Error reading Devin projects:",e),[])),v().catch(e=>((0,n.logError)("Error reading Antigravity projects:",e),[])),m().catch(e=>((0,n.logError)("Error reading Goose projects:",e),[]))]);return function(...e){let r=new Map;for(let t of e)for(let e of t){let t=r.get(e.name);if(!t){r.set(e.name,{...e,cli:[...e.cli]});continue}let s=[...t.cli];for(let r of e.cli)s.includes(r)||s.push(r);let o=e.lastModified.getTime()>t.lastModified.getTime()?e:t;r.set(e.name,{...t,cli:s,lastModified:o.lastModified,lastModifiedFormatted:o.lastModifiedFormatted,sessionCount:void 0===t.sessionCount&&void 0===e.sessionCount?void 0:(t.sessionCount??0)+(e.sessionCount??0)})}let t=Array.from(r.values());return t.sort((e,r)=>r.lastModified.getTime()-e.lastModified.getTime()),t}(d,f,p,_,j,g,x,k,w,y,P,E)}function m(e){if(!e)throw RangeError("Empty project name");if(/^[/\\]/.test(e))throw RangeError("Absolute project name");let r=(0,t.resolve)((0,s.getClaudeProjectsPath)()),o=(0,t.resolve)((0,t.join)(r,e));if(!o.startsWith(r+t.sep))throw RangeError("Project path escapes root");return o}function d(e){let r=e.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);return r?r[0]:void 0}async function f(e){try{let r=await u(e);if(!r)return[];let s=r.filter(e=>e.isFile()&&e.name.endsWith(".jsonl")&&d(e.name)),o=(await (0,a.batchAll)(s.map(r=>async()=>{let s=(0,t.join)(e,r.name),o=await c(s,r.name);return{name:r.name,path:s,lastModified:o,lastModifiedFormatted:(0,i.formatDate)(o),sessionId:d(r.name),cli:"claude"}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return o.sort((e,r)=>r.lastModified.getTime()-e.lastModified.getTime()),o}catch(e){return(0,n.logError)("Error reading session files:",e),[]}}(0,o.runtimeCache)(v,30),(0,o.runtimeCache)(e=>f(e),30),e.s(["UUID_RE",0,l,"resolveProjectPath",0,m,"resolveSessionFilePath",0,function(e,r){if(!l.test(r))throw RangeError("Invalid session ID");let s=m(e);return(0,t.join)(s,`${r}.jsonl`)}])},83534,e=>{"use strict";e.s(["runtimeCache",0,function(e,r,t){let s=new Map,o=new Map,a=t?.maxSize;return async(...t)=>{let n=JSON.stringify(t),i=s.get(n);if(i&&Date.now()<i.expiry)return i.data;let l=o.get(n);if(l)return l;let c=e(...t).then(e=>{if(o.delete(n),a&&s.size>=a){let e=s.keys().next().value;s.delete(e)}return s.set(n,{data:e,expiry:Date.now()+1e3*r}),e},e=>{throw o.delete(n),e});return o.set(n,c),c}}])}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__0zyc_nm._.js.map