failproofai 0.0.11-beta.8 → 0.0.11

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 (239) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +1 -0
  3. package/.next/standalone/.next/build-manifest.json +6 -6
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/required-server-files.json +1 -1
  6. package/.next/standalone/.next/routes-manifest.json +6 -0
  7. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
  8. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  9. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  10. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  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 +2 -2
  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/_head.segment.rsc +3 -3
  16. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  17. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
  19. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  20. package/.next/standalone/.next/server/app/_not-found/page.js +2 -2
  21. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  24. package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
  25. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
  26. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  27. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
  28. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  29. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  30. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  31. package/.next/standalone/.next/server/app/api/audit/invite/route/app-paths-manifest.json +3 -0
  32. package/.next/standalone/.next/server/app/api/audit/invite/route/build-manifest.json +9 -0
  33. package/.next/standalone/.next/server/app/api/audit/invite/route/server-reference-manifest.json +4 -0
  34. package/.next/standalone/.next/server/app/api/audit/invite/route.js +7 -0
  35. package/.next/standalone/.next/server/app/api/audit/invite/route.js.map +5 -0
  36. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -0
  37. package/.next/standalone/.next/server/app/api/audit/invite/route_client-reference-manifest.js +3 -0
  38. package/.next/standalone/.next/server/app/api/audit/run/route.js +1 -1
  39. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/auth/login-request/route.js +1 -1
  41. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +2 -2
  43. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/auth/logout/route.js +2 -2
  45. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/auth/reminder/route.js +2 -2
  47. package/.next/standalone/.next/server/app/api/auth/reminder/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/auth/status/route.js +2 -2
  49. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/audit/page/build-manifest.json +3 -3
  52. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  53. package/.next/standalone/.next/server/app/audit/page.js +2 -2
  54. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  56. package/.next/standalone/.next/server/app/index.html +1 -1
  57. package/.next/standalone/.next/server/app/index.rsc +15 -15
  58. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  59. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
  60. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  61. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
  62. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  63. package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
  64. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  65. package/.next/standalone/.next/server/app/page.js +2 -2
  66. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  68. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +3 -3
  69. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
  70. package/.next/standalone/.next/server/app/policies/page.js +2 -2
  71. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  73. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +3 -3
  74. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  75. package/.next/standalone/.next/server/app/project/[name]/page.js +3 -3
  76. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  78. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +3 -3
  79. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  80. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  81. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +3 -3
  82. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  84. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +3 -3
  85. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  86. package/.next/standalone/.next/server/app/projects/page.js +3 -3
  87. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  88. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  89. package/.next/standalone/.next/server/app-paths-manifest.json +1 -0
  90. package/.next/standalone/.next/server/chunks/[externals]__1_g_b3t._.js +3 -0
  91. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0dwpg-h._.js +3 -0
  92. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lnenda._.js +3 -0
  93. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13i_sva._.js +3 -0
  94. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1_mqemn._.js +1 -1
  95. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_audit_invite_route_actions_0-2n5sy.js +3 -0
  96. package/.next/standalone/.next/server/chunks/node_modules_0-tu4ot._.js +3 -0
  97. package/.next/standalone/.next/server/chunks/node_modules_0ttxbz7._.js +3 -0
  98. package/.next/standalone/.next/server/chunks/node_modules_1bnh1y0._.js +3 -0
  99. package/.next/standalone/.next/server/chunks/node_modules_1epycqa._.js +3 -0
  100. package/.next/standalone/.next/server/chunks/node_modules_1wpdcgo._.js +3 -0
  101. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_17k9e3w.js +3 -3
  102. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +1 -1
  103. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +1 -1
  104. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1d4gx_t._.js → [root-of-the-server]__00uwqi6._.js} +2 -2
  106. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0808sha._.js +4 -0
  107. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1cd25c7._.js → [root-of-the-server]__0e4-6d8._.js} +3 -3
  108. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ehe24g._.js +4 -0
  109. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1-scthx._.js → [root-of-the-server]__0f62vu9._.js} +2 -2
  110. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g253ve._.js +4 -0
  111. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0l13qf2._.js → [root-of-the-server]__0k65l27._.js} +1 -1
  112. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__15i0juc._.js → [root-of-the-server]__0kjb_s4._.js} +2 -2
  113. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vxf0_g._.js +4 -0
  114. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12mcauo._.js +4 -0
  115. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0989_dx._.js → [root-of-the-server]__1e-x7j4._.js} +2 -2
  116. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1mt35_w._.js +1 -1
  117. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pcxxwg._.js +2 -2
  118. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1uvfwgr._.js +4 -0
  119. package/.next/standalone/.next/server/chunks/ssr/_05whahf._.js +1 -1
  120. package/.next/standalone/.next/server/chunks/ssr/_0il3fl1._.js +3 -0
  121. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +49 -21
  122. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  123. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
  124. package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_0ihmbv4.js +3 -0
  125. package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_1ao30b1.js +3 -0
  126. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +1 -1
  127. package/.next/standalone/.next/server/middleware-build-manifest.js +6 -6
  128. package/.next/standalone/.next/server/pages/404.html +1 -1
  129. package/.next/standalone/.next/server/pages/500.html +1 -1
  130. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  131. package/.next/standalone/.next/server/server-reference-manifest.json +10 -10
  132. package/.next/standalone/.next/static/chunks/{0d49wc5zca0u1.js → 02fywjt0by40a.js} +1 -1
  133. package/.next/standalone/.next/static/chunks/0f7d7hnbh4djs.js +1 -0
  134. package/.next/standalone/.next/static/chunks/0h7auy7hzjyhw.js +1 -0
  135. package/.next/standalone/.next/static/chunks/0xdx2ehtbdoeg.js +1 -0
  136. package/.next/standalone/.next/static/chunks/{1nd1e30h8s_mc.js → 1-a5rvq67k7ed.js} +1 -1
  137. package/.next/standalone/.next/static/chunks/{1m2yj97j7f_km.js → 15csyj1_rf0-w.js} +1 -1
  138. package/.next/standalone/.next/static/chunks/1o0xa47736gi9.css +2 -0
  139. package/.next/standalone/.next/static/chunks/24cv31x607n7k.js +1 -0
  140. package/.next/standalone/.next/static/chunks/{3w8d8k_dca5rp.js → 2h0dkzyy0vocp.js} +1 -1
  141. package/.next/standalone/.next/static/chunks/2n_s8v1ae38_a.js +69 -0
  142. package/.next/standalone/.next/static/chunks/2y-jmvrjxz60x.js +6 -0
  143. package/.next/standalone/.next/static/chunks/{24z-bgbisv379.js → 3eik_d9qrvoft.js} +1 -1
  144. package/.next/standalone/.next/static/chunks/3i27c3hcriawq.css +1 -0
  145. package/.next/standalone/.next/static/chunks/{0j969hb6nujdf.js → 3v61675vr6jav.js} +1 -1
  146. package/.next/standalone/.next/static/chunks/3zkg2s2vzxc3d.js +1 -0
  147. package/.next/standalone/.next/static/chunks/{turbopack-00qy7zfa7m--m.js → turbopack-3lrm4f20fz89b.js} +1 -1
  148. package/.next/standalone/app/api/audit/invite/route.ts +192 -0
  149. package/.next/standalone/app/api/audit/run/route.ts +35 -0
  150. package/.next/standalone/app/api/auth/login-request/route.ts +2 -2
  151. package/.next/standalone/app/api/auth/login-verify/route.ts +10 -2
  152. package/.next/standalone/app/audit/_components/audit-dashboard.tsx +39 -63
  153. package/.next/standalone/app/audit/_components/audit-poster.tsx +326 -0
  154. package/.next/standalone/app/audit/_components/auth-dialog.tsx +23 -49
  155. package/.next/standalone/app/audit/_components/come-back-better-section.tsx +336 -0
  156. package/.next/standalone/app/audit/_components/how-to-improve-section.tsx +187 -0
  157. package/.next/standalone/app/audit/_components/invite-dialog.tsx +230 -0
  158. package/.next/standalone/app/audit/_components/quirks-section.tsx +75 -0
  159. package/.next/standalone/app/audit/_components/share-templates.ts +63 -32
  160. package/.next/standalone/app/audit/_components/sigil.tsx +9 -66
  161. package/.next/standalone/app/audit/_components/strengths-section.tsx +20 -32
  162. package/.next/standalone/app/audit/audit-styles.css +778 -1786
  163. package/.next/standalone/app/components/sessions-list.tsx +77 -80
  164. package/.next/standalone/app/globals.css +241 -34
  165. package/.next/standalone/app/layout.tsx +1 -10
  166. package/.next/standalone/app/policies/hooks-client.tsx +45 -28
  167. package/.next/standalone/app/project/[name]/page.tsx +23 -79
  168. package/.next/standalone/app/projects/page.tsx +14 -23
  169. package/.next/standalone/assets/audit/poster-styles.css +1 -1
  170. package/.next/standalone/assets/audit/styles.css +11 -11
  171. package/.next/standalone/components/navbar.tsx +2 -37
  172. package/.next/standalone/components/reach-developers.tsx +10 -25
  173. package/.next/standalone/lib/auth/api-server-client.ts +28 -0
  174. package/.next/standalone/lib/client-telemetry.ts +4 -0
  175. package/.next/standalone/node_modules/@next/env/package.json +2 -2
  176. package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
  177. package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  178. package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
  179. package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
  180. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +2 -2
  181. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
  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/start-server.js +1 -1
  184. package/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  185. package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  186. package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  187. package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
  188. package/.next/standalone/node_modules/next/package.json +15 -15
  189. package/.next/standalone/package.json +19 -14
  190. package/.next/standalone/server.js +1 -1
  191. package/README.md +2 -2
  192. package/bin/failproofai.mjs +24 -5
  193. package/dist/cli.mjs +2328 -381
  194. package/lib/auth/api-server-client.ts +28 -0
  195. package/lib/client-telemetry.ts +4 -0
  196. package/package.json +19 -14
  197. package/scripts/launch.ts +30 -4
  198. package/scripts/postinstall.mjs +10 -1
  199. package/scripts/skew-log-filter.ts +46 -0
  200. package/scripts/validate-mdx.ts +139 -0
  201. package/src/audit/cli.ts +330 -0
  202. package/src/audit/open-browser.ts +69 -0
  203. package/src/audit/social-proof.ts +34 -0
  204. package/src/auth/cli.ts +16 -13
  205. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07tgnzi._.js +0 -3
  206. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0oeun7z._.js +0 -3
  207. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12pit4m._.js +0 -3
  208. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13ra2jq._.js +0 -3
  209. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1b9z5-i._.js +0 -3
  210. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ixjiy8._.js +0 -3
  211. package/.next/standalone/.next/server/chunks/_1-1804f._.js +0 -3
  212. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__00jkjmt._.js +0 -4
  213. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013du6r._.js +0 -4
  214. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e85wxv._.js +0 -4
  215. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gfxvb1._.js +0 -3
  216. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1hlrq6y._.js +0 -4
  217. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ihxdo5._.js +0 -4
  218. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1vvfde2._.js +0 -4
  219. package/.next/standalone/.next/server/chunks/ssr/node_modules_html2canvas_dist_html2canvas_esm_1k58rb_.js +0 -3
  220. package/.next/standalone/.next/server/chunks/ssr/node_modules_html2canvas_dist_html2canvas_esm_1n-0xws.js +0 -3
  221. package/.next/standalone/.next/static/chunks/09ueq8s1as8xs.css +0 -2
  222. package/.next/standalone/.next/static/chunks/0qassxjx1ef04.js +0 -1
  223. package/.next/standalone/.next/static/chunks/0qxb5czqxe-vu.js +0 -1
  224. package/.next/standalone/.next/static/chunks/1dh06515j265n.js +0 -41
  225. package/.next/standalone/.next/static/chunks/29gs4efgi3hme.js +0 -6
  226. package/.next/standalone/.next/static/chunks/2mni177pnjx6u.js +0 -1
  227. package/.next/standalone/.next/static/chunks/2so39wg7mjbi7.js +0 -1
  228. package/.next/standalone/.next/static/chunks/3gti1qdk5epqn.js +0 -1
  229. package/.next/standalone/.next/static/chunks/3wycox197ouus.css +0 -1
  230. package/.next/standalone/app/audit/_components/findings-section.tsx +0 -135
  231. package/.next/standalone/app/audit/_components/identity-section.tsx +0 -126
  232. package/.next/standalone/app/audit/_components/policies-section.tsx +0 -194
  233. package/.next/standalone/app/audit/_components/return-section.tsx +0 -416
  234. package/.next/standalone/app/audit/_components/score-section.tsx +0 -179
  235. package/.next/standalone/app/audit/_components/share-dock.tsx +0 -265
  236. package/.next/standalone/app/audit/_components/show-off-cta.tsx +0 -135
  237. /package/.next/standalone/.next/static/{CVv2A0hMd24t0c0x3V-W_ → P_MIRSeoE296wkbE-Icin}/_buildManifest.js +0 -0
  238. /package/.next/standalone/.next/static/{CVv2A0hMd24t0c0x3V-W_ → P_MIRSeoE296wkbE-Icin}/_clientMiddlewareManifest.js +0 -0
  239. /package/.next/standalone/.next/static/{CVv2A0hMd24t0c0x3V-W_ → P_MIRSeoE296wkbE-Icin}/_ssgManifest.js +0 -0
@@ -0,0 +1,330 @@
1
+ /**
2
+ * `failproofai audit` — run a local audit of your agent-CLI history, then open
3
+ * the dashboard to view it.
4
+ *
5
+ * failproofai audit Scan, then launch the dashboard at /audit.
6
+ * failproofai audit --help Show usage.
7
+ *
8
+ * `runAudit()` is a pure local function (no network, no account). We run it,
9
+ * render the same four progress stages the dashboard's RunProgress shows,
10
+ * pre-warm the dashboard cache (~/.failproofai/audit-dashboard.json), then start
11
+ * the bundled dashboard server and open the browser to /audit — which renders
12
+ * instantly from that cache.
13
+ *
14
+ * No arguments yet — a bare `failproofai audit` does a full scan (all CLIs, all
15
+ * history). Flags (--since, --cli, --project, --port, --no-open) are easy
16
+ * follow-ups against `RunAuditOptions`.
17
+ */
18
+ import { runAudit } from "./index";
19
+ import { writeDashboardCache } from "./dashboard-cache";
20
+ import type { AuditResult, RunAuditOptions } from "./types";
21
+ import { trackHookEvent } from "../hooks/hook-telemetry";
22
+ import { getInstanceId } from "../../lib/telemetry-id";
23
+ import { openWhenReady } from "./open-browser";
24
+
25
+ /** Port the bundled dashboard binds to. Matches `scripts/launch.ts`'s default
26
+ * for `start` mode, which `failproofai` (bare) already uses. */
27
+ const DASHBOARD_PORT = 8020;
28
+
29
+ /**
30
+ * Mirror of `app/audit/_components/run-progress.tsx`'s `STAGES`. Kept identical
31
+ * so the CLI and the dashboard's in-progress view tell the same story — the
32
+ * dashboard even renders a mock `$ failproofai audit` terminal, and this is the
33
+ * real thing. `audit-cli.test.ts` guards against drift between the two.
34
+ */
35
+ export const AUDIT_STAGES: ReadonlyArray<{ label: string; detail: string }> = [
36
+ { label: "discovering transcripts", detail: "walking ~/.claude, ~/.codex, ~/.cursor, …" },
37
+ { label: "parsing session logs", detail: "reading JSONL + sqlite session stores" },
38
+ { label: "running policy checks", detail: "replaying through 30 builtin policies" },
39
+ { label: "aggregating results", detail: "counting hits, ranking by frequency" },
40
+ ];
41
+
42
+ const HELP = `
43
+ failproofai audit — audit your AI agent's behavior, then open the dashboard
44
+
45
+ USAGE
46
+ failproofai audit Scan your agent-CLI session history for risky and
47
+ wasteful patterns, then open the audit dashboard.
48
+ failproofai audit --help Show this help.
49
+
50
+ WHAT IT DOES
51
+ 1. Scans past sessions from every installed agent CLI (Claude, Codex, Cursor,
52
+ Copilot, OpenCode, Pi, Gemini) — entirely on your machine.
53
+ 2. Starts the local dashboard and opens
54
+ http://localhost:${DASHBOARD_PORT}/audit with your results.
55
+
56
+ Runs fully offline — no account or network required. Press Ctrl+C to stop the
57
+ dashboard server when you're done.
58
+ `.trimStart();
59
+
60
+ // ── ANSI helpers ────────────────────────────────────────────────────────────
61
+ const RESET = "\x1b[0m";
62
+ const DIM = "\x1b[2m";
63
+ const BOLD = "\x1b[1m";
64
+ const PINK = "\x1b[38;5;204m";
65
+ const GREEN = "\x1b[38;5;120m";
66
+ const CYAN = "\x1b[38;5;81m";
67
+ const SPINNER = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
68
+
69
+ function colorOn(): boolean {
70
+ if (process.env.NO_COLOR && process.env.NO_COLOR !== "") return false;
71
+ if (process.env.FORCE_COLOR === "0") return false;
72
+ if (process.env.FORCE_COLOR) return true;
73
+ return !!process.stdout.isTTY;
74
+ }
75
+
76
+ /** Wrap `s` in an ANSI code when color is enabled, else return it bare. */
77
+ function c(code: string, s: string): string {
78
+ return colorOn() ? `${code}${s}${RESET}` : s;
79
+ }
80
+
81
+ function num(n: number): string {
82
+ return n.toLocaleString("en-US");
83
+ }
84
+
85
+ /**
86
+ * Print an error and exit 1. We exit directly rather than throwing a `CliError`
87
+ * because, in the shipped single-file bundle (`dist/cli.mjs`), the entrypoint's
88
+ * dynamically-imported `CliError` is a different class instance than the one
89
+ * bundled here, so `err instanceof CliError` fails and the message degrades to
90
+ * "Unexpected error" + exit 2. Exiting here keeps the audit command's failures
91
+ * clean in both source and bundled runs.
92
+ */
93
+ function die(message: string): never {
94
+ process.stderr.write(`Error: ${message}\n`);
95
+ process.exit(1);
96
+ }
97
+
98
+ // ── Progress animation ───────────────────────────────────────────────────────
99
+
100
+ interface Progress {
101
+ /** Mark every stage done and stop the timers. */
102
+ finish(): void;
103
+ /** Stop the timers without marking done (used on error). */
104
+ fail(): void;
105
+ }
106
+
107
+ /**
108
+ * Render the four audit stages with a live spinner, redrawing in place. Like the
109
+ * dashboard's RunProgress, the stages are time-driven (runAudit emits no phase
110
+ * events) and the last stage is *held* until `finish()` is called, so it never
111
+ * claims "done" before the real work resolves. TTY-only — the caller picks the
112
+ * plain-text path when stdout isn't a terminal.
113
+ */
114
+ function startProgress(): Progress {
115
+ const n = AUDIT_STAGES.length;
116
+ let stage = 0;
117
+ let tick = 0;
118
+ let done = false;
119
+ let printed = false;
120
+
121
+ const lineFor = (i: number): string => {
122
+ const s = AUDIT_STAGES[i];
123
+ if (done || i < stage) return ` ${c(GREEN, "✓")} ${c(DIM, s.label)}`;
124
+ if (i === stage) {
125
+ return ` ${c(PINK, SPINNER[tick % SPINNER.length])} ${s.label} ${c(DIM, s.detail)}`;
126
+ }
127
+ return ` ${c(DIM, "○")} ${c(DIM, s.label)}`;
128
+ };
129
+
130
+ const render = (): void => {
131
+ const lines = Array.from({ length: n }, (_, i) => lineFor(i));
132
+ // Move the cursor back up over the previously-drawn block, then clear and
133
+ // rewrite each line in place.
134
+ if (printed) process.stdout.write(`\x1b[${n}A`);
135
+ process.stdout.write(lines.map((l) => `\x1b[2K${l}`).join("\n") + "\n");
136
+ printed = true;
137
+ };
138
+
139
+ render();
140
+ const spinTimer = setInterval(() => {
141
+ tick++;
142
+ render();
143
+ }, 90);
144
+ // Advance through stages on a fixed cadence, holding on the last one until
145
+ // finish() flips `done`.
146
+ const stageTimer = setInterval(() => {
147
+ if (stage < n - 1) {
148
+ stage++;
149
+ render();
150
+ }
151
+ }, 1100);
152
+
153
+ const stop = (): void => {
154
+ clearInterval(spinTimer);
155
+ clearInterval(stageTimer);
156
+ };
157
+
158
+ return {
159
+ finish() {
160
+ stop();
161
+ done = true;
162
+ render();
163
+ },
164
+ fail() {
165
+ stop();
166
+ process.stdout.write("\n");
167
+ },
168
+ };
169
+ }
170
+
171
+ /** Run the audit, showing animated progress on a TTY or a single line elsewhere. */
172
+ async function runWithProgress(opts: RunAuditOptions): Promise<AuditResult> {
173
+ if (!process.stdout.isTTY) {
174
+ process.stdout.write(" scanning your agent session history — this can take a moment…\n");
175
+ return runAudit(opts);
176
+ }
177
+ const progress = startProgress();
178
+ try {
179
+ const result = await runAudit(opts);
180
+ progress.finish();
181
+ return result;
182
+ } catch (err) {
183
+ progress.fail();
184
+ throw err;
185
+ }
186
+ }
187
+
188
+ // ── Output ───────────────────────────────────────────────────────────────────
189
+
190
+ function printHeader(): void {
191
+ process.stdout.write(`\n ${c(PINK, "🛡 failproofai audit")} ${c(DIM, "· beta")}\n\n`);
192
+ process.stdout.write(` ${c(DIM, "starting audit…")}\n\n`);
193
+ }
194
+
195
+ /**
196
+ * The post-run summary lines (no leading indent, no trailing newlines). Pure so
197
+ * it's unit-testable; `printSummary` handles the indentation + stdout.
198
+ */
199
+ export function buildSummary(result: AuditResult): string[] {
200
+ const sessions = result.transcripts.scanned;
201
+ const events = result.eventsScanned;
202
+ const projects = result.projectsScanned.length;
203
+ const enabledRows = result.results.filter((r) => r.source === "builtin" && r.enabledInConfig);
204
+ const slippingRows = result.results.filter((r) => !(r.source === "builtin" && r.enabledInConfig));
205
+
206
+ const lines: string[] = [];
207
+ lines.push(
208
+ `${c(GREEN, "✓ audit complete")} ${c(DIM, "·")} ` +
209
+ `${c(BOLD, num(events))} tool call${events === 1 ? "" : "s"} across ` +
210
+ `${num(sessions)} session${sessions === 1 ? "" : "s"}` +
211
+ (projects > 0 ? ` ${c(DIM, "·")} ${num(projects)} project${projects === 1 ? "" : "s"}` : ""),
212
+ );
213
+
214
+ if (result.totals.hits === 0) {
215
+ // Only call it a "clean run" when we actually scanned something — for zero
216
+ // events the caller prints "no agent sessions found yet" guidance instead.
217
+ if (events > 0) lines.push(c(DIM, "clean run — nothing flagged. nice."));
218
+ return lines;
219
+ }
220
+
221
+ const parts: string[] = [];
222
+ if (slippingRows.length > 0) {
223
+ parts.push(
224
+ `${c(PINK, String(slippingRows.length))} ${slippingRows.length === 1 ? "pattern" : "patterns"} slipping through`,
225
+ );
226
+ }
227
+ if (enabledRows.length > 0) {
228
+ parts.push(`${c(GREEN, String(enabledRows.length))} already blocked by your policies`);
229
+ }
230
+ if (parts.length > 0) lines.push(parts.join(` ${c(DIM, "·")} `));
231
+ return lines;
232
+ }
233
+
234
+ function printSummary(result: AuditResult): void {
235
+ process.stdout.write("\n");
236
+ for (const line of buildSummary(result)) process.stdout.write(` ${line}\n`);
237
+ }
238
+
239
+ // ── Entry point ──────────────────────────────────────────────────────────────
240
+
241
+ export async function runAuditCli(args: string[]): Promise<void> {
242
+ if (args.includes("--help") || args.includes("-h")) {
243
+ process.stdout.write(HELP);
244
+ process.exit(0);
245
+ }
246
+ // No arguments supported yet — reject typos rather than silently doing a bare
247
+ // audit, so a future `failproofai audit --since 7d` doesn't quietly no-op.
248
+ const stray = args.find((a) => a !== "--help" && a !== "-h");
249
+ if (stray) {
250
+ die(
251
+ `\`audit\` takes no arguments yet (got: ${stray}).\n` +
252
+ `Run \`failproofai audit\` to scan your history and open the dashboard.`,
253
+ );
254
+ }
255
+
256
+ const instanceId = getInstanceId();
257
+ // Fire-and-forget is safe for `started`: the multi-second audit below (and the
258
+ // awaited cli_audit_completed / cli_audit_failed) keep the process alive long
259
+ // enough for this fetch to land. Awaiting it would add up to a 5s pre-audit
260
+ // stall on a flaky network for no reliability gain.
261
+ void trackHookEvent(instanceId, "cli_audit_started", { source: "cli" });
262
+
263
+ printHeader();
264
+
265
+ // Full scan: all CLIs, all history, per-transcript cache on.
266
+ const opts: RunAuditOptions = {};
267
+
268
+ let result: AuditResult;
269
+ try {
270
+ result = await runWithProgress(opts);
271
+ } catch (err) {
272
+ // Await before die(): die() calls process.exit(1), which would kill an
273
+ // in-flight fire-and-forget fetch and drop this event. trackHookEvent is
274
+ // bounded (5s timeout) and never throws, so this can't hang or mask the error.
275
+ await trackHookEvent(instanceId, "cli_audit_failed", {
276
+ source: "cli",
277
+ error_type: err instanceof Error ? err.name : "unknown",
278
+ });
279
+ die(`Audit failed: ${err instanceof Error ? err.message : String(err)}`);
280
+ }
281
+
282
+ printSummary(result);
283
+
284
+ // Await before the empty-history branch below, which calls process.exit(0) and
285
+ // would otherwise drop this event. On the dashboard path launch() keeps the
286
+ // process alive, but awaiting makes delivery reliable on every exit path.
287
+ // Bounded (5s) and never throws.
288
+ await trackHookEvent(instanceId, "cli_audit_completed", {
289
+ source: "cli",
290
+ events_scanned: result.eventsScanned,
291
+ sessions_scanned: result.transcripts.scanned,
292
+ total_hits: result.totals.hits,
293
+ findings: result.results.length,
294
+ });
295
+
296
+ // No sessions on disk — guide the user instead of opening an empty dashboard.
297
+ if (result.eventsScanned === 0) {
298
+ process.stdout.write(
299
+ `\n ${c(DIM, "no agent sessions found yet.")}\n` +
300
+ ` install hooks with ${c(CYAN, "failproofai policies --install")} ` +
301
+ `${c(DIM, "and come back after using your agent.")}\n\n`,
302
+ );
303
+ process.exit(0);
304
+ }
305
+
306
+ // Pre-warm the dashboard cache — the /audit page reads this file directly, so
307
+ // the page renders our result instantly with no in-browser re-run.
308
+ const persisted = writeDashboardCache(opts, result);
309
+ if (!persisted) {
310
+ process.stdout.write(
311
+ `\n ${c(PINK, "!")} ${c(DIM, "couldn't save the audit cache; the dashboard may show an empty state.")}\n`,
312
+ );
313
+ }
314
+
315
+ const url = `http://localhost:${DASHBOARD_PORT}/audit`;
316
+ process.stdout.write(
317
+ `\n ${c(DIM, "starting the dashboard…")}\n` +
318
+ ` ${c(PINK, "✦")} ${c(BOLD, "here's your audit")} ${c(DIM, "→")} ${c(CYAN, url)}\n` +
319
+ ` ${c(DIM, "(opening in your browser — press Ctrl+C to stop the server)")}\n\n`,
320
+ );
321
+
322
+ // Open the page once the server answers (best-effort, detached), then start
323
+ // the server. `launch("start")` blocks-by-keeping-alive — it spawns the
324
+ // bundled standalone dashboard and the process stays up serving it.
325
+ openWhenReady(DASHBOARD_PORT, "/audit");
326
+ const { launch } = await import("../../scripts/launch");
327
+ launch("start");
328
+ // Intentionally no process.exit(): launch() keeps this process alive running
329
+ // the dashboard until the user stops it.
330
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Best-effort "open the dashboard in the browser once it's actually listening".
3
+ *
4
+ * `failproofai audit` writes the dashboard cache, then starts the bundled
5
+ * dashboard server (a blocking call) and wants to pop the browser to /audit the
6
+ * moment the server answers — never before (a connection-refused tab is a bad
7
+ * first impression). This polls the server root, then shells out to the
8
+ * platform's URL opener. Every failure is swallowed: the worst case is the user
9
+ * clicks the URL we already printed to the terminal.
10
+ */
11
+ import { spawn } from "node:child_process";
12
+
13
+ const POLL_INTERVAL_MS = 150;
14
+ const POLL_TIMEOUT_MS = 30_000;
15
+
16
+ /** Open a URL with the platform's default handler. Never throws. */
17
+ function openUrl(url: string): void {
18
+ let cmd: string;
19
+ let args: string[];
20
+ if (process.platform === "darwin") {
21
+ cmd = "open";
22
+ args = [url];
23
+ } else if (process.platform === "win32") {
24
+ // `start` is a cmd builtin; the empty "" is the (required) window-title arg
25
+ // so a URL containing `&` or spaces isn't mis-parsed as the title.
26
+ cmd = "cmd";
27
+ args = ["/c", "start", "", url];
28
+ } else {
29
+ cmd = "xdg-open";
30
+ args = [url];
31
+ }
32
+ try {
33
+ const child = spawn(cmd, args, { stdio: "ignore", detached: true });
34
+ // Headless Linux without xdg-open, missing `open`, etc. — swallow.
35
+ child.on("error", () => {});
36
+ child.unref();
37
+ } catch {
38
+ // ignore — the URL was already printed for manual use.
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Poll `http://localhost:<port>/` until it responds (any status, including a
44
+ * redirect), then open `http://localhost:<port><path>`. Detached and
45
+ * best-effort: returns immediately, does its work on the event loop, and never
46
+ * throws into the caller (which is about to make a blocking `launch()` call).
47
+ */
48
+ export function openWhenReady(port: number, path: string): void {
49
+ const base = `http://localhost:${port}`;
50
+ const target = `${base}${path}`;
51
+ void (async () => {
52
+ const deadline = Date.now() + POLL_TIMEOUT_MS;
53
+ while (Date.now() < deadline) {
54
+ try {
55
+ // `redirect: "manual"` so the dashboard's `/ → /policies` 307 counts as
56
+ // "up" without us following it and rendering an unrelated page.
57
+ await fetch(base, { method: "GET", redirect: "manual" });
58
+ openUrl(target);
59
+ return;
60
+ } catch {
61
+ // Not listening yet — wait and retry.
62
+ await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
63
+ }
64
+ }
65
+ // Timed out waiting for the probe. The server may still be coming up; open
66
+ // anyway as a last resort so a slow cold boot still lands on the page.
67
+ openUrl(target);
68
+ })();
69
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Population-level signals shown on the audit poster: how rare your
3
+ * archetype is and where your score sits in the cohort. Seeded with
4
+ * snapshot values; swap for live aggregates once that pipeline lands.
5
+ */
6
+
7
+ import type { ArchetypeKey } from "./archetypes";
8
+
9
+ /** Percentage of audited agents that map to a given archetype. */
10
+ const ARCHETYPE_RARITY: Record<ArchetypeKey, number> = {
11
+ optimist: 18,
12
+ cowboy: 9,
13
+ explorer: 14,
14
+ goldfish: 11,
15
+ architect: 7,
16
+ precision: 16,
17
+ hammer: 13,
18
+ ghost: 12,
19
+ };
20
+
21
+ /** Map a 0-100 score to a "top N%" rank band. Bands roughly mirror the
22
+ * S/A/B/C/D/F tiers in scoring.ts. */
23
+ export function getScoreRank(score: number): string {
24
+ if (score >= 90) return "top 5%";
25
+ if (score >= 80) return "top 15%";
26
+ if (score >= 71) return "top 35%";
27
+ if (score >= 55) return "top 60%";
28
+ if (score >= 40) return "top 85%";
29
+ return "bottom tier";
30
+ }
31
+
32
+ export function getArchetypeRarityPct(key: ArchetypeKey): number {
33
+ return ARCHETYPE_RARITY[key];
34
+ }
package/src/auth/cli.ts CHANGED
@@ -144,7 +144,7 @@ async function runLogin(): Promise<void> {
144
144
  const nowSecs = Math.floor(Date.now() / 1000);
145
145
  const refreshUsable = existing.refresh_expires_at > nowSecs;
146
146
  if (refreshUsable) {
147
- void trackHookEvent(getInstanceId(), "audit_cli_auth_login_completed", {
147
+ await trackHookEvent(getInstanceId(), "audit_cli_auth_login_completed", {
148
148
  source: "cli",
149
149
  status: "already_signed_in",
150
150
  user_id: existing.user.id,
@@ -160,6 +160,8 @@ async function runLogin(): Promise<void> {
160
160
  // Overwrite cleanly so a half-broken file doesn't survive next startup.
161
161
  deleteAuth();
162
162
  }
163
+ // Fire-and-forget: the interactive `email:` / `code:` prompts that follow keep
164
+ // the process alive well past the 5s fetch, and awaiting would stall the prompt.
163
165
  void trackHookEvent(getInstanceId(), "audit_cli_auth_login_started", {
164
166
  source: "cli",
165
167
  api_base: getApiBase(),
@@ -177,7 +179,7 @@ async function runLogin(): Promise<void> {
177
179
  email = "";
178
180
  }
179
181
  if (!email) {
180
- void trackHookEvent(getInstanceId(), "audit_cli_auth_login_completed", {
182
+ await trackHookEvent(getInstanceId(), "audit_cli_auth_login_completed", {
181
183
  source: "cli",
182
184
  status: "aborted_invalid_email",
183
185
  });
@@ -186,6 +188,7 @@ async function runLogin(): Promise<void> {
186
188
 
187
189
  try {
188
190
  const r = await requestLoginCode(email);
191
+ // Fire-and-forget: the `code:` prompt loop below keeps the process alive.
189
192
  void trackHookEvent(getInstanceId(), "audit_otp_requested", {
190
193
  source: "cli",
191
194
  status: "success",
@@ -197,7 +200,7 @@ async function runLogin(): Promise<void> {
197
200
  );
198
201
  } catch (err) {
199
202
  const isApi = err instanceof AuthApiError;
200
- void trackHookEvent(getInstanceId(), "audit_otp_requested", {
203
+ await trackHookEvent(getInstanceId(), "audit_otp_requested", {
201
204
  source: "cli",
202
205
  status: "failed",
203
206
  error_code: isApi ? err.code : "upstream_unreachable",
@@ -228,7 +231,7 @@ async function runLogin(): Promise<void> {
228
231
  break;
229
232
  } catch (err) {
230
233
  const isApi = err instanceof AuthApiError;
231
- void trackHookEvent(getInstanceId(), "audit_otp_verified", {
234
+ await trackHookEvent(getInstanceId(), "audit_otp_verified", {
232
235
  source: "cli",
233
236
  status: "failed",
234
237
  attempt: verifyAttempts,
@@ -248,7 +251,7 @@ async function runLogin(): Promise<void> {
248
251
  }
249
252
  }
250
253
  if (!tokenResp) {
251
- void trackHookEvent(getInstanceId(), "audit_cli_auth_login_completed", {
254
+ await trackHookEvent(getInstanceId(), "audit_cli_auth_login_completed", {
252
255
  source: "cli",
253
256
  status: "exhausted_attempts",
254
257
  attempts: verifyAttempts,
@@ -257,7 +260,7 @@ async function runLogin(): Promise<void> {
257
260
  }
258
261
 
259
262
  writeAuth(authFromTokenResponse(tokenResp));
260
- void trackHookEvent(getInstanceId(), "audit_otp_verified", {
263
+ await trackHookEvent(getInstanceId(), "audit_otp_verified", {
261
264
  source: "cli",
262
265
  status: "success",
263
266
  attempt: verifyAttempts,
@@ -273,14 +276,14 @@ async function runLogin(): Promise<void> {
273
276
  // `source: "audit_set_reminder_auth_dialog"`; this is the CLI sibling —
274
277
  // without it, anyone who signs in via `failproofai auth login` stays
275
278
  // unjoined to their pre-auth events.
276
- void trackHookEvent(getInstanceId(), "audit_user_identity_linked", {
279
+ await trackHookEvent(getInstanceId(), "audit_user_identity_linked", {
277
280
  source: "cli",
278
281
  user_id: tokenResp.user.id,
279
282
  email: tokenResp.user.email,
280
283
  local_random_id: getInstanceId(),
281
284
  $set: { email: tokenResp.user.email, user_id: tokenResp.user.id },
282
285
  });
283
- void trackHookEvent(getInstanceId(), "audit_cli_auth_login_completed", {
286
+ await trackHookEvent(getInstanceId(), "audit_cli_auth_login_completed", {
284
287
  source: "cli",
285
288
  status: "success",
286
289
  attempts: verifyAttempts,
@@ -295,7 +298,7 @@ async function runLogin(): Promise<void> {
295
298
  async function runLogout(): Promise<void> {
296
299
  const existing = readAuth();
297
300
  if (!existing) {
298
- void trackHookEvent(getInstanceId(), "audit_cli_auth_logout_completed", {
301
+ await trackHookEvent(getInstanceId(), "audit_cli_auth_logout_completed", {
299
302
  source: "cli",
300
303
  had_session: false,
301
304
  upstream: "noop",
@@ -315,7 +318,7 @@ async function runLogout(): Promise<void> {
315
318
  }
316
319
  }
317
320
  deleteAuth();
318
- void trackHookEvent(getInstanceId(), "audit_cli_auth_logout_completed", {
321
+ await trackHookEvent(getInstanceId(), "audit_cli_auth_logout_completed", {
319
322
  source: "cli",
320
323
  had_session: true,
321
324
  upstream,
@@ -326,10 +329,10 @@ async function runLogout(): Promise<void> {
326
329
  );
327
330
  }
328
331
 
329
- function runWhoami(): void {
332
+ async function runWhoami(): Promise<void> {
330
333
  const existing = readAuth();
331
334
  if (!existing) {
332
- void trackHookEvent(getInstanceId(), "audit_cli_auth_whoami", {
335
+ await trackHookEvent(getInstanceId(), "audit_cli_auth_whoami", {
333
336
  source: "cli",
334
337
  authenticated: false,
335
338
  });
@@ -337,7 +340,7 @@ function runWhoami(): void {
337
340
  process.exitCode = 1;
338
341
  return;
339
342
  }
340
- void trackHookEvent(getInstanceId(), "audit_cli_auth_whoami", {
343
+ await trackHookEvent(getInstanceId(), "audit_cli_auth_whoami", {
341
344
  source: "cli",
342
345
  authenticated: true,
343
346
  user_id: existing.user.id,
@@ -1,3 +0,0 @@
1
- module.exports=[74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},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"))},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"))},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"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},43488,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),x=e.i(26937),v=e.i(10372),R=e.i(93695);e.i(20232);var g=e.i(220),f=e.i(89171),m=e.i(6375),_=e.i(17707),w=e.i(72561);async function E(){await (0,w.initTelemetry)();let e=(0,_.readAuth)();if(!e)return(0,w.trackEvent)("audit_user_logged_out",{source:"dashboard",had_session:!1,upstream:"noop"}),f.NextResponse.json({authenticated:!1},{status:200});let t="skipped",r=null;try{await (0,m.logoutSession)(e.access_token,e.refresh_token),t="revoked"}catch(e){e instanceof m.AuthApiError&&401===e.status?t="revoked":(t="failed",r=e instanceof Error?e.message.slice(0,200):String(e).slice(0,200))}return(0,_.deleteAuth)(),(0,w.trackEvent)("audit_user_logged_out",{source:"dashboard",had_session:!0,upstream:t,upstream_error:r,user_id:e.user.id}),f.NextResponse.json({authenticated:!1,upstream:t},{status:200})}e.s(["POST",0,E,"dynamic",0,"force-dynamic"],19851);var y=e.i(19851);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/auth/logout/route",pathname:"/api/auth/logout",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/auth/logout/route.ts",nextConfigOutput:"standalone",userland:y,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:b,serverHooks:k}=C;async function q(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),C.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let f="/api/auth/logout/route";f=f.replace(/\/index$/,"")||"/";let m=await C.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!m)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:_,deploymentId:w,params:E,nextConfig:y,parsedUrl:A,isDraftMode:b,prerenderManifest:k,routerServerContext:q,isOnDemandRevalidate:N,revalidateOnlyGenerated:T,resolvedPathname:P,clientReferenceManifest:S,serverActionsManifest:j}=m,O=(0,i.normalizeAppPath)(f),H=!!(k.dynamicRoutes[O]||k.routes[P]),I=async()=>((null==q?void 0:q.render404)?await q.render404(e,t,A,!1):t.end("This page could not be found"),null);if(H&&!b){let e=!!k.routes[P],t=k.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(y.adapterPath)return await I();throw new R.NoFallbackError}}let U=null;!H||C.isDev||b||(U="/index"===(U=P)?"/":U);let M=!0===C.isDev||!H,D=H&&!M;j&&S&&(0,o.setManifestsSingleton)({page:f,clientReferenceManifest:S,serverActionsManifest:j});let $=e.method||"GET",F=(0,s.getTracer)(),K=F.getActiveScopeSpan(),B=!!(null==q?void 0:q.isWrappedByNextServer),L=!!(0,n.getRequestMeta)(e,"minimalMode"),G=(0,n.getRequestMeta)(e,"incrementalCache")||await C.getIncrementalCache(e,y,k,L);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let V={params:E,previewProps:k.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:M,incrementalCache:G,cacheLifeProfiles:y.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>C.onRequestError(e,t,a,n,q)},sharedContext:{buildId:_,deploymentId:w}},W=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),z=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t));try{let n,o=async e=>C.handle(z,V).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void 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");if(a){let t=`${$} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${$} ${f}`)}),i=async n=>{var s,i;let l=async({previousCacheEntry:r})=>{try{if(!L&&N&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(n);e.fetchMetrics=V.renderOpts.fetchMetrics;let i=V.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let l=V.renderOpts.collectedTags;if(!H)return await (0,c.sendResponse)(W,X,s,V.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[v.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==V.renderOpts.collectedRevalidate&&!(V.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&V.renderOpts.collectedRevalidate,a=void 0===V.renderOpts.collectedExpire||V.renderOpts.collectedExpire>=v.INFINITE_CACHE?void 0:V.renderOpts.collectedExpire;return{value:{kind:g.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 C.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:N})},!1,q),t}},d=await C.handleResponse({req:e,nextConfig:y,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:k,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:L});if(!H)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",N?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return L&&H||u.delete(v.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,x.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(W,X,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};B&&K?await i(K):(n=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${$} ${f}`,kind:s.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},i),void 0,!B))}catch(t){if(t instanceof R.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:N})},!1,q),H)throw t;return await (0,c.sendResponse)(W,X,new Response(null,{status:500})),null}}e.s(["handler",0,q,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:b})},"routeModule",0,C,"serverHooks",0,k,"workAsyncStorage",0,A,"workUnitAsyncStorage",0,b],43488)},78081,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__14odj07._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js"].map(t=>e.l(t))).then(()=>t(39702)))}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__07tgnzi._.js.map
@@ -1,3 +0,0 @@
1
- module.exports=[74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},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"))},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"))},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"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},52263,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),d=e.i(16795),l=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),m=e.i(26937),_=e.i(10372),x=e.i(93695);e.i(20232);var v=e.i(220),R=e.i(89171),f=e.i(17707),g=e.i(6375),y=e.i(72561);async function w(){let e=await (0,f.whoAmI)(),t=(0,f.readReminder)();return t&&e&&e.me.email===t.user_email?R.NextResponse.json({authenticated:!0,reminder:{next_audit_at:t.next_audit_at,user_email:t.user_email,set_at:t.set_at}}):R.NextResponse.json({authenticated:!!e,reminder:null})}async function E(e){let t;await (0,y.initTelemetry)();let r=await (0,f.whoAmI)();if(!r)return(0,y.trackEvent)("audit_reminder_set",{status:"unauthorized",source:"dashboard"}),R.NextResponse.json({code:"unauthorized",message:"Sign in before setting a reminder."},{status:401});let a={},n=await e.text();if(n.trim().length>0){let e;try{e=JSON.parse(n)}catch{return(0,y.trackEvent)("audit_reminder_set",{status:"validation_error",source:"dashboard",reason:"malformed_json",user_id:r.me.id}),R.NextResponse.json({code:"validation_error",message:"Request body is not valid JSON."},{status:400})}if(null===e||"object"!=typeof e||Array.isArray(e))return(0,y.trackEvent)("audit_reminder_set",{status:"validation_error",source:"dashboard",reason:"not_an_object",user_id:r.me.id}),R.NextResponse.json({code:"validation_error",message:"Request body must be a JSON object."},{status:400});a=e}let s=Math.floor(Date.now()/1e3),i=s+31536e3;if((t="number"==typeof a.at&&Number.isFinite(a.at)?Math.floor(a.at):s+86400*("number"==typeof a.in_days&&Number.isFinite(a.in_days)?Math.max(1,Math.min(365,Math.floor(a.in_days))):7))<=s)return(0,y.trackEvent)("audit_reminder_set",{status:"validation_error",source:"dashboard",reason:"in_the_past",user_id:r.me.id}),R.NextResponse.json({code:"validation_error",message:"Reminder must be in the future."},{status:400});if(t>i)return(0,y.trackEvent)("audit_reminder_set",{status:"validation_error",source:"dashboard",reason:"too_far_in_future",user_id:r.me.id}),R.NextResponse.json({code:"validation_error",message:"Reminder must be within 365 days. Did you pass milliseconds instead of seconds?"},{status:400});let o={next_audit_at:t,user_email:r.me.email,set_at:s};(0,f.writeReminder)(o);let d="skipped",l=null;try{await (0,g.scheduleReminder)(r.auth.access_token,{at:t}),d="scheduled"}catch(e){d="failed",l=e instanceof g.AuthApiError?`${e.code}: ${e.message}`.slice(0,200):e instanceof Error?e.message.slice(0,200):String(e).slice(0,200)}return(0,y.trackEvent)("audit_reminder_set",{status:"success",source:"dashboard",user_id:r.me.id,offset_days:Math.round((t-s)/86400),upstream:d,upstream_error:l}),R.NextResponse.json({authenticated:!0,reminder:o})}async function b(){await (0,y.initTelemetry)();let e=await (0,f.whoAmI)(),t=(0,f.readReminder)();(0,f.deleteReminder)();let r="skipped",a=null;if(e)try{await (0,g.cancelReminder)(e.auth.access_token),r="cancelled"}catch(e){r="failed",a=e instanceof g.AuthApiError?`${e.code}: ${e.message}`.slice(0,200):e instanceof Error?e.message.slice(0,200):String(e).slice(0,200)}return(0,y.trackEvent)("audit_reminder_cleared",{source:"dashboard",had_local_reminder:null!==t,user_id:e?.me.id??null,upstream:r,upstream_error:a}),R.NextResponse.json({ok:!0})}e.s(["DELETE",0,b,"GET",0,w,"POST",0,E,"dynamic",0,"force-dynamic"],13757);var A=e.i(13757);let N=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/auth/reminder/route",pathname:"/api/auth/reminder",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/auth/reminder/route.ts",nextConfigOutput:"standalone",userland:A,...{}}),{workAsyncStorage:C,workUnitAsyncStorage:k,serverHooks:j}=N;async function q(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),N.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let R="/api/auth/reminder/route";R=R.replace(/\/index$/,"")||"/";let f=await N.prepare(e,t,{srcPage:R,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:g,deploymentId:y,params:w,nextConfig:E,parsedUrl:b,isDraftMode:A,prerenderManifest:C,routerServerContext:k,isOnDemandRevalidate:j,revalidateOnlyGenerated:q,resolvedPathname:T,clientReferenceManifest:S,serverActionsManifest:P}=f,O=(0,o.normalizeAppPath)(R),M=!!(C.dynamicRoutes[O]||C.routes[T]),I=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,b,!1):t.end("This page could not be found"),null);if(M&&!A){let e=!!C.routes[T],t=C.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await I();throw new x.NoFallbackError}}let H=null;!M||N.isDev||A||(H="/index"===(H=T)?"/":H);let D=!0===N.isDev||!M,U=M&&!D;P&&S&&(0,i.setManifestsSingleton)({page:R,clientReferenceManifest:S,serverActionsManifest:P});let $=e.method||"GET",F=(0,s.getTracer)(),K=F.getActiveScopeSpan(),B=!!(null==k?void 0:k.isWrappedByNextServer),L=!!(0,n.getRequestMeta)(e,"minimalMode"),G=(0,n.getRequestMeta)(e,"incrementalCache")||await N.getIncrementalCache(e,E,C,L);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let z={params:w,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:D,incrementalCache:G,cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>N.onRequestError(e,t,a,n,k)},sharedContext:{buildId:g,deploymentId:y}},J=new d.NodeNextRequest(e),V=new d.NodeNextResponse(t),W=l.NextRequestAdapter.fromNodeNextRequest(J,(0,l.signalFromNodeResponse)(t));try{let n,i=async e=>N.handle(W,z).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void 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");if(a){let t=`${$} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${$} ${R}`)}),o=async n=>{var s,o;let d=async({previousCacheEntry:r})=>{try{if(!L&&j&&q&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=z.renderOpts.fetchMetrics;let o=z.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let d=z.renderOpts.collectedTags;if(!M)return await (0,p.sendResponse)(J,V,s,z.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[_.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=_.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,a=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=_.INFINITE_CACHE?void 0:z.renderOpts.collectedExpire;return{value:{kind:v.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 N.onRequestError(e,t,{routerKind:"App Router",routePath:R,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:j})},!1,k),t}},l=await N.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:j,revalidateOnlyGenerated:q,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:L});if(!M)return null;if((null==l||null==(s=l.value)?void 0:s.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(o=l.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",j?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(l.value.headers);return L&&M||u.delete(_.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,m.getCacheControlHeader)(l.cacheControl)),await (0,p.sendResponse)(J,V,new Response(l.value.body,{headers:u,status:l.value.status||200})),null};B&&K?await o(K):(n=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${$} ${R}`,kind:s.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},o),void 0,!B))}catch(t){if(t instanceof x.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:j})},!1,k),M)throw t;return await (0,p.sendResponse)(J,V,new Response(null,{status:500})),null}}e.s(["handler",0,q,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:k})},"routeModule",0,N,"serverHooks",0,j,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,k],52263)},78081,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__14odj07._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js"].map(t=>e.l(t))).then(()=>t(39702)))}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__0oeun7z._.js.map
@@ -1,3 +0,0 @@
1
- module.exports=[74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},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"))},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"))},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"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},96889,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),x=e.i(26937),v=e.i(10372),R=e.i(93695);e.i(20232);var m=e.i(220),f=e.i(89171),g=e.i(17707);async function _(){let e=(0,g.readAuth)();if(!e)return f.NextResponse.json({authenticated:!1,reminder:null},{status:200});let t=(0,g.readReminder)(),r=t&&t.user_email===e.user.email?{next_audit_at:t.next_audit_at,user_email:t.user_email,set_at:t.set_at}:null;return f.NextResponse.json({authenticated:!0,user:{id:e.user.id,email:e.user.email},reminder:r},{status:200})}e.s(["GET",0,_,"dynamic",0,"force-dynamic"],20855);var w=e.i(20855);let E=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/auth/status/route",pathname:"/api/auth/status",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/auth/status/route.ts",nextConfigOutput:"standalone",userland:w,...{}}),{workAsyncStorage:y,workUnitAsyncStorage:C,serverHooks:A}=E;async function b(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),E.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let f="/api/auth/status/route";f=f.replace(/\/index$/,"")||"/";let g=await E.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:_,deploymentId:w,params:y,nextConfig:C,parsedUrl:A,isDraftMode:b,prerenderManifest:q,routerServerContext:N,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,resolvedPathname:j,clientReferenceManifest:k,serverActionsManifest:S}=g,O=(0,i.normalizeAppPath)(f),H=!!(q.dynamicRoutes[O]||q.routes[j]),I=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,A,!1):t.end("This page could not be found"),null);if(H&&!b){let e=!!q.routes[j],t=q.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(C.adapterPath)return await I();throw new R.NoFallbackError}}let U=null;!H||E.isDev||b||(U="/index"===(U=j)?"/":U);let M=!0===E.isDev||!H,D=H&&!M;S&&k&&(0,o.setManifestsSingleton)({page:f,clientReferenceManifest:k,serverActionsManifest:S});let $=e.method||"GET",F=(0,s.getTracer)(),K=F.getActiveScopeSpan(),B=!!(null==N?void 0:N.isWrappedByNextServer),L=!!(0,n.getRequestMeta)(e,"minimalMode"),G=(0,n.getRequestMeta)(e,"incrementalCache")||await E.getIncrementalCache(e,C,q,L);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let V={params:y,previewProps:q.preview,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:M,incrementalCache:G,cacheLifeProfiles:C.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>E.onRequestError(e,t,a,n,N)},sharedContext:{buildId:_,deploymentId:w}},W=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),z=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t));try{let n,o=async e=>E.handle(z,V).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void 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");if(a){let t=`${$} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${$} ${f}`)}),i=async n=>{var s,i;let l=async({previousCacheEntry:r})=>{try{if(!L&&T&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(n);e.fetchMetrics=V.renderOpts.fetchMetrics;let i=V.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let l=V.renderOpts.collectedTags;if(!H)return await (0,c.sendResponse)(W,X,s,V.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[v.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==V.renderOpts.collectedRevalidate&&!(V.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&V.renderOpts.collectedRevalidate,a=void 0===V.renderOpts.collectedExpire||V.renderOpts.collectedExpire>=v.INFINITE_CACHE?void 0:V.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 E.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,N),t}},d=await E.handleResponse({req:e,nextConfig:C,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:q,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:L});if(!H)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",T?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return L&&H||u.delete(v.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,x.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(W,X,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};B&&K?await i(K):(n=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${$} ${f}`,kind:s.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},i),void 0,!B))}catch(t){if(t instanceof R.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,N),H)throw t;return await (0,c.sendResponse)(W,X,new Response(null,{status:500})),null}}e.s(["handler",0,b,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:y,workUnitAsyncStorage:C})},"routeModule",0,E,"serverHooks",0,A,"workAsyncStorage",0,y,"workUnitAsyncStorage",0,C],96889)},78081,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__14odj07._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js"].map(t=>e.l(t))).then(()=>t(39702)))}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__12pit4m._.js.map