failproofai 0.0.14 → 0.0.15-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +6 -6
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +2 -2
  5. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
  6. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page.js +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 +2 -2
  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/_head.segment.rsc +3 -3
  15. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  16. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
  18. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  19. package/.next/standalone/.next/server/app/_not-found/page.js +2 -2
  20. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  23. package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
  24. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
  25. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  26. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
  27. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  28. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  29. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  30. package/.next/standalone/.next/server/app/api/audit/invite/route.js +1 -1
  31. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/audit/run/route.js +1 -1
  33. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/auth/login-request/route.js +1 -1
  35. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +1 -1
  37. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/auth/logout/route.js +1 -1
  39. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/auth/reminder/route.js +1 -1
  41. package/.next/standalone/.next/server/app/api/auth/reminder/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/auth/status/route.js +1 -1
  43. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +1 -1
  45. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/audit/page/build-manifest.json +3 -3
  47. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  48. package/.next/standalone/.next/server/app/audit/page.js +2 -2
  49. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  51. package/.next/standalone/.next/server/app/index.html +1 -1
  52. package/.next/standalone/.next/server/app/index.rsc +15 -15
  53. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  54. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
  55. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  56. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
  57. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  58. package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
  59. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  60. package/.next/standalone/.next/server/app/page.js +2 -2
  61. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  62. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  63. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +3 -3
  64. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +20 -8
  65. package/.next/standalone/.next/server/app/policies/page.js +2 -2
  66. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  68. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +3 -3
  69. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  70. package/.next/standalone/.next/server/app/project/[name]/page.js +4 -4
  71. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  73. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +3 -3
  74. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  75. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  76. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +4 -4
  77. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  78. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  79. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +3 -3
  80. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  81. package/.next/standalone/.next/server/app/projects/page.js +3 -3
  82. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  84. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-219ec._.js +1 -1
  85. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0hv08mx._.js → [root-of-the-server]__0-dh5jy._.js} +1 -1
  86. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04_h-a5._.js +1 -1
  87. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06cuf1y._.js +1 -1
  88. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0obaznk._.js → [root-of-the-server]__0h3lfmp._.js} +1 -1
  89. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jnjf2t._.js +1 -1
  90. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0xvsnvt._.js → [root-of-the-server]__0l4vuqm._.js} +1 -1
  91. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0longh-._.js +3 -0
  92. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sb_5m8._.js +4 -4
  93. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0xuaoik._.js +6 -4
  94. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__1hkdkmz._.js → [root-of-the-server]__10oa-v9._.js} +1 -1
  95. package/.next/standalone/.next/server/chunks/[root-of-the-server]__16le-kd._.js +1 -1
  96. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__1i9rknc._.js → [root-of-the-server]__18d-9oi._.js} +1 -1
  97. package/.next/standalone/.next/server/chunks/[root-of-the-server]__19120tr._.js +3 -0
  98. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1fwl2mz._.js +1 -1
  99. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1is3glr._.js +3 -0
  100. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1myjm-d._.js +1 -1
  101. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_17k9e3w.js +6 -6
  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]__0hdsupo._.js → [root-of-the-server]__0114ewg._.js} +3 -3
  106. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01od0m6._.js +3 -0
  107. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02r5bgf._.js +4 -0
  108. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e8sjqm._.js +4 -0
  109. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0lkzqax._.js +4 -0
  110. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0lpvwqm._.js +21 -0
  111. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ynf7tx._.js → [root-of-the-server]__0qucxyj._.js} +3 -3
  112. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0u02miy._.js +4 -0
  113. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0uno39i._.js +3 -0
  114. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1s2b6h0._.js → [root-of-the-server]__0x3anhr._.js} +2 -2
  115. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0y4wf1u._.js +3 -0
  116. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__170799-._.js +10 -10
  117. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__00cz9as._.js → [root-of-the-server]__1apb7k_._.js} +1 -1
  118. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ath6v_._.js +4 -0
  119. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1nq7ivq._.js +1 -1
  120. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1py795m._.js +3 -0
  121. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qapotl._.js +3 -0
  122. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1zqz4v8._.js +4 -0
  123. package/.next/standalone/.next/server/chunks/ssr/_077y5np._.js +3 -0
  124. package/.next/standalone/.next/server/chunks/ssr/_1-3unkg._.js +3 -0
  125. package/.next/standalone/.next/server/chunks/ssr/_1e19atl._.js +3 -0
  126. package/.next/standalone/.next/server/chunks/ssr/_1m_p7pi._.js +3 -0
  127. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
  128. package/.next/standalone/.next/server/chunks/ssr/app_components_project-list_tsx_1ke6anr._.js +3 -0
  129. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  130. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
  131. package/.next/standalone/.next/server/chunks/ssr/lib_0xkhw_v._.js +1 -1
  132. package/.next/standalone/.next/server/chunks/ssr/lib_hermes-projects_ts_05b8-it._.js +1 -1
  133. package/.next/standalone/.next/server/chunks/ssr/lib_openclaw-projects_ts_0qxq3bp._.js +1 -1
  134. package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_0gkzjaa.js → node_modules_html-to-image_es_index_1wnt2ya.js} +1 -1
  135. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +1 -1
  136. package/.next/standalone/.next/server/middleware-build-manifest.js +6 -6
  137. package/.next/standalone/.next/server/pages/404.html +1 -1
  138. package/.next/standalone/.next/server/pages/500.html +1 -1
  139. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  140. package/.next/standalone/.next/server/server-reference-manifest.json +22 -10
  141. package/.next/standalone/.next/static/chunks/{29o4j32z643_a.js → 05h7pau8d3rpj.js} +1 -1
  142. package/.next/standalone/.next/static/chunks/0oos4ntyvkmjl.js +1 -0
  143. package/.next/standalone/.next/static/chunks/0tuwf_7uhfn2y.js +6 -0
  144. package/.next/standalone/.next/static/chunks/1hdhteui932bq.js +1 -0
  145. package/.next/standalone/.next/static/chunks/1l6q2-8m0gk19.js +1 -0
  146. package/.next/standalone/.next/static/chunks/2geqsiz0n8e3w.js +1 -0
  147. package/.next/standalone/.next/static/chunks/{3-ogr79xqbw0h.js → 2mazwb1qmur1p.js} +1 -1
  148. package/.next/standalone/.next/static/chunks/2pujpnfx4pws6.css +2 -0
  149. package/.next/standalone/.next/static/chunks/{1ua5armwfph8o.js → 31fmsp1soxi07.js} +1 -1
  150. package/.next/standalone/.next/static/chunks/{3s8aaig91937v.js → 37-so-zy208k7.js} +1 -1
  151. package/.next/standalone/.next/static/chunks/3a_o5v_sl858j.js +1 -0
  152. package/.next/standalone/.next/static/chunks/{02jcotghcxrbu.js → 3kmwfieo15mr2.js} +1 -1
  153. package/.next/standalone/.next/static/chunks/{2uh_4k4m296z5.js → 3p66lo2y-ezfr.js} +1 -1
  154. package/.next/standalone/.next/static/chunks/{06z_ex1ts3n4s.js → 412ajx6jkb5_i.js} +1 -1
  155. package/.next/standalone/.next/static/chunks/{turbopack-10hj8t5pf33tu.js → turbopack-1lsv92x7klwrn.js} +1 -1
  156. package/.next/standalone/app/actions/get-hooks-config.ts +125 -8
  157. package/.next/standalone/app/actions/update-hooks-config.ts +38 -1
  158. package/.next/standalone/app/components/project-list.tsx +229 -42
  159. package/.next/standalone/app/policies/hooks-client.tsx +149 -27
  160. package/.next/standalone/app/project/[name]/page.tsx +12 -2
  161. package/.next/standalone/integration-suite/README.md +43 -1
  162. package/.next/standalone/integration-suite/ci-entrypoint.sh +21 -6
  163. package/.next/standalone/integration-suite/install-clis.sh +58 -13
  164. package/.next/standalone/integration-suite/probe-cli.sh +51 -11
  165. package/.next/standalone/integration-suite/report.js +52 -6
  166. package/.next/standalone/integration-suite/run.sh +55 -3
  167. package/.next/standalone/lib/hermes-profiles.ts +156 -0
  168. package/.next/standalone/lib/hermes-projects.ts +91 -25
  169. package/.next/standalone/lib/hermes-sessions.ts +65 -10
  170. package/.next/standalone/lib/openclaw-projects.ts +111 -18
  171. package/.next/standalone/lib/openclaw-sessions.ts +20 -0
  172. package/.next/standalone/lib/paths.ts +36 -0
  173. package/.next/standalone/lib/project-tree.ts +193 -0
  174. package/.next/standalone/lib/projects.ts +22 -0
  175. package/.next/standalone/node_modules/@next/env/package.json +1 -1
  176. package/.next/standalone/node_modules/next/dist/build/next-config-ts/transpile-config.js +3 -114
  177. package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
  178. package/.next/standalone/node_modules/next/dist/cli/next-test.js +2 -1
  179. package/.next/standalone/node_modules/next/dist/compiled/http-proxy/index.js +5 -5
  180. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +11 -10
  181. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +11 -10
  182. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +2 -2
  183. package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +9 -9
  184. package/.next/standalone/node_modules/next/dist/lib/install-dependencies.js +1 -1
  185. package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
  186. package/.next/standalone/node_modules/next/dist/lib/typescript/loadTsConfig.js +181 -0
  187. package/.next/standalone/node_modules/next/dist/lib/typescript/missingDependencyError.js +1 -1
  188. package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeCheckCli.js +53 -0
  189. package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeScriptCli.js +256 -0
  190. package/.next/standalone/node_modules/next/dist/lib/verify-typescript-setup.js +97 -56
  191. package/.next/standalone/node_modules/next/dist/server/app-render/action-handler.js +129 -34
  192. package/.next/standalone/node_modules/next/dist/server/app-render/manifests-singleton.js +52 -4
  193. package/.next/standalone/node_modules/next/dist/server/config-schema.js +1 -1
  194. package/.next/standalone/node_modules/next/dist/server/config-shared.js +1 -2
  195. package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
  196. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +2 -2
  197. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
  198. package/.next/standalone/node_modules/next/dist/server/image-optimizer.js +8 -27
  199. package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
  200. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/index.js +90 -53
  201. package/.next/standalone/node_modules/next/dist/server/lib/patch-fetch.js +15 -2
  202. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/proxy-request.js +4 -0
  203. package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
  204. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/unstable-cache.js +1 -1
  205. package/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  206. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/prepare-destination.js +2 -1
  207. package/.next/standalone/node_modules/next/dist/shared/lib/server-reference-info.js +12 -0
  208. package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  209. package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  210. package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
  211. package/.next/standalone/node_modules/next/package.json +10 -10
  212. package/.next/standalone/package.json +7 -6
  213. package/.next/standalone/pi-extension/index.ts +38 -5
  214. package/.next/standalone/server.js +1 -1
  215. package/bin/failproofai.mjs +14 -13
  216. package/dist/cli.mjs +789 -399
  217. package/lib/hermes-profiles.ts +156 -0
  218. package/lib/hermes-projects.ts +91 -25
  219. package/lib/hermes-sessions.ts +65 -10
  220. package/lib/openclaw-projects.ts +111 -18
  221. package/lib/openclaw-sessions.ts +20 -0
  222. package/lib/paths.ts +36 -0
  223. package/lib/project-tree.ts +193 -0
  224. package/lib/projects.ts +22 -0
  225. package/package.json +7 -6
  226. package/pi-extension/index.ts +38 -5
  227. package/scripts/launch.ts +7 -0
  228. package/src/audit/cli-adapters/hermes.ts +6 -3
  229. package/src/audit/cli-adapters/openclaw.ts +17 -13
  230. package/src/hooks/configure-wizard.ts +24 -2
  231. package/src/hooks/custom-hooks-loader.ts +90 -13
  232. package/src/hooks/enforcement-capability.ts +266 -0
  233. package/src/hooks/handler.ts +20 -3
  234. package/src/hooks/hook-activity-store.ts +14 -0
  235. package/src/hooks/hooks-config.ts +90 -6
  236. package/src/hooks/integrations.ts +123 -19
  237. package/src/hooks/manager.ts +206 -75
  238. package/src/hooks/policy-evaluator.ts +59 -7
  239. package/src/hooks/policy-types.ts +31 -0
  240. package/src/hooks/types.ts +50 -2
  241. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q2nbsl._.js +0 -3
  242. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1d9qen3._.js +0 -3
  243. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1mrihkj._.js +0 -3
  244. package/.next/standalone/.next/server/chunks/lib_openclaw-projects_ts_0gc-p24._.js +0 -3
  245. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__015_i4t._.js +0 -4
  246. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__030k0c6._.js +0 -3
  247. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__03lv-pe._.js +0 -4
  248. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__042d3cd._.js +0 -3
  249. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09q1168._.js +0 -3
  250. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qeuy9c._.js +0 -4
  251. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s89hoe._.js +0 -4
  252. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0zf8xlq._.js +0 -3
  253. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17ai7sy._.js +0 -4
  254. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1d8omgc._.js +0 -3
  255. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1fax1sl._.js +0 -19
  256. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1tkjqka._.js +0 -4
  257. package/.next/standalone/.next/server/chunks/ssr/_05whahf._.js +0 -3
  258. package/.next/standalone/.next/server/chunks/ssr/_0_9_ytf._.js +0 -3
  259. package/.next/standalone/.next/server/chunks/ssr/_1kje4fm._.js +0 -3
  260. package/.next/standalone/.next/server/chunks/ssr/_1p0-leb._.js +0 -3
  261. package/.next/standalone/.next/static/chunks/0o0ut0ugd0_-s.js +0 -1
  262. package/.next/standalone/.next/static/chunks/0xl97x-874k-u.js +0 -1
  263. package/.next/standalone/.next/static/chunks/19d7hqx8udopz.js +0 -1
  264. package/.next/standalone/.next/static/chunks/36j05kb2x323i.css +0 -2
  265. package/.next/standalone/.next/static/chunks/370sj2lgkw5ey.js +0 -1
  266. package/.next/standalone/.next/static/chunks/3w7g0n0iwwnbs.js +0 -1
  267. package/.next/standalone/.next/static/chunks/42oeva1-w0z2d.js +0 -6
  268. /package/.next/standalone/.next/static/{WQRKgSfFekLcC_pvyzp4S → nhn6Tt0--xZKdgVGIqR6E}/_buildManifest.js +0 -0
  269. /package/.next/standalone/.next/static/{WQRKgSfFekLcC_pvyzp4S → nhn6Tt0--xZKdgVGIqR6E}/_clientMiddlewareManifest.js +0 -0
  270. /package/.next/standalone/.next/static/{WQRKgSfFekLcC_pvyzp4S → nhn6Tt0--xZKdgVGIqR6E}/_ssgManifest.js +0 -0
@@ -0,0 +1,3 @@
1
+ module.exports=[69349,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(77975);a.i(46786),a.i(14747);let e=/^[a-z]{2,}:/;function f(a){return!!a&&e.test(a)}var g=a.i(16316),h=a.i(27950),i=a.i(45481),j=a.i(90619),k=a.i(95947),l=a.i(87256);function m(a,b,c){return{key:a,label:b,depth:c,children:new Map,projectCount:0,lastModified:new Date(0),cli:[]}}function n(a,b){for(let c of(b.lastModified.getTime()>a.lastModified.getTime()&&(a.lastModified=b.lastModified,a.lastModifiedFormatted=b.lastModifiedFormatted),"number"==typeof b.sessionCount&&(a.sessionCount=(a.sessionCount??0)+b.sessionCount),a.projectCount+=1,b.cli))a.cli.includes(c)||a.cli.push(c)}function o(a){let b=[...a.children.values()].map(o).sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime());return{key:a.key,label:a.label,depth:a.depth,children:b,project:a.project,sessionCount:a.sessionCount,projectCount:a.projectCount,lastModified:a.lastModified,lastModifiedFormatted:a.lastModifiedFormatted,cli:a.cli}}var p=a.i(89027),q=a.i(41146);let r=(0,a.i(64831).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var s=a.i(33540),t=a.i(74215),u=a.i(38246),v=a.i(65967),w=a.i(24451);function x({date:a,formatted:c}){return(0,b.jsx)("span",{children:c||(0,g.formatDate)(a)})}let y="failproofai.projects.collapsed";function z(a){try{window.localStorage.setItem(y,JSON.stringify([...a]))}catch{}}function A({node:a,collapsed:c,interactive:e,onToggle:g}){let h=a.children.length>0,i=a.project,j=c?q.ChevronRight:p.ChevronDown,k={paddingLeft:`${1.25*Math.min(a.depth,4)}rem`};return(0,b.jsxs)("tr",{className:"border-b border-border hover:bg-muted/50 transition-colors",children:[(0,b.jsx)("td",{className:"px-4 py-3",children:(0,b.jsx)("div",{style:k,children:(0,b.jsx)(r,{className:`w-5 h-5 ${h?"text-muted-foreground":"text-primary"}`})})}),(0,b.jsx)("td",{className:"px-4 py-3 max-w-md",children:(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",style:k,children:[h?e?(0,b.jsxs)("button",{type:"button",onClick:()=>g(a.key),"aria-expanded":!c,"aria-label":`${c?"Expand":"Collapse"} ${a.label}`,className:"flex items-center gap-1 font-semibold text-foreground hover:text-primary transition-colors break-words break-all text-left",children:[(0,b.jsx)(j,{className:"w-4 h-4 shrink-0"}),a.label]}):(0,b.jsxs)("span",{className:"flex items-center gap-1 font-semibold text-foreground break-words break-all",children:[(0,b.jsx)(j,{className:"w-4 h-4 shrink-0"}),a.label]}):i?(0,b.jsx)(u.default,{href:`/project/${encodeURIComponent(i.name)}`,className:"font-semibold text-foreground hover:text-primary transition-colors break-words break-all inline-block max-w-full",children:a.depth>0?a.label:function(a,b){return f(b)?b.replace(/:/g,"/"):/^[A-Za-z]--/.test(a)?a[0]+":/"+a.slice(3).replace(/-/g,"/"):a.replace(/-/g,"/")}(i.name,i.path)}):(0,b.jsx)("span",{className:"font-semibold text-foreground",children:a.label}),a.cli.map(a=>(0,b.jsx)(d.CliBadge,{cli:a},a)),h&&void 0!==a.sessionCount&&(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:[a.sessionCount," session",1===a.sessionCount?"":"s"]})]})}),(0,b.jsx)("td",{className:"px-4 py-3 text-sm text-muted-foreground hidden md:table-cell truncate max-w-md",children:i?i.path:""}),(0,b.jsx)("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:(0,b.jsx)(x,{date:a.lastModified,formatted:a.lastModifiedFormatted})})]})}a.s(["default",0,function({folders:a}){let d=(0,j.useUrlParams)(),e=(0,c.useRef)(!1),[g,p]=(0,c.useState)(()=>(0,k.paramToKeywords)(d.get("q"))),[q,r]=(0,c.useState)(""),[u,x]=(0,c.useState)(()=>{let a=d.get("cli");return(0,l.isKnownCli)(a)?a:""}),{filterPreset:B,dateRange:C,currentPage:D,setCurrentPage:E,handlePresetChange:F,handleDateRangeChange:G,clearFilters:H}=(0,i.useFilterState)(g,{filterPreset:(0,k.paramToPreset)(d.get("preset")),dateRange:(0,k.paramsToDateRange)(d.get("from"),d.get("to")),currentPage:(0,k.paramToPage)(d.get("page"))});(0,c.useEffect)(()=>{if(!e.current){e.current=!0;return}d.setAll({preset:(0,k.presetToParam)(B),...(0,k.dateRangeToParams)(C),q:(0,k.keywordsToParam)(g),page:(0,k.pageToParam)(D),cli:u||void 0})},[B,C,g,D,u]);let I=a=>{let b=a.trim();b&&!g.includes(b)&&(p([...g,b]),r(""))},J=()=>{p([]),r("")},K=(0,c.useMemo)(()=>(0,h.rehydrateDates)(a),[a]),L=(0,c.useMemo)(()=>{let a=(0,h.filterByDate)(K,B,C);return g.length>0&&(a=a.filter(a=>{let b=a.name.toLowerCase();return g.every(a=>{let c=a.trim().toLowerCase().replace(/\//g,"-");return 0===c.length||b.includes(c)})})),u&&(a=a.filter(a=>a.cli.includes(u))),a.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime())},[K,B,C,g,u]),M=(0,c.useMemo)(()=>(function(a){let b=new Map;for(let d of a){var c;let a,e=f(c=d.path)?c.split(":"):[];if(0===e.length){let a=m(`project:${d.name}`,d.name,0);a.project=d,n(a,d),b.set(a.key,a);continue}let g=b,h="";for(let b=0;b<e.length;b++){let c=e[b];h=0===b?c:`${h}:${c}`;let f=g.get(h);f||(f=m(h,c,b),g.set(h,f)),n(f,d),a=f,g=f.children}a&&!a.project&&(a.project=d)}return[...b.values()].map(o).sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime())})(L),[L]),N=Math.max(1,Math.ceil(M.length/h.ITEMS_PER_PAGE));(0,c.useEffect)(()=>{D>N&&E(N)},[D,N,E]);let O=(D-1)*h.ITEMS_PER_PAGE,P=Math.min(O+h.ITEMS_PER_PAGE,M.length),Q=(0,c.useMemo)(()=>M.slice(O,P),[M,O,P]),R=M.slice(0,O).reduce((a,b)=>a+b.projectCount,0),S=Q.reduce((a,b)=>a+b.projectCount,0),[T,U]=(0,c.useState)(()=>new Set);(0,c.useEffect)(()=>{U(new Set(function(){try{let a=window.localStorage.getItem(y),b=a?JSON.parse(a):null;return Array.isArray(b)?b.filter(a=>"string"==typeof a):[]}catch{return[]}}()))},[]);let V=a=>{U(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),z(c),c})},W=g.length>0,X=(0,c.useMemo)(()=>{var a;let b,c;return a=a=>!W&&T.has(a),b=[],(c=d=>{for(let e of d)b.push(e),e.children.length>0&&!a(e.key)&&c(e.children)})(Q),b},[Q,T,W]),Y=(0,c.useMemo)(()=>{let a,b;return a=[],(b=c=>{for(let d of c)d.children.length>0&&(a.push(d.key),b(d.children))})(Q),a},[Q]),Z=X.filter(a=>a.children.length>0).map(a=>a.key).some(a=>!T.has(a));return(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("div",{className:"bg-card border border-border rounded-lg p-4",children:(0,b.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Filter by:"}),h.FILTER_PRESETS.map(a=>(0,b.jsx)("button",{onClick:()=>F(a.value),className:`px-3 py-1.5 text-sm rounded-md transition-colors ${B===a.value?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:a.label},a.value)),(0,b.jsx)("span",{className:"ml-2 text-sm font-medium text-foreground",children:"CLI:"}),(0,b.jsxs)("select",{"aria-label":"Filter by CLI",value:u,onChange:a=>{let b=a.target.value;x(""===b||(0,l.isKnownCli)(b)?b:"")},className:"px-2 py-1.5 text-sm bg-input border border-border rounded-md text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent",children:[(0,b.jsx)("option",{value:"",children:"All CLIs"}),l.KNOWN_CLI_IDS.map(a=>(0,b.jsx)("option",{value:a,children:(0,l.getCliLabel)(a)},a))]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(s.Search,{className:"w-4 h-4 text-muted-foreground"}),(0,b.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Search Keywords:"})]}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"text",value:q,onChange:a=>r(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),I(q))},placeholder:"Enter keyword and press Enter",className:"px-3 py-2 text-sm bg-input border border-border rounded-md text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent transition-all hover:border-primary/50 w-[250px]","aria-label":"Add keyword"}),(0,b.jsx)("button",{onClick:()=>I(q),className:"px-3 py-2 text-sm bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors","aria-label":"Add keyword",children:"Add"})]}),g.length>0&&(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g.map((a,c)=>(0,b.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-muted text-muted-foreground rounded-md text-sm",children:[(0,b.jsx)("span",{children:a}),(0,b.jsx)("button",{onClick:()=>{p(g.filter((a,b)=>b!==c))},className:"hover:text-foreground transition-colors p-0.5 rounded hover:bg-muted/80","aria-label":`Remove keyword ${a}`,children:(0,b.jsx)(t.X,{className:"w-3.5 h-3.5"})})]},c)),(0,b.jsx)("button",{onClick:J,className:"px-2 py-1.5 text-xs bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors","aria-label":"Clear all keywords",children:"Clear all"})]})]})]}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,b.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Custom Range:"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(w.default,{id:"date-from",value:C.from,onChange:a=>G("from",a),"aria-label":"Filter from date"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:"to"}),(0,b.jsx)(w.default,{id:"date-to",value:C.to,onChange:a=>G("to",a),"aria-label":"Filter to date"})]}),("all"!==B||null!==C.from||null!==C.to||g.length>0||""!==u)&&(0,b.jsx)("button",{onClick:()=>{H(),J(),x("")},className:"px-3 py-2 text-sm bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors",children:"Clear"})]}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground",children:[Y.length>0&&!W&&(0,b.jsx)("button",{type:"button",onClick:()=>{U(a=>{let b=new Set(a);for(let a of Y)Z?b.add(a):b.delete(a);return z(b),b})},className:"text-xs text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:Z?"Collapse all":"Expand all"}),0===L.length?(0,b.jsx)("span",{children:"No projects found"}):(0,b.jsxs)("span",{children:["Showing ",R+1,"-",R+S," of ",L.length," projects",L.length!==K.length&&(0,b.jsxs)("span",{className:"ml-1",children:["(filtered from ",K.length," total)"]}),g.length>0&&(0,b.jsxs)("span",{className:"ml-1",children:["with ",g.length," keyword",1!==g.length?"s":""]})]})]})]})}),(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[(0,b.jsx)("div",{className:"overflow-x-auto",children:(0,b.jsxs)("table",{className:"w-full",children:[(0,b.jsx)("thead",{children:(0,b.jsxs)("tr",{className:"border-b border-border bg-muted/50",children:[(0,b.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground w-12",children:(0,b.jsx)("span",{className:"sr-only",children:"Icon"})}),(0,b.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground max-w-md",children:"Agent Root"}),(0,b.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground hidden md:table-cell",children:"Path"}),(0,b.jsx)("th",{scope:"col",className:"px-4 py-3 text-left text-sm font-semibold text-foreground",children:"Last Modified"})]})}),(0,b.jsx)("tbody",{children:0===X.length?(0,b.jsx)("tr",{children:(0,b.jsx)("td",{colSpan:4,className:"px-4 py-8 text-center text-muted-foreground",children:"No projects found matching the selected filter."})}):X.map(a=>(0,b.jsx)(A,{node:a,collapsed:!W&&T.has(a.key),interactive:!W,onToggle:V},a.key))})]})}),L.length>0&&(0,b.jsx)(v.default,{currentPage:D,totalPages:N,onPageChange:E})]})]})}],69349)}];
2
+
3
+ //# sourceMappingURL=app_components_project-list_tsx_1ke6anr._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[3171,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(11367),e=a.i(5607);a.s(["default",0,function({error:a,reset:f}){return(0,c.useEffect)(()=>{(0,d.getTelemetryConfig)().then(b=>{(0,e.setClientTelemetryConfig)(b),(0,e.captureClientEvent)("client_error",{error_message:a.message,error_name:a.name,error_digest:a.digest,boundary:"global"})}).catch(()=>{})},[a]),(0,b.jsx)("html",{children:(0,b.jsx)("body",{children:(0,b.jsx)("main",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#031035",color:"#f8fafc",fontFamily:"system-ui, sans-serif"},children:(0,b.jsxs)("div",{style:{textAlign:"center",padding:"2rem",border:"1px solid rgba(239,68,68,0.4)",borderRadius:"0.5rem",maxWidth:"500px"},children:[(0,b.jsx)("h2",{style:{color:"#ef4444",marginBottom:"0.5rem",fontSize:"1.25rem"},children:"Something went wrong"}),(0,b.jsx)("p",{style:{color:"#94a3b8",marginBottom:"1.5rem"},children:a.message||"An unexpected error occurred."}),(0,b.jsx)("button",{onClick:f,style:{padding:"0.5rem 1.25rem",background:"#3b82f6",color:"white",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]})})})})}])}];
1
+ module.exports=[3171,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(29581),e=a.i(5607);a.s(["default",0,function({error:a,reset:f}){return(0,c.useEffect)(()=>{(0,d.getTelemetryConfig)().then(b=>{(0,e.setClientTelemetryConfig)(b),(0,e.captureClientEvent)("client_error",{error_message:a.message,error_name:a.name,error_digest:a.digest,boundary:"global"})}).catch(()=>{})},[a]),(0,b.jsx)("html",{children:(0,b.jsx)("body",{children:(0,b.jsx)("main",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#031035",color:"#f8fafc",fontFamily:"system-ui, sans-serif"},children:(0,b.jsxs)("div",{style:{textAlign:"center",padding:"2rem",border:"1px solid rgba(239,68,68,0.4)",borderRadius:"0.5rem",maxWidth:"500px"},children:[(0,b.jsx)("h2",{style:{color:"#ef4444",marginBottom:"0.5rem",fontSize:"1.25rem"},children:"Something went wrong"}),(0,b.jsx)("p",{style:{color:"#94a3b8",marginBottom:"1.5rem"},children:a.message||"An unexpected error occurred."}),(0,b.jsx)("button",{onClick:f,style:{padding:"0.5rem 1.25rem",background:"#3b82f6",color:"white",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]})})})})}])}];
2
2
 
3
3
  //# sourceMappingURL=app_global-error_tsx_1kp6l3x._.js.map
@@ -1,8 +1,8 @@
1
- module.exports=[22712,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(35112),e=a.i(38246),f=a.i(64831);let g=(0,f.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),h=(0,f.default)("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),i=(0,f.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),j=(0,f.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);var k=a.i(89027),l=a.i(85650),m=a.i(52562);let n=(0,f.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),o=(0,f.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var p=a.i(74215),q=a.i(65967),r=a.i(5050);let s=(0,r.createServerReference)("409a8011f18d94f84f5ebf30534677b4a8b6d81578",r.callServer,void 0,r.findSourceMapURL,"getHookActivityAction"),t=(0,r.createServerReference)("604bdb7c675991b6765414bb88e08082aad0e8adc3",r.callServer,void 0,r.findSourceMapURL,"searchHookActivityAction"),u=(0,r.createServerReference)("006d7443e613357829b40adaac068a115508df626b",r.callServer,void 0,r.findSourceMapURL,"getHooksConfigAction"),v=(0,r.createServerReference)("60072e86b97598b4347d7bdd6d89d607b1da0ce91b",r.callServer,void 0,r.findSourceMapURL,"togglePolicyAction"),w=(0,r.createServerReference)("60bf2ae748eb1404cd8cbd03c3fa8ece7d62ecdc1e",r.callServer,void 0,r.findSourceMapURL,"installHooksWebAction"),x=(0,r.createServerReference)("604ea829f89db034e3b8d54f85742b44192a13cf9f",r.callServer,void 0,r.findSourceMapURL,"removeHooksWebAction"),y=(0,r.createServerReference)("60cf60cbd7c61987a905fddb52447f5f33a926715f",r.callServer,void 0,r.findSourceMapURL,"updatePolicyParamsAction");var z=a.i(6236),A=a.i(10765),B=a.i(90619),C=a.i(95947),D=a.i(87256),E=a.i(40695);function F({sessionId:a,transcriptPath:c,integration:d,cwd:f}){if(!a)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"\\u2014"});let g=a?a.slice(0,8):"—",h="codex"===d||(c?.includes("/.codex/")??!1),i="copilot"===d||(c?.includes("/.copilot/session-state/")??!1),j="cursor"===d||(c?.includes("/.cursor/")??!1),k="opencode"===d||(c?.includes("/.local/share/opencode/")??!1)||(c?.includes("/.opencode/")??!1),l="pi"===d||(c?.includes("/.pi/")??!1);if(h||i||j||k||l){let c,d=f?(c=/^([A-Za-z]):[\\/](.*)$/.exec(f))?c[1]+"--"+c[2].replace(/[\\/]/g,"-"):f.replace(/[\\/]/g,"-"):h?"codex":i?"copilot":j?"cursor":k?"opencode":"pi";return(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(d)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g})}let m=c?function(a){let b=a.replace(/\\/g,"/").split("/").filter(Boolean);if(b.length<2)return null;let c=b[b.length-2];return!c||c.startsWith(".")?null:c}(c):null;return m?(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(m)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g}):(0,b.jsx)("span",{className:"text-muted-foreground font-mono",children:g})}function G({decision:a}){return"deny"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,b.jsx)(h,{className:"h-3 w-3"}),"Deny"]}):"instruct"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,b.jsx)(i,{className:"h-3 w-3"}),"Instruct"]}):(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,b.jsx)(g,{className:"h-3 w-3"}),"Allow"]})}function H({eventType:a}){return(0,b.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:a})}function I({integration:a}){if(!a)return null;let c=(0,D.getCliLabel)(a),d=(0,D.getCliBadgeClasses)(a);return(0,b.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${d}`,title:`Agent CLI: ${c}`,children:c})}function J({mode:a}){let c="default"===a;return(0,b.jsx)("span",{title:a,className:`inline-block max-w-full truncate rounded px-1.5 py-0.5 align-middle text-[0.6rem] font-medium border ${c?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:a})}function K({ms:a}){return(0,b.jsx)("span",{className:`font-mono text-[0.7rem] ${a>500?"text-red-400":a>100?"text-amber-400":"text-muted-foreground"}`,children:a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`})}function L({text:a,field:d}){let[e,f]=(0,c.useState)(!1),{capture:g}=(0,A.usePostHog)(),h=async b=>{b.stopPropagation(),g("activity_copy_clicked",{field:d??"unknown"});try{await navigator.clipboard.writeText(a),f(!0),setTimeout(()=>f(!1),1500)}catch{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b),f(!0),setTimeout(()=>f(!1),1500)}};return(0,b.jsx)("button",{onClick:h,className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:e?(0,b.jsx)(m.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(l.Copy,{className:"h-3 w-3"})})}function M({value:a,onChange:c}){return(0,b.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(d=>(0,b.jsx)("button",{onClick:()=>c(d.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${a===d.value?"deny"===d.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===d.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===d.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:d.label},d.value))})}function N({stats:a}){let c=a.totalEvents>0?a.denyCount/a.totalEvents*100:0,d=c.toFixed(c>=10?0:1),e=0===a.denyCount?"":c>=5?" is-deny":c>=2?" is-warn":"";return(0,b.jsxs)("div",{className:"stat-bar",role:"group","aria-label":"Activity stats",children:[(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"total events"}),(0,b.jsx)("span",{className:"value",children:a.totalEvents.toLocaleString()}),(0,b.jsx)("span",{className:"meta",children:"across all installed agents"})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"deny rate"}),(0,b.jsxs)("span",{className:`value${e}`,children:[d,"%"]}),(0,b.jsxs)("span",{className:"meta",children:[a.denyCount.toLocaleString()," of ",a.totalEvents.toLocaleString()," denied"]})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"top policy"}),(0,b.jsx)("span",{className:"value",style:{fontSize:16,fontWeight:500,color:a.topPolicy?"var(--accent-pink)":"var(--dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a.topPolicy??void 0,children:a.topPolicy??"—"}),(0,b.jsx)("span",{className:"meta",children:"most-evaluated policy in scope"})]})]})}function O({item:a}){return(0,b.jsx)("tr",{children:(0,b.jsx)("td",{colSpan:11,className:"px-0 py-0",children:(0,b.jsxs)("div",{className:"activity-detail animate-expand text-xs",children:[(0,b.jsxs)("span",{className:"activity-detail-eyebrow",children:[(0,b.jsx)("span",{"aria-hidden":"true",children:"\\u25be"}),"event detail"]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.sessionId??"—"}),a.sessionId&&(0,b.jsx)(L,{text:a.sessionId,field:"session_id"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.cwd??"—"}),a.cwd&&(0,b.jsx)(L,{text:a.cwd,field:"cwd"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,b.jsx)("span",{className:"font-mono text-foreground break-all",children:a.transcriptPath??"—"}),a.transcriptPath?.startsWith("opencode-db://")&&(0,b.jsx)("span",{className:"text-muted-foreground ml-1",children:"(stored in opencode DB)"})]})]}),a.policyNames&&a.policyNames.length>1&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.policyNames.join(", ")})]}),a.reason&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,b.jsx)("span",{className:"text-foreground",children:a.reason})]})]})})})}function P({hooksInstalled:a,onSwitchTab:d}){let{intervalSec:e}=(0,z.useAutoRefresh)(),{capture:f}=(0,A.usePostHog)(),g=(0,B.useUrlParams)(),h=(0,c.useRef)(!1),[i,l]=(0,c.useState)(()=>(0,C.paramToPage)(g.get("page"))),[m,n]=(0,c.useState)(null),[o,p]=(0,c.useState)(null),[r,u]=(0,c.useState)(()=>{let a=g.get("decision");return"allow"===a||"deny"===a||"instruct"===a?a:""}),[v,w]=(0,c.useState)(()=>g.get("event")??""),[x,y]=(0,c.useState)(()=>g.get("policy")??""),[E,L]=(0,c.useState)(()=>g.get("session")??""),[Q,R]=(0,c.useState)(()=>{let a=g.get("cli");return(0,D.isKnownCli)(a)?a:""}),S=(0,c.useRef)(null),T=(0,c.useRef)(!0),U=(0,c.useRef)({filterDecision:r,filterEventType:v,filterPolicy:x,filterSessionId:E,filterCli:Q});U.current={filterDecision:r,filterEventType:v,filterPolicy:x,filterSessionId:E,filterCli:Q},(0,c.useEffect)(()=>{if(!h.current){h.current=!0;return}g.setAll({decision:r||void 0,event:v||void 0,policy:x||void 0,session:E||void 0,cli:Q||void 0,page:(0,C.pageToParam)(i)})},[r,v,x,E,Q,i]);let V=""!==r||""!==v||""!==x||""!==E||""!==Q,W=(0,c.useCallback)(async a=>{try{let b,{filterDecision:c,filterEventType:d,filterPolicy:e,filterSessionId:f,filterCli:g}=U.current;b=""!==c||""!==d||""!==e||""!==f||""!==g?await t({decision:c||void 0,eventType:d||void 0,policyName:e||void 0,sessionId:f||void 0,integration:g||void 0},a):await s(a),n(b)}catch{}},[]);(0,c.useEffect)(()=>{W(i);let a=setInterval(()=>W(i),e>0?1e3*e:5e3);return()=>clearInterval(a)},[i,W,e]),(0,c.useEffect)(()=>(S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{if(l(1),p(null),W(1),T.current){T.current=!1;return}f("activity_filter_changed",{active_filter_count:+(""!==r)+ +(""!==v)+ +(""!==x)+ +(""!==E)+ +(""!==Q),has_decision:""!==r,has_event_type:""!==v,has_policy:""!==x,has_session:""!==E,has_cli:""!==Q,decision:r||null,event_type:v||null,cli:Q||null})},300),()=>{S.current&&clearTimeout(S.current)}),[r,v,x,E,Q]);let X=m?.entries??[],Y=m?.totalPages??1;return(0,b.jsxs)(b.Fragment,{children:[m?.stats&&m.stats.totalEvents>0&&(0,b.jsx)("div",{style:{marginBottom:18},children:(0,b.jsx)(N,{stats:m.stats})}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"filter-bar",children:[(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"decision"}),(0,b.jsx)(M,{value:r,onChange:u})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"event"}),(0,b.jsxs)("select",{value:v,onChange:a=>w(a.target.value),className:"filter-input",children:[(0,b.jsx)("option",{value:"",children:"all events"}),(0,b.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,b.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,b.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,b.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,b.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,b.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"cli"}),(0,b.jsxs)("select",{value:Q,onChange:a=>{let b=a.target.value;R(""===b||(0,D.isKnownCli)(b)?b:"")},className:"filter-input","aria-label":"Filter by CLI",children:[(0,b.jsx)("option",{value:"",children:"all clis"}),D.KNOWN_CLI_IDS.map(a=>(0,b.jsx)("option",{value:a,children:(0,D.getCliLabel)(a)},a))]})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"policy"}),(0,b.jsx)("input",{type:"text",value:x,onChange:a=>y(a.target.value),placeholder:"filter by policy…",className:"filter-input"})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"session"}),(0,b.jsx)("input",{type:"text",value:E,onChange:a=>L(a.target.value),placeholder:"filter by session…",className:"filter-input"})]}),V&&(0,b.jsx)("button",{type:"button",className:"filter-clear",onClick:()=>{u(""),w(""),R(""),y(""),L("")},"aria-label":"Clear all filters",children:"[ clear ]"})]}),0===X.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[(0,b.jsx)(j,{className:"h-12 w-12 text-muted-foreground/30"}),!1===a?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4 font-medium",children:"Policies are not installed"}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:["Go to the"," ",(0,b.jsx)("button",{className:"underline hover:text-foreground transition-colors",onClick:()=>d?.("policies"),children:"Policies tab"})," ","and click ",(0,b.jsx)("span",{className:"font-mono bg-muted px-1 rounded",children:"Install"})," to enable policy monitoring."]})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4",children:V?"No matching activity.":"Waiting for hook events…"})]}):(0,b.jsx)("div",{className:"overflow-x-auto activity-table-wrap",children:(0,b.jsxs)("table",{className:"w-full text-xs activity-table",style:{tableLayout:"fixed"},children:[(0,b.jsxs)("colgroup",{children:[(0,b.jsx)("col",{style:{width:32}}),(0,b.jsx)("col",{style:{width:"7%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"13%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"8%"}})]}),(0,b.jsx)("thead",{className:"activity-thead",children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{className:"px-4 py-3"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Time"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Decision"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Event"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"CLI"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Tool"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Policy"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Reason"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Mode"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Duration"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Session"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-border/30",children:X.map((a,d)=>{var e;let g,h="deny"===a.decision,i=o===d,j="instruct"===a.decision;return(0,b.jsxs)(c.default.Fragment,{children:[(0,b.jsxs)("tr",{onClick:()=>{p(a=>{let b=a===d?null:d,c=X[d];return f("activity_row_toggled",{expanded:null!==b,decision:c?.decision??null,policy_name:c?.policyName??null,event_type:c?.eventType??null}),b})},className:`activity-data-row cursor-pointer transition-colors ${h?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":j?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":d%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${i?"bg-muted/20":""}`,children:[(0,b.jsx)("td",{className:"px-4 py-2",children:(0,b.jsx)(k.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${i?"rotate-0":"-rotate-90"}`})}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground whitespace-nowrap",title:new Date(a.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(e=a.timestamp,(g=Date.now()-e)<6e4?`${Math.max(1,Math.floor(g/1e3))}s ago`:g<36e5?`${Math.floor(g/6e4)}m ago`:g<864e5?`${Math.floor(g/36e5)}h ago`:`${Math.floor(g/864e5)}d ago`)}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(G,{decision:a.decision})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(H,{eventType:a.eventType})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(I,{integration:a.integration})}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.toolName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.policyNames&&a.policyNames.length>1?(0,b.jsxs)("span",{title:a.policyNames.join(", "),children:[a.policyNames[0],(0,b.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",a.policyNames.length-1]})]}):a.policyName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate",title:a.reason??"",children:a.reason??"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:a.permissionMode?(0,b.jsx)(J,{mode:a.permissionMode}):"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(K,{ms:a.durationMs})}),(0,b.jsx)("td",{className:"px-3 py-2",title:a.sessionId??"",children:(0,b.jsx)(F,{sessionId:a.sessionId,transcriptPath:a.transcriptPath,integration:a.integration,cwd:a.cwd})})]}),i&&(0,b.jsx)(O,{item:a})]},`${a.timestamp}-${d}`)})})]})}),(0,b.jsx)(q.default,{currentPage:i,totalPages:Y,onPageChange:a=>{f("activity_pagination_changed",{from_page:i,to_page:a,total_pages:Y}),l(a),p(null)}})]})]})}function Q({enabled:a,onChange:c,disabled:d}){return(0,b.jsx)("button",{onClick:c,disabled:d,className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors disabled:opacity-40 ${a?"bg-emerald-500":"bg-muted-foreground/30"}`,"aria-label":a?"Disable policy":"Enable policy",children:(0,b.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform ${a?"translate-x-3.5":"translate-x-0.5"}`})})}function R({policy:a,onClose:d,onSave:e}){let f=a.params??{},g=a.currentParams??{},[h,i]=(0,c.useState)(()=>{let a={};for(let[b,c]of Object.entries(f)){let d=b in g?g[b]:c.default;a[b]=d}return a});(0,c.useEffect)(()=>{let a=a=>{"Escape"===a.key&&d()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[d]);let j=(a,b)=>{i(c=>({...c,[a]:b}))};return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:a=>{a.target===a.currentTarget&&d()},children:(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-mono font-semibold text-foreground",children:a.name}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]}),(0,b.jsx)("button",{onClick:d,className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,b.jsx)(p.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"overflow-y-auto flex-1 px-4 py-4 space-y-4",children:Object.entries(f).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-semibold text-foreground mb-1 font-mono",children:a}),(0,b.jsx)("p",{className:"text-[0.65rem] text-muted-foreground mb-1.5",children:c.description}),((a,c)=>{let d=h[a];if("boolean"===c.type)return(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:!!d,onChange:b=>j(a,b.target.checked),className:"rounded border-border"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:c.description})]});if("number"===c.type)return(0,b.jsx)("input",{type:"number",value:"number"==typeof d?d:"",onChange:b=>j(a,Number(b.target.value)),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"});if("string[]"===c.type){let c=Array.isArray(d)?d.join("\n"):"";return(0,b.jsx)("textarea",{value:c,onChange:b=>j(a,b.target.value.split("\n").filter(a=>""!==a.trim())),rows:4,placeholder:"One entry per line",className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-2 focus:ring-primary/40 resize-y"})}if("pattern[]"===c.type){let c=Array.isArray(d)?d:[];return(0,b.jsxs)("div",{className:"space-y-1.5",children:[c.map((d,e)=>(0,b.jsxs)("div",{className:"flex gap-1.5 items-center",children:[(0,b.jsx)("input",{type:"text",value:d.regex,onChange:b=>{let d=[...c];d[e]={...d[e],regex:b.target.value},j(a,d)},placeholder:"regex",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("input",{type:"text",value:d.label,onChange:b=>{let d=[...c];d[e]={...d[e],label:b.target.value},j(a,d)},placeholder:"label",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("button",{onClick:()=>j(a,c.filter((a,b)=>b!==e)),className:"text-muted-foreground/50 hover:text-destructive transition-colors",children:(0,b.jsx)(p.X,{className:"h-3.5 w-3.5"})})]},e)),(0,b.jsx)("button",{onClick:()=>j(a,[...c,{regex:"",label:""}]),className:"text-xs text-primary hover:underline",children:"+ Add pattern"})]})}return(0,b.jsx)("input",{type:"text",value:"string"==typeof d?d:"",onChange:b=>j(a,b.target.value),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"})})(a,c)]},a))}),(0,b.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,b.jsx)(E.Button,{variant:"outline",size:"sm",onClick:d,className:"h-7 text-xs",children:"Cancel"}),(0,b.jsx)(E.Button,{size:"sm",onClick:()=>e(h),className:"h-7 text-xs",children:"Save"})]})]})})}function S({message:a,onDismiss:c,onInstall:e,isPending:f}){let{capture:g}=(0,A.usePostHog)();return(0,d.createPortal)((0,b.jsxs)("div",{className:"fixed top-4 right-4 z-[9999] w-full max-w-sm",style:{animation:"slideInFromRight 0.25s ease-out"},children:[(0,b.jsx)("style",{children:`
1
+ module.exports=[22712,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(35112),e=a.i(38246),f=a.i(52562),g=a.i(89027),h=a.i(64831);let i=(0,h.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var j=a.i(85650);let k=(0,h.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),l=(0,h.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),m=(0,h.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),n=(0,h.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),o=(0,h.default)("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),p=(0,h.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var q=a.i(74215),r=a.i(65967),s=a.i(5050);let t=(0,s.createServerReference)("4073783ac3f775f2f7cdeadc278198a2e3c4f5592b",s.callServer,void 0,s.findSourceMapURL,"getHookActivityAction"),u=(0,s.createServerReference)("609b38b60710b0c8adce4d1efd1c7de4e88c626055",s.callServer,void 0,s.findSourceMapURL,"searchHookActivityAction"),v=(0,s.createServerReference)("003e4c258222b6742072e3f739bba7e90fb6b7e463",s.callServer,void 0,s.findSourceMapURL,"getHooksConfigAction"),w=(0,s.createServerReference)("607991f426867151247b1be1fdef804b5d3f1d8d2b",s.callServer,void 0,s.findSourceMapURL,"toggleCustomPolicyAction"),x=(0,s.createServerReference)("607270bd929a755d58bf803866c87e85149e554942",s.callServer,void 0,s.findSourceMapURL,"togglePolicyAction"),y=(0,s.createServerReference)("602152b5d1e7d93269f75420a4f05ca0640c3c70d8",s.callServer,void 0,s.findSourceMapURL,"installHooksWebAction"),z=(0,s.createServerReference)("604a04e49d6741ea531781581e3e95157c5d082139",s.callServer,void 0,s.findSourceMapURL,"removeHooksWebAction"),A=(0,s.createServerReference)("6075287cb3d5c0fc86c98c535fc0c3e0bb5090e513",s.callServer,void 0,s.findSourceMapURL,"updatePolicyParamsAction");var B=a.i(6236),C=a.i(10765),D=a.i(90619),E=a.i(95947),F=a.i(87256);let G={claude:{PreToolUse:"block",UserPromptSubmit:"block",PermissionRequest:"block",Stop:"block",SubagentStop:"block",PreCompact:"block",PostToolBatch:"block",ConfigChange:"block",UserPromptExpansion:"block",TaskCreated:"block",TaskCompleted:"block",TeammateIdle:"block",Elicitation:"block",ElicitationResult:"block",PostToolUse:"observe",PostToolUseFailure:"observe",SessionStart:"observe",Setup:"observe",SubagentStart:"observe",SessionEnd:"observe",StopFailure:"observe",PermissionDenied:"observe",Notification:"observe",InstructionsLoaded:"observe",CwdChanged:"observe",FileChanged:"observe",PostCompact:"observe",WorktreeRemove:"observe"},codex:{PreToolUse:"block",PermissionRequest:"block",UserPromptSubmit:"block",Stop:"block",SubagentStop:"block",PostToolUse:"observe",SessionStart:"observe",SubagentStart:"observe",PreCompact:"observe",PostCompact:"observe"},copilot:{PreToolUse:"block",Stop:"block",SubagentStop:"block",UserPromptSubmit:"block",PermissionRequest:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",PostToolUseFailure:"observe",PreCompact:"observe",Notification:"observe"},cursor:{PreToolUse:"block",Stop:"block",UserPromptSubmit:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"},opencode:{PreToolUse:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",UserPromptSubmit:"observe",PermissionRequest:"observe"},pi:{PreToolUse:"block",UserPromptSubmit:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",Stop:"observe"},hermes:{PreToolUse:"block",PostToolUse:"observe",SubagentStop:"observe",SessionStart:"observe",SessionEnd:"observe"},openclaw:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",SubagentStop:"observe",PreCompact:"observe"},factory:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PreCompact:"block",PostToolUse:"observe",SubagentStop:"observe",SessionStart:"observe",SessionEnd:"observe",Notification:"observe"},devin:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PermissionRequest:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"},antigravity:{PreToolUse:"block",Stop:"block",PostToolUse:"observe",UserPromptSubmit:"observe"},goose:{PreToolUse:"block",UserPromptSubmit:"observe",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"}};var H=a.i(40695);function I({sessionId:a,transcriptPath:c,integration:d,cwd:f}){if(!a)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"\\u2014"});let g=a?a.slice(0,8):"—",h="codex"===d||(c?.includes("/.codex/")??!1),i="copilot"===d||(c?.includes("/.copilot/session-state/")??!1),j="cursor"===d||(c?.includes("/.cursor/")??!1),k="opencode"===d||(c?.includes("/.local/share/opencode/")??!1)||(c?.includes("/.opencode/")??!1),l="pi"===d||(c?.includes("/.pi/")??!1);if(h||i||j||k||l){let c,d=f?(c=/^([A-Za-z]):[\\/](.*)$/.exec(f))?c[1]+"--"+c[2].replace(/[\\/]/g,"-"):f.replace(/[\\/]/g,"-"):h?"codex":i?"copilot":j?"cursor":k?"opencode":"pi";return(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(d)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g})}let m=c?function(a){let b=a.replace(/\\/g,"/").split("/").filter(Boolean);if(b.length<2)return null;let c=b[b.length-2];return!c||c.startsWith(".")?null:c}(c):null;return m?(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(m)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g}):(0,b.jsx)("span",{className:"text-muted-foreground font-mono",children:g})}function J({decision:a}){return"deny"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,b.jsx)(o,{className:"h-3 w-3"}),"Deny"]}):"instruct"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,b.jsx)(m,{className:"h-3 w-3"}),"Instruct"]}):(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,b.jsx)(n,{className:"h-3 w-3"}),"Allow"]})}function K({eventType:a}){return(0,b.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:a})}function L({integration:a}){if(!a)return null;let c=(0,F.getCliLabel)(a),d=(0,F.getCliBadgeClasses)(a);return(0,b.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${d}`,title:`Agent CLI: ${c}`,children:c})}function M({mode:a}){let c="default"===a;return(0,b.jsx)("span",{title:a,className:`inline-block max-w-full truncate rounded px-1.5 py-0.5 align-middle text-[0.6rem] font-medium border ${c?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:a})}function N({ms:a}){return(0,b.jsx)("span",{className:`font-mono text-[0.7rem] ${a>500?"text-red-400":a>100?"text-amber-400":"text-muted-foreground"}`,children:a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`})}function O({text:a,field:d}){let[e,g]=(0,c.useState)(!1),{capture:h}=(0,C.usePostHog)(),i=async b=>{b.stopPropagation(),h("activity_copy_clicked",{field:d??"unknown"});try{await navigator.clipboard.writeText(a),g(!0),setTimeout(()=>g(!1),1500)}catch{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b),g(!0),setTimeout(()=>g(!1),1500)}};return(0,b.jsx)("button",{onClick:i,className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:e?(0,b.jsx)(f.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(j.Copy,{className:"h-3 w-3"})})}function P({value:a,onChange:c}){return(0,b.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(d=>(0,b.jsx)("button",{onClick:()=>c(d.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${a===d.value?"deny"===d.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===d.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===d.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:d.label},d.value))})}function Q({stats:a}){let c=a.totalEvents>0?a.denyCount/a.totalEvents*100:0,d=c.toFixed(c>=10?0:1),e=0===a.denyCount?"":c>=5?" is-deny":c>=2?" is-warn":"";return(0,b.jsxs)("div",{className:"stat-bar",role:"group","aria-label":"Activity stats",children:[(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"total events"}),(0,b.jsx)("span",{className:"value",children:a.totalEvents.toLocaleString()}),(0,b.jsx)("span",{className:"meta",children:"across all installed agents"})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"deny rate"}),(0,b.jsxs)("span",{className:`value${e}`,children:[d,"%"]}),(0,b.jsxs)("span",{className:"meta",children:[a.denyCount.toLocaleString()," of ",a.totalEvents.toLocaleString()," denied"]})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"top policy"}),(0,b.jsx)("span",{className:"value",style:{fontSize:16,fontWeight:500,color:a.topPolicy?"var(--accent-pink)":"var(--dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a.topPolicy??void 0,children:a.topPolicy??"—"}),(0,b.jsx)("span",{className:"meta",children:"most-evaluated policy in scope"})]})]})}function R({item:a}){if("observe"!==function(a,b){if(!a||!b)return;let c=G[a];if(c)return c[b]}(a.integration,a.eventType))return null;let c=a.matchedPolicies??[];if(0===c.length)return null;let d=a.integration?(0,F.getCliLabel)(a.integration):"This CLI",e=c.map(a=>a.replace(/^(custom|\.failproofai-(project|user))\//,"")),f=1===e.length?e[0]:`${e.length} policies`,g="deny"===a.decision;return(0,b.jsxs)("div",{className:"sm:col-span-2 lg:col-span-3 mt-1 flex items-start gap-2 rounded border border-amber-500/30 bg-amber-500/5 px-2.5 py-2",children:[(0,b.jsx)(p,{className:"h-3.5 w-3.5 shrink-0 text-amber-500/80 mt-0.5","aria-hidden":"true"}),(0,b.jsxs)("p",{className:"text-[0.7rem] leading-relaxed text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-medium text-foreground",children:g?"Not enforced.":"Ran, but cannot enforce here."})," ",(0,b.jsx)("span",{className:"font-mono",children:f})," ran on"," ",(0,b.jsx)("span",{className:"font-mono",children:a.eventType}),", but ",d," discards hook verdicts for this event",g?" — the action went ahead anyway.":", so a policy cannot block here."," ","Move the check to an event ",d," enforces on, such as"," ",(0,b.jsx)("span",{className:"font-mono",children:"PreToolUse"}),"."]})]})}function S({item:a}){return(0,b.jsx)("tr",{children:(0,b.jsx)("td",{colSpan:11,className:"px-0 py-0",children:(0,b.jsxs)("div",{className:"activity-detail animate-expand text-xs",children:[(0,b.jsxs)("span",{className:"activity-detail-eyebrow",children:[(0,b.jsx)("span",{"aria-hidden":"true",children:"▾"}),"event detail"]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-2",children:[(0,b.jsx)(R,{item:a}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.sessionId??"—"}),a.sessionId&&(0,b.jsx)(O,{text:a.sessionId,field:"session_id"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.cwd??"—"}),a.cwd&&(0,b.jsx)(O,{text:a.cwd,field:"cwd"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,b.jsx)("span",{className:"font-mono text-foreground break-all",children:a.transcriptPath??"—"}),a.transcriptPath?.startsWith("opencode-db://")&&(0,b.jsx)("span",{className:"text-muted-foreground ml-1",children:"(stored in opencode DB)"})]})]}),a.policyNames&&a.policyNames.length>1&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.policyNames.join(", ")})]}),a.reason&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,b.jsx)("span",{className:"text-foreground",children:a.reason})]})]})})})}function T({hooksInstalled:a,onSwitchTab:d}){let{intervalSec:e}=(0,B.useAutoRefresh)(),{capture:f}=(0,C.usePostHog)(),h=(0,D.useUrlParams)(),i=(0,c.useRef)(!1),[j,k]=(0,c.useState)(()=>(0,E.paramToPage)(h.get("page"))),[m,n]=(0,c.useState)(null),[o,p]=(0,c.useState)(null),[q,s]=(0,c.useState)(()=>{let a=h.get("decision");return"allow"===a||"deny"===a||"instruct"===a?a:""}),[v,w]=(0,c.useState)(()=>h.get("event")??""),[x,y]=(0,c.useState)(()=>h.get("policy")??""),[z,A]=(0,c.useState)(()=>h.get("session")??""),[G,H]=(0,c.useState)(()=>{let a=h.get("cli");return(0,F.isKnownCli)(a)?a:""}),O=(0,c.useRef)(null),R=(0,c.useRef)(!0),U=(0,c.useRef)({filterDecision:q,filterEventType:v,filterPolicy:x,filterSessionId:z,filterCli:G});U.current={filterDecision:q,filterEventType:v,filterPolicy:x,filterSessionId:z,filterCli:G},(0,c.useEffect)(()=>{if(!i.current){i.current=!0;return}h.setAll({decision:q||void 0,event:v||void 0,policy:x||void 0,session:z||void 0,cli:G||void 0,page:(0,E.pageToParam)(j)})},[q,v,x,z,G,j]);let V=""!==q||""!==v||""!==x||""!==z||""!==G,W=(0,c.useCallback)(async a=>{try{let b,{filterDecision:c,filterEventType:d,filterPolicy:e,filterSessionId:f,filterCli:g}=U.current;b=""!==c||""!==d||""!==e||""!==f||""!==g?await u({decision:c||void 0,eventType:d||void 0,policyName:e||void 0,sessionId:f||void 0,integration:g||void 0},a):await t(a),n(b)}catch{}},[]);(0,c.useEffect)(()=>{W(j);let a=setInterval(()=>W(j),e>0?1e3*e:5e3);return()=>clearInterval(a)},[j,W,e]),(0,c.useEffect)(()=>(O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{if(k(1),p(null),W(1),R.current){R.current=!1;return}f("activity_filter_changed",{active_filter_count:+(""!==q)+ +(""!==v)+ +(""!==x)+ +(""!==z)+ +(""!==G),has_decision:""!==q,has_event_type:""!==v,has_policy:""!==x,has_session:""!==z,has_cli:""!==G,decision:q||null,event_type:v||null,cli:G||null})},300),()=>{O.current&&clearTimeout(O.current)}),[q,v,x,z,G]);let X=m?.entries??[],Y=m?.totalPages??1;return(0,b.jsxs)(b.Fragment,{children:[m?.stats&&m.stats.totalEvents>0&&(0,b.jsx)("div",{style:{marginBottom:18},children:(0,b.jsx)(Q,{stats:m.stats})}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"filter-bar",children:[(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"decision"}),(0,b.jsx)(P,{value:q,onChange:s})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"event"}),(0,b.jsxs)("select",{value:v,onChange:a=>w(a.target.value),className:"filter-input",children:[(0,b.jsx)("option",{value:"",children:"all events"}),(0,b.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,b.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,b.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,b.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,b.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,b.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"cli"}),(0,b.jsxs)("select",{value:G,onChange:a=>{let b=a.target.value;H(""===b||(0,F.isKnownCli)(b)?b:"")},className:"filter-input","aria-label":"Filter by CLI",children:[(0,b.jsx)("option",{value:"",children:"all clis"}),F.KNOWN_CLI_IDS.map(a=>(0,b.jsx)("option",{value:a,children:(0,F.getCliLabel)(a)},a))]})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"policy"}),(0,b.jsx)("input",{type:"text",value:x,onChange:a=>y(a.target.value),placeholder:"filter by policy…",className:"filter-input"})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"session"}),(0,b.jsx)("input",{type:"text",value:z,onChange:a=>A(a.target.value),placeholder:"filter by session…",className:"filter-input"})]}),V&&(0,b.jsx)("button",{type:"button",className:"filter-clear",onClick:()=>{s(""),w(""),H(""),y(""),A("")},"aria-label":"Clear all filters",children:"[ clear ]"})]}),0===X.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[(0,b.jsx)(l,{className:"h-12 w-12 text-muted-foreground/30"}),!1===a?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4 font-medium",children:"Policies are not installed"}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:["Go to the"," ",(0,b.jsx)("button",{className:"underline hover:text-foreground transition-colors",onClick:()=>d?.("policies"),children:"Policies tab"})," ","and click ",(0,b.jsx)("span",{className:"font-mono bg-muted px-1 rounded",children:"Install"})," to enable policy monitoring."]})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4",children:V?"No matching activity.":"Waiting for hook events…"})]}):(0,b.jsx)("div",{className:"overflow-x-auto activity-table-wrap",children:(0,b.jsxs)("table",{className:"w-full text-xs activity-table",style:{tableLayout:"fixed"},children:[(0,b.jsxs)("colgroup",{children:[(0,b.jsx)("col",{style:{width:32}}),(0,b.jsx)("col",{style:{width:"7%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"13%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"8%"}})]}),(0,b.jsx)("thead",{className:"activity-thead",children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{className:"px-4 py-3"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Time"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Decision"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Event"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"CLI"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Tool"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Policy"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Reason"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Mode"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Duration"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Session"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-border/30",children:X.map((a,d)=>{var e;let h,i="deny"===a.decision,j=o===d,k="instruct"===a.decision;return(0,b.jsxs)(c.default.Fragment,{children:[(0,b.jsxs)("tr",{onClick:()=>{p(a=>{let b=a===d?null:d,c=X[d];return f("activity_row_toggled",{expanded:null!==b,decision:c?.decision??null,policy_name:c?.policyName??null,event_type:c?.eventType??null}),b})},className:`activity-data-row cursor-pointer transition-colors ${i?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":k?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":d%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${j?"bg-muted/20":""}`,children:[(0,b.jsx)("td",{className:"px-4 py-2",children:(0,b.jsx)(g.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${j?"rotate-0":"-rotate-90"}`})}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground whitespace-nowrap",title:new Date(a.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(e=a.timestamp,(h=Date.now()-e)<6e4?`${Math.max(1,Math.floor(h/1e3))}s ago`:h<36e5?`${Math.floor(h/6e4)}m ago`:h<864e5?`${Math.floor(h/36e5)}h ago`:`${Math.floor(h/864e5)}d ago`)}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(J,{decision:a.decision})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(K,{eventType:a.eventType})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(L,{integration:a.integration})}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.toolName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.policyNames&&a.policyNames.length>1?(0,b.jsxs)("span",{title:a.policyNames.join(", "),children:[a.policyNames[0],(0,b.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",a.policyNames.length-1]})]}):a.policyName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate",title:a.reason??"",children:a.reason??"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:a.permissionMode?(0,b.jsx)(M,{mode:a.permissionMode}):"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(N,{ms:a.durationMs})}),(0,b.jsx)("td",{className:"px-3 py-2",title:a.sessionId??"",children:(0,b.jsx)(I,{sessionId:a.sessionId,transcriptPath:a.transcriptPath,integration:a.integration,cwd:a.cwd})})]}),j&&(0,b.jsx)(S,{item:a})]},`${a.timestamp}-${d}`)})})]})}),(0,b.jsx)(r.default,{currentPage:j,totalPages:Y,onPageChange:a=>{f("activity_pagination_changed",{from_page:j,to_page:a,total_pages:Y}),k(a),p(null)}})]})]})}function U({enabled:a,onChange:c,disabled:d}){return(0,b.jsx)("button",{onClick:c,disabled:d,className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors disabled:opacity-40 ${a?"bg-emerald-500":"bg-muted-foreground/30"}`,"aria-label":a?"Disable policy":"Enable policy",children:(0,b.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform ${a?"translate-x-3.5":"translate-x-0.5"}`})})}function V({policy:a,onClose:d,onSave:e}){let f=a.params??{},g=a.currentParams??{},[h,i]=(0,c.useState)(()=>{let a={};for(let[b,c]of Object.entries(f)){let d=b in g?g[b]:c.default;a[b]=d}return a});(0,c.useEffect)(()=>{let a=a=>{"Escape"===a.key&&d()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[d]);let j=(a,b)=>{i(c=>({...c,[a]:b}))};return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:a=>{a.target===a.currentTarget&&d()},children:(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-mono font-semibold text-foreground",children:a.name}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]}),(0,b.jsx)("button",{onClick:d,className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,b.jsx)(q.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"overflow-y-auto flex-1 px-4 py-4 space-y-4",children:Object.entries(f).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-semibold text-foreground mb-1 font-mono",children:a}),(0,b.jsx)("p",{className:"text-[0.65rem] text-muted-foreground mb-1.5",children:c.description}),((a,c)=>{let d=h[a];if("boolean"===c.type)return(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:!!d,onChange:b=>j(a,b.target.checked),className:"rounded border-border"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:c.description})]});if("number"===c.type)return(0,b.jsx)("input",{type:"number",value:"number"==typeof d?d:"",onChange:b=>j(a,Number(b.target.value)),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"});if("string[]"===c.type){let c=Array.isArray(d)?d.join("\n"):"";return(0,b.jsx)("textarea",{value:c,onChange:b=>j(a,b.target.value.split("\n").filter(a=>""!==a.trim())),rows:4,placeholder:"One entry per line",className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-2 focus:ring-primary/40 resize-y"})}if("pattern[]"===c.type){let c=Array.isArray(d)?d:[];return(0,b.jsxs)("div",{className:"space-y-1.5",children:[c.map((d,e)=>(0,b.jsxs)("div",{className:"flex gap-1.5 items-center",children:[(0,b.jsx)("input",{type:"text",value:d.regex,onChange:b=>{let d=[...c];d[e]={...d[e],regex:b.target.value},j(a,d)},placeholder:"regex",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("input",{type:"text",value:d.label,onChange:b=>{let d=[...c];d[e]={...d[e],label:b.target.value},j(a,d)},placeholder:"label",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("button",{onClick:()=>j(a,c.filter((a,b)=>b!==e)),className:"text-muted-foreground/50 hover:text-destructive transition-colors",children:(0,b.jsx)(q.X,{className:"h-3.5 w-3.5"})})]},e)),(0,b.jsx)("button",{onClick:()=>j(a,[...c,{regex:"",label:""}]),className:"text-xs text-primary hover:underline",children:"+ Add pattern"})]})}return(0,b.jsx)("input",{type:"text",value:"string"==typeof d?d:"",onChange:b=>j(a,b.target.value),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"})})(a,c)]},a))}),(0,b.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,b.jsx)(H.Button,{variant:"outline",size:"sm",onClick:d,className:"h-7 text-xs",children:"Cancel"}),(0,b.jsx)(H.Button,{size:"sm",onClick:()=>e(h),className:"h-7 text-xs",children:"Save"})]})]})})}function W({message:a,onDismiss:c,onInstall:e,isPending:f}){let{capture:g}=(0,C.usePostHog)();return(0,d.createPortal)((0,b.jsxs)("div",{className:"fixed top-4 right-4 z-[9999] w-full max-w-sm",style:{animation:"slideInFromRight 0.25s ease-out"},children:[(0,b.jsx)("style",{children:`
2
2
  @keyframes slideInFromRight {
3
3
  from { transform: translateX(calc(100% + 1rem)); opacity: 0; }
4
4
  to { transform: translateX(0); opacity: 1; }
5
5
  }
6
- `}),(0,b.jsxs)("div",{className:"rounded-lg border border-red-500/40 bg-red-950/95 shadow-2xl shadow-red-900/40 overflow-hidden backdrop-blur-sm",children:[(0,b.jsx)("div",{className:"h-0.5 w-full bg-gradient-to-r from-red-600 via-red-400 to-red-600"}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("div",{className:"shrink-0 mt-0.5 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 ring-2 ring-red-500/30",children:(0,b.jsx)(p.X,{className:"h-3 w-3 text-white",strokeWidth:3})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-[0.65rem] font-bold uppercase tracking-widest text-red-400 mb-0.5",children:"Error"}),(0,b.jsx)("p",{className:"text-sm text-red-100 leading-snug",children:a})]}),(0,b.jsx)("button",{onClick:c,className:"shrink-0 -mt-0.5 -mr-0.5 rounded p-0.5 text-red-400/60 transition-colors hover:bg-red-500/20 hover:text-red-200","aria-label":"Dismiss",children:(0,b.jsx)(p.X,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)(E.Button,{size:"sm",onClick:()=>{g("hooks_install_from_error_clicked",{error_message:a.slice(0,200)}),c(),e()},disabled:f,className:"h-7 flex-1 border-0 bg-red-500 px-3 text-xs font-semibold text-white hover:bg-red-400 disabled:opacity-50",children:"Install hooks"}),(0,b.jsx)(E.Button,{variant:"ghost",size:"sm",onClick:c,className:"h-7 px-3 text-xs text-red-400 hover:bg-red-500/10 hover:text-red-200",children:"Dismiss"})]})]})]})]}),document.body)}function T({onHooksInstallChange:a}){let[d,e]=(0,c.useState)(null),[f,g]=(0,c.useTransition)(),[h,i]=(0,c.useState)(null),[k,l]=(0,c.useState)(null),[m,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(()=>new Set),s=(0,c.useRef)(!1),{capture:t}=(0,A.usePostHog)(),z=(0,c.useCallback)((a,b)=>{t("action_error_displayed",{error_type:a,error_message:b.slice(0,200)}),i(b)},[t]),B=(0,c.useCallback)(async()=>{try{let b=await u();e(b),a?.(b.clis.some(a=>a.installed))}catch{}},[a]);(0,c.useEffect)(()=>{B()},[B]),(0,c.useEffect)(()=>{d&&(s.current?r(new Set(d.clis.filter(a=>a.installed).map(a=>a.id))):(s.current=!0,r(new Set(d.clis.filter(a=>a.installed||a.detected).map(a=>a.id)))))},[d?.clis]);let C=(0,c.useMemo)(()=>new Set((d?.clis??[]).filter(a=>a.installed).map(a=>a.id)),[d?.clis]),F=(0,c.useMemo)(()=>{let a=[],b=[];for(let c of d?.clis??[]){let d=q.has(c.id);d&&!C.has(c.id)&&a.push(c.id),!d&&C.has(c.id)&&b.push(c.id)}return{toInstall:a,toRemove:b}},[d?.clis,q,C]),G=F.toInstall.length>0||F.toRemove.length>0,H=()=>{let{toInstall:a,toRemove:b}=F;(0!==a.length||0!==b.length)&&(t("cli_install_remove_submitted",{to_install:a,to_remove:b,count_install:a.length,count_remove:b.length}),g(async()=>{try{i(null),a.length>0&&await w("user",a),b.length>0&&await x("user",b)}catch(a){z("cli_apply",a instanceof Error?a.message:"Failed to apply changes.")}finally{await B()}}))};if(!d)return(0,b.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading\\u2026"})});let I=d.clis.some(a=>a.installed),J=C.size,K=q.size,L=Array.from(new Set(d.policies.map(a=>a.category)));return(0,b.jsxs)(b.Fragment,{children:[m&&(0,b.jsx)(R,{policy:m,onClose:()=>{t("policy_config_modal_closed",{policy_name:m.name,action:"cancel"}),p(null)},onSave:a=>{if(!m)return;let b=m.name;p(null),g(async()=>{try{i(null),await y(b,a),await B()}catch(a){z("param_update",a instanceof Error?a.message:"Failed to save configuration.")}})}}),(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4 px-5 py-3.5 border-b border-border/60 bg-muted/10",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-wrap",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:`h-2 w-2 rounded-full transition-shadow ${I?"bg-emerald-400 shadow-[0_0_8px_rgba(52,211,153,0.6)]":"bg-muted-foreground/40"}`,"aria-hidden":!0}),(0,b.jsx)("span",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-foreground/90",children:"Integrations"})]}),(0,b.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,b.jsxs)("div",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-muted-foreground",children:[(0,b.jsx)("span",{className:"text-foreground tabular-nums",children:J.toString().padStart(2,"0")}),(0,b.jsxs)("span",{className:"opacity-50",children:[" / 0",d.clis.length," active"]})]}),G&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[0.65rem] uppercase tracking-[0.2em] font-mono text-pink-400",children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-pink-400 animate-pulse"}),F.toInstall.length+F.toRemove.length," pending"]})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,b.jsx)(E.Button,{variant:"outline",size:"sm",onClick:()=>{let a=Array.from(C).filter(a=>q.has(a));0!==a.length&&(t("cli_reinstall_submitted",{cli_ids:a,count:a.length}),g(async()=>{try{i(null),await w("user",a)}catch(a){z("cli_reinstall",a instanceof Error?a.message:"Failed to reinstall.")}finally{await B()}}))},disabled:f||0===K,className:"text-xs h-7 px-3 font-mono",children:"Reinstall"}),(0,b.jsx)(E.Button,{variant:"default",size:"sm",onClick:H,disabled:f||!G,className:"text-xs h-7 px-3 font-mono",children:"Apply changes"})]})]}),(0,b.jsx)("div",{className:"divide-y divide-border/30 border-b border-border/60",children:d.clis.map((a,c)=>{let e=q.has(a.id),g=C.has(a.id),h=e!==g,i=(0,D.getCliBadgeClasses)(a.id),j=i.split(" ").find(a=>a.startsWith("text-"))??"text-foreground";return(0,b.jsxs)("label",{className:`group relative flex items-center gap-3 pl-6 pr-5 py-3 cursor-pointer transition-colors hover:bg-muted/15 ${h?"bg-pink-500/[0.04]":""}`,children:[(0,b.jsx)("div",{className:`absolute left-0 top-0 bottom-0 w-[3px] ${j} bg-current transition-opacity ${e?"opacity-100":"opacity-25 group-hover:opacity-60"}`,"aria-hidden":!0}),(0,b.jsx)("div",{className:"font-mono text-[0.65rem] text-muted-foreground/40 tabular-nums w-6 select-none",children:(c+1).toString().padStart(2,"0")}),(0,b.jsxs)("div",{className:"relative shrink-0",children:[(0,b.jsx)("input",{type:"checkbox",checked:e,onChange:()=>{var b;return b=a.id,void r(a=>{let c=new Set(a),e=!c.has(b);e?c.add(b):c.delete(b);let f=d?.clis.find(a=>a.id===b);return t("cli_selection_toggled",{cli_id:b,checked:e,current_state:f?.installed?"installed":f?.detected?"detected":"inactive"}),c})},disabled:f,className:"sr-only peer","aria-label":`Toggle ${a.label}`}),(0,b.jsx)("div",{className:`h-[18px] w-[18px] rounded-sm border transition-all peer-focus-visible:ring-2 peer-focus-visible:ring-primary/40 ${e?"bg-primary border-primary":"bg-background/50 border-border group-hover:border-foreground/40"}`,children:e&&(0,b.jsx)("svg",{viewBox:"0 0 18 18",className:"h-full w-full text-primary-foreground",fill:"none","aria-hidden":!0,children:(0,b.jsx)("path",{d:"M4 9.5L7.5 12.5L14 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),(0,b.jsx)("div",{className:"min-w-[150px] shrink-0",children:(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:a.label})}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[g?(0,b.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border ${i}`,children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-current shadow-[0_0_4px_currentColor]"}),"Active"]}):a.detected?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/60 text-muted-foreground/80 bg-muted/20",children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-current opacity-60"}),"Detected"]}):(0,b.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/30 text-muted-foreground/40",children:"Inactive"}),h&&(0,b.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-pink-500/40 text-pink-400 bg-pink-500/10",children:e?"+ install":"− remove"})]}),(0,b.jsx)("div",{className:"ml-auto hidden lg:block text-[0.7rem] font-mono text-muted-foreground/50 truncate max-w-[420px] group-hover:text-muted-foreground/80 transition-colors",title:a.settingsPath,children:a.settingsPath})]},a.id)})}),(0,b.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border/40 bg-muted/5",children:[(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-semibold text-foreground",children:d.enabledPolicies.length})," / ",d.policies.length+(d.customPolicies?.length??0)," ","policies enabled"]}),I&&(0,b.jsxs)("span",{className:"text-[0.65rem] text-muted-foreground/60",children:["· shared across ",J," active CLI",1===J?"":"s"]})]}),h&&(0,b.jsx)("div",{className:"px-4 py-2 bg-red-500/10 border-b border-red-500/20 text-xs text-red-400",children:h}),k&&(0,b.jsx)(S,{message:k,onDismiss:()=>l(null),onInstall:H,isPending:f}),L.map(a=>{let c=d.policies.filter(b=>b.category===a),h=c.filter(a=>a.enabled).length;return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,b.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:a}),(0,b.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[h," / ",c.length," enabled"]})]}),c.map(a=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,b.jsx)("div",{className:"mt-0.5 shrink-0",children:(0,b.jsx)(Q,{enabled:a.enabled,onChange:()=>{var b,c;return b=a.name,c=a.enabled,void(!d||(!d.clis.some(a=>a.installed)?l("Policies are not installed. Install policies to continue."):(l(null),e(a=>a?{...a,policies:a.policies.map(a=>a.name===b?{...a,enabled:!c}:a),enabledPolicies:c?a.enabledPolicies.filter(a=>a!==b):[...a.enabledPolicies,b]}:a),g(async()=>{try{await v(b,!c)}catch{z("policy_toggle","Failed to save policy change."),B()}}))))},disabled:f})}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:[(0,b.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:a.name}),a.beta&&(0,b.jsx)("span",{className:"shrink-0 text-[0.6rem] px-1 py-0.5 rounded border bg-violet-500/10 text-violet-400 border-violet-500/20",children:"beta"})]}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:a.description}),a.eventScope&&(0,b.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:a.eventScope}),a.params&&Object.keys(a.params).length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-1 mt-1.5",children:Object.entries(a.params).map(([c,d])=>{let e=a.currentParams?.[c]??d.default,f=JSON.stringify(e)!==JSON.stringify(d.default);return(0,b.jsxs)("span",{className:`inline-flex items-center gap-1 font-mono text-[0.6rem] px-1.5 py-0.5 rounded border ${f?"bg-primary/10 text-primary/70 border-primary/20":"bg-muted/40 text-muted-foreground/55 border-border/40"}`,children:[(0,b.jsxs)("span",{className:"opacity-70",children:[c,":"]}),(0,b.jsx)("span",{children:function(a,b){if("string[]"===a||"pattern[]"===a){let c=Array.isArray(b)?b:[];return 0===c.length?"none":"pattern[]"===a?`${c.length} pattern${1!==c.length?"s":""}`:1===c.length?String(c[0]).slice(0,24):`${c.length} values`}return"boolean"===a?b?"on":"off":null==b||""===b?"—":String(b).slice(0,32)}(d.type,e)})]},c)})})]}),a.params&&Object.keys(a.params).length>0&&(0,b.jsx)("button",{className:"shrink-0 mt-0.5 text-muted-foreground hover:text-primary transition-colors",onClick:()=>{let b=Object.entries(a.params??{}).filter(([b,c])=>JSON.stringify(a.currentParams?.[b]??c.default)!==JSON.stringify(c.default)).length;t("policy_config_modal_opened",{policy_name:a.name,param_count:Object.keys(a.params??{}).length,has_customized_params:b>0,customized_count:b}),p(a)},title:"Edit parameters",children:(0,b.jsx)(n,{className:"h-3.5 w-3.5"})})]},a.name))]},a)}),d.customPoliciesPath&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,b.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:"Custom Policies"}),(0,b.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[d.customPolicies?.length??0," detected"]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/20",children:[(0,b.jsx)(o,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:d.customPoliciesPath})]}),(0,b.jsxs)("div",{className:"flex items-start gap-2 px-4 py-2.5 border-b border-border/20 bg-muted/10",children:[(0,b.jsx)(j,{className:"h-3.5 w-3.5 text-muted-foreground/60 shrink-0 mt-0.5"}),(0,b.jsx)("p",{className:"text-[0.7rem] text-muted-foreground/70 leading-relaxed",children:"Custom policies are always active. To add, remove, or reorder them, edit the JS file above."})]}),d.customPolicies?.map(a=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,b.jsx)("div",{className:"h-4 w-7 shrink-0 mt-0.5"}),(0,b.jsx)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:(0,b.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:a.name})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[a.description&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:a.description}),a.eventScope&&(0,b.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:a.eventScope})]})]},a.name))]})]})]})}function U({activeTab:a,onChange:c}){return(0,b.jsx)("div",{className:"tabs",style:{padding:0,marginBottom:24},children:[{id:"activity",label:"Activity"},{id:"policies",label:"Configure"}].map(d=>(0,b.jsx)("button",{type:"button",onClick:()=>c(d.id),className:`tab${a===d.id?" is-active":""}`,children:d.label.toLowerCase()},d.id))})}a.s(["default",0,function({initialTab:a="activity"}){let d=(0,B.useUrlParams)(),{capture:e}=(0,A.usePostHog)(),[f,g]=(0,c.useState)(a),[h,i]=(0,c.useState)(void 0),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)([]);(0,c.useEffect)(()=>{u().then(a=>{i(a.clis.some(a=>a.installed)),k({enabled:a.enabledPolicies.length,total:a.policies.length+(a.customPolicies?.length??0)}),m(a.clis.filter(a=>a.installed).map(a=>a.label))}).catch(()=>i(void 0))},[]);let n=0===l.length?"Policy evaluations":l.length<=3?`Policy evaluations across ${l.join(", ")}`:`Policy evaluations across ${l.length} agents`,o=a=>{a!==f&&e("policies_tab_switched",{tab:a,from_tab:f}),g(a),d.setAll({tab:"activity"===a?void 0:a})};return(0,b.jsx)("main",{className:"report",children:(0,b.jsxs)("section",{className:"section","data-screen-label":"policies",children:[(0,b.jsx)("h2",{style:{fontFamily:"var(--font-mono)",fontSize:24,fontWeight:600,letterSpacing:"-0.01em",color:"var(--ink)",margin:"0 0 16px"},children:"activity"===f?"Policies":"Configure Policies"}),"activity"===f?(0,b.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:32,flexWrap:"wrap",margin:"0 0 24px"},children:[(0,b.jsxs)("div",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,flex:"1 1 480px",minWidth:0},children:[n,j&&(0,b.jsxs)("span",{style:{color:"var(--dim)"},children:[" · ","enabled policies"," ",(0,b.jsxs)("span",{style:{color:"var(--ink)",fontVariantNumeric:"tabular-nums"},children:[j.enabled,"/",j.total]})]})]}),(0,b.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6,flex:"0 0 auto"},children:[(0,b.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,letterSpacing:"0.22em",textTransform:"uppercase",color:"var(--dim)"},children:"want to change which policies fire?"}),(0,b.jsx)("button",{type:"button",className:"btn btn-primary",onClick:()=>o("policies"),children:"[ configure policies → ]"})]})]}):(0,b.jsx)("p",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,maxWidth:720,margin:"0 0 24px"},children:"switch policies on or off across your installed agent CLIs."}),(0,b.jsx)(U,{activeTab:f,onChange:o}),"activity"===f?(0,b.jsx)(P,{hooksInstalled:h,onSwitchTab:o}):(0,b.jsx)(T,{onHooksInstallChange:i})]})})}],22712)}];
6
+ `}),(0,b.jsxs)("div",{className:"rounded-lg border border-red-500/40 bg-red-950/95 shadow-2xl shadow-red-900/40 overflow-hidden backdrop-blur-sm",children:[(0,b.jsx)("div",{className:"h-0.5 w-full bg-gradient-to-r from-red-600 via-red-400 to-red-600"}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("div",{className:"shrink-0 mt-0.5 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 ring-2 ring-red-500/30",children:(0,b.jsx)(q.X,{className:"h-3 w-3 text-white",strokeWidth:3})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-[0.65rem] font-bold uppercase tracking-widest text-red-400 mb-0.5",children:"Error"}),(0,b.jsx)("p",{className:"text-sm text-red-100 leading-snug",children:a})]}),(0,b.jsx)("button",{onClick:c,className:"shrink-0 -mt-0.5 -mr-0.5 rounded p-0.5 text-red-400/60 transition-colors hover:bg-red-500/20 hover:text-red-200","aria-label":"Dismiss",children:(0,b.jsx)(q.X,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)(H.Button,{size:"sm",onClick:()=>{g("hooks_install_from_error_clicked",{error_message:a.slice(0,200)}),c(),e()},disabled:f,className:"h-7 flex-1 border-0 bg-red-500 px-3 text-xs font-semibold text-white hover:bg-red-400 disabled:opacity-50",children:"Install hooks"}),(0,b.jsx)(H.Button,{variant:"ghost",size:"sm",onClick:c,className:"h-7 px-3 text-xs text-red-400 hover:bg-red-500/10 hover:text-red-200",children:"Dismiss"})]})]})]})]}),document.body)}function X({onHooksInstallChange:a}){let[d,e]=(0,c.useState)(null),[f,g]=(0,c.useTransition)(),[h,j]=(0,c.useState)(null),[m,n]=(0,c.useState)(null),[o,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(()=>new Set),s=(0,c.useRef)(!1),{capture:t}=(0,C.usePostHog)(),u=(0,c.useCallback)((a,b)=>{t("action_error_displayed",{error_type:a,error_message:b.slice(0,200)}),j(b)},[t]),B=(0,c.useCallback)(async()=>{try{let b=await v();e(b),a?.(b.clis.some(a=>a.installed))}catch{}},[a]);(0,c.useEffect)(()=>{B()},[B]),(0,c.useEffect)(()=>{d&&(s.current?r(new Set(d.clis.filter(a=>a.installed).map(a=>a.id))):(s.current=!0,r(new Set(d.clis.filter(a=>a.installed||a.detected).map(a=>a.id)))))},[d?.clis]);let D=(0,c.useMemo)(()=>new Set((d?.clis??[]).filter(a=>a.installed).map(a=>a.id)),[d?.clis]),E=(0,c.useMemo)(()=>{let a=[],b=[];for(let c of d?.clis??[]){let d=q.has(c.id);d&&!D.has(c.id)&&a.push(c.id),!d&&D.has(c.id)&&b.push(c.id)}return{toInstall:a,toRemove:b}},[d?.clis,q,D]),G=E.toInstall.length>0||E.toRemove.length>0,I=(a,b)=>{d&&(e(c=>c?{...c,customPolicies:c.customPolicies?.map(c=>c.id===a?{...c,enabled:!b}:c),conventionPolicies:c.conventionPolicies.map(c=>({...c,policies:c.policies.map(c=>c.id===a?{...c,enabled:!b}:c)}))}:c),g(async()=>{try{await w(a,!b)}catch{u("custom_policy_toggle","Failed to save custom policy change."),B()}}))},J=()=>{let{toInstall:a,toRemove:b}=E;(0!==a.length||0!==b.length)&&(t("cli_install_remove_submitted",{to_install:a,to_remove:b,count_install:a.length,count_remove:b.length}),g(async()=>{try{j(null),a.length>0&&await y("user",a),b.length>0&&await z("user",b)}catch(a){u("cli_apply",a instanceof Error?a.message:"Failed to apply changes.")}finally{await B()}}))};if(!d)return(0,b.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,b.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Loading","…"]})});let K=d.clis.some(a=>a.installed),L=D.size,M=q.size,N=Array.from(new Set(d.policies.map(a=>a.category)));return(0,b.jsxs)(b.Fragment,{children:[o&&(0,b.jsx)(V,{policy:o,onClose:()=>{t("policy_config_modal_closed",{policy_name:o.name,action:"cancel"}),p(null)},onSave:a=>{if(!o)return;let b=o.name;p(null),g(async()=>{try{j(null),await A(b,a),await B()}catch(a){u("param_update",a instanceof Error?a.message:"Failed to save configuration.")}})}}),(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4 px-5 py-3.5 border-b border-border/60 bg-muted/10",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-wrap",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:`h-2 w-2 rounded-full transition-shadow ${K?"bg-emerald-400 shadow-[0_0_8px_rgba(52,211,153,0.6)]":"bg-muted-foreground/40"}`,"aria-hidden":!0}),(0,b.jsx)("span",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-foreground/90",children:"Integrations"})]}),(0,b.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,b.jsxs)("div",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-muted-foreground",children:[(0,b.jsx)("span",{className:"text-foreground tabular-nums",children:L.toString().padStart(2,"0")}),(0,b.jsxs)("span",{className:"opacity-50",children:[" / 0",d.clis.length," active"]})]}),G&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[0.65rem] uppercase tracking-[0.2em] font-mono text-pink-400",children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-pink-400 animate-pulse"}),E.toInstall.length+E.toRemove.length," pending"]})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,b.jsx)(H.Button,{variant:"outline",size:"sm",onClick:()=>{let a=Array.from(D).filter(a=>q.has(a));0!==a.length&&(t("cli_reinstall_submitted",{cli_ids:a,count:a.length}),g(async()=>{try{j(null),await y("user",a)}catch(a){u("cli_reinstall",a instanceof Error?a.message:"Failed to reinstall.")}finally{await B()}}))},disabled:f||0===M,className:"text-xs h-7 px-3 font-mono",children:"Reinstall"}),(0,b.jsx)(H.Button,{variant:"default",size:"sm",onClick:J,disabled:f||!G,className:"text-xs h-7 px-3 font-mono",children:"Apply changes"})]})]}),(0,b.jsx)("div",{className:"divide-y divide-border/30 border-b border-border/60",children:d.clis.map((a,c)=>{let e=q.has(a.id),g=D.has(a.id),h=e!==g,i=(0,F.getCliBadgeClasses)(a.id),j=i.split(" ").find(a=>a.startsWith("text-"))??"text-foreground";return(0,b.jsxs)("label",{className:`group relative flex items-center gap-3 pl-6 pr-5 py-3 cursor-pointer transition-colors hover:bg-muted/15 ${h?"bg-pink-500/[0.04]":""}`,children:[(0,b.jsx)("div",{className:`absolute left-0 top-0 bottom-0 w-[3px] ${j} bg-current transition-opacity ${e?"opacity-100":"opacity-25 group-hover:opacity-60"}`,"aria-hidden":!0}),(0,b.jsx)("div",{className:"font-mono text-[0.65rem] text-muted-foreground/40 tabular-nums w-6 select-none",children:(c+1).toString().padStart(2,"0")}),(0,b.jsxs)("div",{className:"relative shrink-0",children:[(0,b.jsx)("input",{type:"checkbox",checked:e,onChange:()=>{var b;return b=a.id,void r(a=>{let c=new Set(a),e=!c.has(b);e?c.add(b):c.delete(b);let f=d?.clis.find(a=>a.id===b);return t("cli_selection_toggled",{cli_id:b,checked:e,current_state:f?.installed?"installed":f?.detected?"detected":"inactive"}),c})},disabled:f,className:"sr-only peer","aria-label":`Toggle ${a.label}`}),(0,b.jsx)("div",{className:`h-[18px] w-[18px] rounded-sm border transition-all peer-focus-visible:ring-2 peer-focus-visible:ring-primary/40 ${e?"bg-primary border-primary":"bg-background/50 border-border group-hover:border-foreground/40"}`,children:e&&(0,b.jsx)("svg",{viewBox:"0 0 18 18",className:"h-full w-full text-primary-foreground",fill:"none","aria-hidden":!0,children:(0,b.jsx)("path",{d:"M4 9.5L7.5 12.5L14 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),(0,b.jsx)("div",{className:"min-w-[150px] shrink-0",children:(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:a.label})}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[g?(0,b.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border ${i}`,children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-current shadow-[0_0_4px_currentColor]"}),"Active"]}):a.detected?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/60 text-muted-foreground/80 bg-muted/20",children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-current opacity-60"}),"Detected"]}):(0,b.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/30 text-muted-foreground/40",children:"Inactive"}),h&&(0,b.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-pink-500/40 text-pink-400 bg-pink-500/10",children:e?"+ install":"− remove"})]}),(0,b.jsx)("div",{className:"ml-auto hidden lg:block text-[0.7rem] font-mono text-muted-foreground/50 truncate max-w-[420px] group-hover:text-muted-foreground/80 transition-colors",title:a.settingsPath,children:a.settingsPath})]},a.id)})}),(0,b.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border/40 bg-muted/5",children:[(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-semibold text-foreground",children:d.enabledPolicies.length})," / ",d.policies.length+(d.customPolicies?.length??0)+(d.conventionPolicies?.reduce((a,b)=>a+b.policies.length,0)??0)," ","policies enabled"]}),K&&(0,b.jsxs)("span",{className:"text-[0.65rem] text-muted-foreground/60",children:["· shared across ",L," active CLI",1===L?"":"s"]})]}),h&&(0,b.jsx)("div",{className:"px-4 py-2 bg-red-500/10 border-b border-red-500/20 text-xs text-red-400",children:h}),m&&(0,b.jsx)(W,{message:m,onDismiss:()=>n(null),onInstall:J,isPending:f}),N.map(a=>{let c=d.policies.filter(b=>b.category===a),h=c.filter(a=>a.enabled).length;return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,b.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:a}),(0,b.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[h," / ",c.length," enabled"]})]}),c.map(a=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,b.jsx)("div",{className:"mt-0.5 shrink-0",children:(0,b.jsx)(U,{enabled:a.enabled,onChange:()=>{var b,c;return b=a.name,c=a.enabled,void(!d||(!d.clis.some(a=>a.installed)?n("Policies are not installed. Install policies to continue."):(n(null),e(a=>a?{...a,policies:a.policies.map(a=>a.name===b?{...a,enabled:!c}:a),enabledPolicies:c?a.enabledPolicies.filter(a=>a!==b):[...a.enabledPolicies,b]}:a),g(async()=>{try{await x(b,!c)}catch{u("policy_toggle","Failed to save policy change."),B()}}))))},disabled:f})}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:[(0,b.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:a.name}),a.beta&&(0,b.jsx)("span",{className:"shrink-0 text-[0.6rem] px-1 py-0.5 rounded border bg-violet-500/10 text-violet-400 border-violet-500/20",children:"beta"})]}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:a.description}),a.eventScope&&(0,b.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:a.eventScope}),a.params&&Object.keys(a.params).length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-1 mt-1.5",children:Object.entries(a.params).map(([c,d])=>{let e=a.currentParams?.[c]??d.default,f=JSON.stringify(e)!==JSON.stringify(d.default);return(0,b.jsxs)("span",{className:`inline-flex items-center gap-1 font-mono text-[0.6rem] px-1.5 py-0.5 rounded border ${f?"bg-primary/10 text-primary/70 border-primary/20":"bg-muted/40 text-muted-foreground/55 border-border/40"}`,children:[(0,b.jsxs)("span",{className:"opacity-70",children:[c,":"]}),(0,b.jsx)("span",{children:function(a,b){if("string[]"===a||"pattern[]"===a){let c=Array.isArray(b)?b:[];return 0===c.length?"none":"pattern[]"===a?`${c.length} pattern${1!==c.length?"s":""}`:1===c.length?String(c[0]).slice(0,24):`${c.length} values`}return"boolean"===a?b?"on":"off":null==b||""===b?"—":String(b).slice(0,32)}(d.type,e)})]},c)})})]}),a.params&&Object.keys(a.params).length>0&&(0,b.jsx)("button",{className:"shrink-0 mt-0.5 text-muted-foreground hover:text-primary transition-colors",onClick:()=>{let b=Object.entries(a.params??{}).filter(([b,c])=>JSON.stringify(a.currentParams?.[b]??c.default)!==JSON.stringify(c.default)).length;t("policy_config_modal_opened",{policy_name:a.name,param_count:Object.keys(a.params??{}).length,has_customized_params:b>0,customized_count:b}),p(a)},title:"Edit parameters",children:(0,b.jsx)(k,{className:"h-3.5 w-3.5"})})]},a.name))]},a)}),(d.customPoliciesPaths?.length||d.customPoliciesPath)&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,b.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:"Custom Policies"}),(0,b.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[d.customPolicies?.length??0," detected"]})]}),(d.customPoliciesPaths??[d.customPoliciesPath]).map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/20",children:[(0,b.jsx)(i,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a})]},a)),(0,b.jsxs)("div",{className:"flex items-start gap-2 px-4 py-2.5 border-b border-border/20 bg-muted/10",children:[(0,b.jsx)(l,{className:"h-3.5 w-3.5 text-muted-foreground/60 shrink-0 mt-0.5"}),(0,b.jsx)("p",{className:"text-[0.7rem] text-muted-foreground/70 leading-relaxed",children:"Re-run the install command to add, remove, or reorder files."})]}),d.customPolicies?.map(a=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,b.jsx)("div",{className:"mt-0.5 shrink-0",children:(0,b.jsx)(U,{enabled:a.enabled,onChange:()=>I(a.id,a.enabled),disabled:f})}),(0,b.jsx)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:(0,b.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:a.name})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[a.description&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:a.description}),a.eventScope&&(0,b.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:a.eventScope})]})]},a.id))]}),d.conventionPolicies?.map(a=>(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,b.jsxs)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:["Convention Policies — ","project"===a.scope?"Project":"User"]}),(0,b.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[a.policies.length," hook",1===a.policies.length?"":"s"]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/20",children:[(0,b.jsx)(i,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a.path})]}),0===a.policies.length?(0,b.jsxs)("div",{className:"flex items-start gap-2 px-4 py-2.5 border-b border-border/20 bg-muted/10",children:[(0,b.jsx)(l,{className:"h-3.5 w-3.5 text-muted-foreground/60 shrink-0 mt-0.5"}),(0,b.jsxs)("p",{className:"text-[0.7rem] text-muted-foreground/70 leading-relaxed",children:["No policies could be read from this file. It is still loaded at runtime — run ",(0,b.jsx)("span",{className:"font-mono",children:"failproofai policies"})," to see what it registers."]})]}):a.policies.map(c=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,b.jsx)("div",{className:"mt-0.5 shrink-0",children:(0,b.jsx)(U,{enabled:c.enabled,onChange:()=>I(c.id,c.enabled),disabled:f})}),(0,b.jsx)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:(0,b.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:c.name})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[c.description&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:c.description}),c.eventScope&&(0,b.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:c.eventScope})]})]},`${a.path}:${c.name}`))]},a.path))]})]})}function Y({activeTab:a,onChange:c}){return(0,b.jsx)("div",{className:"tabs",style:{padding:0,marginBottom:24},children:[{id:"activity",label:"Activity"},{id:"policies",label:"Configure"}].map(d=>(0,b.jsx)("button",{type:"button",onClick:()=>c(d.id),className:`tab${a===d.id?" is-active":""}`,children:d.label.toLowerCase()},d.id))})}a.s(["default",0,function({initialTab:a="activity"}){let d=(0,D.useUrlParams)(),{capture:e}=(0,C.usePostHog)(),[f,g]=(0,c.useState)(a),[h,i]=(0,c.useState)(void 0),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)([]);(0,c.useEffect)(()=>{v().then(a=>{i(a.clis.some(a=>a.installed)),k({enabled:a.enabledPolicies.length,total:a.policies.length+(a.customPolicies?.length??0)+(a.conventionPolicies?.reduce((a,b)=>a+b.policies.length,0)??0)}),m(a.clis.filter(a=>a.installed).map(a=>a.label))}).catch(()=>i(void 0))},[]);let n=0===l.length?"Policy evaluations":l.length<=3?`Policy evaluations across ${l.join(", ")}`:`Policy evaluations across ${l.length} agents`,o=a=>{a!==f&&e("policies_tab_switched",{tab:a,from_tab:f}),g(a),d.setAll({tab:"activity"===a?void 0:a})};return(0,b.jsx)("main",{className:"report",children:(0,b.jsxs)("section",{className:"section","data-screen-label":"policies",children:[(0,b.jsx)("h2",{style:{fontFamily:"var(--font-mono)",fontSize:24,fontWeight:600,letterSpacing:"-0.01em",color:"var(--ink)",margin:"0 0 16px"},children:"activity"===f?"Policies":"Configure Policies"}),"activity"===f?(0,b.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:32,flexWrap:"wrap",margin:"0 0 24px"},children:[(0,b.jsxs)("div",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,flex:"1 1 480px",minWidth:0},children:[n,j&&(0,b.jsxs)("span",{style:{color:"var(--dim)"},children:[" · ","enabled policies"," ",(0,b.jsxs)("span",{style:{color:"var(--ink)",fontVariantNumeric:"tabular-nums"},children:[j.enabled,"/",j.total]})]})]}),(0,b.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6,flex:"0 0 auto"},children:[(0,b.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,letterSpacing:"0.22em",textTransform:"uppercase",color:"var(--dim)"},children:"want to change which policies fire?"}),(0,b.jsx)("button",{type:"button",className:"btn btn-primary",onClick:()=>o("policies"),children:"[ configure policies → ]"})]})]}):(0,b.jsx)("p",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,maxWidth:720,margin:"0 0 24px"},children:"switch policies on or off across your installed agent CLIs."}),(0,b.jsx)(Y,{activeTab:f,onChange:o}),"activity"===f?(0,b.jsx)(T,{hooksInstalled:h,onSwitchTab:o}):(0,b.jsx)(X,{onHooksInstallChange:i})]})})}],22712)}];
7
7
 
8
8
  //# sourceMappingURL=app_policies_hooks-client_tsx_19dqvpc._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[90798,a=>{"use strict";var b=a.i(46786),c=a.i(14747);a.s(["decodeFolderName",0,function(a){return/^[A-Za-z]--/.test(a)?a[0]+":/"+a.slice(3).replace(/-/g,"/"):a.replace(/-/g,"/")},"encodeFolderName",0,function(a){let b=/^([A-Za-z]):[\\/](.*)$/.exec(a);return b?b[1]+"--"+b[2].replace(/[\\/]/g,"-"):a.replace(/[\\/]/g,"-")},"getClaudeProjectsPath",0,function(){let a=process.env.CLAUDE_PROJECTS_PATH;return a||(0,c.join)((0,b.homedir)(),".claude","projects")}])},34900,a=>{"use strict";a.s(["runtimeCache",0,function(a,b,c){let d=new Map,e=new Map,f=c?.maxSize;return async(...c)=>{let g=JSON.stringify(c),h=d.get(g);if(h&&Date.now()<h.expiry)return h.data;let i=e.get(g);if(i)return i;let j=a(...c).then(a=>{if(e.delete(g),f&&d.size>=f){let a=d.keys().next().value;d.delete(a)}return d.set(g,{data:a,expiry:Date.now()+1e3*b}),a},a=>{throw e.delete(g),a});return e.set(g,j),j}}])},76668,a=>{"use strict";let b=1;function c(a){return`[failproofai${new Date().toISOString()}] ${a}`}a.s(["logError",0,function(a,b){void 0!==b?console.error(c("ERROR"),a,b):console.error(c("ERROR"),a)},"logWarn",0,function(a,d){b>=b&&(void 0!==d?console.warn(c("WARN"),a,d):console.warn(c("WARN"),a))}])},33432,a=>{"use strict";a.s(["formatDate",0,function(a){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).format(a)}])},26192,a=>{"use strict";async function b(a,b){let c=Array(a.length),d=0;async function e(){for(;d<a.length;){let b=d++;try{c[b]={status:"fulfilled",value:await a[b]()}}catch(a){c[b]={status:"rejected",reason:a}}}}let f=Array.from({length:Math.min(b,a.length)},()=>e());return await Promise.all(f),c}a.s(["batchAll",0,b])},69191,a=>{"use strict";var b=a.i(12714),c=a.i(50227),d=a.i(90798),e=a.i(34900),f=a.i(26192),g=a.i(76668),h=a.i(33432);async function i(a,c){try{return(await (0,b.stat)(a)).mtime}catch(a){return(0,g.logWarn)(`Failed to stat ${c}:`,a),new Date(0)}}async function j(a){try{if(!(await (0,b.stat)(a)).isDirectory())return null;return await (0,b.readdir)(a,{withFileTypes:!0})}catch{return null}}async function k(){try{let a=(0,d.getClaudeProjectsPath)(),b=await j(a);if(!b)return[];let e=(await (0,f.batchAll)(b.filter(a=>a.isDirectory()).map(b=>async()=>{let d=(0,c.join)(a,b.name),e=await i(d,b.name);return{name:b.name,path:d,isDirectory:!0,lastModified:e,lastModifiedFormatted:(0,h.formatDate)(e),cli:["claude"]}}),16)).filter(a=>"fulfilled"===a.status).map(a=>a.value);return e.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),e}catch(a){return(0,g.logError)("Error reading Claude project folders:",a),[]}}async function l(){let[{getCodexProjects:b},{getCopilotProjects:c},{getCursorProjects:d},{getOpenCodeProjects:e},{getPiProjects:f},{getHermesProjects:h},{getOpenClawProjects:i},{getFactoryProjects:j},{getDevinProjects:l},{getAntigravityProjects:m},{getGooseProjects:n}]=await Promise.all([a.A(93658),a.A(60956),a.A(26244),a.A(2164),a.A(92351),a.A(84789),a.A(74486),a.A(71273),a.A(11848),a.A(39907),a.A(14028)]),[o,p,q,r,s,t,u,v,w,x,y,z]=await Promise.all([k(),b().catch(a=>((0,g.logError)("Error reading Codex projects:",a),[])),c().catch(a=>((0,g.logError)("Error reading Copilot projects:",a),[])),d().catch(a=>((0,g.logError)("Error reading Cursor projects:",a),[])),e().catch(a=>((0,g.logError)("Error reading OpenCode projects:",a),[])),f().catch(a=>((0,g.logError)("Error reading Pi projects:",a),[])),h().catch(a=>((0,g.logError)("Error reading Hermes projects:",a),[])),i().catch(a=>((0,g.logError)("Error reading OpenClaw projects:",a),[])),j().catch(a=>((0,g.logError)("Error reading Factory projects:",a),[])),l().catch(a=>((0,g.logError)("Error reading Devin projects:",a),[])),m().catch(a=>((0,g.logError)("Error reading Antigravity projects:",a),[])),n().catch(a=>((0,g.logError)("Error reading Goose projects:",a),[]))]);return function(...a){let b=new Map;for(let c of a)for(let a of c){let c=b.get(a.name);if(!c){b.set(a.name,{...a,cli:[...a.cli]});continue}let d=[...c.cli];for(let b of a.cli)d.includes(b)||d.push(b);let e=a.lastModified.getTime()>c.lastModified.getTime()?a:c;b.set(a.name,{...c,cli:d,lastModified:e.lastModified,lastModifiedFormatted:e.lastModifiedFormatted})}let c=Array.from(b.values());return c.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),c}(o,p,q,r,s,t,u,v,w,x,y,z)}function m(a){let b=a.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);return b?b[0]:void 0}async function n(a){try{let b=await j(a);if(!b)return[];let d=b.filter(a=>a.isFile()&&a.name.endsWith(".jsonl")&&m(a.name)),e=(await (0,f.batchAll)(d.map(b=>async()=>{let d=(0,c.join)(a,b.name),e=await i(d,b.name);return{name:b.name,path:d,lastModified:e,lastModifiedFormatted:(0,h.formatDate)(e),sessionId:m(b.name),cli:"claude"}}),16)).filter(a=>"fulfilled"===a.status).map(a=>a.value);return e.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),e}catch(a){return(0,g.logError)("Error reading session files:",a),[]}}let o=(0,e.runtimeCache)(l,30),p=(0,e.runtimeCache)(a=>n(a),30);a.s(["UUID_RE",0,/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,"getCachedProjectFolders",0,o,"getCachedSessionFiles",0,p,"resolveProjectPath",0,function(a){if(!a)throw RangeError("Empty project name");if(/^[/\\]/.test(a))throw RangeError("Absolute project name");let b=(0,c.resolve)((0,d.getClaudeProjectsPath)()),e=(0,c.resolve)((0,c.join)(b,a));if(!e.startsWith(b+c.sep))throw RangeError("Project path escapes root");return e}])},83397,92246,a=>{"use strict";var b=a.i(24868),c=a.i(14747),d=a.i(90798),e=a.i(69191);async function f(a,d,e,f){let g=`agent-${f}.jsonl`;for(let f of[(0,c.join)(a,d,g),(0,c.join)(a,d,e,g),(0,c.join)(a,d,e,"subagents",g)])if(!(0,c.relative)(a,f).startsWith(".."))try{return await (0,b.access)(f),f}catch(a){if("ENOENT"===a.code)continue;break}return null}var g=a.i(34900),h=a.i(26192),i=a.i(33432);function j(a){if(a<1e3)return`${a}ms`;let b=Math.round(a/100);if(b<600)return`${(b/10).toFixed(1)}s`;let c=Math.round(a/1e3);if(c<3600){let a=Math.floor(c/60);return`${a}m ${c%60}s`}let d=Math.round(a/6e4),e=Math.floor(d/60);return`${e}h ${d%60}m`}function k(a){let b=(0,i.formatDate)(a),c=a.getMilliseconds().toString().padStart(3,"0");return`${b}.${c}`}function l(a,b,c,d){return{_source:d,uuid:a.uuid||"",parentUuid:a.parentUuid??null,timestamp:b,timestampMs:c.getTime(),timestampFormatted:k(c)}}async function m(a,b){let c=a.split("\n").filter(a=>""!==a.trim()),d=new Map,e=[],f=[],g=new Set,h=!1;for(let a=0;a<c.length;a++){let i;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let j=c[a];try{i=JSON.parse(j)}catch{continue}let k={...i,_source:b};f.push(k);let m=i.type,n=i.timestamp;if(!n)continue;let o=new Date(n),p=o.getTime();if("user"===m){let a=i.message;if(Array.isArray(a?.content)){let b=a.content;if(b.some(a=>"tool_result"===a.type)){let a=i.toolUseResult,c="string"==typeof a?.agentId?a.agentId:void 0;for(let a of(c&&/^[a-f0-9]+$/.test(c)&&g.add(c),b)){if("tool_result"!==a.type)continue;let b=a.tool_use_id;if(!b)continue;let{text:e,images:f}=function(a){let b=a.content;if("string"==typeof b)return{text:b};if(Array.isArray(b)){let a=b.filter(a=>"text"===a.type).map(a=>a.text),c=b.filter(a=>"image"===a.type).map(a=>{let b=a.source;return{base64:b.data,mediaType:b.media_type}}).filter(a=>a.base64&&a.mediaType);return{text:a.length>0?a.join("\n"):void 0,images:c.length>0?c:void 0}}return{}}(a);d.set(b,{timestamp:n,timestampMs:p,content:e,images:f,agentId:c})}continue}}let c="string"==typeof a?.content?a.content:"";e.push({type:"user",...l(i,n,o,b),message:{role:"user",content:c}});continue}if("assistant"===m){let a=i.message,c=[];if(Array.isArray(a?.content)&&(c=a.content.filter(a=>["text","tool_use","thinking"].includes(a.type)).map(a=>{if("text"===a.type)return{type:"text",text:a.text};if("tool_use"===a.type){let b=a.input;return{type:"tool_use",id:a.id,name:a.name,input:a.input??{},..."Task"===a.name&&b?{subagentType:b.subagent_type,subagentDescription:b.description}:{}}}return{type:"thinking",thinking:a.thinking,signature:a.signature}})),0===c.length)continue;e.push({type:"assistant",...l(i,n,o,b),message:{role:"assistant",content:c,model:a?.model}});continue}if("file-history-snapshot"===m||"progress"===m||"system"===m){e.push({type:m,...l(i,n,o,b),raw:{...i}});continue}if("queue-operation"===m){let a=h?"Session Resumed":"Session Started";h=!0,e.push({type:"queue-operation",...l(i,n,o,b),label:a});continue}}let i=0;for(let a of e)if("assistant"===a.type)for(let b of(++i%200==0&&await new Promise(a=>setImmediate(a)),a.message.content)){if("tool_use"!==b.type)continue;let c=d.get(b.id);if(!c)continue;let e=new Date(c.timestamp),f=Math.max(0,c.timestampMs-a.timestampMs);b.result={timestamp:c.timestamp,timestampFormatted:k(e),content:c.content,images:c.images,durationMs:f,durationFormatted:j(f)},c.agentId&&(b.subagentId=c.agentId)}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,subagentIds:Array.from(g)}}async function n(a,g){let i=(0,e.resolveProjectPath)(a),j=(0,d.getClaudeProjectsPath)(),k=(0,c.join)(i,`${g}.jsonl`),l=await (0,b.readFile)(k,"utf-8"),{entries:n,rawLines:o,subagentIds:p}=await m(l,"session");if(0===p.length)return{entries:n,rawLines:o,subagentIds:[]};let q=await (0,h.batchAll)(p.map(c=>async()=>{let d=`agent-${c}`,e=await f(j,a,g,c);if(!e)return null;let h=await (0,b.readFile)(e,"utf-8"),{entries:i,rawLines:k}=await m(h,d);return{entries:i,rawLines:k}}),4),r=[...n],s=[...o];for(let a of q)"fulfilled"===a.status&&a.value&&(r.push(...a.value.entries),s.push(...a.value.rawLines));return r.length>500&&await new Promise(a=>setImmediate(a)),r.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:r,rawLines:s,subagentIds:p}}a.s(["formatDuration",0,j],92246);let o=(0,g.runtimeCache)((a,b)=>n(a,b),60,{maxSize:50});a.s(["baseEntry",0,l,"formatTimestamp",0,k,"getCachedSessionLog",0,o,"parseRawLines",0,function(a,b){return a.split("\n").filter(a=>""!==a.trim()).flatMap(a=>{try{let c=JSON.parse(a);return void 0!==b&&(c._source=b),[c]}catch{return[]}})}],83397)}];
1
+ module.exports=[90798,a=>{"use strict";var b=a.i(46786),c=a.i(14747);function d(a){return/^[A-Za-z]--/.test(a)?a[0]+":/"+a.slice(3).replace(/-/g,"/"):a.replace(/-/g,"/")}let e=/^[a-z]{2,}:/;function f(a){return!!a&&e.test(a)}a.s(["decodeFolderName",0,d,"encodeFolderName",0,function(a){let b=/^([A-Za-z]):[\\/](.*)$/.exec(a);return b?b[1]+"--"+b[2].replace(/[\\/]/g,"-"):a.replace(/[\\/]/g,"-")},"getClaudeProjectsPath",0,function(){let a=process.env.CLAUDE_PROJECTS_PATH;return a||(0,c.join)((0,b.homedir)(),".claude","projects")},"isSyntheticProjectPath",0,f,"projectDisplayName",0,function(a,b){return f(b)?b.replace(/:/g,"/"):d(a)}])},34900,a=>{"use strict";a.s(["runtimeCache",0,function(a,b,c){let d=new Map,e=new Map,f=c?.maxSize;return async(...c)=>{let g=JSON.stringify(c),h=d.get(g);if(h&&Date.now()<h.expiry)return h.data;let i=e.get(g);if(i)return i;let j=a(...c).then(a=>{if(e.delete(g),f&&d.size>=f){let a=d.keys().next().value;d.delete(a)}return d.set(g,{data:a,expiry:Date.now()+1e3*b}),a},a=>{throw e.delete(g),a});return e.set(g,j),j}}])},76668,a=>{"use strict";let b=1;function c(a){return`[failproofai${new Date().toISOString()}] ${a}`}a.s(["logError",0,function(a,b){void 0!==b?console.error(c("ERROR"),a,b):console.error(c("ERROR"),a)},"logWarn",0,function(a,d){b>=b&&(void 0!==d?console.warn(c("WARN"),a,d):console.warn(c("WARN"),a))}])},33432,a=>{"use strict";a.s(["formatDate",0,function(a){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).format(a)}])},26192,a=>{"use strict";async function b(a,b){let c=Array(a.length),d=0;async function e(){for(;d<a.length;){let b=d++;try{c[b]={status:"fulfilled",value:await a[b]()}}catch(a){c[b]={status:"rejected",reason:a}}}}let f=Array.from({length:Math.min(b,a.length)},()=>e());return await Promise.all(f),c}a.s(["batchAll",0,b])},69191,a=>{"use strict";var b=a.i(12714),c=a.i(50227),d=a.i(90798),e=a.i(34900),f=a.i(26192),g=a.i(76668),h=a.i(33432);async function i(a,c){try{return(await (0,b.stat)(a)).mtime}catch(a){return(0,g.logWarn)(`Failed to stat ${c}:`,a),new Date(0)}}async function j(a){try{if(!(await (0,b.stat)(a)).isDirectory())return null;return await (0,b.readdir)(a,{withFileTypes:!0})}catch{return null}}async function k(){try{let a=(0,d.getClaudeProjectsPath)(),b=await j(a);if(!b)return[];let e=(await (0,f.batchAll)(b.filter(a=>a.isDirectory()).map(b=>async()=>{let d=(0,c.join)(a,b.name),e=await i(d,b.name);return{name:b.name,path:d,isDirectory:!0,lastModified:e,lastModifiedFormatted:(0,h.formatDate)(e),cli:["claude"]}}),16)).filter(a=>"fulfilled"===a.status).map(a=>a.value);return e.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),e}catch(a){return(0,g.logError)("Error reading Claude project folders:",a),[]}}async function l(){let[{getCodexProjects:b},{getCopilotProjects:c},{getCursorProjects:d},{getOpenCodeProjects:e},{getPiProjects:f},{getHermesProjects:h},{getOpenClawProjects:i},{getFactoryProjects:j},{getDevinProjects:l},{getAntigravityProjects:m},{getGooseProjects:n}]=await Promise.all([a.A(93658),a.A(60956),a.A(26244),a.A(2164),a.A(92351),a.A(84789),a.A(74486),a.A(71273),a.A(11848),a.A(39907),a.A(14028)]),[o,p,q,r,s,t,u,v,w,x,y,z]=await Promise.all([k(),b().catch(a=>((0,g.logError)("Error reading Codex projects:",a),[])),c().catch(a=>((0,g.logError)("Error reading Copilot projects:",a),[])),d().catch(a=>((0,g.logError)("Error reading Cursor projects:",a),[])),e().catch(a=>((0,g.logError)("Error reading OpenCode projects:",a),[])),f().catch(a=>((0,g.logError)("Error reading Pi projects:",a),[])),h().catch(a=>((0,g.logError)("Error reading Hermes projects:",a),[])),i().catch(a=>((0,g.logError)("Error reading OpenClaw projects:",a),[])),j().catch(a=>((0,g.logError)("Error reading Factory projects:",a),[])),l().catch(a=>((0,g.logError)("Error reading Devin projects:",a),[])),m().catch(a=>((0,g.logError)("Error reading Antigravity projects:",a),[])),n().catch(a=>((0,g.logError)("Error reading Goose projects:",a),[]))]);return function(...a){let b=new Map;for(let c of a)for(let a of c){let c=b.get(a.name);if(!c){b.set(a.name,{...a,cli:[...a.cli]});continue}let d=[...c.cli];for(let b of a.cli)d.includes(b)||d.push(b);let e=a.lastModified.getTime()>c.lastModified.getTime()?a:c;b.set(a.name,{...c,cli:d,lastModified:e.lastModified,lastModifiedFormatted:e.lastModifiedFormatted,sessionCount:void 0===c.sessionCount&&void 0===a.sessionCount?void 0:(c.sessionCount??0)+(a.sessionCount??0)})}let c=Array.from(b.values());return c.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),c}(o,p,q,r,s,t,u,v,w,x,y,z)}function m(a){let b=a.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);return b?b[0]:void 0}async function n(a){try{let b=await j(a);if(!b)return[];let d=b.filter(a=>a.isFile()&&a.name.endsWith(".jsonl")&&m(a.name)),e=(await (0,f.batchAll)(d.map(b=>async()=>{let d=(0,c.join)(a,b.name),e=await i(d,b.name);return{name:b.name,path:d,lastModified:e,lastModifiedFormatted:(0,h.formatDate)(e),sessionId:m(b.name),cli:"claude"}}),16)).filter(a=>"fulfilled"===a.status).map(a=>a.value);return e.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),e}catch(a){return(0,g.logError)("Error reading session files:",a),[]}}let o=(0,e.runtimeCache)(l,30),p=(0,e.runtimeCache)(a=>n(a),30);a.s(["UUID_RE",0,/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,"getCachedProjectFolders",0,o,"getCachedSessionFiles",0,p,"resolveProjectPath",0,function(a){if(!a)throw RangeError("Empty project name");if(/^[/\\]/.test(a))throw RangeError("Absolute project name");let b=(0,c.resolve)((0,d.getClaudeProjectsPath)()),e=(0,c.resolve)((0,c.join)(b,a));if(!e.startsWith(b+c.sep))throw RangeError("Project path escapes root");return e}])},83397,92246,a=>{"use strict";var b=a.i(24868),c=a.i(14747),d=a.i(90798),e=a.i(69191);async function f(a,d,e,f){let g=`agent-${f}.jsonl`;for(let f of[(0,c.join)(a,d,g),(0,c.join)(a,d,e,g),(0,c.join)(a,d,e,"subagents",g)])if(!(0,c.relative)(a,f).startsWith(".."))try{return await (0,b.access)(f),f}catch(a){if("ENOENT"===a.code)continue;break}return null}var g=a.i(34900),h=a.i(26192),i=a.i(33432);function j(a){if(a<1e3)return`${a}ms`;let b=Math.round(a/100);if(b<600)return`${(b/10).toFixed(1)}s`;let c=Math.round(a/1e3);if(c<3600){let a=Math.floor(c/60);return`${a}m ${c%60}s`}let d=Math.round(a/6e4),e=Math.floor(d/60);return`${e}h ${d%60}m`}function k(a){let b=(0,i.formatDate)(a),c=a.getMilliseconds().toString().padStart(3,"0");return`${b}.${c}`}function l(a,b,c,d){return{_source:d,uuid:a.uuid||"",parentUuid:a.parentUuid??null,timestamp:b,timestampMs:c.getTime(),timestampFormatted:k(c)}}async function m(a,b){let c=a.split("\n").filter(a=>""!==a.trim()),d=new Map,e=[],f=[],g=new Set,h=!1;for(let a=0;a<c.length;a++){let i;a>0&&a%200==0&&await new Promise(a=>setImmediate(a));let j=c[a];try{i=JSON.parse(j)}catch{continue}let k={...i,_source:b};f.push(k);let m=i.type,n=i.timestamp;if(!n)continue;let o=new Date(n),p=o.getTime();if("user"===m){let a=i.message;if(Array.isArray(a?.content)){let b=a.content;if(b.some(a=>"tool_result"===a.type)){let a=i.toolUseResult,c="string"==typeof a?.agentId?a.agentId:void 0;for(let a of(c&&/^[a-f0-9]+$/.test(c)&&g.add(c),b)){if("tool_result"!==a.type)continue;let b=a.tool_use_id;if(!b)continue;let{text:e,images:f}=function(a){let b=a.content;if("string"==typeof b)return{text:b};if(Array.isArray(b)){let a=b.filter(a=>"text"===a.type).map(a=>a.text),c=b.filter(a=>"image"===a.type).map(a=>{let b=a.source;return{base64:b.data,mediaType:b.media_type}}).filter(a=>a.base64&&a.mediaType);return{text:a.length>0?a.join("\n"):void 0,images:c.length>0?c:void 0}}return{}}(a);d.set(b,{timestamp:n,timestampMs:p,content:e,images:f,agentId:c})}continue}}let c="string"==typeof a?.content?a.content:"";e.push({type:"user",...l(i,n,o,b),message:{role:"user",content:c}});continue}if("assistant"===m){let a=i.message,c=[];if(Array.isArray(a?.content)&&(c=a.content.filter(a=>["text","tool_use","thinking"].includes(a.type)).map(a=>{if("text"===a.type)return{type:"text",text:a.text};if("tool_use"===a.type){let b=a.input;return{type:"tool_use",id:a.id,name:a.name,input:a.input??{},..."Task"===a.name&&b?{subagentType:b.subagent_type,subagentDescription:b.description}:{}}}return{type:"thinking",thinking:a.thinking,signature:a.signature}})),0===c.length)continue;e.push({type:"assistant",...l(i,n,o,b),message:{role:"assistant",content:c,model:a?.model}});continue}if("file-history-snapshot"===m||"progress"===m||"system"===m){e.push({type:m,...l(i,n,o,b),raw:{...i}});continue}if("queue-operation"===m){let a=h?"Session Resumed":"Session Started";h=!0,e.push({type:"queue-operation",...l(i,n,o,b),label:a});continue}}let i=0;for(let a of e)if("assistant"===a.type)for(let b of(++i%200==0&&await new Promise(a=>setImmediate(a)),a.message.content)){if("tool_use"!==b.type)continue;let c=d.get(b.id);if(!c)continue;let e=new Date(c.timestamp),f=Math.max(0,c.timestampMs-a.timestampMs);b.result={timestamp:c.timestamp,timestampFormatted:k(e),content:c.content,images:c.images,durationMs:f,durationFormatted:j(f)},c.agentId&&(b.subagentId=c.agentId)}return e.length>500&&await new Promise(a=>setImmediate(a)),e.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:e,rawLines:f,subagentIds:Array.from(g)}}async function n(a,g){let i=(0,e.resolveProjectPath)(a),j=(0,d.getClaudeProjectsPath)(),k=(0,c.join)(i,`${g}.jsonl`),l=await (0,b.readFile)(k,"utf-8"),{entries:n,rawLines:o,subagentIds:p}=await m(l,"session");if(0===p.length)return{entries:n,rawLines:o,subagentIds:[]};let q=await (0,h.batchAll)(p.map(c=>async()=>{let d=`agent-${c}`,e=await f(j,a,g,c);if(!e)return null;let h=await (0,b.readFile)(e,"utf-8"),{entries:i,rawLines:k}=await m(h,d);return{entries:i,rawLines:k}}),4),r=[...n],s=[...o];for(let a of q)"fulfilled"===a.status&&a.value&&(r.push(...a.value.entries),s.push(...a.value.rawLines));return r.length>500&&await new Promise(a=>setImmediate(a)),r.sort((a,b)=>a.timestampMs-b.timestampMs),{entries:r,rawLines:s,subagentIds:p}}a.s(["formatDuration",0,j],92246);let o=(0,g.runtimeCache)((a,b)=>n(a,b),60,{maxSize:50});a.s(["baseEntry",0,l,"formatTimestamp",0,k,"getCachedSessionLog",0,o,"parseRawLines",0,function(a,b){return a.split("\n").filter(a=>""!==a.trim()).flatMap(a=>{try{let c=JSON.parse(a);return void 0!==b&&(c._source=b),[c]}catch{return[]}})}],83397)}];
2
2
 
3
3
  //# sourceMappingURL=lib_0xkhw_v._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[83884,a=>{"use strict";var b=a.i(94431),c=a.i(54563),d=a.i(34900),e=a.i(33432);async function f(){let a=await (0,b.openSqliteReadonly)((0,c.hermesDbPath)());if(!a)return[];try{return a.query("SELECT s.id, s.source, s.cwd, s.title, s.user_id, s.chat_id, s.chat_type, s.started_at, s.ended_at, s.message_count, lm.last_activity FROM sessions s LEFT JOIN (SELECT session_id, MAX(timestamp) AS last_activity FROM messages GROUP BY session_id) lm ON lm.session_id = s.id ORDER BY lm.last_activity DESC").map(a=>({sessionId:a.id,source:a.source??void 0,cwd:a.cwd??void 0,title:a.title??void 0,userId:a.user_id??void 0,chatId:a.chat_id??void 0,chatType:a.chat_type??void 0,mtimeMs:(0,c.epochToMs)(a.last_activity??a.ended_at??a.started_at),messageCount:"number"==typeof a.message_count?a.message_count:0,hasMessages:null!=a.last_activity}))}catch{return[]}finally{a.close()}}let g=(0,d.runtimeCache)(f,2);async function h(){let a=await f(),b=new Map;for(let c of a){if(c.messageCount<=0&&!c.hasMessages)continue;let a=c.source??"unknown";b.set(a,Math.max(b.get(a)??0,c.mtimeMs))}let c=[];for(let[a,d]of b){let b=new Date(d);c.push({name:`hermes-${a}`,path:`hermes:${a}`,isDirectory:!0,lastModified:b,lastModifiedFormatted:(0,e.formatDate)(b),cli:["hermes"]})}return c.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),c}async function i(a){if(!a.startsWith("hermes-"))return{cwd:null,sessions:[]};let b=a.slice(7),c=(await f()).filter(a=>(a.messageCount>0||a.hasMessages)&&(a.source??"unknown")===b);return{cwd:`hermes:${b}`,sessions:c.map(a=>{let b=new Date(a.mtimeMs);return{name:a.title??a.sessionId,path:`hermes://${a.sessionId}`,lastModified:b,lastModifiedFormatted:(0,e.formatDate)(b),sessionId:a.sessionId,cli:"hermes",userId:a.userId,channelId:a.chatId,channelType:a.chatType}})}}let j=(0,d.runtimeCache)(h,2),k=(0,d.runtimeCache)(a=>i(a),2,{maxSize:50});a.s(["getCachedHermesProjects",0,j,"getCachedHermesSessions",0,g,"getCachedHermesSessionsByEncodedName",0,k,"getHermesProjects",0,h,"getHermesSessions",0,f,"getHermesSessionsByEncodedName",0,i])}];
1
+ module.exports=[83884,a=>{"use strict";var b=a.i(94431),c=a.i(54563),d=a.i(43600),e=a.i(34900),f=a.i(33432);async function g(){let a=[];for(let{profile:b,dbPath:d}of(0,c.hermesDbPaths)())a.push(...await h(d,b));return a.sort((a,b)=>b.mtimeMs-a.mtimeMs),a}async function h(a,d){let e=await (0,b.openSqliteReadonly)(a);if(!e)return[];try{return e.query("SELECT s.id, s.source, s.cwd, s.title, s.user_id, s.chat_id, s.chat_type, s.started_at, s.ended_at, s.message_count, lm.last_activity FROM sessions s LEFT JOIN (SELECT session_id, MAX(timestamp) AS last_activity FROM messages GROUP BY session_id) lm ON lm.session_id = s.id ORDER BY lm.last_activity DESC").map(a=>({sessionId:a.id,profile:d,source:a.source??void 0,cwd:a.cwd??void 0,title:a.title??void 0,userId:a.user_id??void 0,chatId:a.chat_id??void 0,chatType:a.chat_type??void 0,mtimeMs:(0,c.epochToMs)(a.last_activity??a.ended_at??a.started_at),messageCount:"number"==typeof a.message_count?a.message_count:0,hasMessages:null!=a.last_activity}))}catch{return[]}finally{e.close()}}let i=(0,e.runtimeCache)(g,2);async function j(){let a=await g(),b=new Map;for(let c of a){if(c.messageCount<=0&&!c.hasMessages)continue;let a=c.profile||d.HERMES_DEFAULT_PROFILE,e=c.source??"unknown",f=JSON.stringify([a,e]),g=b.get(f);g?(g.latest=Math.max(g.latest,c.mtimeMs),g.count+=1):b.set(f,{profile:a,source:e,latest:c.mtimeMs,count:1})}let c=[];for(let{profile:a,source:e,latest:g,count:h}of b.values()){let b=new Date(g);c.push({name:(0,d.hermesProjectName)(a,e),path:(0,d.hermesProjectPath)(a,e),isDirectory:!0,lastModified:b,lastModifiedFormatted:(0,f.formatDate)(b),cli:["hermes"],sessionCount:h})}return c.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),c}async function k(a){let b=(0,d.hermesProjectNameCandidates)(a);if(0===b.length)return{cwd:null,sessions:[]};let c=await g(),e=a=>c.filter(b=>(b.messageCount>0||b.hasMessages)&&(b.profile||d.HERMES_DEFAULT_PROFILE)===a.profile&&(b.source??"unknown")===a.source),h=b[0],i=e(h);if(0===i.length)for(let a of b.slice(1)){let b=e(a);if(b.length>0){h=a,i=b;break}}let{profile:j,source:k}=h;return{cwd:(0,d.hermesProjectPath)(j,k),sessions:i.map(a=>{let b=new Date(a.mtimeMs);return{name:a.title??a.sessionId,path:`hermes://${a.sessionId}`,lastModified:b,lastModifiedFormatted:(0,f.formatDate)(b),sessionId:a.sessionId,cli:"hermes",userId:a.userId,channelId:a.chatId,channelType:a.chatType}})}}let l=(0,e.runtimeCache)(j,2),m=(0,e.runtimeCache)(a=>k(a),2,{maxSize:50});a.s(["getCachedHermesProjects",0,l,"getCachedHermesSessions",0,i,"getCachedHermesSessionsByEncodedName",0,m,"getHermesProjects",0,j,"getHermesSessions",0,g,"getHermesSessionsByEncodedName",0,k])}];
2
2
 
3
3
  //# sourceMappingURL=lib_hermes-projects_ts_05b8-it._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[96877,a=>{"use strict";var b=a.i(2157),c=a.i(50227),d=a.i(34900),e=a.i(87488),f=a.i(33432);function g(a){return"string"==typeof a&&a.length>0?a:void 0}async function h(){let a=(0,e.listOpenClawTranscripts)(),d=new Map,f=[];for(let h of a){let a=d.get(h.agentId);a||(a=function(a){let d,f=new Map,h=(0,c.join)((0,e.openclawHome)(),"agents",a,"sessions","sessions.json");try{d=JSON.parse((0,b.readFileSync)(h,"utf-8"))}catch{return f}if(!d||"object"!=typeof d)return f;for(let a of Object.values(d)){if(!a||"object"!=typeof a)continue;let b=g(a.sessionId);if(!b)continue;let c=a.origin&&"object"==typeof a.origin?a.origin:{},d="number"==typeof a.lastInteractionAt?a.lastInteractionAt:"number"==typeof a.updatedAt?a.updatedAt:void 0;f.set(b,{lastMs:d,channel:g(a.lastChannel)??g(c.provider)??g(c.surface),chatType:g(a.chatType)??g(c.chatType),label:g(c.label),chatId:g(a.lastTo)??g(c.from)})}return f}(h.agentId),d.set(h.agentId,a));let i=a.get(h.sessionId);f.push({sessionId:h.sessionId,agentId:h.agentId,channel:i?.channel??"local",label:i?.label,chatType:i?.chatType,chatId:i?.chatId,mtimeMs:i?.lastMs??h.mtimeMs,sizeBytes:h.sizeBytes})}return f.sort((a,b)=>b.mtimeMs-a.mtimeMs),f}let i=(0,d.runtimeCache)(h,2);async function j(){let a=await h(),b=new Map;for(let c of a)b.set(c.channel,Math.max(b.get(c.channel)??0,c.mtimeMs));let c=[];for(let[a,d]of b){let b=new Date(d);c.push({name:`openclaw-${a}`,path:`openclaw:${a}`,isDirectory:!0,lastModified:b,lastModifiedFormatted:(0,f.formatDate)(b),cli:["openclaw"]})}return c.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),c}async function k(a){if(!a.startsWith("openclaw-"))return{cwd:null,sessions:[]};let b=a.slice(9),c=(await h()).filter(a=>a.channel===b);return{cwd:`openclaw:${b}`,sessions:c.map(a=>{let b=new Date(a.mtimeMs);return{name:a.label??a.chatId??a.sessionId,path:a.sessionId,lastModified:b,lastModifiedFormatted:(0,f.formatDate)(b),sessionId:a.sessionId,cli:"openclaw",channelId:a.chatId,channelType:a.chatType}})}}let l=(0,d.runtimeCache)(j,2),m=(0,d.runtimeCache)(a=>k(a),2,{maxSize:50});a.s(["getCachedOpenClawProjects",0,l,"getCachedOpenClawSessions",0,i,"getCachedOpenClawSessionsByEncodedName",0,m,"getOpenClawProjects",0,j,"getOpenClawSessions",0,h,"getOpenClawSessionsByEncodedName",0,k])}];
1
+ module.exports=[96877,a=>{"use strict";var b=a.i(2157),c=a.i(50227),d=a.i(34900),e=a.i(87488),f=a.i(33432);function g(a){return"string"==typeof a&&a.length>0?a:void 0}async function h(){let a=(0,e.listOpenClawTranscripts)(),d=new Map,f=[];for(let h of a){let a=d.get(h.agentId);a||(a=function(a){let d,f=new Map,h=(0,c.join)((0,e.openclawHome)(),"agents",a,"sessions","sessions.json");try{d=JSON.parse((0,b.readFileSync)(h,"utf-8"))}catch{return f}if(!d||"object"!=typeof d)return f;for(let a of Object.values(d)){if(!a||"object"!=typeof a)continue;let b=g(a.sessionId);if(!b)continue;let c=a.origin&&"object"==typeof a.origin?a.origin:{},d="number"==typeof a.lastInteractionAt?a.lastInteractionAt:"number"==typeof a.updatedAt?a.updatedAt:void 0;f.set(b,{lastMs:d,channel:g(a.lastChannel)??g(c.provider)??g(c.surface),chatType:g(a.chatType)??g(c.chatType),label:g(c.label),chatId:g(a.lastTo)??g(c.from)})}return f}(h.agentId),d.set(h.agentId,a));let i=a.get(h.sessionId);f.push({sessionId:h.sessionId,agentId:h.agentId,channel:i?.channel??"local",label:i?.label,chatType:i?.chatType,chatId:i?.chatId,transcriptPath:h.transcriptPath,mtimeMs:i?.lastMs??h.mtimeMs,sizeBytes:h.sizeBytes})}return f.sort((a,b)=>b.mtimeMs-a.mtimeMs),f}let i=(0,d.runtimeCache)(h,2);function j(a,b){return`openclaw-${a}-${b}`}function k(a,b){return`openclaw:${a}:${b}`}function l(a){if(!a.startsWith("openclaw-"))return[];let b=a.slice(9);if(!b)return[];let c=[];for(let a of(0,e.listOpenClawAgents)().sort((a,b)=>b.length-a.length)){let d=`${a}-`;b.startsWith(d)&&b.length>d.length&&c.push({agentId:a,channel:b.slice(d.length)})}return c.push({agentId:null,channel:b}),c}async function m(){let a=await h(),b=new Map;for(let c of a){let a=JSON.stringify([c.agentId,c.channel]),d=b.get(a);d?(d.latest=Math.max(d.latest,c.mtimeMs),d.count+=1):b.set(a,{agentId:c.agentId,channel:c.channel,latest:c.mtimeMs,count:1})}let c=[];for(let{agentId:a,channel:d,latest:e,count:g}of b.values()){let b=new Date(e);c.push({name:j(a,d),path:k(a,d),isDirectory:!0,lastModified:b,lastModifiedFormatted:(0,f.formatDate)(b),cli:["openclaw"],sessionCount:g})}return c.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),c}async function n(a){let b=l(a);if(0===b.length)return{cwd:null,sessions:[]};let c=await h(),d=a=>c.filter(b=>b.channel===a.channel&&(null===a.agentId||b.agentId===a.agentId)),e=b[0],g=d(e);if(0===g.length)for(let a of b.slice(1)){let b=d(a);if(b.length>0){e=a,g=b;break}}let{agentId:i,channel:j}=e;return{cwd:null===i?`openclaw:${j}`:k(i,j),sessions:g.map(a=>{let b=new Date(a.mtimeMs);return{name:a.label??a.chatId??a.sessionId,path:a.sessionId,lastModified:b,lastModifiedFormatted:(0,f.formatDate)(b),sessionId:a.sessionId,cli:"openclaw",channelId:a.chatId,channelType:a.chatType}})}}let o=(0,d.runtimeCache)(m,2),p=(0,d.runtimeCache)(a=>n(a),2,{maxSize:50});a.s(["getCachedOpenClawProjects",0,o,"getCachedOpenClawSessions",0,i,"getCachedOpenClawSessionsByEncodedName",0,p,"getOpenClawProjects",0,m,"getOpenClawSessions",0,h,"getOpenClawSessionsByEncodedName",0,n,"openClawProjectName",0,j,"openClawProjectNameCandidates",0,l,"openClawProjectPath",0,k,"parseOpenClawProjectName",0,function(a){return l(a)[0]??null}])}];
2
2
 
3
3
  //# sourceMappingURL=lib_openclaw-projects_ts_0qxq3bp._.js.map
@@ -1,3 +1,3 @@
1
1
  module.exports=[3900,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_html-to-image_es_index_1ao30b1.js"].map(b=>a.l(b))).then(()=>b(63460)))}];
2
2
 
3
- //# sourceMappingURL=node_modules_html-to-image_es_index_0gkzjaa.js.map
3
+ //# sourceMappingURL=node_modules_html-to-image_es_index_1wnt2ya.js.map