@codeyam/codeyam-cli 0.1.10 → 0.1.12
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.
- package/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +2 -2
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/database/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +42 -16
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +11 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -1
- package/codeyam-cli/src/commands/editor.js +1214 -217
- package/codeyam-cli/src/commands/editor.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +1 -0
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +893 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +6 -3
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +261 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +75 -1
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +441 -17
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +67 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +125 -10
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +40 -1
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +3 -1
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/editorAudit.js +145 -0
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
- package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
- package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js +1 -1
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/editorEntityHelpers.js +129 -0
- package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js +40 -1
- package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
- package/codeyam-cli/src/utils/editorMigration.js +224 -0
- package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarios.js +163 -2
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
- package/codeyam-cli/src/utils/editorSeedAdapter.js +253 -4
- package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
- package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
- package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js +19 -2
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +41 -3
- package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
- package/codeyam-cli/src/utils/fileWatcher.js +38 -0
- package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +9 -0
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
- package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
- package/codeyam-cli/src/utils/scenarioCoverage.js +8 -9
- package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -1
- package/codeyam-cli/src/utils/scenariosManifest.js +18 -10
- package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +33 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
- package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
- package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
- package/codeyam-cli/src/webserver/backgroundServer.js +18 -4
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CzTDWkF2.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-BFbq6iFk.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-B6OMi58N.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-DuYodzo1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CXo9EeCl.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DYCNb2It.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-CZgY3sxX.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-CnYYwRDw.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CDoF7ZpU.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-TSD3C211.js → ScenarioViewer-DrnfvaLL.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Df3UCi8k.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-DRKR9T0U.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-ClR-g3tY.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-DTH6ydEA.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-74hnHF59.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-B8CYhCO9.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-CLaoh4ac.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-BZ2DZxbW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-C4pqxYJB.js → chunk-JZWAC4HX-BBXArFPl.js} +13 -21
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-CT4unAk-.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-zK0B6Nu-.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-DJB0YQJL.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CkXFP_i-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor._tab-DPw7NZHc.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-DmBK1JBK.js +58 -0
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-DBa7T2FK.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-DwCV5__E.js → entity._sha._-BqAN7hyG.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BOi8kpwd.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Dg1NhIms.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CJX6kkkV.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-BhVjZhKg.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-_gzKltPN.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-CV_17tZS.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-D-YXmMbR.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-CGrDAxj0.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-Blo6EK8G.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-BsX0F-9C.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-CCrgCshv.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-Byazq8Pv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-DVQ0oHR7.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-b3f77062.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{memory-9gnxSZlb.js → memory-b-VmA2Vj.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-DGcndCAa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{root-BWAyuj0r.js → root-D5Zi3U2Z.js} +4 -4
- package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-C0Uw0bcK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-OoNgHIfW.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-Bcemfu8a.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-BgMmG7R9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-Cs87hJYK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BR3Rs7JY.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-C14nCb1q.js → useLastLogLine-BxxP_XF9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BermyNU5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useToast-a_QN_W9_.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-yTyb36j3.js +13 -0
- package/codeyam-cli/src/webserver/build/server/assets/{index-ChX0hPcu.js → index-Cr7d_IsG.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-M_wqNAfu.js +10 -0
- package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-_ybRgrlc.js +551 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/editorProxy.js +93 -11
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
- package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
- package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
- package/codeyam-cli/src/webserver/server.js +9 -0
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +105 -9
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
- package/codeyam-cli/templates/editor-step-hook.py +104 -20
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +42 -7
- package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +62 -0
- package/package.json +1 -1
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Ii3inc0_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/editor-COWCNVyV.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-CNB06EIa.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-CXSi2aeZ.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CHMiAog3.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-phvmGvat.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-6134dc40.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C-_hOl_g.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-kSNsMjj8.js +0 -10
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Bm2xIhmh.js +0 -439
package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-ClR-g3tY.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u,
|
|
1
|
+
import{r as u,L as p,w as se,u as te,d as ae,f as re}from"./chunk-JZWAC4HX-BBXArFPl.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{u as ne}from"./useLastLogLine-BxxP_XF9.js";import{u as le}from"./useToast-a_QN_W9_.js";import{u as oe}from"./useReportContext-BermyNU5.js";import{L as ie}from"./LogViewer-CZgY3sxX.js";import{I as E,C as P,E as ce}from"./EntityTypeIcon-B6OMi58N.js";import{S as Y}from"./SafeScreenshot-CDoF7ZpU.js";import{g as de}from"./scenarioStatus-B_8jpV3e.js";import{c as q}from"./createLucideIcon-DJB0YQJL.js";import{C as xe}from"./circle-check-CT4unAk-.js";import{L as S}from"./loader-circle-DVQ0oHR7.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{r as u,j as e,L as p,w as se,u as te,d as ae,f as re}from"./chunk-JZWAC4H
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const ue=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],pe=q("zap",ue);function ge({recentSimulations:g}){const f=u.useMemo(()=>{const r=new Map;return g.forEach(a=>{const d=a.entitySha,c=r.get(d);c?c.push(a):r.set(d,[a])}),Array.from(r.entries()).map(([a,d])=>({entitySha:a,entityName:d[0].entityName,scenarios:d}))},[g]);return e.jsxs("section",{className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsx("div",{className:"flex justify-between items-start mb-5",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Recent Simulations"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:g.length>0?`Latest ${g.length} captured screenshot${g.length!==1?"s":""}`:"No simulations captured yet"})]})}),g.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-6 mb-5",children:f.map(r=>e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center bg-purple-100",children:e.jsx(E,{size:16,style:{color:"#8B5CF6"}})}),e.jsx(p,{to:`/entity/${r.entitySha}`,className:"text-sm font-semibold text-gray-900 no-underline hover:text-gray-700 transition-colors",children:r.entityName})]}),e.jsx("div",{className:"grid grid-cols-4 gap-3",children:r.scenarios.map((a,d)=>e.jsx(p,{to:a.scenarioId?`/entity/${a.entitySha}/scenarios/${a.scenarioId}`:`/entity/${a.entitySha}`,className:"aspect-4/3 border border-gray-200 rounded-lg overflow-hidden bg-gray-50 transition-all flex items-center justify-center hover:scale-105",onMouseEnter:c=>{c.currentTarget.style.borderColor="#005C75",c.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.2)"},onMouseLeave:c=>{c.currentTarget.style.borderColor="#E5E7EB",c.currentTarget.style.boxShadow="none"},title:a.scenarioName,children:e.jsx(Y,{screenshotPath:a.screenshotPath,alt:a.scenarioName,className:"max-w-full max-h-full object-contain object-center"})},a.scenarioId||`${a.entitySha}-${d}`))})]},r.entitySha))}),e.jsx(p,{to:"/simulations",className:"block text-center p-3 rounded-lg no-underline font-semibold text-sm transition-all",style:{color:"#005C75",backgroundColor:"#F6F9FC"},onMouseEnter:r=>r.currentTarget.style.backgroundColor="#EEF4F8",onMouseLeave:r=>r.currentTarget.style.backgroundColor="#F6F9FC",children:"View All Recent Simulations →"})]}):e.jsxs("div",{className:"py-12 px-6 text-center rounded-lg w-full flex flex-col items-center justify-center min-h-50 border border-dashed",style:{backgroundColor:"#F2F7F8",borderColor:"#BBCCD3"},children:[e.jsx("div",{className:"mb-4 rounded-full flex items-center justify-center",style:{width:"48px",height:"48px",backgroundColor:"#E5EFF1"},children:e.jsx(E,{size:24,style:{color:"#7A9BA5"},strokeWidth:1.5})}),e.jsx("p",{className:"text-sm font-medium m-0",style:{color:"#5A7380"},children:"No simulations captured yet."}),e.jsxs("p",{className:"text-xs m-0 mt-2",style:{color:"#7A9BA5"},children:["Trigger an analysis from the"," ",e.jsx(p,{to:"/git",className:"underline hover:no-underline",style:{color:"#7A9BA5"},children:"Git"})," ","or"," ",e.jsx(p,{to:"/files",className:"underline hover:no-underline",style:{color:"#7A9BA5"},children:"Files"})," ","page."]})]})]})}const ye="/assets/codeyam-name-logo-CvKwUgHo.svg",Te=()=>[{title:"Dashboard - CodeYam"},{name:"description",content:"CodeYam project dashboard"}],Le=se(function(){var _,H;const{stats:f,uncommittedFiles:r,uncommittedEntitiesList:a,recentSimulations:d,visualEntitiesForSimulation:c,projectSlug:b,queueState:$,currentCommit:F}=te(),x=ae(),Q=re(),{showToast:j}=le();oe({source:"dashboard"});const[Z,G]=u.useState(new Set),[m,O]=u.useState(null),[K,B]=u.useState(!1),[M,A]=u.useState(!1),{lastLine:T,isCompleted:D}=ne(b,!!m),{simulatingEntity:v,scenarios:k,scenarioStatuses:fe,allScenariosCaptured:L}=u.useMemo(()=>{var o,C;const s={simulatingEntity:null,scenarios:[],scenarioStatuses:[],allScenariosCaptured:!1};if(!m)return s;const l=c==null?void 0:c.find(N=>N.sha===m);if(!l)return s;const n=(o=l.analyses)==null?void 0:o[0],i=(n==null?void 0:n.scenarios)||[],t=((C=n==null?void 0:n.status)==null?void 0:C.scenarios)||[],y=t.filter(N=>N.screenshotFinishedAt).length,h=i.length>0&&y===i.length;return{simulatingEntity:l,scenarios:i,scenarioStatuses:t,allScenariosCaptured:h}},[m,c]);u.useEffect(()=>{(D||L)&&O(null)},[D,L]);const z=(_=F==null?void 0:F.metadata)==null?void 0:_.currentRun,V=new Set((z==null?void 0:z.currentEntityShas)||[]),I=new Set($.jobs.flatMap(s=>s.entityShas||[])),R=new Set(((H=$.currentlyExecuting)==null?void 0:H.entityShas)||[]),W=a.filter(s=>s.entityType==="visual"||s.entityType==="library"),w=W.filter(s=>!V.has(s.sha)&&!I.has(s.sha)&&!R.has(s.sha)),X=()=>{if(w.length===0){j("All entities are already queued or analyzing","info",3e3);return}const s=w.map(l=>l.sha);A(!0),j(`Starting analysis for ${w.length} entities...`,"info",3e3),x.submit({entityShas:s.join(",")},{method:"post",action:"/api/analyze"})};u.useEffect(()=>{if(x.state==="idle"&&x.data){const s=x.data;s.success?(console.log("[Analyze All] Success:",s.message),j(`Analysis started for ${s.entityCount} entities in ${s.fileCount} files. Watch the logs for progress.`,"success",6e3),A(!1)):s.error&&(console.error("[Analyze All] Error:",s.error),j(`Error: ${s.error}`,"error",8e3),A(!1))}},[x.state,x.data,j]);const J=s=>{G(l=>{const n=new Set(l);return n.has(s)?n.delete(s):n.add(s),n})},ee=[{label:"Total Entities",value:f.totalEntities,iconType:"folder",link:"/files",color:"#005C75",tooltip:"In CodeYam, an entity is a discrete, analyzable unit of code that can be independently simulated and tested."},{label:"Analyzed Entities",value:f.entitiesWithAnalyses,iconType:"check",link:"/simulations",color:"#10B981",tooltip:"Entities that have been analyzed by CodeYam and have generated scenarios."},{label:"Visual Components",value:f.visualEntities,iconType:"image",link:"/files?entityType=visual",color:"#8B5CF6",tooltip:"React components and visual elements that can be rendered and captured as screenshots."},{label:"Library Functions",value:f.libraryEntities,iconType:"code-xml",link:"/files?entityType=library",color:"#0DBFE9",tooltip:"Reusable functions and utilities that can be independently tested."}];return e.jsx("div",{className:"bg-cygray-10 min-h-screen",children:e.jsxs("div",{className:"px-20 pt-8 pb-12",children:[e.jsxs("header",{className:"mb-8 flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("img",{src:ye,alt:"CodeYam",className:"h-3.5"}),e.jsx("span",{className:"text-gray-400 text-sm",children:"|"}),e.jsx("h1",{className:"text-sm font-mono font-normal text-gray-400 m-0",children:b?b.replace(/-/g," ").replace(/\b\w/g,s=>s.toUpperCase()):"Project"})]}),Q.state==="loading"&&e.jsx("div",{className:"text-blue-600 text-sm font-medium animate-pulse",children:"🔄 Updating..."})]}),e.jsx("div",{className:"flex items-center justify-between gap-3",children:ee.map((s,l)=>e.jsx(p,{to:s.link,className:"flex-1 bg-white rounded-xl border border-gray-200 overflow-hidden flex transition-all hover:shadow-lg no-underline cursor-pointer",style:{borderLeft:`4px solid ${s.color}`},children:e.jsxs("div",{className:"px-6 py-6 flex flex-col gap-3 flex-1",children:[e.jsxs("div",{className:"flex md:justify-between md:items-start md:flex-row flex-col",children:[e.jsxs("div",{className:"flex items-center gap-1.5 group relative",children:[e.jsx("span",{className:"text-xs text-gray-700 font-medium font-mono uppercase",children:s.label}),e.jsxs("svg",{className:"w-3 h-3 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 16v-4m0-4h.01"})]}),e.jsx("div",{className:"absolute left-0 top-full mt-2 hidden group-hover:block z-50 w-80",children:e.jsxs("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 shadow-lg",children:[s.tooltip,e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-900 transform rotate-45"})]})})]}),e.jsx("div",{className:"text-xs font-medium transition-colors flex items-center gap-1 sm:hidden md:flex",style:{color:s.color},children:"View All →"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"rounded-lg p-2 leading-none shrink-0",style:{backgroundColor:`${s.color}15`},children:[s.iconType==="folder"&&e.jsx(he,{size:20,style:{color:s.color}}),s.iconType==="check"&&e.jsx(xe,{size:20,style:{color:s.color}}),s.iconType==="image"&&e.jsx(E,{size:20,style:{color:s.color}}),s.iconType==="code-xml"&&e.jsx(P,{size:20,style:{color:s.color}})]}),e.jsx("div",{className:"text-3xl font-semibold font-mono text-gray-900 leading-none",children:s.value.toLocaleString("en-US")})]}),e.jsx("div",{className:"text-xs font-medium transition-colors flex items-center gap-1 md:hidden",style:{color:s.color},children:"View All →"})]})]})},l))}),e.jsxs("div",{className:"mt-12 grid gap-8 items-start",style:{gridTemplateColumns:"repeat(auto-fit, minmax(500px, 1fr))"},children:[e.jsxs("section",{id:"uncommitted",className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Uncommitted Changes"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:r.length>0?`${r.length} file${r.length!==1?"s":""} with ${a.length} uncommitted entit${a.length!==1?"ies":"y"}`:"No uncommitted changes detected"})]}),W.length>0&&e.jsx("button",{onClick:X,disabled:x.state!=="idle"||M||w.length===0,className:"px-5 py-2.5 text-white border-none rounded-lg text-sm font-semibold cursor-pointer transition-all hover:-translate-y-px disabled:bg-gray-400 disabled:cursor-not-allowed disabled:translate-y-0",style:{backgroundColor:"#005C75"},onMouseEnter:s=>s.currentTarget.style.backgroundColor="#004560",onMouseLeave:s=>s.currentTarget.style.backgroundColor="#005C75",children:x.state!=="idle"||M?"Starting analysis...":w.length===0?"All Queued":"Analyze All"})]}),r.length>0?e.jsx("div",{className:"flex flex-col gap-3",children:r.map(([s,l])=>{const n=Z.has(s),i=l.editedEntities||[];return e.jsxs("div",{className:"bg-white border border-gray-200 border-l-4 rounded-lg overflow-hidden",style:{borderLeftColor:"#005C75"},children:[e.jsx("div",{className:"p-4 cursor-pointer select-none transition-colors hover:bg-gray-50",onClick:()=>J(s),role:"button",tabIndex:0,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-gray-500 text-xs w-4 shrink-0",children:n?"▼":"▶"}),e.jsxs("svg",{width:"16",height:"20",viewBox:"0 0 12 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"shrink-0",children:[e.jsxs("g",{clipPath:"url(#clip0_784_10666)",children:[e.jsx("path",{d:"M0 2.55857C0 1.14551 1.14551 0 2.55857 0H8.73194L12 3.3616V13.4414C12 14.8545 10.8545 16 9.44143 16H2.55857C1.14551 16 0 14.8545 0 13.4414V2.55857Z",fill:"#DDDDFE"}),e.jsx("path",{d:"M8.72656 3.3307H11.9906L8.72656 0V3.3307Z",fill:"#306AFF"}),e.jsx("line",{x1:"1.8125",y1:"5.94825",x2:"10.0235",y2:"5.94825",stroke:"#306AFF",strokeWidth:"1.27929"}),e.jsx("line",{x1:"1.8125",y1:"8.82715",x2:"6.01207",y2:"8.82715",stroke:"#306AFF",strokeWidth:"1.27929"}),e.jsx("line",{x1:"1.8125",y1:"11.7061",x2:"10.0235",y2:"11.7061",stroke:"#306AFF",strokeWidth:"1.27929"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_784_10666",children:e.jsx("rect",{width:"12",height:"16",fill:"white"})})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-normal text-gray-900 text-sm block truncate",children:s}),e.jsxs("span",{className:"text-xs text-gray-500",children:[i.length," entit",i.length!==1?"ies":"y"]})]})]})}),n&&e.jsx("div",{className:"border-t border-gray-200 bg-gray-50 p-3 flex flex-col gap-2",children:i.length>0?i.map(t=>{const y=V.has(t.sha),h=I.has(t.sha)||R.has(t.sha);return e.jsxs(p,{to:`/entity/${t.sha}`,className:"flex items-center gap-4 p-4 bg-white border border-gray-200 rounded-lg no-underline transition-all hover:shadow-md hover:-translate-y-0.5",style:{borderColor:"inherit"},onMouseEnter:o=>o.currentTarget.style.borderColor="#005C75",onMouseLeave:o=>o.currentTarget.style.borderColor="inherit",children:[e.jsxs("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center",style:{backgroundColor:t.entityType==="visual"?"#8B5CF615":t.entityType==="library"?"#6366F1":"#EC4899"},children:[t.entityType==="visual"&&e.jsx(E,{size:16,style:{color:"#8B5CF6"}}),t.entityType==="library"&&e.jsx(P,{size:16,className:"text-white"}),t.entityType==="other"&&e.jsx(pe,{size:16,className:"text-white"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("div",{className:"font-semibold text-gray-900 text-sm",children:t.name}),t.entityType==="visual"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#8B5CF60D",color:"#8B5CF6"},children:"Visual"}),t.entityType==="library"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#0DBFE90D",color:"#0DBFE9"},children:"Library"}),t.entityType==="other"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#EC48990D",color:"#EC4899"},children:"Other"})]}),t.description&&e.jsx("div",{className:"text-sm text-gray-500 mt-1 overflow-hidden text-ellipsis whitespace-nowrap",children:t.description})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[y&&e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded text-xs text-pink-700 font-semibold flex items-center gap-1.5",children:[e.jsx(S,{size:14,className:"animate-spin"}),"Analyzing..."]}),!y&&h&&e.jsx("div",{className:"px-2 py-1 bg-purple-50 border border-purple-300 rounded text-xs text-purple-700 font-semibold",children:"⏳ Queued"}),!y&&!h&&e.jsx("button",{onClick:o=>{o.preventDefault(),o.stopPropagation(),j(`Starting analysis for ${t.name}...`,"info",3e3),x.submit({entityShas:t.sha},{method:"post",action:"/api/analyze"})},disabled:x.state!=="idle",className:"px-3 py-1.5 text-white border-none rounded text-xs font-medium cursor-pointer transition-all disabled:bg-gray-400 disabled:cursor-not-allowed",style:{backgroundColor:"#005C75"},onMouseEnter:o=>o.currentTarget.style.backgroundColor="#004560",onMouseLeave:o=>o.currentTarget.style.backgroundColor="#005C75",children:"Analyze"})]})]},t.sha)}):e.jsx("div",{className:"text-sm text-gray-500 italic p-2",children:"No entity changes detected in this file"})})]},s)})}):e.jsxs("div",{className:"py-12 px-6 text-center flex flex-col items-center rounded-lg min-h-50 justify-center border border-dashed",style:{backgroundColor:"#F2F7F8",borderColor:"#BBCCD3"},children:[e.jsx("div",{className:"mb-4 rounded-full flex items-center justify-center",style:{width:"48px",height:"48px",backgroundColor:"#E5EFF1"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#7A9BA5",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),e.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]})}),e.jsx("p",{className:"text-sm font-medium m-0",style:{color:"#5A7380"},children:"No Uncommitted Changes."})]})]}),!m&&e.jsx(ge,{recentSimulations:d}),m&&e.jsxs("section",{className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsx("div",{className:"flex justify-between items-start mb-5",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Recent Simulations"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:d.length>0?`Latest ${d.length} captured screenshot${d.length!==1?"s":""}`:"No simulations captured yet"})]})}),m&&e.jsxs("div",{className:"p-0 bg-white rounded-lg flex flex-col gap-0",children:[v&&e.jsx("div",{className:"p-4 rounded-t-lg",style:{backgroundColor:"#F0F5F8",borderBottom:"2px solid #005C75"},children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[32px] leading-none",children:e.jsx(ce,{type:"visual"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-base font-bold mb-1",style:{color:"#005C75"},children:["Generating Simulations for ",v.name]}),e.jsx("div",{className:"text-[13px] text-gray-500 font-mono overflow-hidden text-ellipsis whitespace-nowrap",children:v.filePath})]})]})}),L?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-emerald-600 font-medium p-4 bg-emerald-50",children:[e.jsx("span",{className:"text-lg",children:"✅"}),e.jsxs("span",{children:["Complete (",k.length," scenario",k.length!==1?"s":"",")"]})]}):T?e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(S,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs",title:T,children:T}),b&&e.jsx("button",{onClick:()=>B(!0),className:"px-2 py-1.5 bg-gray-500 text-white border-none rounded-md text-[13px] font-medium cursor-pointer transition-all whitespace-nowrap self-start hover:bg-gray-600 hover:-translate-y-px",title:"View analysis logs",children:"📋 Logs"})]}):x.state!=="idle"?e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(S,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:"Initializing analysis..."})]}):e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(S,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:"Starting analysis..."})]}),k.length>0&&e.jsx("div",{className:"flex gap-2 flex-wrap p-4 bg-white border-t border-gray-200",children:k.slice(0,8).map((s,l)=>{var C,N,U;const n=(C=v==null?void 0:v.analyses)==null?void 0:C[0],i=de(s,n==null?void 0:n.status,void 0,m||void 0,void 0),t=(U=(N=s.metadata)==null?void 0:N.screenshotPaths)==null?void 0:U[0],y=i.isCaptured,h=i.status==="capturing"||i.status==="starting",o=i.hasError;return y?e.jsx(p,{to:`/entity/${m}`,className:"w-20 h-15 border-2 border-gray-200 rounded overflow-hidden bg-gray-50 cursor-pointer transition-all flex items-center justify-center no-underline hover:border-blue-600 hover:scale-105 hover:shadow-md",children:e.jsx(Y,{screenshotPath:t,alt:s.name,title:s.name,className:"max-w-full max-h-full object-contain object-center"})},l):o?e.jsx("div",{className:"w-20 h-15 border-2 border-solid border-red-300 rounded bg-red-50 flex flex-col items-center justify-center text-lg",title:i.errorMessage||"Capture error",children:e.jsx("span",{className:"text-red-500",children:"⚠️"})},l):e.jsx("div",{className:"w-20 h-15 border-2 border-dashed border-gray-300 rounded bg-gray-50 flex items-center justify-center text-2xl",title:`${h?"Capturing":"Pending"} ${s.name}...`,children:e.jsx("span",{className:h?"animate-pulse":"text-gray-400",children:h?"⋯":"⏹️"})},l)})})]})]})]}),K&&b&&e.jsx(ie,{projectSlug:b,onClose:()=>B(!1)})]})})});export{Le as default,Te as meta};
|
|
11
|
+
*/const ue=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],pe=q("zap",ue);function ge({recentSimulations:g}){const f=u.useMemo(()=>{const r=new Map;return g.forEach(a=>{const d=a.entitySha,c=r.get(d);c?c.push(a):r.set(d,[a])}),Array.from(r.entries()).map(([a,d])=>({entitySha:a,entityName:d[0].entityName,scenarios:d}))},[g]);return e.jsxs("section",{className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsx("div",{className:"flex justify-between items-start mb-5",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Recent Simulations"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:g.length>0?`Latest ${g.length} captured screenshot${g.length!==1?"s":""}`:"No simulations captured yet"})]})}),g.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-6 mb-5",children:f.map(r=>e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center bg-purple-100",children:e.jsx(E,{size:16,style:{color:"#8B5CF6"}})}),e.jsx(p,{to:`/entity/${r.entitySha}`,className:"text-sm font-semibold text-gray-900 no-underline hover:text-gray-700 transition-colors",children:r.entityName})]}),e.jsx("div",{className:"grid grid-cols-4 gap-3",children:r.scenarios.map((a,d)=>e.jsx(p,{to:a.scenarioId?`/entity/${a.entitySha}/scenarios/${a.scenarioId}`:`/entity/${a.entitySha}`,className:"aspect-4/3 border border-gray-200 rounded-lg overflow-hidden bg-gray-50 transition-all flex items-center justify-center hover:scale-105",onMouseEnter:c=>{c.currentTarget.style.borderColor="#005C75",c.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.2)"},onMouseLeave:c=>{c.currentTarget.style.borderColor="#E5E7EB",c.currentTarget.style.boxShadow="none"},title:a.scenarioName,children:e.jsx(Y,{screenshotPath:a.screenshotPath,alt:a.scenarioName,className:"max-w-full max-h-full object-contain object-center"})},a.scenarioId||`${a.entitySha}-${d}`))})]},r.entitySha))}),e.jsx(p,{to:"/simulations",className:"block text-center p-3 rounded-lg no-underline font-semibold text-sm transition-all",style:{color:"#005C75",backgroundColor:"#F6F9FC"},onMouseEnter:r=>r.currentTarget.style.backgroundColor="#EEF4F8",onMouseLeave:r=>r.currentTarget.style.backgroundColor="#F6F9FC",children:"View All Recent Simulations →"})]}):e.jsxs("div",{className:"py-12 px-6 text-center rounded-lg w-full flex flex-col items-center justify-center min-h-50 border border-dashed",style:{backgroundColor:"#F2F7F8",borderColor:"#BBCCD3"},children:[e.jsx("div",{className:"mb-4 rounded-full flex items-center justify-center",style:{width:"48px",height:"48px",backgroundColor:"#E5EFF1"},children:e.jsx(E,{size:24,style:{color:"#7A9BA5"},strokeWidth:1.5})}),e.jsx("p",{className:"text-sm font-medium m-0",style:{color:"#5A7380"},children:"No simulations captured yet."}),e.jsxs("p",{className:"text-xs m-0 mt-2",style:{color:"#7A9BA5"},children:["Trigger an analysis from the"," ",e.jsx(p,{to:"/git",className:"underline hover:no-underline",style:{color:"#7A9BA5"},children:"Git"})," ","or"," ",e.jsx(p,{to:"/files",className:"underline hover:no-underline",style:{color:"#7A9BA5"},children:"Files"})," ","page."]})]})]})}const ye="/assets/codeyam-name-logo-CvKwUgHo.svg",Le=()=>[{title:"Dashboard - CodeYam"},{name:"description",content:"CodeYam project dashboard"}],ze=se(function(){var _,H;const{stats:f,uncommittedFiles:r,uncommittedEntitiesList:a,recentSimulations:d,visualEntitiesForSimulation:c,projectSlug:b,queueState:$,currentCommit:F}=te(),x=ae(),Q=re(),{showToast:j}=le();oe({source:"dashboard"});const[Z,G]=u.useState(new Set),[m,O]=u.useState(null),[K,B]=u.useState(!1),[M,A]=u.useState(!1),{lastLine:T,isCompleted:D}=ne(b,!!m),{simulatingEntity:v,scenarios:k,scenarioStatuses:fe,allScenariosCaptured:L}=u.useMemo(()=>{var o,C;const s={simulatingEntity:null,scenarios:[],scenarioStatuses:[],allScenariosCaptured:!1};if(!m)return s;const l=c==null?void 0:c.find(N=>N.sha===m);if(!l)return s;const n=(o=l.analyses)==null?void 0:o[0],i=(n==null?void 0:n.scenarios)||[],t=((C=n==null?void 0:n.status)==null?void 0:C.scenarios)||[],y=t.filter(N=>N.screenshotFinishedAt).length,h=i.length>0&&y===i.length;return{simulatingEntity:l,scenarios:i,scenarioStatuses:t,allScenariosCaptured:h}},[m,c]);u.useEffect(()=>{(D||L)&&O(null)},[D,L]);const z=(_=F==null?void 0:F.metadata)==null?void 0:_.currentRun,V=new Set((z==null?void 0:z.currentEntityShas)||[]),I=new Set($.jobs.flatMap(s=>s.entityShas||[])),R=new Set(((H=$.currentlyExecuting)==null?void 0:H.entityShas)||[]),W=a.filter(s=>s.entityType==="visual"||s.entityType==="library"),w=W.filter(s=>!V.has(s.sha)&&!I.has(s.sha)&&!R.has(s.sha)),X=()=>{if(w.length===0){j("All entities are already queued or analyzing","info",3e3);return}const s=w.map(l=>l.sha);A(!0),j(`Starting analysis for ${w.length} entities...`,"info",3e3),x.submit({entityShas:s.join(",")},{method:"post",action:"/api/analyze"})};u.useEffect(()=>{if(x.state==="idle"&&x.data){const s=x.data;s.success?(console.log("[Analyze All] Success:",s.message),j(`Analysis started for ${s.entityCount} entities in ${s.fileCount} files. Watch the logs for progress.`,"success",6e3),A(!1)):s.error&&(console.error("[Analyze All] Error:",s.error),j(`Error: ${s.error}`,"error",8e3),A(!1))}},[x.state,x.data,j]);const J=s=>{G(l=>{const n=new Set(l);return n.has(s)?n.delete(s):n.add(s),n})},ee=[{label:"Total Entities",value:f.totalEntities,iconType:"folder",link:"/files",color:"#005C75",tooltip:"In CodeYam, an entity is a discrete, analyzable unit of code that can be independently simulated and tested."},{label:"Analyzed Entities",value:f.entitiesWithAnalyses,iconType:"check",link:"/simulations",color:"#10B981",tooltip:"Entities that have been analyzed by CodeYam and have generated scenarios."},{label:"Visual Components",value:f.visualEntities,iconType:"image",link:"/files?entityType=visual",color:"#8B5CF6",tooltip:"React components and visual elements that can be rendered and captured as screenshots."},{label:"Library Functions",value:f.libraryEntities,iconType:"code-xml",link:"/files?entityType=library",color:"#0DBFE9",tooltip:"Reusable functions and utilities that can be independently tested."}];return e.jsx("div",{className:"bg-cygray-10 min-h-screen",children:e.jsxs("div",{className:"px-20 pt-8 pb-12",children:[e.jsxs("header",{className:"mb-8 flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("img",{src:ye,alt:"CodeYam",className:"h-3.5"}),e.jsx("span",{className:"text-gray-400 text-sm",children:"|"}),e.jsx("h1",{className:"text-sm font-mono font-normal text-gray-400 m-0",children:b?b.replace(/-/g," ").replace(/\b\w/g,s=>s.toUpperCase()):"Project"})]}),Q.state==="loading"&&e.jsx("div",{className:"text-blue-600 text-sm font-medium animate-pulse",children:"🔄 Updating..."})]}),e.jsx("div",{className:"flex items-center justify-between gap-3",children:ee.map((s,l)=>e.jsx(p,{to:s.link,className:"flex-1 bg-white rounded-xl border border-gray-200 overflow-hidden flex transition-all hover:shadow-lg no-underline cursor-pointer",style:{borderLeft:`4px solid ${s.color}`},children:e.jsxs("div",{className:"px-6 py-6 flex flex-col gap-3 flex-1",children:[e.jsxs("div",{className:"flex md:justify-between md:items-start md:flex-row flex-col",children:[e.jsxs("div",{className:"flex items-center gap-1.5 group relative",children:[e.jsx("span",{className:"text-xs text-gray-700 font-medium font-mono uppercase",children:s.label}),e.jsxs("svg",{className:"w-3 h-3 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 16v-4m0-4h.01"})]}),e.jsx("div",{className:"absolute left-0 top-full mt-2 hidden group-hover:block z-50 w-80",children:e.jsxs("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 shadow-lg",children:[s.tooltip,e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-900 transform rotate-45"})]})})]}),e.jsx("div",{className:"text-xs font-medium transition-colors flex items-center gap-1 sm:hidden md:flex",style:{color:s.color},children:"View All →"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"rounded-lg p-2 leading-none shrink-0",style:{backgroundColor:`${s.color}15`},children:[s.iconType==="folder"&&e.jsx(he,{size:20,style:{color:s.color}}),s.iconType==="check"&&e.jsx(xe,{size:20,style:{color:s.color}}),s.iconType==="image"&&e.jsx(E,{size:20,style:{color:s.color}}),s.iconType==="code-xml"&&e.jsx(P,{size:20,style:{color:s.color}})]}),e.jsx("div",{className:"text-3xl font-semibold font-mono text-gray-900 leading-none",children:s.value.toLocaleString("en-US")})]}),e.jsx("div",{className:"text-xs font-medium transition-colors flex items-center gap-1 md:hidden",style:{color:s.color},children:"View All →"})]})]})},l))}),e.jsxs("div",{className:"mt-12 grid gap-8 items-start",style:{gridTemplateColumns:"repeat(auto-fit, minmax(500px, 1fr))"},children:[e.jsxs("section",{id:"uncommitted",className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Uncommitted Changes"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:r.length>0?`${r.length} file${r.length!==1?"s":""} with ${a.length} uncommitted entit${a.length!==1?"ies":"y"}`:"No uncommitted changes detected"})]}),W.length>0&&e.jsx("button",{onClick:X,disabled:x.state!=="idle"||M||w.length===0,className:"px-5 py-2.5 text-white border-none rounded-lg text-sm font-semibold cursor-pointer transition-all hover:-translate-y-px disabled:bg-gray-400 disabled:cursor-not-allowed disabled:translate-y-0",style:{backgroundColor:"#005C75"},onMouseEnter:s=>s.currentTarget.style.backgroundColor="#004560",onMouseLeave:s=>s.currentTarget.style.backgroundColor="#005C75",children:x.state!=="idle"||M?"Starting analysis...":w.length===0?"All Queued":"Analyze All"})]}),r.length>0?e.jsx("div",{className:"flex flex-col gap-3",children:r.map(([s,l])=>{const n=Z.has(s),i=l.editedEntities||[];return e.jsxs("div",{className:"bg-white border border-gray-200 border-l-4 rounded-lg overflow-hidden",style:{borderLeftColor:"#005C75"},children:[e.jsx("div",{className:"p-4 cursor-pointer select-none transition-colors hover:bg-gray-50",onClick:()=>J(s),role:"button",tabIndex:0,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-gray-500 text-xs w-4 shrink-0",children:n?"▼":"▶"}),e.jsxs("svg",{width:"16",height:"20",viewBox:"0 0 12 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"shrink-0",children:[e.jsxs("g",{clipPath:"url(#clip0_784_10666)",children:[e.jsx("path",{d:"M0 2.55857C0 1.14551 1.14551 0 2.55857 0H8.73194L12 3.3616V13.4414C12 14.8545 10.8545 16 9.44143 16H2.55857C1.14551 16 0 14.8545 0 13.4414V2.55857Z",fill:"#DDDDFE"}),e.jsx("path",{d:"M8.72656 3.3307H11.9906L8.72656 0V3.3307Z",fill:"#306AFF"}),e.jsx("line",{x1:"1.8125",y1:"5.94825",x2:"10.0235",y2:"5.94825",stroke:"#306AFF",strokeWidth:"1.27929"}),e.jsx("line",{x1:"1.8125",y1:"8.82715",x2:"6.01207",y2:"8.82715",stroke:"#306AFF",strokeWidth:"1.27929"}),e.jsx("line",{x1:"1.8125",y1:"11.7061",x2:"10.0235",y2:"11.7061",stroke:"#306AFF",strokeWidth:"1.27929"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_784_10666",children:e.jsx("rect",{width:"12",height:"16",fill:"white"})})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-normal text-gray-900 text-sm block truncate",children:s}),e.jsxs("span",{className:"text-xs text-gray-500",children:[i.length," entit",i.length!==1?"ies":"y"]})]})]})}),n&&e.jsx("div",{className:"border-t border-gray-200 bg-gray-50 p-3 flex flex-col gap-2",children:i.length>0?i.map(t=>{const y=V.has(t.sha),h=I.has(t.sha)||R.has(t.sha);return e.jsxs(p,{to:`/entity/${t.sha}`,className:"flex items-center gap-4 p-4 bg-white border border-gray-200 rounded-lg no-underline transition-all hover:shadow-md hover:-translate-y-0.5",style:{borderColor:"inherit"},onMouseEnter:o=>o.currentTarget.style.borderColor="#005C75",onMouseLeave:o=>o.currentTarget.style.borderColor="inherit",children:[e.jsxs("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center",style:{backgroundColor:t.entityType==="visual"?"#8B5CF615":t.entityType==="library"?"#6366F1":"#EC4899"},children:[t.entityType==="visual"&&e.jsx(E,{size:16,style:{color:"#8B5CF6"}}),t.entityType==="library"&&e.jsx(P,{size:16,className:"text-white"}),t.entityType==="other"&&e.jsx(pe,{size:16,className:"text-white"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("div",{className:"font-semibold text-gray-900 text-sm",children:t.name}),t.entityType==="visual"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#8B5CF60D",color:"#8B5CF6"},children:"Visual"}),t.entityType==="library"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#0DBFE90D",color:"#0DBFE9"},children:"Library"}),t.entityType==="other"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#EC48990D",color:"#EC4899"},children:"Other"})]}),t.description&&e.jsx("div",{className:"text-sm text-gray-500 mt-1 overflow-hidden text-ellipsis whitespace-nowrap",children:t.description})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[y&&e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded text-xs text-pink-700 font-semibold flex items-center gap-1.5",children:[e.jsx(S,{size:14,className:"animate-spin"}),"Analyzing..."]}),!y&&h&&e.jsx("div",{className:"px-2 py-1 bg-purple-50 border border-purple-300 rounded text-xs text-purple-700 font-semibold",children:"⏳ Queued"}),!y&&!h&&e.jsx("button",{onClick:o=>{o.preventDefault(),o.stopPropagation(),j(`Starting analysis for ${t.name}...`,"info",3e3),x.submit({entityShas:t.sha},{method:"post",action:"/api/analyze"})},disabled:x.state!=="idle",className:"px-3 py-1.5 text-white border-none rounded text-xs font-medium cursor-pointer transition-all disabled:bg-gray-400 disabled:cursor-not-allowed",style:{backgroundColor:"#005C75"},onMouseEnter:o=>o.currentTarget.style.backgroundColor="#004560",onMouseLeave:o=>o.currentTarget.style.backgroundColor="#005C75",children:"Analyze"})]})]},t.sha)}):e.jsx("div",{className:"text-sm text-gray-500 italic p-2",children:"No entity changes detected in this file"})})]},s)})}):e.jsxs("div",{className:"py-12 px-6 text-center flex flex-col items-center rounded-lg min-h-50 justify-center border border-dashed",style:{backgroundColor:"#F2F7F8",borderColor:"#BBCCD3"},children:[e.jsx("div",{className:"mb-4 rounded-full flex items-center justify-center",style:{width:"48px",height:"48px",backgroundColor:"#E5EFF1"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#7A9BA5",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),e.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]})}),e.jsx("p",{className:"text-sm font-medium m-0",style:{color:"#5A7380"},children:"No Uncommitted Changes."})]})]}),!m&&e.jsx(ge,{recentSimulations:d}),m&&e.jsxs("section",{className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsx("div",{className:"flex justify-between items-start mb-5",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Recent Simulations"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:d.length>0?`Latest ${d.length} captured screenshot${d.length!==1?"s":""}`:"No simulations captured yet"})]})}),m&&e.jsxs("div",{className:"p-0 bg-white rounded-lg flex flex-col gap-0",children:[v&&e.jsx("div",{className:"p-4 rounded-t-lg",style:{backgroundColor:"#F0F5F8",borderBottom:"2px solid #005C75"},children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[32px] leading-none",children:e.jsx(ce,{type:"visual"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-base font-bold mb-1",style:{color:"#005C75"},children:["Generating Simulations for ",v.name]}),e.jsx("div",{className:"text-[13px] text-gray-500 font-mono overflow-hidden text-ellipsis whitespace-nowrap",children:v.filePath})]})]})}),L?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-emerald-600 font-medium p-4 bg-emerald-50",children:[e.jsx("span",{className:"text-lg",children:"✅"}),e.jsxs("span",{children:["Complete (",k.length," scenario",k.length!==1?"s":"",")"]})]}):T?e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(S,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs",title:T,children:T}),b&&e.jsx("button",{onClick:()=>B(!0),className:"px-2 py-1.5 bg-gray-500 text-white border-none rounded-md text-[13px] font-medium cursor-pointer transition-all whitespace-nowrap self-start hover:bg-gray-600 hover:-translate-y-px",title:"View analysis logs",children:"📋 Logs"})]}):x.state!=="idle"?e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(S,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:"Initializing analysis..."})]}):e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(S,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:"Starting analysis..."})]}),k.length>0&&e.jsx("div",{className:"flex gap-2 flex-wrap p-4 bg-white border-t border-gray-200",children:k.slice(0,8).map((s,l)=>{var C,N,U;const n=(C=v==null?void 0:v.analyses)==null?void 0:C[0],i=de(s,n==null?void 0:n.status,void 0,m||void 0,void 0),t=(U=(N=s.metadata)==null?void 0:N.screenshotPaths)==null?void 0:U[0],y=i.isCaptured,h=i.status==="capturing"||i.status==="starting",o=i.hasError;return y?e.jsx(p,{to:`/entity/${m}`,className:"w-20 h-15 border-2 border-gray-200 rounded overflow-hidden bg-gray-50 cursor-pointer transition-all flex items-center justify-center no-underline hover:border-blue-600 hover:scale-105 hover:shadow-md",children:e.jsx(Y,{screenshotPath:t,alt:s.name,title:s.name,className:"max-w-full max-h-full object-contain object-center"})},l):o?e.jsx("div",{className:"w-20 h-15 border-2 border-solid border-red-300 rounded bg-red-50 flex flex-col items-center justify-center text-lg",title:i.errorMessage||"Capture error",children:e.jsx("span",{className:"text-red-500",children:"⚠️"})},l):e.jsx("div",{className:"w-20 h-15 border-2 border-dashed border-gray-300 rounded bg-gray-50 flex items-center justify-center text-2xl",title:`${h?"Capturing":"Pending"} ${s.name}...`,children:e.jsx("span",{className:h?"animate-pulse":"text-gray-400",children:h?"⋯":"⏹️"})},l)})})]})]})]}),K&&b&&e.jsx(ie,{projectSlug:b,onClose:()=>B(!1)})]})})});export{ze as default,Le as meta};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
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
|
|
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-
|
|
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,
|
|
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),
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|