failproofai 1.0.4-beta.7 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +5 -5
  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 +2 -2
  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 +2 -2
  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.rsc +7 -7
  12. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
  13. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  14. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  16. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page.js +2 -2
  18. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  21. package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
  22. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  23. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
  24. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  25. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/audit/run/route.js +4 -4
  27. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/audit/page/build-manifest.json +2 -2
  35. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +4 -37
  36. package/.next/standalone/.next/server/app/audit/page.js +2 -2
  37. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/index.html +1 -1
  40. package/.next/standalone/.next/server/app/index.rsc +14 -14
  41. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
  42. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
  43. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  44. package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
  45. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  46. package/.next/standalone/.next/server/app/page.js +2 -2
  47. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
  50. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
  51. package/.next/standalone/.next/server/app/policies/page.js +4 -4
  52. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  54. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
  55. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  56. package/.next/standalone/.next/server/app/project/[name]/page.js +3 -3
  57. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  59. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
  60. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  61. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  62. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +4 -4
  63. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  65. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
  66. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  67. package/.next/standalone/.next/server/app/projects/page.js +3 -3
  68. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  69. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  70. package/.next/standalone/.next/server/app/settings/page/build-manifest.json +2 -2
  71. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -15
  72. package/.next/standalone/.next/server/app/settings/page.js +4 -4
  73. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/chunks/{[externals]__0v1hz15._.js → [externals]__0-9ti7z._.js} +1 -1
  76. package/.next/standalone/.next/server/chunks/{[externals]__1nb206a._.js → [externals]__0u3wrvq._.js} +1 -1
  77. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rv7m0k._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/[root-of-the-server]__17g9wh7._.js +1 -1
  80. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1legmza._.js +1 -1
  81. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1p-qi2t._.js +1 -1
  82. package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
  83. package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
  84. package/.next/standalone/.next/server/chunks/{_0otft92._.js → _1-akg6w._.js} +2 -2
  85. package/.next/standalone/.next/server/chunks/_1ek68ln._.js +10 -10
  86. package/.next/standalone/.next/server/chunks/_1vslkoe._.js +1 -1
  87. package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw._.js +1 -1
  88. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  89. package/.next/standalone/.next/server/chunks/src_hooks_fp-home_ts_09kv0bn._.js +1 -1
  90. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1fvfw59._.js → [root-of-the-server]__00-s7h8._.js} +1 -1
  91. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +4 -0
  92. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +4 -0
  93. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +4 -0
  94. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__12hbpha._.js → [root-of-the-server]__09flfsx._.js} +2 -2
  95. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +4 -0
  96. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +4 -0
  97. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0kokc8z._.js → [root-of-the-server]__0n_lxhg._.js} +1 -1
  98. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oa1lav._.js +1 -1
  99. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +4 -0
  100. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s740oi._.js +6 -0
  101. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0dxf928._.js → [root-of-the-server]__190won8._.js} +1 -1
  102. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0n2txhk._.js → [root-of-the-server]__1ctpynv._.js} +1 -1
  103. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +4 -0
  104. package/.next/standalone/.next/server/chunks/ssr/_02yoeej._.js +3 -0
  105. package/.next/standalone/.next/server/chunks/ssr/{_0a0zlpr._.js → _04rbnaq._.js} +2 -2
  106. package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
  107. package/.next/standalone/.next/server/chunks/ssr/{_0s-77v5._.js → _0h_douw._.js} +1 -1
  108. package/.next/standalone/.next/server/chunks/ssr/_1_ozgif._.js +1 -1
  109. package/.next/standalone/.next/server/chunks/ssr/_1ddpc5g._.js +1 -1
  110. package/.next/standalone/.next/server/chunks/ssr/_1es2j7i._.js +14 -51
  111. package/.next/standalone/.next/server/chunks/ssr/{_07t3jol._.js → _1u8-lu2._.js} +2 -2
  112. package/.next/standalone/.next/server/chunks/ssr/_1ylae7o._.js +3 -0
  113. package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +3 -0
  114. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +2 -2
  115. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +69 -1
  116. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  117. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
  118. package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +1 -1
  119. package/.next/standalone/.next/server/chunks/ssr/node_modules_13n822a._.js +1 -1
  120. package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_1ao30b1.js +3 -0
  121. package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +1 -1
  122. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589g._.js +1 -1
  123. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
  124. package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
  125. package/.next/standalone/.next/server/pages/404.html +1 -1
  126. package/.next/standalone/.next/server/pages/500.html +1 -1
  127. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  128. package/.next/standalone/.next/server/server-reference-manifest.json +21 -65
  129. package/.next/standalone/.next/static/chunks/{0f1pznnc7zlub.js → 0-tyrpwuc3lla.js} +1 -1
  130. package/.next/standalone/.next/static/chunks/0ca7octhod0g2.js +69 -0
  131. package/.next/standalone/.next/static/chunks/0u64yey446k4f.css +1 -0
  132. package/.next/standalone/.next/static/chunks/{1csubx9gwhsf6.js → 1j6o9min_6qa9.js} +1 -1
  133. package/.next/standalone/.next/static/chunks/27cl8h-c2w7cd.js +1 -0
  134. package/.next/standalone/.next/static/chunks/{0jpd8dv2vk930.css → 29-iqnp9v_axt.css} +1 -1
  135. package/.next/standalone/.next/static/chunks/{3uyhmm01g64k4.css → 2k9f4tyv04809.css} +0 -1
  136. package/.next/standalone/.next/static/chunks/{0t6ea7d3bkmdv.js → 2lwipmv5etc8m.js} +1 -1
  137. package/.next/standalone/.next/static/chunks/2pd16tn5qmx13.js +1 -0
  138. package/.next/standalone/.next/static/chunks/{0ntdfr2552x-h.js → 2u8vh73tpw28_.js} +1 -1
  139. package/.next/standalone/.next/static/chunks/{15uon66hpwbgg.js → 31u94yukw9fz-.js} +1 -1
  140. package/.next/standalone/.next/static/chunks/{2pwfrn6_mw-1u.js → 3p9_8x5ezce-9.js} +1 -1
  141. package/.next/standalone/.next/static/chunks/3qfoeqhy5l10x.js +1 -0
  142. package/.next/standalone/.next/static/chunks/{083fk73jtv9a0.js → 3tjji451hrgc0.js} +1 -1
  143. package/.next/standalone/.next/static/chunks/3zkg2s2vzxc3d.js +1 -0
  144. package/.next/standalone/.next/static/chunks/{turbopack-3s3c-u_u_l0u9.js → turbopack-3p73obe0xmrxm.js} +1 -1
  145. package/.next/standalone/.opencode/plugins/failproofai.mjs +27 -51
  146. package/.next/standalone/app/actions/get-scheduled-audit.ts +0 -5
  147. package/.next/standalone/app/actions/update-scheduled-audit.ts +57 -18
  148. package/.next/standalone/app/api/auth/status/route.ts +2 -3
  149. package/.next/standalone/app/audit/_components/audit-dashboard.tsx +34 -140
  150. package/.next/standalone/app/audit/_components/audit-poster.tsx +10 -29
  151. package/.next/standalone/app/audit/_components/come-back-better-section.tsx +1 -6
  152. package/.next/standalone/app/audit/_components/empty-state.tsx +1 -4
  153. package/.next/standalone/app/audit/_components/how-to-improve-section.tsx +5 -19
  154. package/.next/standalone/app/audit/_components/share-templates.ts +44 -110
  155. package/.next/standalone/app/audit/audit-styles.css +1 -132
  156. package/.next/standalone/app/settings/page.tsx +1 -1
  157. package/.next/standalone/app/settings/settings-client.tsx +45 -50
  158. package/.next/standalone/lib/auth/api-server-client.ts +5 -33
  159. package/.next/standalone/lib/claude-sessions.ts +27 -101
  160. package/.next/standalone/lib/codex-sessions.ts +4 -20
  161. package/.next/standalone/lib/copilot-sessions.ts +1 -32
  162. package/.next/standalone/lib/cursor-sessions.ts +5 -62
  163. package/.next/standalone/lib/sqlite-reader.ts +1 -78
  164. package/.next/standalone/package.json +9 -9
  165. package/.next/standalone/server.js +1 -1
  166. package/bin/failproofai.mjs +1 -1
  167. package/dist/cli.mjs +500 -1762
  168. package/dist/worker.mjs +16 -138
  169. package/lib/auth/api-server-client.ts +5 -33
  170. package/lib/claude-sessions.ts +27 -101
  171. package/lib/codex-sessions.ts +4 -20
  172. package/lib/copilot-sessions.ts +1 -32
  173. package/lib/cursor-sessions.ts +5 -62
  174. package/lib/sqlite-reader.ts +1 -78
  175. package/package.json +9 -9
  176. package/pi-extension/index.ts +5 -50
  177. package/src/audit/cache.ts +0 -6
  178. package/src/audit/cli-adapters/claude.ts +0 -13
  179. package/src/audit/cli-login.ts +1 -4
  180. package/src/audit/cli.ts +7 -157
  181. package/src/audit/harm-report.ts +4 -111
  182. package/src/audit/index.ts +15 -286
  183. package/src/audit/machine-store.ts +9 -8
  184. package/src/audit/redact-example.ts +15 -324
  185. package/src/audit/report-harm.ts +37 -33
  186. package/src/audit/report.ts +3 -6
  187. package/src/audit/schedule-cli.ts +33 -54
  188. package/src/audit/scoring.ts +0 -49
  189. package/src/audit/types.ts +0 -52
  190. package/src/hooks/builtin-policies.ts +2 -67
  191. package/src/hooks/configure-wizard.ts +0 -55
  192. package/src/hooks/fp-config.ts +48 -83
  193. package/src/hooks/fp-home.ts +0 -27
  194. package/src/hooks/integrations.ts +14 -51
  195. package/src/hooks/uninstall-cli.ts +2 -17
  196. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-4ja6q._.js +0 -4
  197. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__00cr3xu._.js +0 -4
  198. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04px77e._.js +0 -4
  199. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0egr5s1._.js +0 -6
  200. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0i0l1di._.js +0 -4
  201. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0r3c1_0._.js +0 -4
  202. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17xnxlx._.js +0 -4
  203. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ckpmkk._.js +0 -4
  204. package/.next/standalone/.next/server/chunks/ssr/_04ng_6x._.js +0 -3
  205. package/.next/standalone/.next/server/chunks/ssr/_0l2hi_d._.js +0 -3
  206. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_rerun-button_tsx_0blihgw._.js +0 -3
  207. package/.next/standalone/.next/static/chunks/0divvxng208xo.js +0 -1
  208. package/.next/standalone/.next/static/chunks/27du9n7ssja7l.js +0 -1
  209. package/.next/standalone/.next/static/chunks/2h_pcb1y8_jde.js +0 -1
  210. package/.next/standalone/app/actions/get-leaks.ts +0 -104
  211. package/.next/standalone/app/audit/_components/leak-section.tsx +0 -192
  212. package/src/audit/desktop-notify.ts +0 -420
  213. package/src/audit/leak-fingerprint.ts +0 -198
  214. package/src/audit/leak-record.ts +0 -248
  215. package/src/audit/leak-scan.ts +0 -268
  216. package/src/audit/leak-store.ts +0 -220
  217. package/src/audit/macos-notifier.ts +0 -298
  218. package/src/hooks/notice.ts +0 -24
  219. /package/.next/standalone/.next/static/{YiPsVpjrc-pEQoN7XvhZ0 → dg8VQ7Ejlo0Qsh_x92oIt}/_buildManifest.js +0 -0
  220. /package/.next/standalone/.next/static/{YiPsVpjrc-pEQoN7XvhZ0 → dg8VQ7Ejlo0Qsh_x92oIt}/_clientMiddlewareManifest.js +0 -0
  221. /package/.next/standalone/.next/static/{YiPsVpjrc-pEQoN7XvhZ0 → dg8VQ7Ejlo0Qsh_x92oIt}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[41857,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("0010d731e46f24bbaee74596f787e10879803125f1",d.callServer,void 0,d.findSourceMapURL,"getScheduledAuditAction"),f=(0,d.createServerReference)("4072a14fe91ce270d2518518491fa1971e194fedee",d.callServer,void 0,d.findSourceMapURL,"setAutoAuditAction"),g=(0,d.createServerReference)("403a11adb1c6381625711f1c9696b58c97cf602e2d",d.callServer,void 0,d.findSourceMapURL,"setAuditNotifyAction"),h=(0,d.createServerReference)("40cffc801944f1a09aa2865a3f3c380212656e17ec",d.callServer,void 0,d.findSourceMapURL,"setAuditIntervalAction");var i=a.i(89564),j=a.i(10765),k=a.i(17094);let l=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function m(a){if((0,k.isAbortError)(a))return"request timed out. check your network and try again.";let b=a instanceof Error?a.message:String(a);return`network error: ${b}`}function n({open:a,headline:d="where to route the reminder?",subhead:e="we'll send a one-time code to confirm.",onClose:f,onAuthed:g,source:h="unknown"}){let{capture:i}=(0,j.usePostHog)(),[o,p]=(0,c.useState)({kind:"email",error:null}),[q,r]=(0,c.useState)(!1),s=(0,c.useRef)(!1),t=(0,c.useRef)(null),u=(0,c.useRef)(null);(0,c.useEffect)(()=>{a&&(p({kind:"email",error:null}),r(!1),s.current=!1,i("audit_auth_dialog_opened",{source:h}))},[i,a,h]);let v=(0,c.useRef)(!1);(0,c.useEffect)(()=>{if(a){v.current=!0;return}v.current&&!s.current&&i("audit_auth_dialog_dismissed",{source:h,step:o.kind}),v.current=!1},[i,a,h,o.kind]),(0,c.useEffect)(()=>{if(!a)return;let b=setTimeout(()=>{"email"===o.kind?t.current?.focus():"code"===o.kind&&u.current?.focus()},50);return()=>clearTimeout(b)},[a,o.kind]),(0,c.useEffect)(()=>{if(!a)return;let b=a=>{"Escape"!==a.key||q||f()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[a,q,f]);let w="code"===o.kind&&o.resendIn>0;(0,c.useEffect)(()=>{if(!w)return;let a=setInterval(()=>{p(a=>"code"===a.kind?{...a,resendIn:Math.max(0,a.resendIn-1)}:a)},1e3);return()=>clearInterval(a)},[w]);let x=(0,c.useCallback)(async(a,b={})=>{let{isResend:c=!1}=b,d=a=>{c?p(b=>"code"===b.kind?{...b,error:a}:b):p({kind:"email",error:a})};r(!0);try{let b=await (0,k.fetchWithTimeout)("/api/auth/login-request",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:a})}),c=await b.json().catch(()=>({}));if(!b.ok){let a=c.message??"could not send code.";"rate_limited"===c.code&&void 0!==c.retry_after_secs?a=`too many tries. wait ${c.retry_after_secs}s and try again.`:"upstream_unreachable"===c.code&&(a="api-server unreachable. check your network."),d(a);return}p({kind:"code",email:a,error:null,expiresIn:c.expires_in??600,resendIn:c.resend_available_in??30})}catch(a){d(m(a))}finally{r(!1)}},[]),y=(0,c.useCallback)(async(a,b)=>{r(!0);try{let c=await (0,k.fetchWithTimeout)("/api/auth/login-verify",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:a,code:b})}),d=await c.json().catch(()=>({}));if(!c.ok||!d.authenticated||!d.user){let a=d.message??"invalid code.";"invalid_code"===d.code&&(a="wrong code, or it expired. try again."),p(b=>"code"===b.kind?{...b,error:a}:b);return}s.current=!0,i("audit_auth_dialog_succeeded",{source:h}),p({kind:"done",user:d.user}),g(d.user)}catch(b){let a=m(b);p(b=>"code"===b.kind?{...b,error:a}:b)}finally{r(!1)}},[i,g,h]),z=(0,c.useCallback)(async a=>{if(a.preventDefault(),q||"email"!==o.kind)return;let b=String(new FormData(a.currentTarget).get("email")??"").trim().toLowerCase();l.test(b)?await x(b):p({kind:"email",error:"that doesn't look like an email."})},[q,o,x]),A=(0,c.useCallback)(async a=>{if(a.preventDefault(),q||"code"!==o.kind)return;let b=String(new FormData(a.currentTarget).get("code")??"").trim();b.length<4||b.length>12?p(a=>"code"===a.kind?{...a,error:"code is 4–12 characters."}:a):await y(o.email,b)},[q,o,y]),B=(0,c.useCallback)(async()=>{"code"!==o.kind||o.resendIn>0||q||await x(o.email,{isResend:!0})},[o,q,x]);return a?(0,b.jsx)("div",{className:"auth-dialog-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"auth-dialog-title",onClick:a=>{q||a.target!==a.currentTarget||f()},children:(0,b.jsxs)("div",{className:"auth-dialog",children:[(0,b.jsx)("button",{type:"button",className:"auth-close",onClick:f,disabled:q,"aria-label":"close",children:"×"}),(0,b.jsx)("h2",{id:"auth-dialog-title",className:"auth-headline",children:d}),"email"===o.kind&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"auth-sub",children:e}),(0,b.jsxs)("form",{onSubmit:z,className:"auth-form",children:[(0,b.jsx)("input",{ref:t,id:"auth-dialog-email",name:"email",type:"email",autoComplete:"email",inputMode:"email",spellCheck:!1,placeholder:"you@yourdomain.com",disabled:q,className:"auth-input",required:!0}),o.error&&(0,b.jsx)("div",{className:"auth-error",children:o.error}),(0,b.jsxs)("div",{className:"auth-actions",children:[(0,b.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:q,children:q?"sending…":"send code"}),(0,b.jsx)("button",{type:"button",className:"auth-btn",onClick:f,disabled:q,children:"cancel"})]})]})]}),"code"===o.kind&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"auth-sub",children:["code sent to ",(0,b.jsx)("span",{className:"auth-email",children:o.email}),". expires in ",Math.ceil(o.expiresIn/60)," min."]}),(0,b.jsxs)("form",{onSubmit:A,className:"auth-form",children:[(0,b.jsx)("input",{ref:u,id:"auth-dialog-code",name:"code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",spellCheck:!1,placeholder:"123456",disabled:q,className:"auth-input auth-input-code",maxLength:12,required:!0}),o.error&&(0,b.jsx)("div",{className:"auth-error",children:o.error}),(0,b.jsxs)("div",{className:"auth-actions",children:[(0,b.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:q,children:q?"verifying…":"verify"}),(0,b.jsx)("button",{type:"button",className:"auth-btn",onClick:B,disabled:q||o.resendIn>0,children:o.resendIn>0?`resend in ${o.resendIn}s`:"resend code"})]}),(0,b.jsx)("button",{type:"button",className:"auth-back",onClick:()=>p({kind:"email",error:null}),disabled:q,children:"← use a different email"})]})]}),"done"===o.kind&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"auth-sub",children:[(0,b.jsx)("span",{className:"auth-ok",children:"✓"})," signed in as"," ",(0,b.jsx)("span",{className:"auth-email",children:o.user.email}),"."]}),(0,b.jsx)("div",{className:"auth-actions",children:(0,b.jsx)("button",{type:"button",className:"auth-btn primary",onClick:f,children:"continue"})})]})]})}):null}var o=a.i(18952),p=a.i(80977);function q(a){return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function r(a,b){let c=a-b;if(c<=0)return"now";let d=Math.floor(c/864e5),e=Math.floor(c%864e5/36e5);return d>0?e>0?`${d}d ${e}h`:`${d}d`:e>0?`${e}h`:`${Math.max(1,Math.floor(c/6e4))}m`}function s(a){return a.toLocaleString("en-US")}function t({label:a,value:c,sub:d,tone:e}){return(0,b.jsxs)("div",{className:"set-stat",children:[(0,b.jsx)("div",{className:"set-stat-label",children:a}),(0,b.jsx)("div",{className:`set-stat-value${e?` ${e}`:""}`,children:c}),(0,b.jsx)("div",{className:"set-stat-sub",children:d??" "})]})}function u({lastRunAtMs:a,nextDueAtMs:c,now:d}){if(null==a||null==c||c<=a)return null;let e=Math.min(100,Math.max(0,(d-a)/(c-a)*100));return(0,b.jsxs)("div",{className:"tape","aria-hidden":"true",children:[(0,b.jsxs)("div",{className:"tape-rail",children:[(0,b.jsx)("div",{className:"tape-fill",style:{width:`${e}%`}}),(0,b.jsx)("div",{className:"tape-now",style:{left:`${e}%`}})]}),(0,b.jsxs)("div",{className:"tape-ends",children:[(0,b.jsxs)("span",{children:["last scan · ",q(a)]}),(0,b.jsxs)("span",{className:"tape-next",children:["next · ",r(c,d)]})]})]})}function v({enabled:a,onChange:c,disabled:d,label:e}){return(0,b.jsx)("button",{type:"button",role:"switch","aria-checked":a,"aria-label":e,disabled:d,onClick:c,className:"sw","data-on":a?"true":"false",children:(0,b.jsx)("span",{className:"sw-knob"})})}let w=[{label:"reads",body:"every session transcript on disk — your prompts, the files your agents read and wrote, and command output."},{label:"runs",body:"entirely on this machine. the transcripts never leave it."},{label:"sends",body:"only the newest masked credential exposure, its CLI, time, location, and this machine's name — only when email is configured."}];a.s(["default",0,function({initial:a}){let[d,j]=(0,c.useState)(a),[k,l]=(0,c.useState)(a?.auto??!1),[m,x]=(0,c.useState)(a?.notify??!0),[y,z]=(0,c.useState)(a?.intervalDays??7),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)(null===a),[I,J]=(0,c.useState)(0),K=(0,c.useRef)(!0),L=(0,c.useRef)(null!==a),M=(0,c.useCallback)(async()=>{try{let a=await e();if(!K.current)return;j(a),L.current=!0,l(a.auto),x(a.notify),z(a.intervalDays),J(Date.now()),H(!1)}catch{K.current&&!L.current&&H(!0)}},[]);(0,c.useEffect)(()=>(K.current=!0,M(),()=>{K.current=!1}),[M]),(0,c.useEffect)(()=>{let a=()=>void M();return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[M]);let N=d?.signedInAs??null,O=d?.daemon==="running",P=d?.daemon==="unsupported-platform",Q=d?.schedule??null,R=d?.lastScan??null,S=Q?.lastExitCode!=null&&0!==Q.lastExitCode&&75!==Q.lastExitCode,T=(0,c.useCallback)(async()=>{B(!0);try{let a=await f(!0);l(a.auto),(0,o.toast)("scheduled audits on."),await M()}catch{l(!1),(0,o.toast)("could not turn that on.")}finally{B(!1)}},[M]),U=(0,c.useCallback)(async()=>{if(k){B(!0);try{let a=await f(!1);a.ok&&l(a.auto),(0,o.toast)("scheduled audits off."),await M()}catch{(0,o.toast)("could not turn that off.")}finally{B(!1)}return}await T()},[k,T,M]),V=(0,c.useCallback)(async()=>{let a=!m;B(!0);try{let b=await g(a);x(b.notify),j(a=>a?{...a,notify:b.notify}:a),(0,o.toast)(b.notify?"system notifications on.":"system notifications off.")}catch{(0,o.toast)(`could not turn system notifications ${a?"on":"off"}.`)}finally{B(!1)}},[m]),W=(0,c.useCallback)(async a=>{B(!0);try{let b=await h(a);z(b.intervalDays),j(a=>a?{...a,intervalDays:b.intervalDays}:a),(0,o.toast)(`scanning every ${b.intervalDays} day${1===b.intervalDays?"":"s"}.`)}catch{z(d?.intervalDays??7),(0,o.toast)("could not save that.")}finally{B(!1)}},[d?.intervalDays]),X=(0,c.useCallback)(async()=>{B(!0);try{await fetch("/api/auth/logout",{method:"POST"}),(0,o.toast)("signed out. scans and desktop notifications continue; email alerts pause."),await M()}catch{(0,o.toast)("could not sign out.")}finally{B(!1)}},[M]),Y=(0,c.useCallback)(async()=>{if(!C){D(!0);try{await (0,i.triggerRun)({cli:[],since:"all",noCache:!1}),(0,o.toast)("scan complete."),await M()}catch(a){(0,o.toast)(a instanceof i.RerunError&&"timeout"===a.kind?"the scan is taking a while — it will finish in the background.":"the scan could not be completed.")}finally{D(!1)}}},[M,C]),Z=(0,c.useCallback)(async a=>{F(!1),await M(),await T()},[T,M]),$=d?O?{value:"running",sub:null!=d.daemonStartedAtMs&&I>0?`up ${function(a){let b=Math.floor(a/864e5);if(b>0)return`${b}d`;let c=Math.floor(a/36e5);return c>0?`${c}h`:`${Math.max(1,Math.floor(a/6e4))}m`}(Math.max(0,I-d.daemonStartedAtMs))}`:"",tone:"ok"}:P?{value:"unavailable",sub:"not on this platform"}:"not-installed"===d.daemon?{value:"not installed",sub:"run failproofai config",tone:"warn"}:"unknown"===d.daemon?{value:"unknown",sub:"could not read it"}:{value:"stopped",sub:"run failproofai config",tone:"warn"}:{value:"…",sub:"reading"},_=k?Q?.nextDueAtMs==null?{value:"pending",sub:"after the next scan"}:{value:I>0?r(Q.nextDueAtMs,I):"—",sub:q(Q.nextDueAtMs)}:{value:"off",sub:"nothing scheduled"},aa=R?{value:(0,p.formatRelativeTime)(Date.parse(R.finishedAt)),sub:null!=R.sessionsScanned?`${s(R.sessionsScanned)} sessions`:"scanned"}:{value:"none yet",sub:"run one below"},ab=R?null==R.findings?{value:"—",sub:"unreadable"}:{value:s(R.findings),sub:"this scan",...R.findings>0?{tone:"warn"}:{}}:{value:"—",sub:"no scan yet"};return(0,b.jsxs)("main",{className:"report",children:[(0,b.jsxs)("section",{className:"section set-sec",children:[(0,b.jsxs)("div",{className:"set-mast",children:[(0,b.jsx)("h1",{className:"set-title",children:"settings"}),(0,b.jsx)("p",{className:"set-lede",children:"keeping watch, so you don't have to."})]}),G?(0,b.jsx)("div",{className:"set-console",children:(0,b.jsx)("div",{className:"set-cell",children:(0,b.jsxs)("p",{className:"set-warn",children:["could not read this machine's settings. check that the dashboard can reach ",(0,b.jsx)("code",{children:"~/.failproofai/config.json"}),"."]})})}):(0,b.jsxs)("div",{className:"set-console",children:[(0,b.jsxs)("div",{className:"set-stats",children:[(0,b.jsx)(t,{label:"daemon",...$}),(0,b.jsx)(t,{label:"next scan",..._}),(0,b.jsx)(t,{label:"last scan",...aa}),(0,b.jsx)(t,{label:"findings",...ab})]}),(0,b.jsxs)("div",{className:"set-cols",children:[(0,b.jsxs)("div",{className:"set-cell set-config",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"scheduled audit"}),(0,b.jsxs)("div",{className:"set-row set-row-main",children:[(0,b.jsx)(v,{enabled:k,disabled:A||null===d,onChange:()=>void U(),label:k?"turn off scheduled audits":"turn on scheduled audits"}),(0,b.jsxs)("div",{className:"set-row-copy",children:[(0,b.jsx)("span",{className:"set-strong",children:k?"scanning on a schedule.":"scan on a schedule."}),(0,b.jsx)("span",{className:"set-dim",children:k?N?"scheduled scans are active; the latest masked leak is emailed.":"scheduled scans are active. add an email below for masked alerts.":"off. nothing runs and nothing is sent."})]})]}),(0,b.jsxs)("div",{className:"set-row set-row-interval",children:[(0,b.jsx)("span",{className:"set-dim",children:"scan every"}),(0,b.jsx)("input",{type:"number",className:"set-num",min:1,max:90,value:y,disabled:A||null===d,"aria-label":"days between scheduled scans",onChange:a=>z(Number(a.target.value)),onBlur:a=>{let b=Number(a.target.value);Number.isFinite(b)?b!==d?.intervalDays&&W(b):z(d?.intervalDays??7)}}),(0,b.jsx)("span",{className:"set-dim",children:"days"}),(0,b.jsxs)("span",{className:"set-hint",children:[1,"–",90]})]}),(0,b.jsxs)("div",{className:"set-row set-row-main",children:[(0,b.jsx)(v,{enabled:m,disabled:A||null===d,onChange:()=>void V(),label:m?"turn off system notifications":"turn on system notifications"}),(0,b.jsxs)("div",{className:"set-row-copy",children:[(0,b.jsx)("span",{className:"set-strong",children:"system notifications."}),(0,b.jsx)("span",{className:"set-dim",children:m?"on when a scheduled scan finds credentials.":"off. scheduled scans and email alerts continue."})]})]}),(0,b.jsx)("div",{className:"set-rule"}),(0,b.jsx)("div",{className:"set-row set-row-identity",children:N?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"set-dim",children:"reports go to"}),(0,b.jsx)("span",{className:"set-email",children:N.email}),(0,b.jsx)("button",{type:"button",className:"set-link",disabled:A,onClick:()=>void X(),children:"sign out"})]}):k?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"set-warn",children:"signed out — scheduled scans continue; email alerts are paused."}),(0,b.jsx)("button",{type:"button",className:"set-link",disabled:A,onClick:()=>F(!0),children:"add email alerts"})]}):(0,b.jsx)("span",{className:"set-dim",children:"scans and system notifications work without an account. add email later if you want alerts in your inbox."})}),k&&d&&!O&&(0,b.jsx)("p",{className:"set-warn",children:P?"the background service isn't available on this platform, so scheduled scans can't run here. you can still run one now.":"not-installed"===d.daemon?"the background service isn't installed, so nothing will run on the timer. install it with `failproofai config`.":"the background service is stopped, so nothing will run until it starts. repair it with `failproofai config`."}),S&&(0,b.jsxs)("p",{className:"set-warn",children:["the last scheduled scan exited ",Q?.lastExitCode,". the next one will still run."]}),(0,b.jsx)("div",{className:"set-actions",children:(0,b.jsx)("button",{type:"button",className:"btn btn-press",disabled:C,onClick:()=>void Y(),children:C?"[ scanning… ]":"[ run a scan now ]"})})]}),(0,b.jsxs)("div",{className:"set-cell set-how",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"how it works"}),(0,b.jsx)("dl",{className:"set-how-list",children:w.map(a=>(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:a.label}),(0,b.jsx)("dd",{className:"set-how-body",children:a.body})]},a.label))})]})]})]}),k&&I>0&&(0,b.jsx)(u,{lastRunAtMs:Q?.lastRunAtMs??null,nextDueAtMs:Q?.nextDueAtMs??null,now:I})]}),(0,b.jsx)(n,{open:E,source:"settings_scheduled_audit",headline:"where should the report go?",subhead:"we'll send a one-time code to confirm.",onClose:()=>F(!1),onAuthed:a=>void Z(a)})]})}],41857)}];
1
+ module.exports=[41857,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("00f6b50473064890b0c44f3b8c2fa386cc1b19bfbb",d.callServer,void 0,d.findSourceMapURL,"getScheduledAuditAction"),f=(0,d.createServerReference)("401684fac4cdbd736839609820cbfd5214a2fef3de",d.callServer,void 0,d.findSourceMapURL,"setAutoAuditAction"),g=(0,d.createServerReference)("40ef91b7bce96f7703710c0e91b75e7376497ee007",d.callServer,void 0,d.findSourceMapURL,"setAuditIntervalAction");var h=a.i(89564),i=a.i(4543),j=a.i(18952),k=a.i(80977);function l(a){return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function m(a,b){let c=a-b;if(c<=0)return"now";let d=Math.floor(c/864e5),e=Math.floor(c%864e5/36e5);return d>0?e>0?`${d}d ${e}h`:`${d}d`:e>0?`${e}h`:`${Math.max(1,Math.floor(c/6e4))}m`}function n(a){return a.toLocaleString("en-US")}function o({label:a,value:c,sub:d,tone:e}){return(0,b.jsxs)("div",{className:"set-stat",children:[(0,b.jsx)("div",{className:"set-stat-label",children:a}),(0,b.jsx)("div",{className:`set-stat-value${e?` ${e}`:""}`,children:c}),(0,b.jsx)("div",{className:"set-stat-sub",children:d??" "})]})}function p({lastRunAtMs:a,nextDueAtMs:c,now:d}){if(null==a||null==c||c<=a)return null;let e=Math.min(100,Math.max(0,(d-a)/(c-a)*100));return(0,b.jsxs)("div",{className:"tape","aria-hidden":"true",children:[(0,b.jsxs)("div",{className:"tape-rail",children:[(0,b.jsx)("div",{className:"tape-fill",style:{width:`${e}%`}}),(0,b.jsx)("div",{className:"tape-now",style:{left:`${e}%`}})]}),(0,b.jsxs)("div",{className:"tape-ends",children:[(0,b.jsxs)("span",{children:["last scan · ",l(a)]}),(0,b.jsxs)("span",{className:"tape-next",children:["next · ",m(c,d)]})]})]})}function q({enabled:a,onChange:c,disabled:d,label:e}){return(0,b.jsx)("button",{type:"button",role:"switch","aria-checked":a,"aria-label":e,disabled:d,onClick:c,className:"sw","data-on":a?"true":"false",children:(0,b.jsx)("span",{className:"sw-knob"})})}let r=[{label:"reads",body:"every session transcript on disk — your prompts, the files your agents read and wrote, and command output."},{label:"runs",body:"entirely on this machine. the transcripts never leave it."},{label:"sends",body:"counts, redacted examples, and this machine's name — and only when a scan finds something harmful."}];a.s(["default",0,function({initial:a}){let[d,s]=(0,c.useState)(a),[t,u]=(0,c.useState)(a?.auto??!1),[v,w]=(0,c.useState)(a?.intervalDays??7),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)(!1),[D,E]=(0,c.useState)(null===a),[F,G]=(0,c.useState)(0),H=(0,c.useRef)(!0),I=(0,c.useRef)(null!==a),J=(0,c.useCallback)(async()=>{try{let a=await e();if(!H.current)return;s(a),I.current=!0,u(a.auto),w(a.intervalDays),G(Date.now()),E(!1)}catch{H.current&&!I.current&&E(!0)}},[]);(0,c.useEffect)(()=>(H.current=!0,J(),()=>{H.current=!1}),[J]),(0,c.useEffect)(()=>{let a=()=>void J();return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[J]);let K=d?.signedInAs??null,L=d?.daemon==="running",M=d?.daemon==="unsupported-platform",N=d?.schedule??null,O=d?.lastScan??null,P=N?.lastExitCode!=null&&0!==N.lastExitCode&&75!==N.lastExitCode,Q=(0,c.useCallback)(async()=>{y(!0);try{let a=await f(!0);if(!a.ok){if(u(!1),"unreachable"===a.reason)return void(0,j.toast)("could not reach the server. check your connection and try again.");await J(),C(!0),(0,j.toast)("that sign-in expired. one more code and it's on.");return}u(a.auto),(0,j.toast)("scheduled audits on."),await J()}catch{u(!1),(0,j.toast)("could not turn that on.")}finally{y(!1)}},[J]),R=(0,c.useCallback)(async()=>{if(t){y(!0);try{let a=await f(!1);a.ok&&u(a.auto),(0,j.toast)("scheduled audits off."),await J()}catch{(0,j.toast)("could not turn that off.")}finally{y(!1)}return}K?await Q():C(!0)},[t,Q,J,K]),S=(0,c.useCallback)(async a=>{y(!0);try{let b=await g(a);w(b.intervalDays),s(a=>a?{...a,intervalDays:b.intervalDays}:a),(0,j.toast)(`scanning every ${b.intervalDays} day${1===b.intervalDays?"":"s"}.`)}catch{w(d?.intervalDays??7),(0,j.toast)("could not save that.")}finally{y(!1)}},[d?.intervalDays]),T=(0,c.useCallback)(async()=>{y(!0);try{await fetch("/api/auth/logout",{method:"POST"}),(0,j.toast)("signed out. scans continue; digests pause."),await J()}catch{(0,j.toast)("could not sign out.")}finally{y(!1)}},[J]),U=(0,c.useCallback)(async()=>{if(!z){A(!0);try{await (0,h.triggerRun)({cli:[],since:"all",noCache:!1}),(0,j.toast)("scan complete."),await J()}catch(a){(0,j.toast)(a instanceof h.RerunError&&"timeout"===a.kind?"the scan is taking a while — it will finish in the background.":"the scan could not be completed.")}finally{A(!1)}}},[J,z]),V=(0,c.useCallback)(async a=>{C(!1),await J(),await Q()},[Q,J]),W=d?L?{value:"running",sub:null!=d.daemonStartedAtMs&&F>0?`up ${function(a){let b=Math.floor(a/864e5);if(b>0)return`${b}d`;let c=Math.floor(a/36e5);return c>0?`${c}h`:`${Math.max(1,Math.floor(a/6e4))}m`}(Math.max(0,F-d.daemonStartedAtMs))}`:"",tone:"ok"}:M?{value:"unavailable",sub:"not on this platform"}:"not-installed"===d.daemon?{value:"not installed",sub:"run failproofai config",tone:"warn"}:"unknown"===d.daemon?{value:"unknown",sub:"could not read it"}:{value:"stopped",sub:"run failproofai config",tone:"warn"}:{value:"…",sub:"reading"},X=t?N?.nextDueAtMs==null?{value:"pending",sub:"after the next scan"}:{value:F>0?m(N.nextDueAtMs,F):"—",sub:l(N.nextDueAtMs)}:{value:"off",sub:"nothing scheduled"},Y=O?{value:(0,k.formatRelativeTime)(Date.parse(O.finishedAt)),sub:null!=O.sessionsScanned?`${n(O.sessionsScanned)} sessions`:"scanned"}:{value:"none yet",sub:"run one below"},Z=O?null==O.findings?{value:"—",sub:"unreadable"}:{value:n(O.findings),sub:"this scan",...O.findings>0?{tone:"warn"}:{}}:{value:"—",sub:"no scan yet"};return(0,b.jsxs)("main",{className:"report",children:[(0,b.jsxs)("section",{className:"section set-sec",children:[(0,b.jsxs)("div",{className:"set-mast",children:[(0,b.jsx)("h1",{className:"set-title",children:"settings"}),(0,b.jsx)("p",{className:"set-lede",children:"keeping watch, so you don't have to."})]}),D?(0,b.jsx)("div",{className:"set-console",children:(0,b.jsx)("div",{className:"set-cell",children:(0,b.jsxs)("p",{className:"set-warn",children:["could not read this machine's settings. check that the dashboard can reach ",(0,b.jsx)("code",{children:"~/.failproofai/config.json"}),"."]})})}):(0,b.jsxs)("div",{className:"set-console",children:[(0,b.jsxs)("div",{className:"set-stats",children:[(0,b.jsx)(o,{label:"daemon",...W}),(0,b.jsx)(o,{label:"next scan",...X}),(0,b.jsx)(o,{label:"last scan",...Y}),(0,b.jsx)(o,{label:"findings",...Z})]}),(0,b.jsxs)("div",{className:"set-cols",children:[(0,b.jsxs)("div",{className:"set-cell set-config",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"scheduled audit"}),(0,b.jsxs)("div",{className:"set-row set-row-main",children:[(0,b.jsx)(q,{enabled:t,disabled:x||null===d,onChange:()=>void R(),label:t?"turn off scheduled audits":"turn on scheduled audits"}),(0,b.jsxs)("div",{className:"set-row-copy",children:[(0,b.jsx)("span",{className:"set-strong",children:t?"scanning on a schedule.":"scan on a schedule."}),(0,b.jsx)("span",{className:"set-dim",children:t?"you'll get an email only when a scan finds something.":"off. nothing runs and nothing is sent."})]})]}),(0,b.jsxs)("div",{className:"set-row set-row-interval",children:[(0,b.jsx)("span",{className:"set-dim",children:"scan every"}),(0,b.jsx)("input",{type:"number",className:"set-num",min:1,max:90,value:v,disabled:x||null===d,"aria-label":"days between scheduled scans",onChange:a=>w(Number(a.target.value)),onBlur:a=>{let b=Number(a.target.value);Number.isFinite(b)?b!==d?.intervalDays&&S(b):w(d?.intervalDays??7)}}),(0,b.jsx)("span",{className:"set-dim",children:"days"}),(0,b.jsxs)("span",{className:"set-hint",children:[1,"–",90]})]}),(0,b.jsx)("div",{className:"set-rule"}),(0,b.jsx)("div",{className:"set-row set-row-identity",children:K?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"set-dim",children:"reports go to"}),(0,b.jsx)("span",{className:"set-email",children:K.email}),(0,b.jsx)("button",{type:"button",className:"set-link",disabled:x,onClick:()=>void T(),children:"sign out"})]}):t?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"set-warn",children:"signed out — scans continue, digests are paused."}),(0,b.jsx)("button",{type:"button",className:"set-link",disabled:x,onClick:()=>C(!0),children:"sign in to resume"})]}):(0,b.jsx)("span",{className:"set-dim",children:"turning this on asks for an email, so there is somewhere to send the report."})}),t&&d&&!L&&(0,b.jsx)("p",{className:"set-warn",children:M?"the background service isn't available on this platform, so scheduled scans can't run here. you can still run one now.":"not-installed"===d.daemon?"the background service isn't installed, so nothing will run on the timer. install it with `failproofai config`.":"the background service is stopped, so nothing will run until it starts. repair it with `failproofai config`."}),P&&(0,b.jsxs)("p",{className:"set-warn",children:["the last scheduled scan exited ",N?.lastExitCode,". the next one will still run."]}),(0,b.jsx)("div",{className:"set-actions",children:(0,b.jsx)("button",{type:"button",className:"btn btn-press",disabled:z,onClick:()=>void U(),children:z?"[ scanning… ]":"[ run a scan now ]"})})]}),(0,b.jsxs)("div",{className:"set-cell set-how",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"how it works"}),(0,b.jsx)("dl",{className:"set-how-list",children:r.map(a=>(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:a.label}),(0,b.jsx)("dd",{className:"set-how-body",children:a.body})]},a.label))})]})]})]}),t&&F>0&&(0,b.jsx)(p,{lastRunAtMs:N?.lastRunAtMs??null,nextDueAtMs:N?.nextDueAtMs??null,now:F})]}),(0,b.jsx)(i.AuthDialog,{open:B,source:"settings_scheduled_audit",headline:"where should the report go?",subhead:"we'll send a one-time code to confirm.",onClose:()=>C(!1),onAuthed:a=>void V(a)})]})}],41857)}];
2
2
 
3
3
  //# sourceMappingURL=app_settings_settings-client_tsx_20lq-mq._.js.map