@codeyam/codeyam-cli 0.1.11 → 0.1.13

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 (214) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +2 -2
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/aws/package.json +1 -1
  6. package/analyzer-template/packages/database/package.json +1 -1
  7. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +42 -16
  8. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +3 -1
  9. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
  10. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
  11. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  12. package/codeyam-cli/src/cli.js +9 -0
  13. package/codeyam-cli/src/cli.js.map +1 -1
  14. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
  15. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
  16. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +11 -0
  17. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -1
  18. package/codeyam-cli/src/commands/editor.js +1360 -201
  19. package/codeyam-cli/src/commands/editor.js.map +1 -1
  20. package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
  21. package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
  22. package/codeyam-cli/src/commands/telemetry.js +37 -0
  23. package/codeyam-cli/src/commands/telemetry.js.map +1 -0
  24. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +893 -1
  25. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  26. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
  27. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
  28. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
  29. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
  30. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +76 -3
  31. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
  32. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +261 -0
  33. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
  34. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +75 -1
  35. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
  36. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
  37. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
  38. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +441 -17
  39. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
  40. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +67 -0
  41. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
  42. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
  43. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
  44. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
  45. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
  46. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
  47. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
  48. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +67 -9
  49. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
  50. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
  51. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
  52. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +40 -1
  53. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
  54. package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
  55. package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
  56. package/codeyam-cli/src/utils/analysisRunner.js +3 -1
  57. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  58. package/codeyam-cli/src/utils/editorAudit.js +145 -0
  59. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  60. package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
  61. package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
  62. package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
  63. package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
  64. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +13 -7
  65. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
  66. package/codeyam-cli/src/utils/editorEntityHelpers.js +129 -0
  67. package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
  68. package/codeyam-cli/src/utils/editorLoaderHelpers.js +40 -1
  69. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
  70. package/codeyam-cli/src/utils/editorMigration.js +224 -0
  71. package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
  72. package/codeyam-cli/src/utils/editorScenarios.js +163 -2
  73. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
  74. package/codeyam-cli/src/utils/editorSeedAdapter.js +253 -4
  75. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
  76. package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
  77. package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
  78. package/codeyam-cli/src/utils/entityChangeStatus.js +19 -2
  79. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
  80. package/codeyam-cli/src/utils/entityChangeStatus.server.js +7 -3
  81. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
  82. package/codeyam-cli/src/utils/fileWatcher.js +38 -0
  83. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  84. package/codeyam-cli/src/utils/install-skills.js +9 -0
  85. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  86. package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
  87. package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
  88. package/codeyam-cli/src/utils/scenarioCoverage.js +8 -9
  89. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -1
  90. package/codeyam-cli/src/utils/scenariosManifest.js +18 -10
  91. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
  92. package/codeyam-cli/src/utils/telemetry.js +106 -0
  93. package/codeyam-cli/src/utils/telemetry.js.map +1 -0
  94. package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
  95. package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
  96. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
  97. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
  98. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +61 -0
  99. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
  100. package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
  101. package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
  102. package/codeyam-cli/src/webserver/backgroundServer.js +18 -4
  103. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  104. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CzTDWkF2.js +1 -0
  105. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-BFbq6iFk.js} +3 -3
  106. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
  107. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-B6OMi58N.js} +1 -1
  108. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-DuYodzo1.js +1 -0
  109. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CXo9EeCl.js +25 -0
  110. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DYCNb2It.js +3 -0
  111. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
  112. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-CZgY3sxX.js} +3 -3
  113. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-CnYYwRDw.js} +2 -2
  114. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CDoF7ZpU.js +1 -0
  115. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-TSD3C211.js → ScenarioViewer-DrnfvaLL.js} +3 -3
  116. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Df3UCi8k.js +34 -0
  117. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
  118. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-DRKR9T0U.js +1 -0
  119. package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-ClR-g3tY.js} +2 -2
  120. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-DTH6ydEA.js} +3 -3
  121. package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-74hnHF59.js} +1 -1
  122. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-B8CYhCO9.js} +3 -3
  123. package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
  124. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
  125. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
  126. package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-CLaoh4ac.js} +1 -1
  127. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-BZ2DZxbW.js} +1 -1
  128. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-C4pqxYJB.js → chunk-JZWAC4HX-BBXArFPl.js} +13 -21
  129. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-CT4unAk-.js} +1 -1
  130. package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-zK0B6Nu-.js} +1 -1
  131. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-DJB0YQJL.js} +1 -1
  132. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CkXFP_i-.js +1 -0
  133. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-DPw7NZHc.js +1 -0
  134. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-CjC3_6JI.js +58 -0
  135. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-DBa7T2FK.js +41 -0
  136. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-DwCV5__E.js → entity._sha._-BqAN7hyG.js} +2 -2
  137. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BOi8kpwd.js +6 -0
  138. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Dg1NhIms.js +6 -0
  139. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CJX6kkkV.js +6 -0
  140. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-BhVjZhKg.js} +2 -2
  141. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-_gzKltPN.js} +6 -6
  142. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
  143. package/codeyam-cli/src/webserver/build/client/assets/files-CV_17tZS.js +1 -0
  144. package/codeyam-cli/src/webserver/build/client/assets/git-D-YXmMbR.js +1 -0
  145. package/codeyam-cli/src/webserver/build/client/assets/globals-DRvOjyO3.css +1 -0
  146. package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-Blo6EK8G.js} +1 -1
  147. package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-BsX0F-9C.js} +1 -1
  148. package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-CCrgCshv.js} +1 -1
  149. package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
  150. package/codeyam-cli/src/webserver/build/client/assets/labs-Byazq8Pv.js +1 -0
  151. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-DVQ0oHR7.js} +1 -1
  152. package/codeyam-cli/src/webserver/build/client/assets/manifest-75b1b319.js +1 -0
  153. package/codeyam-cli/src/webserver/build/client/assets/{memory-9gnxSZlb.js → memory-b-VmA2Vj.js} +2 -2
  154. package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-DGcndCAa.js} +1 -1
  155. package/codeyam-cli/src/webserver/build/client/assets/{root-DBjt6o04.js → root-F-k2uYj5.js} +15 -15
  156. package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-C0Uw0bcK.js} +1 -1
  157. package/codeyam-cli/src/webserver/build/client/assets/settings-OoNgHIfW.js +1 -0
  158. package/codeyam-cli/src/webserver/build/client/assets/simulations-Bcemfu8a.js +1 -0
  159. package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-BgMmG7R9.js} +1 -1
  160. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-Cs87hJYK.js} +1 -1
  161. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BR3Rs7JY.js +1 -0
  162. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-C14nCb1q.js → useLastLogLine-BxxP_XF9.js} +1 -1
  163. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BermyNU5.js +1 -0
  164. package/codeyam-cli/src/webserver/build/client/assets/useToast-a_QN_W9_.js +1 -0
  165. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-lv2ooewK.js +13 -0
  166. package/codeyam-cli/src/webserver/build/server/assets/{index-DsZjKspK.js → index-Im3Smyei.js} +1 -1
  167. package/codeyam-cli/src/webserver/build/server/assets/init-BjuAFKGM.js +10 -0
  168. package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
  169. package/codeyam-cli/src/webserver/build/server/assets/server-build-CNjF0B9B.js +551 -0
  170. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  171. package/codeyam-cli/src/webserver/build-info.json +5 -5
  172. package/codeyam-cli/src/webserver/editorProxy.js +112 -13
  173. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  174. package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
  175. package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
  176. package/codeyam-cli/src/webserver/server.js +41 -0
  177. package/codeyam-cli/src/webserver/server.js.map +1 -1
  178. package/codeyam-cli/src/webserver/terminalServer.js +74 -8
  179. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  180. package/codeyam-cli/templates/editor-step-hook.py +104 -20
  181. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +42 -7
  182. package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
  183. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +62 -0
  184. package/package.json +2 -1
  185. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
  186. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  187. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
  188. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
  189. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
  190. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
  191. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
  192. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
  193. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
  194. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
  195. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
  196. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Ii3inc0_.js +0 -1
  197. package/codeyam-cli/src/webserver/build/client/assets/editor-16o0AIFV.js +0 -15
  198. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-7Uga8I59.js +0 -41
  199. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BwKcai0j.js +0 -6
  200. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CHMiAog3.js +0 -6
  201. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
  202. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
  203. package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
  204. package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
  205. package/codeyam-cli/src/webserver/build/client/assets/globals-CQPR0pFR.css +0 -1
  206. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
  207. package/codeyam-cli/src/webserver/build/client/assets/manifest-76e7b62c.js +0 -1
  208. package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
  209. package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
  210. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C-_hOl_g.js +0 -1
  211. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
  212. package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
  213. package/codeyam-cli/src/webserver/build/server/assets/init-DdqKD2p4.js +0 -10
  214. package/codeyam-cli/src/webserver/build/server/assets/server-build-CKKeWtVK.js +0 -444
@@ -1,4 +1,4 @@
1
- import{j as e,w as se,u as te,k as re,r as f,L as b,f as R}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{L as oe}from"./LogViewer-ceAyBX-H.js";import{u as ie}from"./useLastLogLine-C14nCb1q.js";import{u as le}from"./useReportContext-O-jkvSPx.js";import{E as q}from"./EntityTypeIcon-CQIG2qda.js";import{E as ee}from"./EntityTypeBadge-g3saevPb.js";import{S as Z}from"./SafeScreenshot-BED4B6sP.js";import{L as ae}from"./LoadingDots-BU_OAEMP.js";import{L as ne}from"./loader-circle-DaAZ_H2w.js";import{P as ce,F as de}from"./pause-f5-1lKBt.js";import{c as X}from"./createLucideIcon-CC6AbExI.js";/**
1
+ import{w as se,u as te,j as re,r as f,L as b,f as R}from"./chunk-JZWAC4HX-BBXArFPl.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{L as oe}from"./LogViewer-CZgY3sxX.js";import{u as ie}from"./useLastLogLine-BxxP_XF9.js";import{u as le}from"./useReportContext-BermyNU5.js";import{E as q}from"./EntityTypeIcon-B6OMi58N.js";import{E as ee}from"./EntityTypeBadge-CQgyEGV-.js";import{S as Z}from"./SafeScreenshot-CDoF7ZpU.js";import{L as ae}from"./LoadingDots-By5zI316.js";import{L as ne}from"./loader-circle-DVQ0oHR7.js";import{P as ce,F as de}from"./pause-DGcndCAa.js";import{c as X}from"./createLucideIcon-DJB0YQJL.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -18,10 +18,10 @@ import{j as e,w as se,u as te,k as re,r as f,L as b,f as R}from"./chunk-JZWAC4HX
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const ye=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],ue=X("list-todo",ye),be={analyzer:{bgColor:"#e1e1e1",textColor:"#3e3e3e",borderColor:"#e1e1e1"},capture:{bgColor:"#e1e1e1",textColor:"#3e3e3e",borderColor:"#e1e1e1"},running:{bgColor:"#e8ffe6",textColor:"#00925d",borderColor:"#c3f3bf"},error:{bgColor:"#fee2e2",textColor:"#991b1b",borderColor:"#fecaca"}};function G({variant:o,pid:s,label:k,className:g=""}){const d=be[o],a=k||(o==="analyzer"&&s?`Analyzer: ${s}`:o==="capture"&&s?`Capture: ${s}`:o==="running"?"Running":o==="error"?"Error":"");return e.jsx("div",{className:`inline-flex items-center justify-center px-[8px] rounded-[4px] ${g}`,style:{backgroundColor:d.bgColor,borderWidth:"1px",borderStyle:"solid",borderColor:d.borderColor,height:"20px"},children:e.jsx("span",{className:"font-['IBM_Plex_Sans']",style:{fontSize:"10px",fontWeight:400,lineHeight:"15px",color:d.textColor},children:a})})}const We=()=>[{title:"Activity - CodeYam"},{name:"description",content:"View analysis activity and queue status"}];function ve({activeTab:o,hasCurrentActivity:s,queuedCount:k,historicCount:g}){const d=[{id:"current",label:"Current Activity",hasContent:s,count:s?1:null},{id:"queued",label:"Queued Activity",hasContent:k>0,count:k},{id:"historic",label:"Historic Activity",hasContent:g>0,count:g}];return e.jsx("div",{className:"border-b border-gray-200 mb-6",children:e.jsx("nav",{className:"flex gap-8",children:d.map(a=>{const i=o===a.id;return e.jsx(b,{to:a.id==="current"?"/activity":`/activity/${a.id}`,className:`
21
+ */const ye=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],ue=X("list-todo",ye),be={analyzer:{bgColor:"#e1e1e1",textColor:"#3e3e3e",borderColor:"#e1e1e1"},capture:{bgColor:"#e1e1e1",textColor:"#3e3e3e",borderColor:"#e1e1e1"},running:{bgColor:"#e8ffe6",textColor:"#00925d",borderColor:"#c3f3bf"},error:{bgColor:"#fee2e2",textColor:"#991b1b",borderColor:"#fecaca"}};function G({variant:o,pid:s,label:k,className:g=""}){const d=be[o],a=k||(o==="analyzer"&&s?`Analyzer: ${s}`:o==="capture"&&s?`Capture: ${s}`:o==="running"?"Running":o==="error"?"Error":"");return e.jsx("div",{className:`inline-flex items-center justify-center px-[8px] rounded-[4px] ${g}`,style:{backgroundColor:d.bgColor,borderWidth:"1px",borderStyle:"solid",borderColor:d.borderColor,height:"20px"},children:e.jsx("span",{className:"font-['IBM_Plex_Sans']",style:{fontSize:"10px",fontWeight:400,lineHeight:"15px",color:d.textColor},children:a})})}const $e=()=>[{title:"Activity - CodeYam"},{name:"description",content:"View analysis activity and queue status"}];function je({activeTab:o,hasCurrentActivity:s,queuedCount:k,historicCount:g}){const d=[{id:"current",label:"Current Activity",hasContent:s,count:s?1:null},{id:"queued",label:"Queued Activity",hasContent:k>0,count:k},{id:"historic",label:"Historic Activity",hasContent:g>0,count:g}];return e.jsx("div",{className:"border-b border-gray-200 mb-6",children:e.jsx("nav",{className:"flex gap-8",children:d.map(a=>{const i=o===a.id;return e.jsx(b,{to:a.id==="current"?"/activity":`/activity/${a.id}`,className:`
22
22
  relative pb-4 px-2 text-sm transition-colors cursor-pointer
23
23
  ${i?"font-medium border-b-2":"font-normal hover:text-gray-700"}
24
24
  `,style:i?{color:"#005C75",borderColor:"#005C75"}:{color:"#9ca3af"},children:e.jsxs("span",{className:"flex items-center gap-2",children:[a.label,a.count!==null&&a.count>0&&e.jsx("span",{className:`inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold rounded-full ${i?"bg-[#cbf3fa] text-[#005c75]":"bg-[#e1e1e1] text-[#3e3e3e]"}`,children:a.count}),a.count===null&&a.hasContent&&e.jsx("span",{className:`
25
25
  inline-block w-2 h-2 rounded-full
26
26
  ${i?"":"bg-gray-400"}
27
- `,style:i?{backgroundColor:"#005C75"}:{}})]})},a.id)})})})}function je({currentlyExecuting:o,currentRun:s,state:k,projectSlug:g,commitSha:d,onShowLogs:a,recentCompletedEntities:i,hasMoreCompletedRuns:B,currentEntityScenarios:v,currentEntityForScenarios:z,currentAnalysisStatus:n}){var O,K,V,c;const[h,S]=f.useState({}),[C,D]=f.useState({isKilling:!1,current:0,total:0}),w=R(),I=!!o,N=(o==null?void 0:o.entities)||[],T=!!(s!=null&&s.analysisCompletedAt),H=T&&!!(s!=null&&s.capturePid),M=!T,$=I,t=v||[],{lastLine:x}=ie(g,$);f.useEffect(()=>{if(!s)return;const r=[s.analyzerPid,s.capturePid].filter(l=>!!l);if(r.length===0)return;let m=!0;const E=async()=>{try{const L=await(await fetch(`/api/process-status?pids=${r.join(",")}`)).json();if(L.processes&&m){const W={};L.processes.forEach(u=>{W[u.pid]={isRunning:u.isRunning,processName:u.processName}}),S(W)}}catch(l){m&&console.error("Failed to fetch process statuses:",l)}};E();const p=setInterval(()=>void E(),5e3);return()=>{m=!1,clearInterval(p)}},[s==null?void 0:s.analyzerPid,s==null?void 0:s.capturePid]);const[j,P]=f.useState(!1),[A,y]=f.useState(!1);f.useEffect(()=>{N.length<=3&&j&&P(!1)},[N.length,j]),f.useEffect(()=>{i.length<=3&&A&&y(!1)},[i.length,A]);const Y=j?N:N.slice(0,3),_=N.length>3;return e.jsxs("div",{className:"flex flex-col gap-[45px]",children:[$?e.jsxs("div",{className:"rounded-[10px] p-[15px]",style:{backgroundColor:"#f6f9fc",border:"1px solid #e0e9ec"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-[15px]",children:[e.jsx(ne,{size:14,strokeWidth:2.5,className:"animate-spin",style:{color:"#005c75"}}),e.jsx("span",{className:"font-medium",style:{fontSize:"14px",lineHeight:"18px",color:"#005c75"},children:H?"Capturing...":"Analyzing..."})]}),Y.map(r=>e.jsxs("div",{className:"bg-white border border-[#e1e1e1] rounded-[4px] mb-[15px]",style:{height:"60px",padding:"0 15px",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1)"},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{children:e.jsx(q,{type:r.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex flex-col gap-[1px]",children:[e.jsxs("div",{className:"flex items-center gap-[14px]",children:[e.jsx(b,{to:`/entity/${r.sha}`,className:"hover:underline cursor-pointer",style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#000"},children:r.name}),r.entityType&&e.jsx(ee,{type:r.entityType})]}),e.jsx("div",{className:"truncate font-mono",style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e",width:"422px"},title:r.filePath,children:r.filePath})]})]}),e.jsx("button",{onClick:a,className:"px-[10px] rounded-[4px] transition-colors whitespace-nowrap cursor-pointer",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",lineHeight:"22px",fontWeight:600},children:"View Logs"})]},r.sha)),_&&!j&&e.jsxs("button",{onClick:()=>P(!0),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] mb-[15px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:["+",N.length-3," more"," ",N.length-3===1?"entity":"entities"]}),j&&_&&e.jsx("button",{onClick:()=>P(!1),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] mb-[15px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:"Show less"}),H&&t&&t.length>0&&z&&e.jsx("div",{className:"flex gap-[10px] overflow-x-auto mb-[15px]",children:t.map(r=>{var u,U,Q,J;if(!r.id)return null;const m=(U=(u=r.metadata)==null?void 0:u.screenshotPaths)==null?void 0:U[0],E=(Q=r.metadata)==null?void 0:Q.noScreenshotSaved,p=m&&!E,l=(J=n==null?void 0:n.scenarios)==null?void 0:J.find(F=>F.name===r.name),W=l&&l.screenshotStartedAt&&!l.screenshotFinishedAt||!p&&!E;return e.jsx(b,{to:`/entity/${z.sha}/scenarios/${r.id}`,className:"border border-solid rounded-[6px] overflow-hidden flex-shrink-0 cursor-pointer",style:{width:"160px",height:"90px",backgroundColor:W?"#f9f9f9":void 0,borderColor:W?"#efefef":"#ccc"},children:p?e.jsx(Z,{screenshotPath:m,alt:r.name,className:"w-full h-full object-contain bg-gray-100"}):W?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(ae,{size:"medium"})}):e.jsx("div",{className:"w-full h-full flex items-center justify-center font-mono",style:{backgroundColor:"#FAFAFA",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.02) 1px, transparent 1px)",backgroundSize:"20px 20px",color:"#b0b0b0",fontSize:"11px"},children:"No preview"})},r.id)})}),x&&e.jsx("div",{className:"mb-[15px] font-['IBM_Plex_Mono']",style:{fontSize:"12px",lineHeight:"20px",fontWeight:500,color:"#005c75"},children:x}),e.jsx("div",{className:"mb-[15px]",style:{height:"1px",backgroundColor:"#e0e9ec"}}),((s==null?void 0:s.analyzerPid)||(s==null?void 0:s.capturePid))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{style:{fontSize:"12px",lineHeight:"15px",fontWeight:400,color:"#000"},children:["Running Processes:"," "]}),(s==null?void 0:s.analyzerPid)&&e.jsx(G,{variant:"analyzer",pid:s.analyzerPid}),(s==null?void 0:s.analyzerPid)&&(M||((O=h[s.analyzerPid])==null?void 0:O.isRunning))&&e.jsx(G,{variant:"running"}),(s==null?void 0:s.capturePid)&&e.jsx(G,{variant:"capture",pid:s.capturePid}),(s==null?void 0:s.capturePid)&&(H||((K=h[s.capturePid])==null?void 0:K.isRunning))&&e.jsx(G,{variant:"running"})]}),(((V=h[s==null?void 0:s.analyzerPid])==null?void 0:V.isRunning)||((c=h[s==null?void 0:s.capturePid])==null?void 0:c.isRunning))&&e.jsx("button",{onClick:()=>{const r=[s==null?void 0:s.analyzerPid,s==null?void 0:s.capturePid].filter(p=>{var l;return!!p&&((l=h[p])==null?void 0:l.isRunning)});if(r.length===0)return;const m=r.join(", ");if(!confirm(`Are you sure you want to kill all running processes (${m})?`))return;D({isKilling:!0,current:1,total:r.length}),(async()=>{for(let p=0;p<r.length;p++){const l=r[p];try{await fetch("/api/kill-process",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid:l,commitSha:d||""})})}catch(L){console.error(`Failed to kill process ${l}:`,L)}p<r.length-1&&D({isKilling:!0,current:p+2,total:r.length})}D({isKilling:!1,current:0,total:0}),w.revalidate()})()},disabled:C.isKilling,className:"px-[8px] rounded-[4px] transition-colors whitespace-nowrap cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"#991b1b",color:"white",fontSize:"12px",lineHeight:"15px",fontWeight:500,height:"27px",width:"114px"},children:C.isKilling?"Killing...":"Kill All Processes"})]})]}):e.jsxs("div",{className:"border border-dashed border-[#BCCDD3] rounded-xl p-6 flex items-center justify-between",style:{backgroundColor:"#EDEFF0",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.03) 1px, transparent 1px)",backgroundSize:"20px 20px",borderWidth:"1px",borderStyle:"dashed"},children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-[#DEE3E5] border border-[#BBCCD3] rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(ce,{size:24,style:{color:"#005C75"}})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium mb-1",style:{color:"#3E3E3E"},children:"No Current Activity"}),e.jsxs("p",{className:"text-sm",style:{color:"#8e8e8e"},children:["There are no analyses running. Trigger one from"," ",e.jsx(b,{to:"/git",className:"text-[#005C75] hover:underline font-medium cursor-pointer",children:"Git"})," ","or"," ",e.jsx(b,{to:"/files",className:"text-[#005C75] hover:underline font-medium cursor-pointer",children:"Files"}),"."]})]})]}),e.jsxs(b,{to:"/files",className:"px-4 py-2 bg-[#005C75] text-white rounded-lg text-sm font-medium hover:bg-[#004a5e] transition-colors flex items-center gap-2 whitespace-nowrap no-underline",children:[e.jsx("span",{children:"+"}),e.jsx("span",{children:"New Analysis"})]})]}),i&&i.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-mono uppercase",style:{fontSize:"12px",lineHeight:"18px",color:"#8e8e8e",marginBottom:"16px",fontWeight:500,letterSpacing:"0.05em"},children:"Recently Completed Analyses"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[(A?i:i.slice(0,3)).map(r=>{var p;const m=(p=r.analyses)==null?void 0:p[0],E=(m==null?void 0:m.scenarios)||[];return m==null||m.status,e.jsx("div",{className:"rounded-[8px] p-[15px]",style:{backgroundColor:"#ffffff",border:"1px solid #aff1a9"},children:e.jsxs("div",{className:"flex flex-col gap-[15px]",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(q,{type:r.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex flex-col flex-shrink-0",style:{marginLeft:"15px",gap:"4px"},children:[e.jsxs("div",{className:"flex items-center gap-[5px]",children:[e.jsx(b,{to:`/entity/${r.sha}`,className:"hover:underline cursor-pointer",title:r.name,style:{fontSize:"14px",lineHeight:"18px",color:"#343434",fontWeight:500},children:r.name}),e.jsx("div",{className:"flex items-center justify-center px-2 rounded",style:{height:"20px",backgroundColor:"#e8ffe6",color:"#00925d",fontSize:"12px",lineHeight:"16px",fontWeight:400},children:r.isUncommitted?"Modified":"Up to date"})]}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e",fontWeight:400},className:"font-mono",title:r.filePath,children:r.filePath})]}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx("button",{onClick:a,className:"px-[10px] rounded transition-colors whitespace-nowrap",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",lineHeight:"22px",fontWeight:600},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="#d0dfe3"},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="#e0e9ec"},children:"View Logs"})})]}),e.jsx("div",{className:"border-t border-gray-200 mx-[-15px]"}),E.length>0?e.jsx("div",{className:"flex gap-2.5 overflow-x-auto pb-3 px-[15px] pt-3",style:{paddingLeft:"47px"},children:E.map(l=>{var U,Q,J;if(!l.id)return null;const L=(Q=(U=l.metadata)==null?void 0:U.screenshotPaths)==null?void 0:Q[0],W=(J=l.metadata)==null?void 0:J.noScreenshotSaved,u=L&&!W;return e.jsxs("div",{className:"shrink-0 flex flex-col gap-2",children:[e.jsx(b,{to:`/entity/${r.sha}/scenarios/${l.id}`,className:"block cursor-pointer",children:e.jsx("div",{className:"w-36 h-24 rounded-md border overflow-hidden flex items-center justify-center transition-all",style:{backgroundColor:u?"#f3f4f6":"#FAFAFA",borderColor:u?"#d1d5db":"#BCCDD3",borderStyle:u?"solid":"dashed"},onMouseEnter:F=>{u&&(F.currentTarget.style.borderColor="#005C75",F.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.15)")},onMouseLeave:F=>{F.currentTarget.style.borderColor=u?"#d1d5db":"#BCCDD3",F.currentTarget.style.boxShadow="none"},children:u?e.jsx(Z,{screenshotPath:L,alt:l.name,className:"max-w-full max-h-full object-contain"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center font-mono",style:{backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.02) 1px, transparent 1px)",backgroundSize:"20px 20px",color:"#b0b0b0",fontSize:"11px"},children:"No preview"})})}),e.jsx("div",{className:"text-left text-xs text-gray-600 cursor-default",style:{fontSize:"11px",lineHeight:"14px",maxWidth:"144px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name})]},l.id)})}):e.jsx("div",{className:"italic",style:{fontSize:"12px",color:"#646464",marginLeft:"49px"},children:"No scenarios available"})]})},r.sha)}),i.length>3&&!A&&e.jsxs("button",{onClick:()=>y(!0),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:["+",i.length-3," more"," ",i.length-3===1?"entity":"entities"]}),A&&i.length>3&&e.jsx("button",{onClick:()=>y(!1),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:"Show less"})]})]})]})}function Ne({queueJobs:o,state:s,currentRun:k}){if(!o||o.length===0)return e.jsxs("div",{className:"border border-dashed border-[#BCCDD3] rounded-xl p-6 flex items-center justify-between",style:{backgroundColor:"#EDEFF0",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.03) 1px, transparent 1px)",backgroundSize:"20px 20px",borderWidth:"1px",borderStyle:"dashed"},children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-[#DEE3E5] border border-[#BBCCD3] rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(ue,{size:24,style:{color:"#005C75"}})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium mb-1",style:{color:"#3E3E3E"},children:"No Queued Jobs"}),e.jsx("p",{className:"text-sm",style:{color:"#8e8e8e"},children:"Analysis jobs will appear here when they are queued but not yet started."})]})]}),e.jsxs(b,{to:"/files",className:"px-4 py-2 bg-[#005C75] text-white rounded-lg text-sm font-medium hover:bg-[#004a5e] transition-colors flex items-center gap-2 whitespace-nowrap no-underline",children:[e.jsx("span",{children:"+"}),e.jsx("span",{children:"New Analysis"})]})]});const[g,d]=f.useState(null),[a,i]=f.useState(null),[B,v]=f.useState(null),[z,n]=f.useState(!1),[h,S]=f.useState(!1),[C,D]=f.useState(new Set),w=R();f.useEffect(()=>{o.length<=3&&h&&S(!1)},[o.length,h]);const I=t=>{d(t)},N=(t,x)=>{t.preventDefault(),i(x)},T=async(t,x)=>{if(t.preventDefault(),!g){i(null);return}const j=o.findIndex(y=>y.id===g);if(j===-1){d(null),i(null);return}if(j===x){d(null),i(null);return}const P=j<x?"down":"up",A=Math.abs(x-j);n(!0);try{for(let y=0;y<A;y++)await fetch("/api/queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reorder",jobId:g,direction:P})});w.revalidate()}catch(y){console.error("Failed to reorder job:",y)}finally{n(!1),d(null),i(null)}},H=()=>{z||(d(null),i(null))},M=async t=>{if(confirm("Are you sure you want to cancel this job?"))try{await fetch("/api/queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"remove",jobId:t})}),window.location.reload()}catch(x){console.error("Failed to cancel job:",x)}},$=async()=>{if(confirm(`Are you sure you want to cancel all ${o.length} queued jobs?`))try{await fetch("/api/queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear"})}),window.location.reload()}catch(t){console.error("Failed to cancel jobs:",t)}};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-semibold",style:{fontSize:"16px",lineHeight:"24px",color:"#343434"},children:[o.length," Queued Job",o.length!==1?"s":""]}),o.length>0&&e.jsx("button",{onClick:()=>void $(),className:"px-[10px] py-0 rounded transition-colors cursor-pointer hover:bg-red-300",style:{backgroundColor:"#ffdcd9",color:"#ef4444",fontSize:"12px",fontWeight:500,height:"29px"},children:"Cancel All"})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[(h?o:o.slice(0,3)).map(t=>{var _,O,K,V;const x=o.findIndex(c=>c.id===t.id),j=B===x,P=g===t.id,A=a===x,y=C.has(t.id),Y=((_=t.entities)==null?void 0:_.length)>0?y?t.entities:t.entities.slice(0,3):[];return e.jsxs("div",{className:"rounded-lg p-4 relative",style:{backgroundColor:"#f6f9fc",border:"1px solid #005C75",opacity:P||z?.5:1,transform:A&&g!==null&&!P?"translateY(-2px)":"translateY(0)",transition:"transform 0.2s ease, opacity 0.2s ease",cursor:z?"not-allowed":P?"grabbing":"grab"},onMouseEnter:()=>v(x),onMouseLeave:()=>v(null),draggable:!z,onDragStart:c=>{I(t.id),c.dataTransfer.effectAllowed="move"},onDragOver:c=>N(c,x),onDrop:c=>void T(c,x),onDragEnd:H,children:[e.jsxs("div",{className:"absolute left-4 top-4 flex items-center gap-1.5 flex-shrink-0",children:[e.jsx(fe,{size:16,style:{color:"#005C75"}}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:500,lineHeight:"18px",color:"#005C75"},children:["Job ",x+1]})]}),e.jsxs("div",{className:"flex flex-col gap-2 mt-8",children:[Y.length>0?e.jsxs(e.Fragment,{children:[Y.map(c=>e.jsx("div",{className:"bg-white rounded",style:{border:"1px solid #e1e1e1",height:"60px"},children:e.jsx("div",{className:"flex items-center justify-between h-full px-[15px]",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{children:e.jsx(q,{type:c.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(b,{to:`/entity/${c.sha}`,className:"hover:underline cursor-pointer",style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#000"},children:c.name}),c.entityType&&e.jsx(ee,{type:c.entityType})]}),e.jsx("div",{className:"font-mono",style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e"},children:c.filePath})]})]})})},c.sha)),((O=t.entities)==null?void 0:O.length)>3&&e.jsx("button",{onClick:()=>{D(c=>{const r=new Set(c);return r.has(t.id)?r.delete(t.id):r.add(t.id),r})},className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"40px",fontSize:"12px",color:"#646464",fontWeight:500},children:y?"Show less":`+${t.entities.length-3} more ${t.entities.length-3===1?"entity":"entities"}`})]}):e.jsx("div",{className:"bg-white rounded",style:{border:"1px solid #e1e1e1",height:"60px"},children:e.jsx("div",{className:"flex items-center justify-between h-full px-[15px]",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{style:{transform:"scale(1.0)"},children:e.jsx(de,{size:18,style:{color:"#8e8e8e"}})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#000"},children:((K=t.entityNames)==null?void 0:K[0])||(t.type==="analysis"?"Analysis Job":t.type==="recapture"?"Recapture Job":t.type==="debug-setup"?"Debug Setup":t.type.charAt(0).toUpperCase()+t.type.slice(1))}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e"},children:((V=t.filePaths)==null?void 0:V[0])||(t.filePaths&&t.filePaths.length>1?`${t.filePaths.length} files`:t.entityShas&&t.entityShas.length>0?`${t.entityShas.length} ${t.entityShas.length===1?"entity":"entities"}`:"Queued for processing")})]})]})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 mt-1",children:[j&&e.jsx("div",{className:"cursor-grab active:cursor-grabbing",style:{color:"#8e8e8e"},title:"Drag to reorder",children:e.jsx(me,{size:20})}),e.jsx("button",{onClick:()=>void M(t.id),className:"transition-colors cursor-pointer hover:bg-red-100 rounded flex items-center justify-center",style:{fontSize:"10px",fontWeight:600,lineHeight:"22px",color:"#ef4444",backgroundColor:"#fef6f6",padding:"0 10px",height:"22px"},children:"Cancel"})]})]})]},t.id)}),o.length>3&&!h&&e.jsxs("button",{onClick:()=>S(!0),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:["+",o.length-3," more"," ",o.length-3===1?"job":"jobs"]}),h&&o.length>3&&e.jsx("button",{onClick:()=>S(!1),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:"Show less"})]})]})}function Se({historicalRuns:o,totalHistoricalRuns:s,currentPage:k,totalPages:g,tab:d,onShowLogs:a}){if(s===0)return e.jsxs("div",{className:"border border-dashed border-[#BCCDD3] rounded-xl p-6 flex items-center justify-between",style:{backgroundColor:"#EDEFF0",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.03) 1px, transparent 1px)",backgroundSize:"20px 20px",borderWidth:"1px",borderStyle:"dashed"},children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-[#DEE3E5] border border-[#BBCCD3] rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(xe,{size:24,style:{color:"#005C75"}})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium mb-1",style:{color:"#3E3E3E"},children:"No Historic Activity"}),e.jsx("p",{className:"text-sm",style:{color:"#8e8e8e"},children:"Completed analyses will appear here for historical reference."})]})]}),e.jsxs(b,{to:"/files",className:"px-4 py-2 bg-[#005C75] text-white rounded-lg text-sm font-medium hover:bg-[#004a5e] transition-colors flex items-center gap-2 whitespace-nowrap no-underline",children:[e.jsx("span",{children:"+"}),e.jsx("span",{children:"New Analysis"})]})]});const[i,B]=f.useState(!1),v=[];o.forEach(n=>{n.entities&&n.entities.length>0&&n.entities.forEach(h=>{v.push({...h,runCreatedAt:n.createdAt})})});const z=i?v:v.slice(0,3);return e.jsxs("div",{className:"flex flex-col gap-4",children:[z.map(n=>{var D;const h=(D=n.analyses)==null?void 0:D[0],S=(h==null?void 0:h.scenarios)||[],C=!n.isUncommitted;return e.jsxs("div",{className:"rounded-lg p-4",style:{backgroundColor:C?"#ffffff":"#fef9e7",border:"1px solid",borderColor:C?"#aff1a9":"#f9d689"},children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[e.jsx("div",{children:e.jsx(q,{type:n.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(b,{to:`/entity/${n.sha}`,className:"hover:underline cursor-pointer",style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#343434"},children:n.name}),e.jsx("div",{className:"px-2 py-0.5 rounded",style:{backgroundColor:C?"#e8ffe6":"#fef3cd",color:C?"#00925d":"#a16207",fontSize:"12px",fontWeight:400},children:C?"Up to date":"Out of date"})]}),e.jsx("div",{className:"font-mono",style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e"},title:n.filePath,children:n.filePath})]})]}),e.jsx("button",{onClick:a,className:"px-3 py-1 rounded transition-colors whitespace-nowrap cursor-pointer",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",fontWeight:600},children:"View Logs"})]}),S.length>0&&e.jsxs("div",{className:"flex gap-2 overflow-x-auto",style:{marginLeft:"44px"},children:[S.slice(0,8).map(w=>{var H,M,$;if(!w.id)return null;const I=(M=(H=w.metadata)==null?void 0:H.screenshotPaths)==null?void 0:M[0],N=($=w.metadata)==null?void 0:$.noScreenshotSaved,T=I&&!N;return e.jsx(b,{to:`/entity/${n.sha}/scenarios/${w.id}`,className:"border rounded overflow-hidden flex-shrink-0 cursor-pointer",style:{width:"120px",height:"80px",borderColor:T?"#ccc":"#BCCDD3",borderStyle:T?"solid":"dashed"},children:T?e.jsx(Z,{screenshotPath:I,alt:w.name,className:"w-full h-full object-cover bg-gray-100"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center font-mono",style:{backgroundColor:"#FAFAFA",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.02) 1px, transparent 1px)",backgroundSize:"20px 20px",color:"#b0b0b0",fontSize:"11px"},children:"No preview"})},w.id)}),S.length>8&&e.jsxs("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:"120px",height:"80px",fontSize:"12px",color:"#646464"},children:["+",S.length-8," more"]})]})]},`${n.sha}-${n.runCreatedAt}`)}),v.length>3&&!i&&e.jsxs("button",{onClick:()=>B(!0),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:["+",v.length-3," more"," ",v.length-3===1?"entity":"entities"]}),i&&v.length>3&&e.jsx("button",{onClick:()=>B(!1),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:"Show less"})]})}const $e=se(function(){const s=te(),k=re(),[g,d]=f.useState(!1);le({source:"activity-page"});const a=k.tab||"current";return s?e.jsxs("div",{className:"px-20 py-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900 mb-2",children:"Activity"}),e.jsx("p",{className:"text-[15px] text-gray-500",children:"View queued, current, and historical analysis activity."})]}),e.jsx(ve,{activeTab:a,hasCurrentActivity:s.hasCurrentActivity,queuedCount:s.queuedCount,historicCount:s.totalHistoricalRuns}),a==="current"&&e.jsx(je,{currentlyExecuting:s.currentlyExecuting,currentRun:s.currentRun,state:s.state,projectSlug:s.projectSlug,commitSha:s.commitSha,onShowLogs:()=>d(!0),recentCompletedEntities:s.recentCompletedEntities||[],hasMoreCompletedRuns:s.hasMoreCompletedRuns||!1,currentEntityScenarios:s.currentEntityScenarios||[],currentEntityForScenarios:s.currentEntityForScenarios,currentAnalysisStatus:s.currentAnalysisStatus}),a==="queued"&&e.jsx(Ne,{queueJobs:s.queueJobs,state:s.state,currentRun:s.currentRun}),a==="historic"&&e.jsx(Se,{historicalRuns:s.historicalRuns,totalHistoricalRuns:s.totalHistoricalRuns,currentPage:s.currentPage,totalPages:s.totalPages,tab:a,onShowLogs:()=>d(!0)}),g&&s.projectSlug&&e.jsx(oe,{projectSlug:s.projectSlug,onClose:()=>d(!1)})]}):e.jsx("div",{className:"px-20 py-12",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-gray-600",children:"Loading..."})})})});export{$e as default,We as meta};
27
+ `,style:i?{backgroundColor:"#005C75"}:{}})]})},a.id)})})})}function ve({currentlyExecuting:o,currentRun:s,state:k,projectSlug:g,commitSha:d,onShowLogs:a,recentCompletedEntities:i,hasMoreCompletedRuns:B,currentEntityScenarios:j,currentEntityForScenarios:z,currentAnalysisStatus:n}){var O,K,V,c;const[h,S]=f.useState({}),[C,D]=f.useState({isKilling:!1,current:0,total:0}),w=R(),I=!!o,N=(o==null?void 0:o.entities)||[],T=!!(s!=null&&s.analysisCompletedAt),H=T&&!!(s!=null&&s.capturePid),M=!T,$=I,t=j||[],{lastLine:x}=ie(g,$);f.useEffect(()=>{if(!s)return;const r=[s.analyzerPid,s.capturePid].filter(l=>!!l);if(r.length===0)return;let m=!0;const E=async()=>{try{const L=await(await fetch(`/api/process-status?pids=${r.join(",")}`)).json();if(L.processes&&m){const W={};L.processes.forEach(u=>{W[u.pid]={isRunning:u.isRunning,processName:u.processName}}),S(W)}}catch(l){m&&console.error("Failed to fetch process statuses:",l)}};E();const p=setInterval(()=>void E(),5e3);return()=>{m=!1,clearInterval(p)}},[s==null?void 0:s.analyzerPid,s==null?void 0:s.capturePid]);const[v,P]=f.useState(!1),[A,y]=f.useState(!1);f.useEffect(()=>{N.length<=3&&v&&P(!1)},[N.length,v]),f.useEffect(()=>{i.length<=3&&A&&y(!1)},[i.length,A]);const Y=v?N:N.slice(0,3),_=N.length>3;return e.jsxs("div",{className:"flex flex-col gap-[45px]",children:[$?e.jsxs("div",{className:"rounded-[10px] p-[15px]",style:{backgroundColor:"#f6f9fc",border:"1px solid #e0e9ec"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-[15px]",children:[e.jsx(ne,{size:14,strokeWidth:2.5,className:"animate-spin",style:{color:"#005c75"}}),e.jsx("span",{className:"font-medium",style:{fontSize:"14px",lineHeight:"18px",color:"#005c75"},children:H?"Capturing...":"Analyzing..."})]}),Y.map(r=>e.jsxs("div",{className:"bg-white border border-[#e1e1e1] rounded-[4px] mb-[15px]",style:{height:"60px",padding:"0 15px",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1)"},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{children:e.jsx(q,{type:r.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex flex-col gap-[1px]",children:[e.jsxs("div",{className:"flex items-center gap-[14px]",children:[e.jsx(b,{to:`/entity/${r.sha}`,className:"hover:underline cursor-pointer",style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#000"},children:r.name}),r.entityType&&e.jsx(ee,{type:r.entityType})]}),e.jsx("div",{className:"truncate font-mono",style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e",width:"422px"},title:r.filePath,children:r.filePath})]})]}),e.jsx("button",{onClick:a,className:"px-[10px] rounded-[4px] transition-colors whitespace-nowrap cursor-pointer",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",lineHeight:"22px",fontWeight:600},children:"View Logs"})]},r.sha)),_&&!v&&e.jsxs("button",{onClick:()=>P(!0),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] mb-[15px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:["+",N.length-3," more"," ",N.length-3===1?"entity":"entities"]}),v&&_&&e.jsx("button",{onClick:()=>P(!1),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] mb-[15px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:"Show less"}),H&&t&&t.length>0&&z&&e.jsx("div",{className:"flex gap-[10px] overflow-x-auto mb-[15px]",children:t.map(r=>{var u,U,Q,J;if(!r.id)return null;const m=(U=(u=r.metadata)==null?void 0:u.screenshotPaths)==null?void 0:U[0],E=(Q=r.metadata)==null?void 0:Q.noScreenshotSaved,p=m&&!E,l=(J=n==null?void 0:n.scenarios)==null?void 0:J.find(F=>F.name===r.name),W=l&&l.screenshotStartedAt&&!l.screenshotFinishedAt||!p&&!E;return e.jsx(b,{to:`/entity/${z.sha}/scenarios/${r.id}`,className:"border border-solid rounded-[6px] overflow-hidden flex-shrink-0 cursor-pointer",style:{width:"160px",height:"90px",backgroundColor:W?"#f9f9f9":void 0,borderColor:W?"#efefef":"#ccc"},children:p?e.jsx(Z,{screenshotPath:m,alt:r.name,className:"w-full h-full object-contain bg-gray-100"}):W?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(ae,{size:"medium"})}):e.jsx("div",{className:"w-full h-full flex items-center justify-center font-mono",style:{backgroundColor:"#FAFAFA",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.02) 1px, transparent 1px)",backgroundSize:"20px 20px",color:"#b0b0b0",fontSize:"11px"},children:"No preview"})},r.id)})}),x&&e.jsx("div",{className:"mb-[15px] font-['IBM_Plex_Mono']",style:{fontSize:"12px",lineHeight:"20px",fontWeight:500,color:"#005c75"},children:x}),e.jsx("div",{className:"mb-[15px]",style:{height:"1px",backgroundColor:"#e0e9ec"}}),((s==null?void 0:s.analyzerPid)||(s==null?void 0:s.capturePid))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{style:{fontSize:"12px",lineHeight:"15px",fontWeight:400,color:"#000"},children:["Running Processes:"," "]}),(s==null?void 0:s.analyzerPid)&&e.jsx(G,{variant:"analyzer",pid:s.analyzerPid}),(s==null?void 0:s.analyzerPid)&&(M||((O=h[s.analyzerPid])==null?void 0:O.isRunning))&&e.jsx(G,{variant:"running"}),(s==null?void 0:s.capturePid)&&e.jsx(G,{variant:"capture",pid:s.capturePid}),(s==null?void 0:s.capturePid)&&(H||((K=h[s.capturePid])==null?void 0:K.isRunning))&&e.jsx(G,{variant:"running"})]}),(((V=h[s==null?void 0:s.analyzerPid])==null?void 0:V.isRunning)||((c=h[s==null?void 0:s.capturePid])==null?void 0:c.isRunning))&&e.jsx("button",{onClick:()=>{const r=[s==null?void 0:s.analyzerPid,s==null?void 0:s.capturePid].filter(p=>{var l;return!!p&&((l=h[p])==null?void 0:l.isRunning)});if(r.length===0)return;const m=r.join(", ");if(!confirm(`Are you sure you want to kill all running processes (${m})?`))return;D({isKilling:!0,current:1,total:r.length}),(async()=>{for(let p=0;p<r.length;p++){const l=r[p];try{await fetch("/api/kill-process",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid:l,commitSha:d||""})})}catch(L){console.error(`Failed to kill process ${l}:`,L)}p<r.length-1&&D({isKilling:!0,current:p+2,total:r.length})}D({isKilling:!1,current:0,total:0}),w.revalidate()})()},disabled:C.isKilling,className:"px-[8px] rounded-[4px] transition-colors whitespace-nowrap cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"#991b1b",color:"white",fontSize:"12px",lineHeight:"15px",fontWeight:500,height:"27px",width:"114px"},children:C.isKilling?"Killing...":"Kill All Processes"})]})]}):e.jsxs("div",{className:"border border-dashed border-[#BCCDD3] rounded-xl p-6 flex items-center justify-between",style:{backgroundColor:"#EDEFF0",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.03) 1px, transparent 1px)",backgroundSize:"20px 20px",borderWidth:"1px",borderStyle:"dashed"},children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-[#DEE3E5] border border-[#BBCCD3] rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(ce,{size:24,style:{color:"#005C75"}})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium mb-1",style:{color:"#3E3E3E"},children:"No Current Activity"}),e.jsxs("p",{className:"text-sm",style:{color:"#8e8e8e"},children:["There are no analyses running. Trigger one from"," ",e.jsx(b,{to:"/git",className:"text-[#005C75] hover:underline font-medium cursor-pointer",children:"Git"})," ","or"," ",e.jsx(b,{to:"/files",className:"text-[#005C75] hover:underline font-medium cursor-pointer",children:"Files"}),"."]})]})]}),e.jsxs(b,{to:"/files",className:"px-4 py-2 bg-[#005C75] text-white rounded-lg text-sm font-medium hover:bg-[#004a5e] transition-colors flex items-center gap-2 whitespace-nowrap no-underline",children:[e.jsx("span",{children:"+"}),e.jsx("span",{children:"New Analysis"})]})]}),i&&i.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-mono uppercase",style:{fontSize:"12px",lineHeight:"18px",color:"#8e8e8e",marginBottom:"16px",fontWeight:500,letterSpacing:"0.05em"},children:"Recently Completed Analyses"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[(A?i:i.slice(0,3)).map(r=>{var p;const m=(p=r.analyses)==null?void 0:p[0],E=(m==null?void 0:m.scenarios)||[];return m==null||m.status,e.jsx("div",{className:"rounded-[8px] p-[15px]",style:{backgroundColor:"#ffffff",border:"1px solid #aff1a9"},children:e.jsxs("div",{className:"flex flex-col gap-[15px]",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(q,{type:r.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex flex-col flex-shrink-0",style:{marginLeft:"15px",gap:"4px"},children:[e.jsxs("div",{className:"flex items-center gap-[5px]",children:[e.jsx(b,{to:`/entity/${r.sha}`,className:"hover:underline cursor-pointer",title:r.name,style:{fontSize:"14px",lineHeight:"18px",color:"#343434",fontWeight:500},children:r.name}),e.jsx("div",{className:"flex items-center justify-center px-2 rounded",style:{height:"20px",backgroundColor:"#e8ffe6",color:"#00925d",fontSize:"12px",lineHeight:"16px",fontWeight:400},children:r.isUncommitted?"Modified":"Up to date"})]}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e",fontWeight:400},className:"font-mono",title:r.filePath,children:r.filePath})]}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx("button",{onClick:a,className:"px-[10px] rounded transition-colors whitespace-nowrap",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",lineHeight:"22px",fontWeight:600},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="#d0dfe3"},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="#e0e9ec"},children:"View Logs"})})]}),e.jsx("div",{className:"border-t border-gray-200 mx-[-15px]"}),E.length>0?e.jsx("div",{className:"flex gap-2.5 overflow-x-auto pb-3 px-[15px] pt-3",style:{paddingLeft:"47px"},children:E.map(l=>{var U,Q,J;if(!l.id)return null;const L=(Q=(U=l.metadata)==null?void 0:U.screenshotPaths)==null?void 0:Q[0],W=(J=l.metadata)==null?void 0:J.noScreenshotSaved,u=L&&!W;return e.jsxs("div",{className:"shrink-0 flex flex-col gap-2",children:[e.jsx(b,{to:`/entity/${r.sha}/scenarios/${l.id}`,className:"block cursor-pointer",children:e.jsx("div",{className:"w-36 h-24 rounded-md border overflow-hidden flex items-center justify-center transition-all",style:{backgroundColor:u?"#f3f4f6":"#FAFAFA",borderColor:u?"#d1d5db":"#BCCDD3",borderStyle:u?"solid":"dashed"},onMouseEnter:F=>{u&&(F.currentTarget.style.borderColor="#005C75",F.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.15)")},onMouseLeave:F=>{F.currentTarget.style.borderColor=u?"#d1d5db":"#BCCDD3",F.currentTarget.style.boxShadow="none"},children:u?e.jsx(Z,{screenshotPath:L,alt:l.name,className:"max-w-full max-h-full object-contain"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center font-mono",style:{backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.02) 1px, transparent 1px)",backgroundSize:"20px 20px",color:"#b0b0b0",fontSize:"11px"},children:"No preview"})})}),e.jsx("div",{className:"text-left text-xs text-gray-600 cursor-default",style:{fontSize:"11px",lineHeight:"14px",maxWidth:"144px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name})]},l.id)})}):e.jsx("div",{className:"italic",style:{fontSize:"12px",color:"#646464",marginLeft:"49px"},children:"No scenarios available"})]})},r.sha)}),i.length>3&&!A&&e.jsxs("button",{onClick:()=>y(!0),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:["+",i.length-3," more"," ",i.length-3===1?"entity":"entities"]}),A&&i.length>3&&e.jsx("button",{onClick:()=>y(!1),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:"Show less"})]})]})]})}function Ne({queueJobs:o,state:s,currentRun:k}){if(!o||o.length===0)return e.jsxs("div",{className:"border border-dashed border-[#BCCDD3] rounded-xl p-6 flex items-center justify-between",style:{backgroundColor:"#EDEFF0",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.03) 1px, transparent 1px)",backgroundSize:"20px 20px",borderWidth:"1px",borderStyle:"dashed"},children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-[#DEE3E5] border border-[#BBCCD3] rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(ue,{size:24,style:{color:"#005C75"}})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium mb-1",style:{color:"#3E3E3E"},children:"No Queued Jobs"}),e.jsx("p",{className:"text-sm",style:{color:"#8e8e8e"},children:"Analysis jobs will appear here when they are queued but not yet started."})]})]}),e.jsxs(b,{to:"/files",className:"px-4 py-2 bg-[#005C75] text-white rounded-lg text-sm font-medium hover:bg-[#004a5e] transition-colors flex items-center gap-2 whitespace-nowrap no-underline",children:[e.jsx("span",{children:"+"}),e.jsx("span",{children:"New Analysis"})]})]});const[g,d]=f.useState(null),[a,i]=f.useState(null),[B,j]=f.useState(null),[z,n]=f.useState(!1),[h,S]=f.useState(!1),[C,D]=f.useState(new Set),w=R();f.useEffect(()=>{o.length<=3&&h&&S(!1)},[o.length,h]);const I=t=>{d(t)},N=(t,x)=>{t.preventDefault(),i(x)},T=async(t,x)=>{if(t.preventDefault(),!g){i(null);return}const v=o.findIndex(y=>y.id===g);if(v===-1){d(null),i(null);return}if(v===x){d(null),i(null);return}const P=v<x?"down":"up",A=Math.abs(x-v);n(!0);try{for(let y=0;y<A;y++)await fetch("/api/queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reorder",jobId:g,direction:P})});w.revalidate()}catch(y){console.error("Failed to reorder job:",y)}finally{n(!1),d(null),i(null)}},H=()=>{z||(d(null),i(null))},M=async t=>{if(confirm("Are you sure you want to cancel this job?"))try{await fetch("/api/queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"remove",jobId:t})}),window.location.reload()}catch(x){console.error("Failed to cancel job:",x)}},$=async()=>{if(confirm(`Are you sure you want to cancel all ${o.length} queued jobs?`))try{await fetch("/api/queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear"})}),window.location.reload()}catch(t){console.error("Failed to cancel jobs:",t)}};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-semibold",style:{fontSize:"16px",lineHeight:"24px",color:"#343434"},children:[o.length," Queued Job",o.length!==1?"s":""]}),o.length>0&&e.jsx("button",{onClick:()=>void $(),className:"px-[10px] py-0 rounded transition-colors cursor-pointer hover:bg-red-300",style:{backgroundColor:"#ffdcd9",color:"#ef4444",fontSize:"12px",fontWeight:500,height:"29px"},children:"Cancel All"})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[(h?o:o.slice(0,3)).map(t=>{var _,O,K,V;const x=o.findIndex(c=>c.id===t.id),v=B===x,P=g===t.id,A=a===x,y=C.has(t.id),Y=((_=t.entities)==null?void 0:_.length)>0?y?t.entities:t.entities.slice(0,3):[];return e.jsxs("div",{className:"rounded-lg p-4 relative",style:{backgroundColor:"#f6f9fc",border:"1px solid #005C75",opacity:P||z?.5:1,transform:A&&g!==null&&!P?"translateY(-2px)":"translateY(0)",transition:"transform 0.2s ease, opacity 0.2s ease",cursor:z?"not-allowed":P?"grabbing":"grab"},onMouseEnter:()=>j(x),onMouseLeave:()=>j(null),draggable:!z,onDragStart:c=>{I(t.id),c.dataTransfer.effectAllowed="move"},onDragOver:c=>N(c,x),onDrop:c=>void T(c,x),onDragEnd:H,children:[e.jsxs("div",{className:"absolute left-4 top-4 flex items-center gap-1.5 flex-shrink-0",children:[e.jsx(fe,{size:16,style:{color:"#005C75"}}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:500,lineHeight:"18px",color:"#005C75"},children:["Job ",x+1]})]}),e.jsxs("div",{className:"flex flex-col gap-2 mt-8",children:[Y.length>0?e.jsxs(e.Fragment,{children:[Y.map(c=>e.jsx("div",{className:"bg-white rounded",style:{border:"1px solid #e1e1e1",height:"60px"},children:e.jsx("div",{className:"flex items-center justify-between h-full px-[15px]",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{children:e.jsx(q,{type:c.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(b,{to:`/entity/${c.sha}`,className:"hover:underline cursor-pointer",style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#000"},children:c.name}),c.entityType&&e.jsx(ee,{type:c.entityType})]}),e.jsx("div",{className:"font-mono",style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e"},children:c.filePath})]})]})})},c.sha)),((O=t.entities)==null?void 0:O.length)>3&&e.jsx("button",{onClick:()=>{D(c=>{const r=new Set(c);return r.has(t.id)?r.delete(t.id):r.add(t.id),r})},className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"40px",fontSize:"12px",color:"#646464",fontWeight:500},children:y?"Show less":`+${t.entities.length-3} more ${t.entities.length-3===1?"entity":"entities"}`})]}):e.jsx("div",{className:"bg-white rounded",style:{border:"1px solid #e1e1e1",height:"60px"},children:e.jsx("div",{className:"flex items-center justify-between h-full px-[15px]",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{style:{transform:"scale(1.0)"},children:e.jsx(de,{size:18,style:{color:"#8e8e8e"}})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#000"},children:((K=t.entityNames)==null?void 0:K[0])||(t.type==="analysis"?"Analysis Job":t.type==="recapture"?"Recapture Job":t.type==="debug-setup"?"Debug Setup":t.type.charAt(0).toUpperCase()+t.type.slice(1))}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e"},children:((V=t.filePaths)==null?void 0:V[0])||(t.filePaths&&t.filePaths.length>1?`${t.filePaths.length} files`:t.entityShas&&t.entityShas.length>0?`${t.entityShas.length} ${t.entityShas.length===1?"entity":"entities"}`:"Queued for processing")})]})]})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 mt-1",children:[v&&e.jsx("div",{className:"cursor-grab active:cursor-grabbing",style:{color:"#8e8e8e"},title:"Drag to reorder",children:e.jsx(me,{size:20})}),e.jsx("button",{onClick:()=>void M(t.id),className:"transition-colors cursor-pointer hover:bg-red-100 rounded flex items-center justify-center",style:{fontSize:"10px",fontWeight:600,lineHeight:"22px",color:"#ef4444",backgroundColor:"#fef6f6",padding:"0 10px",height:"22px"},children:"Cancel"})]})]})]},t.id)}),o.length>3&&!h&&e.jsxs("button",{onClick:()=>S(!0),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:["+",o.length-3," more"," ",o.length-3===1?"job":"jobs"]}),h&&o.length>3&&e.jsx("button",{onClick:()=>S(!1),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:"Show less"})]})]})}function Se({historicalRuns:o,totalHistoricalRuns:s,currentPage:k,totalPages:g,tab:d,onShowLogs:a}){if(s===0)return e.jsxs("div",{className:"border border-dashed border-[#BCCDD3] rounded-xl p-6 flex items-center justify-between",style:{backgroundColor:"#EDEFF0",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.03) 1px, transparent 1px)",backgroundSize:"20px 20px",borderWidth:"1px",borderStyle:"dashed"},children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-[#DEE3E5] border border-[#BBCCD3] rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(xe,{size:24,style:{color:"#005C75"}})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium mb-1",style:{color:"#3E3E3E"},children:"No Historic Activity"}),e.jsx("p",{className:"text-sm",style:{color:"#8e8e8e"},children:"Completed analyses will appear here for historical reference."})]})]}),e.jsxs(b,{to:"/files",className:"px-4 py-2 bg-[#005C75] text-white rounded-lg text-sm font-medium hover:bg-[#004a5e] transition-colors flex items-center gap-2 whitespace-nowrap no-underline",children:[e.jsx("span",{children:"+"}),e.jsx("span",{children:"New Analysis"})]})]});const[i,B]=f.useState(!1),j=[];o.forEach(n=>{n.entities&&n.entities.length>0&&n.entities.forEach(h=>{j.push({...h,runCreatedAt:n.createdAt})})});const z=i?j:j.slice(0,3);return e.jsxs("div",{className:"flex flex-col gap-4",children:[z.map(n=>{var D;const h=(D=n.analyses)==null?void 0:D[0],S=(h==null?void 0:h.scenarios)||[],C=!n.isUncommitted;return e.jsxs("div",{className:"rounded-lg p-4",style:{backgroundColor:C?"#ffffff":"#fef9e7",border:"1px solid",borderColor:C?"#aff1a9":"#f9d689"},children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[e.jsx("div",{children:e.jsx(q,{type:n.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(b,{to:`/entity/${n.sha}`,className:"hover:underline cursor-pointer",style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#343434"},children:n.name}),e.jsx("div",{className:"px-2 py-0.5 rounded",style:{backgroundColor:C?"#e8ffe6":"#fef3cd",color:C?"#00925d":"#a16207",fontSize:"12px",fontWeight:400},children:C?"Up to date":"Out of date"})]}),e.jsx("div",{className:"font-mono",style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e"},title:n.filePath,children:n.filePath})]})]}),e.jsx("button",{onClick:a,className:"px-3 py-1 rounded transition-colors whitespace-nowrap cursor-pointer",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",fontWeight:600},children:"View Logs"})]}),S.length>0&&e.jsxs("div",{className:"flex gap-2 overflow-x-auto",style:{marginLeft:"44px"},children:[S.slice(0,8).map(w=>{var H,M,$;if(!w.id)return null;const I=(M=(H=w.metadata)==null?void 0:H.screenshotPaths)==null?void 0:M[0],N=($=w.metadata)==null?void 0:$.noScreenshotSaved,T=I&&!N;return e.jsx(b,{to:`/entity/${n.sha}/scenarios/${w.id}`,className:"border rounded overflow-hidden flex-shrink-0 cursor-pointer",style:{width:"120px",height:"80px",borderColor:T?"#ccc":"#BCCDD3",borderStyle:T?"solid":"dashed"},children:T?e.jsx(Z,{screenshotPath:I,alt:w.name,className:"w-full h-full object-cover bg-gray-100"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center font-mono",style:{backgroundColor:"#FAFAFA",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.02) 1px, transparent 1px)",backgroundSize:"20px 20px",color:"#b0b0b0",fontSize:"11px"},children:"No preview"})},w.id)}),S.length>8&&e.jsxs("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:"120px",height:"80px",fontSize:"12px",color:"#646464"},children:["+",S.length-8," more"]})]})]},`${n.sha}-${n.runCreatedAt}`)}),j.length>3&&!i&&e.jsxs("button",{onClick:()=>B(!0),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:["+",j.length-3," more"," ",j.length-3===1?"entity":"entities"]}),i&&j.length>3&&e.jsx("button",{onClick:()=>B(!1),className:"flex items-center justify-center bg-gray-50 border border-gray-200 rounded-[4px] hover:bg-gray-100 hover:border-gray-300 transition-colors cursor-pointer w-full",style:{height:"60px",fontSize:"14px",color:"#646464",fontWeight:500},children:"Show less"})]})}const Fe=se(function(){const s=te(),k=re(),[g,d]=f.useState(!1);le({source:"activity-page"});const a=k.tab||"current";return s?e.jsxs("div",{className:"px-20 py-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900 mb-2",children:"Activity"}),e.jsx("p",{className:"text-[15px] text-gray-500",children:"View queued, current, and historical analysis activity."})]}),e.jsx(je,{activeTab:a,hasCurrentActivity:s.hasCurrentActivity,queuedCount:s.queuedCount,historicCount:s.totalHistoricalRuns}),a==="current"&&e.jsx(ve,{currentlyExecuting:s.currentlyExecuting,currentRun:s.currentRun,state:s.state,projectSlug:s.projectSlug,commitSha:s.commitSha,onShowLogs:()=>d(!0),recentCompletedEntities:s.recentCompletedEntities||[],hasMoreCompletedRuns:s.hasMoreCompletedRuns||!1,currentEntityScenarios:s.currentEntityScenarios||[],currentEntityForScenarios:s.currentEntityForScenarios,currentAnalysisStatus:s.currentAnalysisStatus}),a==="queued"&&e.jsx(Ne,{queueJobs:s.queueJobs,state:s.state,currentRun:s.currentRun}),a==="historic"&&e.jsx(Se,{historicalRuns:s.historicalRuns,totalHistoricalRuns:s.totalHistoricalRuns,currentPage:s.currentPage,totalPages:s.totalPages,tab:a,onShowLogs:()=>d(!0)}),g&&s.projectSlug&&e.jsx(oe,{projectSlug:s.projectSlug,onClose:()=>d(!1)})]}):e.jsx("div",{className:"px-20 py-12",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-gray-600",children:"Loading..."})})})});export{Fe as default,$e as meta};
@@ -1 +1 @@
1
- import{g as O}from"./chunk-JZWAC4HX-C4pqxYJB.js";function j(b,k){for(var _=0;_<k.length;_++){const l=k[_];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in b)){const L=Object.getOwnPropertyDescriptor(l,u);L&&Object.defineProperty(b,u,L.get?L:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var w={exports:{}},$;function A(){return $||($=1,(function(b,k){(function(_,l){b.exports=l()})(self,(()=>(()=>{var _={6:(p,d)=>{function h(n){try{const e=new URL(n),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return n.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(d,"__esModule",{value:!0}),d.LinkComputer=d.WebLinkProvider=void 0,d.WebLinkProvider=class{constructor(n,e,t,r={}){this._terminal=n,this._regex=e,this._handler=t,this._options=r}provideLinks(n,e){const t=f.computeLink(n,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(n){return n.map((e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:c}=e;this._options.hover(t,r,c)}},e)))}};class f{static computeLink(e,t,r,c){const g=new RegExp(t.source,(t.flags||"")+"g"),[o,s]=f._getWindowedLineStrings(e-1,r),i=o.join("");let a;const x=[];for(;a=g.exec(i);){const v=a[0];if(!h(v))continue;const[m,W]=f._mapStrIdx(r,s,0,a.index),[y,P]=f._mapStrIdx(r,m,W,v.length);if(m===-1||W===-1||y===-1||P===-1)continue;const S={start:{x:W+1,y:m+1},end:{x:P,y:y+1}};x.push({range:S,text:v,activate:c})}return x}static _getWindowedLineStrings(e,t){let r,c=e,g=e,o=0,s="";const i=[];if(r=t.buffer.active.getLine(e)){const a=r.translateToString(!0);if(r.isWrapped&&a[0]!==" "){for(o=0;(r=t.buffer.active.getLine(--c))&&o<2048&&(s=r.translateToString(!0),o+=s.length,i.push(s),r.isWrapped&&s.indexOf(" ")===-1););i.reverse()}for(i.push(a),o=0;(r=t.buffer.active.getLine(++g))&&r.isWrapped&&o<2048&&(s=r.translateToString(!0),o+=s.length,i.push(s),s.indexOf(" ")===-1););}return[i,c]}static _mapStrIdx(e,t,r,c){const g=e.buffer.active,o=g.getNullCell();let s=r;for(;c;){const i=g.getLine(t);if(!i)return[-1,-1];for(let a=s;a<i.length;++a){i.getCell(a,o);const x=o.getChars();if(o.getWidth()&&(c-=x.length||1,a===i.length-1&&x==="")){const v=g.getLine(t+1);v&&v.isWrapped&&(v.getCell(0,o),o.getWidth()===2&&(c+=1))}if(c<0)return[t,a]}t++,s=0}return[t,s]}}d.LinkComputer=f}},l={};function u(p){var d=l[p];if(d!==void 0)return d.exports;var h=l[p]={exports:{}};return _[p](h,h.exports,u),h.exports}var L={};return(()=>{var p=L;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const d=u(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(n,e){const t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(n=f,e={}){this._handler=n,this._options=e}activate(n){this._terminal=n;const e=this._options,t=e.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new d.WebLinkProvider(this._terminal,t,this._handler,e))}dispose(){var n;(n=this._linkProvider)==null||n.dispose()}}})(),L})()))})(w)),w.exports}var C=A();const T=O(C),E=j({__proto__:null,default:T},[C]);export{E as a};
1
+ import{g as O}from"./chunk-JZWAC4HX-BBXArFPl.js";function j(b,k){for(var _=0;_<k.length;_++){const l=k[_];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in b)){const L=Object.getOwnPropertyDescriptor(l,u);L&&Object.defineProperty(b,u,L.get?L:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var w={exports:{}},$;function A(){return $||($=1,(function(b,k){(function(_,l){b.exports=l()})(self,(()=>(()=>{var _={6:(p,d)=>{function h(n){try{const e=new URL(n),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return n.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(d,"__esModule",{value:!0}),d.LinkComputer=d.WebLinkProvider=void 0,d.WebLinkProvider=class{constructor(n,e,t,r={}){this._terminal=n,this._regex=e,this._handler=t,this._options=r}provideLinks(n,e){const t=f.computeLink(n,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(n){return n.map((e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:c}=e;this._options.hover(t,r,c)}},e)))}};class f{static computeLink(e,t,r,c){const g=new RegExp(t.source,(t.flags||"")+"g"),[o,s]=f._getWindowedLineStrings(e-1,r),i=o.join("");let a;const x=[];for(;a=g.exec(i);){const v=a[0];if(!h(v))continue;const[m,W]=f._mapStrIdx(r,s,0,a.index),[y,P]=f._mapStrIdx(r,m,W,v.length);if(m===-1||W===-1||y===-1||P===-1)continue;const S={start:{x:W+1,y:m+1},end:{x:P,y:y+1}};x.push({range:S,text:v,activate:c})}return x}static _getWindowedLineStrings(e,t){let r,c=e,g=e,o=0,s="";const i=[];if(r=t.buffer.active.getLine(e)){const a=r.translateToString(!0);if(r.isWrapped&&a[0]!==" "){for(o=0;(r=t.buffer.active.getLine(--c))&&o<2048&&(s=r.translateToString(!0),o+=s.length,i.push(s),r.isWrapped&&s.indexOf(" ")===-1););i.reverse()}for(i.push(a),o=0;(r=t.buffer.active.getLine(++g))&&r.isWrapped&&o<2048&&(s=r.translateToString(!0),o+=s.length,i.push(s),s.indexOf(" ")===-1););}return[i,c]}static _mapStrIdx(e,t,r,c){const g=e.buffer.active,o=g.getNullCell();let s=r;for(;c;){const i=g.getLine(t);if(!i)return[-1,-1];for(let a=s;a<i.length;++a){i.getCell(a,o);const x=o.getChars();if(o.getWidth()&&(c-=x.length||1,a===i.length-1&&x==="")){const v=g.getLine(t+1);v&&v.isWrapped&&(v.getCell(0,o),o.getWidth()===2&&(c+=1))}if(c<0)return[t,a]}t++,s=0}return[t,s]}}d.LinkComputer=f}},l={};function u(p){var d=l[p];if(d!==void 0)return d.exports;var h=l[p]={exports:{}};return _[p](h,h.exports,u),h.exports}var L={};return(()=>{var p=L;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const d=u(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(n,e){const t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(n=f,e={}){this._handler=n,this._options=e}activate(n){this._terminal=n;const e=this._options,t=e.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new d.WebLinkProvider(this._terminal,t,this._handler,e))}dispose(){var n;(n=this._linkProvider)==null||n.dispose()}}})(),L})()))})(w)),w.exports}var C=A();const T=O(C),E=j({__proto__:null,default:T},[C]);export{E as a};
@@ -1,4 +1,4 @@
1
- import{w as O,u as P,a as I,i as B,r as m,j as e,L as D}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as U}from"./useReportContext-O-jkvSPx.js";import{c as w}from"./createLucideIcon-CC6AbExI.js";import{T as F,C as N}from"./terminal-Br7MOqts.js";import{S as V}from"./search-Di64LWVb.js";import{C as _}from"./chevron-down-C_Pmso5S.js";import{B as A}from"./book-open-BYOypzCa.js";import{T as H}from"./triangle-alert-BLdiCuG-.js";import{C as q,a as z}from"./copy-n2FB0_Sw.js";/**
1
+ import{w as O,u as P,a as I,i as B,r as m,L as D}from"./chunk-JZWAC4HX-BBXArFPl.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{u as U}from"./useReportContext-BermyNU5.js";import{c as w}from"./createLucideIcon-DJB0YQJL.js";import{T as F,C as N}from"./terminal-BgMmG7R9.js";import{S as V}from"./search-C0Uw0bcK.js";import{C as _}from"./chevron-down-BZ2DZxbW.js";import{B as A}from"./book-open-CLaoh4ac.js";import{T as H}from"./triangle-alert-Cs87hJYK.js";import{C as q,a as z}from"./copy-zK0B6Nu-.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -18,5 +18,5 @@ import{w as O,u as P,a as I,i as B,r as m,j as e,L as D}from"./chunk-JZWAC4HX-C4
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const Q=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Z=w("save",Q),Ne=()=>[{title:"Agent Transcripts - CodeYam"},{name:"description",content:"View background agent transcripts and tool call history"}];function ee(s){if(!s)return"";try{return new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return s}}function se(s){if(!s)return"";try{return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}catch{return s}}function te(s){return s.includes("opus")?"Opus":s.includes("sonnet")?"Sonnet":s.includes("haiku")?"Haiku":s}function v({type:s,toolName:t}){const a={user_prompt:"bg-[#00b4d8] text-black",assistant_text:"bg-[#a8dadc] text-black",tool_call:"bg-[#f4a261] text-black",tool_result:"bg-[#2a9d8f] text-black",context:"bg-[#7c3aed] text-white"},r={user_prompt:"USER",assistant_text:"ASSISTANT",tool_call:t||"TOOL",tool_result:"RESULT",context:"CONTEXT"};return e.jsx("span",{className:`inline-block px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wide ${a[s]||"bg-gray-300 text-black"}`,children:r[s]||s})}function re({input:s}){return e.jsx("div",{className:"text-xs font-mono space-y-1",children:Object.entries(s).map(([t,a])=>{let r=typeof a=="string"?a:JSON.stringify(a);return r.length>500&&(r=r.slice(0,500)+"..."),e.jsxs("div",{children:[e.jsxs("span",{className:"text-[#f4a261] font-bold",children:[t,":"]})," ",e.jsx("span",{className:"text-gray-700",children:r})]},t)})})}function ae({content:s,truncated:t,fullLength:a}){const[r,l]=m.useState(!1);return e.jsxs("div",{children:[e.jsxs("pre",{className:"whitespace-pre-wrap break-words text-xs max-h-96 overflow-y-auto text-gray-700",children:[s,t&&!r&&"..."]}),t&&e.jsx("button",{onClick:()=>l(!r),className:"text-[11px] text-gray-500 hover:text-gray-700 mt-1 font-mono cursor-pointer",children:r?"Show less":`Show more (${(a||0)-s.length} more chars)`})]})}function ne({entry:s,pairedResult:t}){const[a,r]=m.useState(!1),l=ee(s.timestamp||"");return s.type==="user_prompt"?e.jsxs("div",{className:"my-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(v,{type:"user_prompt"}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono",children:l})]}),e.jsx("pre",{className:"bg-white border border-gray-200 rounded-md p-3 whitespace-pre-wrap break-words text-xs font-mono border-l-[3px] border-l-[#00b4d8] max-h-72 overflow-y-auto text-gray-800",children:s.text})]}):s.type==="assistant_text"?e.jsxs("div",{className:"my-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(v,{type:"assistant_text"}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono",children:l})]}),e.jsx("div",{className:"bg-white border border-gray-200 rounded-md p-3 whitespace-pre-wrap break-words text-sm border-l-[3px] border-l-[#a8dadc] text-gray-800",children:s.text})]}):s.type==="tool_call"?e.jsxs("div",{className:"my-2",children:[e.jsxs("button",{onClick:()=>r(!a),className:"flex items-center gap-2 w-full text-left bg-white border border-gray-200 rounded-md px-3 py-2 hover:bg-gray-50 cursor-pointer",children:[a?e.jsx(_,{className:"w-3 h-3 text-gray-400 flex-shrink-0"}):e.jsx(N,{className:"w-3 h-3 text-gray-400 flex-shrink-0"}),e.jsx(v,{type:"tool_call",toolName:s.name}),e.jsx("span",{className:"text-xs text-gray-500 font-mono truncate flex-1",children:s.summary||""}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono flex-shrink-0",children:l})]}),a&&e.jsxs("div",{className:"bg-white border border-t-0 border-gray-200 rounded-b-md px-3 py-2 border-l-[3px] border-l-[#f4a261]",children:[e.jsx(re,{input:s.input||{}}),t&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200",children:[e.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wide text-[#2a9d8f] mb-1",children:["Result",t.is_error?" (Error)":"",":"]}),e.jsx(ae,{content:t.content||"",truncated:t.truncated,fullLength:t.fullLength})]})]})]}):(s.type==="tool_result",null)}function oe({context:s}){const[t,a]=m.useState(!1);return e.jsxs("div",{className:"my-2",children:[e.jsxs("button",{onClick:()=>a(!t),className:"flex items-center gap-2 mb-1 cursor-pointer hover:opacity-80",children:[t?e.jsx(_,{className:"w-3 h-3 text-gray-400"}):e.jsx(N,{className:"w-3 h-3 text-gray-400"}),e.jsx(v,{type:"context"}),e.jsx("span",{className:"text-xs text-gray-500",children:"Full prompt context"})]}),t&&e.jsx("pre",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 whitespace-pre-wrap break-words text-xs font-mono border-l-[3px] border-l-[#7c3aed] max-h-96 overflow-y-auto text-gray-700",children:s})]})}function le({snippet:s}){const[t,a]=m.useState(!1),r=s.split(`
22
- `).filter(c=>c.trim()),l=r.slice(0,4),x=r.length>4,i=t?r:l;return e.jsxs("div",{className:"my-2 bg-blue-50 border border-blue-200 rounded-md p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(G,{className:"w-3.5 h-3.5 text-blue-600"}),e.jsx("span",{className:"text-xs font-bold text-blue-800",children:"Source Conversation"}),e.jsxs("span",{className:"text-[10px] text-blue-500",children:[r.length," message",r.length!==1?"s":""]})]}),e.jsx("div",{className:"space-y-1",children:i.map((c,d)=>{const h=c.match(/^\[(\w+)\]:\s*(.*)/);if(!h)return null;const[,g,u]=h,f=g==="user";return e.jsxs("div",{className:"text-xs",children:[e.jsxs("span",{className:`font-bold ${f?"text-blue-700":"text-gray-500"}`,children:[f?"User":"Assistant",":"]})," ",e.jsx("span",{className:"text-gray-700",children:u.length>200?u.slice(0,200)+"...":u})]},d)})}),x&&e.jsx("button",{onClick:()=>a(!t),className:"text-[11px] text-blue-600 hover:text-blue-800 mt-2 font-mono cursor-pointer",children:t?"Show less":`Show all ${r.length} messages`})]})}function ie({change:s}){const[t,a]=m.useState(!1),r=s.action==="created"?!!s.content:s.action==="modified"?!!(s.oldString||s.newString):!1;return e.jsxs("li",{children:[e.jsx("button",{onClick:()=>r&&a(!t),className:`text-left w-full ${r?"hover:text-green-900 cursor-pointer":""}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[r&&(t?e.jsx(_,{className:"w-3 h-3 inline flex-shrink-0"}):e.jsx(N,{className:"w-3 h-3 inline flex-shrink-0"})),s.action==="created"?"Created":"Modified"," ",s.filePath]})}),t&&s.action==="created"&&s.content&&e.jsx("pre",{className:"mt-1 mb-2 ml-4 p-2 bg-white border border-green-200 rounded text-[11px] text-gray-700 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:s.content}),t&&s.action==="modified"&&e.jsxs("div",{className:"mt-1 mb-2 ml-4 space-y-1",children:[s.oldString&&e.jsxs("pre",{className:"p-2 bg-red-50 border border-red-200 rounded text-[11px] text-red-800 whitespace-pre-wrap break-words max-h-32 overflow-y-auto",children:["- ",s.oldString]}),s.newString&&e.jsxs("pre",{className:"p-2 bg-green-50 border border-green-300 rounded text-[11px] text-green-800 whitespace-pre-wrap break-words max-h-32 overflow-y-auto",children:["+ ",s.newString]})]})]})}function ce({changes:s}){const t=s.filter(i=>i.action==="touched"),a=s.filter(i=>i.action!=="touched"),r=a.some(i=>i.action==="created"),l=a.some(i=>i.action==="modified"),x=r?"bg-green-50 border-green-200 text-green-800 [&_ul]:text-green-700":l?"bg-amber-50 border-amber-200 text-amber-800 [&_ul]:text-amber-700":"bg-gray-50 border-gray-200 text-gray-600 [&_ul]:text-gray-500";return e.jsxs("div",{className:`my-2 border rounded-md p-3 ${x}`,children:[e.jsx("div",{className:"text-xs font-bold mb-1",children:"Rule Changes:"}),e.jsxs("ul",{className:"text-xs space-y-0.5 font-mono",children:[a.map((i,c)=>e.jsx(ie,{change:i},c)),t.length>0&&e.jsxs("li",{children:["Touched timestamps on ",t.length," rule",t.length!==1?"s":""]})]})]})}function de({result:s}){const t=s.is_error,a=t?"bg-red-50 border-red-200":"bg-green-50 border-green-200",r=t?"text-red-800":"text-green-800",l=t?"text-red-700":"text-green-700",x=s.subtype.replace(/^error_/,"").replace(/_/g," "),i=d=>d>=6e4?`${(d/6e4).toFixed(1)}m`:`${(d/1e3).toFixed(1)}s`,c=d=>d>=1e3?`${(d/1e3).toFixed(1)}k`:String(d);return e.jsxs("div",{className:`my-2 border rounded-md p-3 ${a}`,children:[e.jsxs("div",{className:`text-xs font-bold mb-1 ${r}`,children:["Session Result: ",x]}),e.jsxs("div",{className:`text-xs ${l} font-mono space-y-0.5`,children:[e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5",children:[s.duration_ms!=null&&e.jsxs("span",{children:["Duration: ",i(s.duration_ms)]}),s.duration_api_ms!=null&&e.jsxs("span",{children:["API time: ",i(s.duration_api_ms)]}),s.num_turns!=null&&e.jsxs("span",{children:["Turns: ",s.num_turns]}),s.total_cost_usd!=null&&e.jsxs("span",{children:["Cost: $",s.total_cost_usd.toFixed(4)]})]}),s.usage&&e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 mt-1",children:[s.usage.input_tokens!=null&&e.jsxs("span",{children:["Input: ",c(s.usage.input_tokens)]}),s.usage.output_tokens!=null&&e.jsxs("span",{children:["Output: ",c(s.usage.output_tokens)]}),s.usage.cache_read_input_tokens!=null&&e.jsxs("span",{children:["Cache read: ",c(s.usage.cache_read_input_tokens)]}),s.usage.cache_creation_input_tokens!=null&&e.jsxs("span",{children:["Cache write:"," ",c(s.usage.cache_creation_input_tokens)]})]}),s.errors&&s.errors.length>0&&e.jsx("div",{className:"mt-1",children:s.errors.map((d,h)=>e.jsx("div",{className:"text-red-700 break-words",children:d},h))})]})]})}function xe({agent:s,defaultOpen:t,isAdmin:a}){var $,E,R;const[r,l]=m.useState(t),[x,i]=m.useState(!1),[c,d]=m.useState(null),[h,g]=m.useState(!1),u=m.useMemo(()=>{const n={};for(const o of s.entries)o.type==="tool_result"&&o.tool_use_id&&(n[o.tool_use_id]=o);return n},[s.entries]),f=m.useMemo(()=>{const n=new Set;for(const o of s.entries)o.type==="tool_call"&&o.tool_use_id&&u[o.tool_use_id]&&n.add(o.tool_use_id);return n},[s.entries,u]),S=n=>{n.stopPropagation(),i(!0),d(null),fetch("/api/save-fixture",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s.id})}).then(o=>o.json()).then(o=>{o.success?d(`Saved to ${o.fixturePath}`):d(`Error: ${o.error}`)}).catch(o=>{d(`Error: ${o instanceof Error?o.message:String(o)}`)}).finally(()=>{i(!1)})},y=(s.ruleChanges||[]).filter(n=>n.action!=="touched"),b=y.filter(n=>n.action==="created"),j=y.filter(n=>n.action==="modified"),p=(s.ruleChanges||[]).filter(n=>n.action==="touched"),k=y.length>0,T=p.length>0,L=k||T;return e.jsxs("div",{className:`bg-white border rounded-lg overflow-hidden mb-4 ${s.stats.errors>0?"border-red-300":b.length>0?"border-green-300":j.length>0?"border-amber-300":"border-gray-200"}`,children:[e.jsxs("button",{onClick:()=>l(!r),className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-gray-50 cursor-pointer",children:[r?e.jsx(_,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}):e.jsx(N,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-bold text-[#005C75] font-mono",children:s.id.slice(0,8)}),s.slug&&e.jsx("span",{className:"text-xs text-gray-500",children:s.slug}),s.model&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-purple-100 text-purple-700",title:s.model,children:te(s.model)}),b.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-green-100 text-green-800",children:[e.jsx(A,{className:"w-3 h-3"}),b.length," rule",b.length!==1?"s":""," ","created"]}),j.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-100 text-amber-800",children:[e.jsx(A,{className:"w-3 h-3"}),j.length," rule",j.length!==1?"s":""," ","modified"]}),!k&&T&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-gray-100 text-gray-500",children:[p.length," timestamp",p.length!==1?"s":""," ","touched"]}),s.stats.errors>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-red-100 text-red-800",children:[e.jsx(H,{className:"w-3 h-3 flex-shrink-0"}),s.stats.errors," ",s.stats.errors===1?"Error":"Errors"]}),e.jsxs("span",{className:"text-[11px] text-gray-400 font-mono",children:[s.stats.toolCalls," tool calls, ",s.stats.textBlocks," text blocks",(($=s.sessionResult)==null?void 0:$.duration_ms)!=null&&e.jsxs(e.Fragment,{children:[" · ",s.sessionResult.duration_ms>=6e4?`${(s.sessionResult.duration_ms/6e4).toFixed(1)}m`:`${(s.sessionResult.duration_ms/1e3).toFixed(1)}s`]}),((E=s.sessionResult)==null?void 0:E.total_cost_usd)!=null&&e.jsxs(e.Fragment,{children:[" · ","$",s.sessionResult.total_cost_usd.toFixed(2)]})]}),e.jsxs("span",{className:"text-[11px] text-gray-400 font-mono ml-auto flex items-center gap-2",children:[se(s.timestamp),a&&k&&e.jsxs("button",{onClick:S,disabled:x,className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] font-bold bg-gray-100 text-gray-600 hover:bg-gray-200 disabled:opacity-50 cursor-pointer",title:"Save as test fixture",children:[e.jsx(Z,{className:"w-3 h-3"}),x?"Saving...":"Save Fixture"]})]})]}),c&&e.jsx("div",{className:`px-4 py-2 text-xs font-mono ${c.startsWith("Error")?"bg-red-50 text-red-700":"bg-green-50 text-green-700"}`,children:c}),r&&e.jsxs("div",{className:"px-4 pb-4 border-t border-gray-100",children:[s.sourceFile&&e.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-gray-500 font-mono",children:[e.jsx("span",{className:"text-gray-400",children:"FILE:"}),e.jsx("span",{className:"truncate",children:s.sourceFile}),e.jsx("button",{onClick:n=>{n.stopPropagation(),navigator.clipboard.writeText(s.sourceFile),g(!0),setTimeout(()=>g(!1),2e3)},className:"p-0.5 rounded text-gray-400 hover:text-gray-600 cursor-pointer transition-colors flex-shrink-0",title:"Copy file path",children:h?e.jsx(q,{className:"w-3.5 h-3.5 text-green-500"}):e.jsx(z,{className:"w-3.5 h-3.5"})})]}),s.sessionResult&&e.jsx(de,{result:s.sessionResult}),s.stats.errors>0&&((R=s.stats.errorMessages)==null?void 0:R.length)>0&&e.jsxs("div",{className:"my-2 bg-red-50 border border-red-200 rounded-md p-3",children:[e.jsxs("div",{className:"text-xs font-bold text-red-800 mb-1",children:[s.stats.errors," Error",s.stats.errors!==1?"s":"",":"]}),e.jsx("ul",{className:"text-xs text-red-700 space-y-1 font-mono",children:s.stats.errorMessages.map((n,o)=>e.jsx("li",{className:"break-words",children:n},o))})]}),s.conversationSnippet&&e.jsx(le,{snippet:s.conversationSnippet}),L&&e.jsx(ce,{changes:s.ruleChanges}),s.context&&e.jsx(oe,{context:s.context}),s.entries.map((n,o)=>{if(n.type==="tool_result"&&n.tool_use_id&&f.has(n.tool_use_id))return null;const M=n.type==="tool_call"&&n.tool_use_id?u[n.tool_use_id]:void 0;return e.jsx(ne,{entry:n,pairedResult:M},`${s.id}-${o}`)})]})]})}function C(s,t){const a=new URLSearchParams;t&&a.set("search",t),s>1&&a.set("page",String(s));const r=a.toString();return`/agent-transcripts${r?`?${r}`:""}`}const ve=O(function(){const{agents:t,error:a,search:r,page:l,totalPages:x}=P(),i=I(),c=B("root"),d=(c==null?void 0:c.isAdmin)??!1,[h,g]=m.useState(r),[u,f]=m.useState(!1),[S,y]=m.useState(0);U({source:"agent-transcripts-page"});const b=p=>{p.preventDefault(),window.location.href=C(1,h)},j=()=>{f(!u),y(p=>p+1)};return a?e.jsx("div",{className:"bg-[#F8F7F6] min-h-screen",children:e.jsxs("div",{className:"px-12 py-6 font-sans",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900",children:"Error"}),e.jsx("p",{className:"text-base text-gray-500",children:a})]})}):e.jsx("div",{className:"bg-[#f9f9f9] min-h-screen",children:e.jsxs("div",{className:"px-20 py-12 font-sans",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("button",{onClick:()=>{i("/memory")},className:"text-gray-600 hover:text-[#005C75] transition-colors cursor-pointer",title:"Back to Memory","aria-label":"Back to Memory",children:e.jsx(K,{className:"w-5 h-5"})}),e.jsx(F,{className:"w-6 h-6 text-[#232323]"}),e.jsx("h1",{className:"text-[24px] font-semibold mb-0",style:{fontFamily:"Sora",color:"#232323"},children:"Agent Transcripts"})]}),e.jsx("p",{className:"text-[15px] text-gray-500 ml-14",children:"View background agent transcripts and tool call history"})]}),e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsxs("form",{onSubmit:b,className:"relative flex-1 max-w-md",children:[e.jsx(V,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",value:h,onChange:p=>g(p.target.value),placeholder:"Search transcripts...",className:"w-full pl-10 pr-4 py-2 border border-gray-200 rounded-md bg-white focus:outline-none focus:ring-2 focus:ring-[#005C75] focus:border-transparent text-sm"})]}),e.jsx("button",{onClick:j,className:"text-xs text-[#005C75] hover:underline cursor-pointer font-mono uppercase font-semibold",children:u?"Collapse All":"Expand All"})]}),e.jsxs("div",{className:"text-sm text-gray-500 mb-4",children:["Page ",l," of ",x,r&&e.jsxs("span",{children:[" ","matching “",r,"”",e.jsx(D,{to:"/agent-transcripts",className:"text-[#005C75] hover:underline ml-2",children:"Clear"})]})]}),t.length===0?e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-12 text-center",children:[e.jsx(F,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No Agent Transcripts Found"}),e.jsx("p",{className:"text-gray-500",children:"Background agent output files will appear here when available."})]}):e.jsx("div",{children:t.map(p=>e.jsx(xe,{agent:p,defaultOpen:u,isAdmin:d},p.id))},S),x>1&&e.jsxs("div",{className:"flex items-center justify-center gap-3 mt-8",children:[e.jsxs("a",{href:l>1?C(l-1,r):void 0,className:`inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-sm font-medium ${l>1?"bg-white border border-gray-200 text-gray-700 hover:bg-gray-50 cursor-pointer":"bg-gray-100 text-gray-400 pointer-events-none"}`,children:[e.jsx(X,{className:"w-4 h-4"}),"Prev"]}),e.jsxs("span",{className:"text-sm text-gray-500 font-mono",children:[l," / ",x]}),e.jsxs("a",{href:l<x?C(l+1,r):void 0,className:`inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-sm font-medium ${l<x?"bg-white border border-gray-200 text-gray-700 hover:bg-gray-50 cursor-pointer":"bg-gray-100 text-gray-400 pointer-events-none"}`,children:["Next",e.jsx(N,{className:"w-4 h-4"})]})]})]})})});export{ve as default,Ne as meta};
21
+ */const Q=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Z=w("save",Q),ve=()=>[{title:"Agent Transcripts - CodeYam"},{name:"description",content:"View background agent transcripts and tool call history"}];function ee(s){if(!s)return"";try{return new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return s}}function se(s){if(!s)return"";try{return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}catch{return s}}function te(s){return s.includes("opus")?"Opus":s.includes("sonnet")?"Sonnet":s.includes("haiku")?"Haiku":s}function v({type:s,toolName:t}){const a={user_prompt:"bg-[#00b4d8] text-black",assistant_text:"bg-[#a8dadc] text-black",tool_call:"bg-[#f4a261] text-black",tool_result:"bg-[#2a9d8f] text-black",context:"bg-[#7c3aed] text-white"},r={user_prompt:"USER",assistant_text:"ASSISTANT",tool_call:t||"TOOL",tool_result:"RESULT",context:"CONTEXT"};return e.jsx("span",{className:`inline-block px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wide ${a[s]||"bg-gray-300 text-black"}`,children:r[s]||s})}function re({input:s}){return e.jsx("div",{className:"text-xs font-mono space-y-1",children:Object.entries(s).map(([t,a])=>{let r=typeof a=="string"?a:JSON.stringify(a);return r.length>500&&(r=r.slice(0,500)+"..."),e.jsxs("div",{children:[e.jsxs("span",{className:"text-[#f4a261] font-bold",children:[t,":"]})," ",e.jsx("span",{className:"text-gray-700",children:r})]},t)})})}function ae({content:s,truncated:t,fullLength:a}){const[r,l]=m.useState(!1);return e.jsxs("div",{children:[e.jsxs("pre",{className:"whitespace-pre-wrap break-words text-xs max-h-96 overflow-y-auto text-gray-700",children:[s,t&&!r&&"..."]}),t&&e.jsx("button",{onClick:()=>l(!r),className:"text-[11px] text-gray-500 hover:text-gray-700 mt-1 font-mono cursor-pointer",children:r?"Show less":`Show more (${(a||0)-s.length} more chars)`})]})}function ne({entry:s,pairedResult:t}){const[a,r]=m.useState(!1),l=ee(s.timestamp||"");return s.type==="user_prompt"?e.jsxs("div",{className:"my-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(v,{type:"user_prompt"}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono",children:l})]}),e.jsx("pre",{className:"bg-white border border-gray-200 rounded-md p-3 whitespace-pre-wrap break-words text-xs font-mono border-l-[3px] border-l-[#00b4d8] max-h-72 overflow-y-auto text-gray-800",children:s.text})]}):s.type==="assistant_text"?e.jsxs("div",{className:"my-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(v,{type:"assistant_text"}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono",children:l})]}),e.jsx("div",{className:"bg-white border border-gray-200 rounded-md p-3 whitespace-pre-wrap break-words text-sm border-l-[3px] border-l-[#a8dadc] text-gray-800",children:s.text})]}):s.type==="tool_call"?e.jsxs("div",{className:"my-2",children:[e.jsxs("button",{onClick:()=>r(!a),className:"flex items-center gap-2 w-full text-left bg-white border border-gray-200 rounded-md px-3 py-2 hover:bg-gray-50 cursor-pointer",children:[a?e.jsx(_,{className:"w-3 h-3 text-gray-400 flex-shrink-0"}):e.jsx(N,{className:"w-3 h-3 text-gray-400 flex-shrink-0"}),e.jsx(v,{type:"tool_call",toolName:s.name}),e.jsx("span",{className:"text-xs text-gray-500 font-mono truncate flex-1",children:s.summary||""}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono flex-shrink-0",children:l})]}),a&&e.jsxs("div",{className:"bg-white border border-t-0 border-gray-200 rounded-b-md px-3 py-2 border-l-[3px] border-l-[#f4a261]",children:[e.jsx(re,{input:s.input||{}}),t&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200",children:[e.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wide text-[#2a9d8f] mb-1",children:["Result",t.is_error?" (Error)":"",":"]}),e.jsx(ae,{content:t.content||"",truncated:t.truncated,fullLength:t.fullLength})]})]})]}):(s.type==="tool_result",null)}function oe({context:s}){const[t,a]=m.useState(!1);return e.jsxs("div",{className:"my-2",children:[e.jsxs("button",{onClick:()=>a(!t),className:"flex items-center gap-2 mb-1 cursor-pointer hover:opacity-80",children:[t?e.jsx(_,{className:"w-3 h-3 text-gray-400"}):e.jsx(N,{className:"w-3 h-3 text-gray-400"}),e.jsx(v,{type:"context"}),e.jsx("span",{className:"text-xs text-gray-500",children:"Full prompt context"})]}),t&&e.jsx("pre",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 whitespace-pre-wrap break-words text-xs font-mono border-l-[3px] border-l-[#7c3aed] max-h-96 overflow-y-auto text-gray-700",children:s})]})}function le({snippet:s}){const[t,a]=m.useState(!1),r=s.split(`
22
+ `).filter(c=>c.trim()),l=r.slice(0,4),x=r.length>4,i=t?r:l;return e.jsxs("div",{className:"my-2 bg-blue-50 border border-blue-200 rounded-md p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(G,{className:"w-3.5 h-3.5 text-blue-600"}),e.jsx("span",{className:"text-xs font-bold text-blue-800",children:"Source Conversation"}),e.jsxs("span",{className:"text-[10px] text-blue-500",children:[r.length," message",r.length!==1?"s":""]})]}),e.jsx("div",{className:"space-y-1",children:i.map((c,d)=>{const h=c.match(/^\[(\w+)\]:\s*(.*)/);if(!h)return null;const[,g,u]=h,f=g==="user";return e.jsxs("div",{className:"text-xs",children:[e.jsxs("span",{className:`font-bold ${f?"text-blue-700":"text-gray-500"}`,children:[f?"User":"Assistant",":"]})," ",e.jsx("span",{className:"text-gray-700",children:u.length>200?u.slice(0,200)+"...":u})]},d)})}),x&&e.jsx("button",{onClick:()=>a(!t),className:"text-[11px] text-blue-600 hover:text-blue-800 mt-2 font-mono cursor-pointer",children:t?"Show less":`Show all ${r.length} messages`})]})}function ie({change:s}){const[t,a]=m.useState(!1),r=s.action==="created"?!!s.content:s.action==="modified"?!!(s.oldString||s.newString):!1;return e.jsxs("li",{children:[e.jsx("button",{onClick:()=>r&&a(!t),className:`text-left w-full ${r?"hover:text-green-900 cursor-pointer":""}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[r&&(t?e.jsx(_,{className:"w-3 h-3 inline flex-shrink-0"}):e.jsx(N,{className:"w-3 h-3 inline flex-shrink-0"})),s.action==="created"?"Created":"Modified"," ",s.filePath]})}),t&&s.action==="created"&&s.content&&e.jsx("pre",{className:"mt-1 mb-2 ml-4 p-2 bg-white border border-green-200 rounded text-[11px] text-gray-700 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:s.content}),t&&s.action==="modified"&&e.jsxs("div",{className:"mt-1 mb-2 ml-4 space-y-1",children:[s.oldString&&e.jsxs("pre",{className:"p-2 bg-red-50 border border-red-200 rounded text-[11px] text-red-800 whitespace-pre-wrap break-words max-h-32 overflow-y-auto",children:["- ",s.oldString]}),s.newString&&e.jsxs("pre",{className:"p-2 bg-green-50 border border-green-300 rounded text-[11px] text-green-800 whitespace-pre-wrap break-words max-h-32 overflow-y-auto",children:["+ ",s.newString]})]})]})}function ce({changes:s}){const t=s.filter(i=>i.action==="touched"),a=s.filter(i=>i.action!=="touched"),r=a.some(i=>i.action==="created"),l=a.some(i=>i.action==="modified"),x=r?"bg-green-50 border-green-200 text-green-800 [&_ul]:text-green-700":l?"bg-amber-50 border-amber-200 text-amber-800 [&_ul]:text-amber-700":"bg-gray-50 border-gray-200 text-gray-600 [&_ul]:text-gray-500";return e.jsxs("div",{className:`my-2 border rounded-md p-3 ${x}`,children:[e.jsx("div",{className:"text-xs font-bold mb-1",children:"Rule Changes:"}),e.jsxs("ul",{className:"text-xs space-y-0.5 font-mono",children:[a.map((i,c)=>e.jsx(ie,{change:i},c)),t.length>0&&e.jsxs("li",{children:["Touched timestamps on ",t.length," rule",t.length!==1?"s":""]})]})]})}function de({result:s}){const t=s.is_error,a=t?"bg-red-50 border-red-200":"bg-green-50 border-green-200",r=t?"text-red-800":"text-green-800",l=t?"text-red-700":"text-green-700",x=s.subtype.replace(/^error_/,"").replace(/_/g," "),i=d=>d>=6e4?`${(d/6e4).toFixed(1)}m`:`${(d/1e3).toFixed(1)}s`,c=d=>d>=1e3?`${(d/1e3).toFixed(1)}k`:String(d);return e.jsxs("div",{className:`my-2 border rounded-md p-3 ${a}`,children:[e.jsxs("div",{className:`text-xs font-bold mb-1 ${r}`,children:["Session Result: ",x]}),e.jsxs("div",{className:`text-xs ${l} font-mono space-y-0.5`,children:[e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5",children:[s.duration_ms!=null&&e.jsxs("span",{children:["Duration: ",i(s.duration_ms)]}),s.duration_api_ms!=null&&e.jsxs("span",{children:["API time: ",i(s.duration_api_ms)]}),s.num_turns!=null&&e.jsxs("span",{children:["Turns: ",s.num_turns]}),s.total_cost_usd!=null&&e.jsxs("span",{children:["Cost: $",s.total_cost_usd.toFixed(4)]})]}),s.usage&&e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 mt-1",children:[s.usage.input_tokens!=null&&e.jsxs("span",{children:["Input: ",c(s.usage.input_tokens)]}),s.usage.output_tokens!=null&&e.jsxs("span",{children:["Output: ",c(s.usage.output_tokens)]}),s.usage.cache_read_input_tokens!=null&&e.jsxs("span",{children:["Cache read: ",c(s.usage.cache_read_input_tokens)]}),s.usage.cache_creation_input_tokens!=null&&e.jsxs("span",{children:["Cache write:"," ",c(s.usage.cache_creation_input_tokens)]})]}),s.errors&&s.errors.length>0&&e.jsx("div",{className:"mt-1",children:s.errors.map((d,h)=>e.jsx("div",{className:"text-red-700 break-words",children:d},h))})]})]})}function xe({agent:s,defaultOpen:t,isAdmin:a}){var $,E,R;const[r,l]=m.useState(t),[x,i]=m.useState(!1),[c,d]=m.useState(null),[h,g]=m.useState(!1),u=m.useMemo(()=>{const n={};for(const o of s.entries)o.type==="tool_result"&&o.tool_use_id&&(n[o.tool_use_id]=o);return n},[s.entries]),f=m.useMemo(()=>{const n=new Set;for(const o of s.entries)o.type==="tool_call"&&o.tool_use_id&&u[o.tool_use_id]&&n.add(o.tool_use_id);return n},[s.entries,u]),S=n=>{n.stopPropagation(),i(!0),d(null),fetch("/api/save-fixture",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s.id})}).then(o=>o.json()).then(o=>{o.success?d(`Saved to ${o.fixturePath}`):d(`Error: ${o.error}`)}).catch(o=>{d(`Error: ${o instanceof Error?o.message:String(o)}`)}).finally(()=>{i(!1)})},y=(s.ruleChanges||[]).filter(n=>n.action!=="touched"),b=y.filter(n=>n.action==="created"),j=y.filter(n=>n.action==="modified"),p=(s.ruleChanges||[]).filter(n=>n.action==="touched"),k=y.length>0,T=p.length>0,L=k||T;return e.jsxs("div",{className:`bg-white border rounded-lg overflow-hidden mb-4 ${s.stats.errors>0?"border-red-300":b.length>0?"border-green-300":j.length>0?"border-amber-300":"border-gray-200"}`,children:[e.jsxs("button",{onClick:()=>l(!r),className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-gray-50 cursor-pointer",children:[r?e.jsx(_,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}):e.jsx(N,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-bold text-[#005C75] font-mono",children:s.id.slice(0,8)}),s.slug&&e.jsx("span",{className:"text-xs text-gray-500",children:s.slug}),s.model&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-purple-100 text-purple-700",title:s.model,children:te(s.model)}),b.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-green-100 text-green-800",children:[e.jsx(A,{className:"w-3 h-3"}),b.length," rule",b.length!==1?"s":""," ","created"]}),j.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-100 text-amber-800",children:[e.jsx(A,{className:"w-3 h-3"}),j.length," rule",j.length!==1?"s":""," ","modified"]}),!k&&T&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-gray-100 text-gray-500",children:[p.length," timestamp",p.length!==1?"s":""," ","touched"]}),s.stats.errors>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-red-100 text-red-800",children:[e.jsx(H,{className:"w-3 h-3 flex-shrink-0"}),s.stats.errors," ",s.stats.errors===1?"Error":"Errors"]}),e.jsxs("span",{className:"text-[11px] text-gray-400 font-mono",children:[s.stats.toolCalls," tool calls, ",s.stats.textBlocks," text blocks",(($=s.sessionResult)==null?void 0:$.duration_ms)!=null&&e.jsxs(e.Fragment,{children:[" · ",s.sessionResult.duration_ms>=6e4?`${(s.sessionResult.duration_ms/6e4).toFixed(1)}m`:`${(s.sessionResult.duration_ms/1e3).toFixed(1)}s`]}),((E=s.sessionResult)==null?void 0:E.total_cost_usd)!=null&&e.jsxs(e.Fragment,{children:[" · ","$",s.sessionResult.total_cost_usd.toFixed(2)]})]}),e.jsxs("span",{className:"text-[11px] text-gray-400 font-mono ml-auto flex items-center gap-2",children:[se(s.timestamp),a&&k&&e.jsxs("button",{onClick:S,disabled:x,className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] font-bold bg-gray-100 text-gray-600 hover:bg-gray-200 disabled:opacity-50 cursor-pointer",title:"Save as test fixture",children:[e.jsx(Z,{className:"w-3 h-3"}),x?"Saving...":"Save Fixture"]})]})]}),c&&e.jsx("div",{className:`px-4 py-2 text-xs font-mono ${c.startsWith("Error")?"bg-red-50 text-red-700":"bg-green-50 text-green-700"}`,children:c}),r&&e.jsxs("div",{className:"px-4 pb-4 border-t border-gray-100",children:[s.sourceFile&&e.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-gray-500 font-mono",children:[e.jsx("span",{className:"text-gray-400",children:"FILE:"}),e.jsx("span",{className:"truncate",children:s.sourceFile}),e.jsx("button",{onClick:n=>{n.stopPropagation(),navigator.clipboard.writeText(s.sourceFile),g(!0),setTimeout(()=>g(!1),2e3)},className:"p-0.5 rounded text-gray-400 hover:text-gray-600 cursor-pointer transition-colors flex-shrink-0",title:"Copy file path",children:h?e.jsx(q,{className:"w-3.5 h-3.5 text-green-500"}):e.jsx(z,{className:"w-3.5 h-3.5"})})]}),s.sessionResult&&e.jsx(de,{result:s.sessionResult}),s.stats.errors>0&&((R=s.stats.errorMessages)==null?void 0:R.length)>0&&e.jsxs("div",{className:"my-2 bg-red-50 border border-red-200 rounded-md p-3",children:[e.jsxs("div",{className:"text-xs font-bold text-red-800 mb-1",children:[s.stats.errors," Error",s.stats.errors!==1?"s":"",":"]}),e.jsx("ul",{className:"text-xs text-red-700 space-y-1 font-mono",children:s.stats.errorMessages.map((n,o)=>e.jsx("li",{className:"break-words",children:n},o))})]}),s.conversationSnippet&&e.jsx(le,{snippet:s.conversationSnippet}),L&&e.jsx(ce,{changes:s.ruleChanges}),s.context&&e.jsx(oe,{context:s.context}),s.entries.map((n,o)=>{if(n.type==="tool_result"&&n.tool_use_id&&f.has(n.tool_use_id))return null;const M=n.type==="tool_call"&&n.tool_use_id?u[n.tool_use_id]:void 0;return e.jsx(ne,{entry:n,pairedResult:M},`${s.id}-${o}`)})]})]})}function C(s,t){const a=new URLSearchParams;t&&a.set("search",t),s>1&&a.set("page",String(s));const r=a.toString();return`/agent-transcripts${r?`?${r}`:""}`}const we=O(function(){const{agents:t,error:a,search:r,page:l,totalPages:x}=P(),i=I(),c=B("root"),d=(c==null?void 0:c.isAdmin)??!1,[h,g]=m.useState(r),[u,f]=m.useState(!1),[S,y]=m.useState(0);U({source:"agent-transcripts-page"});const b=p=>{p.preventDefault(),window.location.href=C(1,h)},j=()=>{f(!u),y(p=>p+1)};return a?e.jsx("div",{className:"bg-[#F8F7F6] min-h-screen",children:e.jsxs("div",{className:"px-12 py-6 font-sans",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900",children:"Error"}),e.jsx("p",{className:"text-base text-gray-500",children:a})]})}):e.jsx("div",{className:"bg-[#f9f9f9] min-h-screen",children:e.jsxs("div",{className:"px-20 py-12 font-sans",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("button",{onClick:()=>{i("/memory")},className:"text-gray-600 hover:text-[#005C75] transition-colors cursor-pointer",title:"Back to Memory","aria-label":"Back to Memory",children:e.jsx(K,{className:"w-5 h-5"})}),e.jsx(F,{className:"w-6 h-6 text-[#232323]"}),e.jsx("h1",{className:"text-[24px] font-semibold mb-0",style:{fontFamily:"Sora",color:"#232323"},children:"Agent Transcripts"})]}),e.jsx("p",{className:"text-[15px] text-gray-500 ml-14",children:"View background agent transcripts and tool call history"})]}),e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsxs("form",{onSubmit:b,className:"relative flex-1 max-w-md",children:[e.jsx(V,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",value:h,onChange:p=>g(p.target.value),placeholder:"Search transcripts...",className:"w-full pl-10 pr-4 py-2 border border-gray-200 rounded-md bg-white focus:outline-none focus:ring-2 focus:ring-[#005C75] focus:border-transparent text-sm"})]}),e.jsx("button",{onClick:j,className:"text-xs text-[#005C75] hover:underline cursor-pointer font-mono uppercase font-semibold",children:u?"Collapse All":"Expand All"})]}),e.jsxs("div",{className:"text-sm text-gray-500 mb-4",children:["Page ",l," of ",x,r&&e.jsxs("span",{children:[" ","matching “",r,"”",e.jsx(D,{to:"/agent-transcripts",className:"text-[#005C75] hover:underline ml-2",children:"Clear"})]})]}),t.length===0?e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-12 text-center",children:[e.jsx(F,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No Agent Transcripts Found"}),e.jsx("p",{className:"text-gray-500",children:"Background agent output files will appear here when available."})]}):e.jsx("div",{children:t.map(p=>e.jsx(xe,{agent:p,defaultOpen:u,isAdmin:d},p.id))},S),x>1&&e.jsxs("div",{className:"flex items-center justify-center gap-3 mt-8",children:[e.jsxs("a",{href:l>1?C(l-1,r):void 0,className:`inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-sm font-medium ${l>1?"bg-white border border-gray-200 text-gray-700 hover:bg-gray-50 cursor-pointer":"bg-gray-100 text-gray-400 pointer-events-none"}`,children:[e.jsx(X,{className:"w-4 h-4"}),"Prev"]}),e.jsxs("span",{className:"text-sm text-gray-500 font-mono",children:[l," / ",x]}),e.jsxs("a",{href:l<x?C(l+1,r):void 0,className:`inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-sm font-medium ${l<x?"bg-white border border-gray-200 text-gray-700 hover:bg-gray-50 cursor-pointer":"bg-gray-100 text-gray-400 pointer-events-none"}`,children:["Next",e.jsx(N,{className:"w-4 h-4"})]})]})]})})});export{we as default,ve as meta};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./createLucideIcon-CC6AbExI.js";/**
1
+ import{c as o}from"./createLucideIcon-DJB0YQJL.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./createLucideIcon-CC6AbExI.js";/**
1
+ import{c as o}from"./createLucideIcon-DJB0YQJL.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.