@langwatch/server 3.1.0-beta.21 → 3.1.0-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/langevals/evaluators/topic_clustering/langevals_topic_clustering/__init__.py +36 -0
  2. package/langevals/evaluators/topic_clustering/langevals_topic_clustering/_logger.py +165 -0
  3. package/langevals/evaluators/topic_clustering/langevals_topic_clustering/batch_clustering.py +153 -0
  4. package/langevals/evaluators/topic_clustering/langevals_topic_clustering/build_response.py +77 -0
  5. package/langevals/evaluators/topic_clustering/langevals_topic_clustering/constants.py +7 -0
  6. package/langevals/evaluators/topic_clustering/langevals_topic_clustering/incremental_clustering.py +325 -0
  7. package/langevals/evaluators/topic_clustering/langevals_topic_clustering/topic_naming.py +432 -0
  8. package/langevals/evaluators/topic_clustering/langevals_topic_clustering/types.py +42 -0
  9. package/langevals/evaluators/topic_clustering/langevals_topic_clustering/utils.py +191 -0
  10. package/langevals/evaluators/topic_clustering/pyproject.toml +52 -0
  11. package/langevals/evaluators/topic_clustering/tests/test_topic_clustering.py +239 -0
  12. package/langevals/evaluators/topic_clustering/tests/test_topic_clustering_integration.py +97 -0
  13. package/langevals/evaluators/topic_clustering/tests/test_topic_naming.py +72 -0
  14. package/langevals/langevals/pytest_plugins/pass_rate_plugin.py +7 -1
  15. package/langevals/langevals/server.py +28 -0
  16. package/langevals/pyproject.toml +3 -0
  17. package/langevals/uv.lock +119 -20
  18. package/langwatch/dist/client/assets/{AnnotationsTable-BDAkYaz6.js → AnnotationsTable-uS_9SQ-g.js} +2 -2
  19. package/langwatch/dist/client/assets/{BatchEvaluationSummary-DMaQM_VB.js → BatchEvaluationSummary-DtFd8yKJ.js} +2 -2
  20. package/langwatch/dist/client/assets/{BudgetEditDrawer-CHaqmdIl.js → BudgetEditDrawer-CHEPz0hH.js} +2 -2
  21. package/langwatch/dist/client/assets/{ChartCard-D14PUg_d.js → ChartCard-s5fMPo7b.js} +2 -2
  22. package/langwatch/dist/client/assets/{ChatWindow-CRDnlP-Q.js → ChatWindow-C0XSteVJ.js} +2 -2
  23. package/langwatch/dist/client/assets/ChatWindow-DFEmNXQL.js +1 -0
  24. package/langwatch/dist/client/assets/{ConfirmDialog-CXIhncvW.js → ConfirmDialog-M94yLNvP.js} +2 -2
  25. package/langwatch/dist/client/assets/{ContactSalesBlock-CijLBwRC.js → ContactSalesBlock-CnnuZ8iI.js} +2 -2
  26. package/langwatch/dist/client/assets/{DSPyExperiment-B1YOL2m8.js → DSPyExperiment-CMA6lrlx.js} +2 -2
  27. package/langwatch/dist/client/assets/{FilterDisplay-BB0xWrLn.js → FilterDisplay-0S3NqCkq.js} +2 -2
  28. package/langwatch/dist/client/assets/{FormatMoney-w9vr_h0X.js → FormatMoney-CCygtAHg.js} +2 -2
  29. package/langwatch/dist/client/assets/{FoundryDrawer-CdJDXtpz.js → FoundryDrawer-B35xZ26C.js} +2 -2
  30. package/langwatch/dist/client/assets/{GatewayErrorPanel-DvE9U2dS.js → GatewayErrorPanel-BsaYQEie.js} +2 -2
  31. package/langwatch/dist/client/assets/{GatewayLayout-lv1p_6B5.js → GatewayLayout-LvwwrwMf.js} +2 -2
  32. package/langwatch/dist/client/assets/{GraphsLayout-BJ68J9e-.js → GraphsLayout-DJ-HI9N1.js} +2 -2
  33. package/langwatch/dist/client/assets/{GroupBindingInputRow-DebZBCnD.js → GroupBindingInputRow-CV-fBkX9.js} +2 -2
  34. package/langwatch/dist/client/assets/{MessagesTable-B6lYde-x.js → MessagesTable-9taaKCOZ.js} +2 -2
  35. package/langwatch/dist/client/assets/{NavigationFooter-CiOVzDUh.js → NavigationFooter-Dzvauw3l.js} +2 -2
  36. package/langwatch/dist/client/assets/{NoDataInfoBlock-quSW_MRm.js → NoDataInfoBlock-CLKl_wlX.js} +2 -2
  37. package/langwatch/dist/client/assets/{OpsPageShell-DJ1WlI6-.js → OpsPageShell-C_mTziRS.js} +2 -2
  38. package/langwatch/dist/client/assets/{OptimizationStudio-BlozXjcN.js → OptimizationStudio-D2zpsmJj.js} +8 -12
  39. package/langwatch/dist/client/assets/{PreconditionsField-BOfcWvmZ.js → PreconditionsField-WXB8kcTK.js} +2 -2
  40. package/langwatch/dist/client/assets/{SettingsLayout-CLCGxMAe.js → SettingsLayout--1gdEuhv.js} +2 -2
  41. package/langwatch/dist/client/assets/{SubscriptionPage-J8b2Zaj6.js → SubscriptionPage-B0ox_4kM.js} +2 -2
  42. package/langwatch/dist/client/assets/{VirtualKeySecretReveal-DR1VDLy7.js → VirtualKeySecretReveal-CRbI1dKQ.js} +2 -2
  43. package/langwatch/dist/client/assets/{WithPermissionGuard-DD8uo3UK.js → WithPermissionGuard-B4Jo8E5-.js} +2 -2
  44. package/langwatch/dist/client/assets/{__...path__-BZVaIayJ.js → __...path__-BF2zkD84.js} +2 -2
  45. package/langwatch/dist/client/assets/{_experiment_-B1aT-wS3.js → _experiment_-D02aoVQk.js} +2 -2
  46. package/langwatch/dist/client/assets/{_id_-oI_eq-I_.js → _id_-Ch8YmTiM.js} +2 -2
  47. package/langwatch/dist/client/assets/{_id_-DAqPuO73.js → _id_-D6ZvwHpH.js} +2 -2
  48. package/langwatch/dist/client/assets/{_id_-DUngklVb.js → _id_-DOC1ZkBm.js} +2 -2
  49. package/langwatch/dist/client/assets/{_id_-jFDAfbob.js → _id_-DfWwW6_N.js} +2 -2
  50. package/langwatch/dist/client/assets/{_id_-BKBrWGG0.js → _id_-DxUo4W7J.js} +2 -2
  51. package/langwatch/dist/client/assets/_not-found-COI3ShsR.js +1 -0
  52. package/langwatch/dist/client/assets/{_project_-Bt1tayHB.js → _project_-_UUt5Ar9.js} +2 -2
  53. package/langwatch/dist/client/assets/{_runId_-CfvnDt5H.js → _runId_-Dimwzp48.js} +2 -2
  54. package/langwatch/dist/client/assets/_slug_-BMvKBwS_.js +2 -0
  55. package/langwatch/dist/client/assets/{_slug_-DZAdl0QS.js → _slug_-CE6VoDSC.js} +2 -2
  56. package/langwatch/dist/client/assets/{_slug_-DmoWXjKT.js → _slug_-OiOLG1Mv.js} +2 -2
  57. package/langwatch/dist/client/assets/{_team_-DL_wKSWK.js → _team_-DKvmwO_5.js} +2 -2
  58. package/langwatch/dist/client/assets/{_workflow_-DcMXLPUe.js → _workflow_-FkilKiB-.js} +3 -3
  59. package/langwatch/dist/client/assets/{_workflow_-NI9bac7d.js → _workflow_-gJZppg3h.js} +2 -2
  60. package/langwatch/dist/client/assets/{access-audit-CFwNwusI.js → access-audit-xcUVYMMT.js} +2 -2
  61. package/langwatch/dist/client/assets/{agents-Di4XRwcn.js → agents-D32g91cu.js} +2 -2
  62. package/langwatch/dist/client/assets/{all-C273mlDB.js → all-vnREzDZj.js} +2 -2
  63. package/langwatch/dist/client/assets/{analytics-CEAcSf6B.js → analytics-DP6Y4Feh.js} +2 -2
  64. package/langwatch/dist/client/assets/{annotation-scores-CHfn4LQp.js → annotation-scores-CjD4CEB6.js} +2 -2
  65. package/langwatch/dist/client/assets/{annotations-CHZQrha6.js → annotations-1rVXiDRQ.js} +2 -2
  66. package/langwatch/dist/client/assets/{api-keys-BT7HExHM.js → api-keys-BJpKyuaz.js} +2 -2
  67. package/langwatch/dist/client/assets/{audit-log-BGk-51Dt.js → audit-log-BdUdZjxp.js} +2 -2
  68. package/langwatch/dist/client/assets/{authentication-DvwXfkp-.js → authentication-8mQB00CC.js} +2 -2
  69. package/langwatch/dist/client/assets/{authorize-tXpHrWyw.js → authorize-BpUueMNW.js} +2 -2
  70. package/langwatch/dist/client/assets/{authorize-CRu9xlpU.js → authorize-CbNBtmxW.js} +2 -2
  71. package/langwatch/dist/client/assets/{automations-CjDvz9Ak.js → automations-34KMkRxd.js} +2 -2
  72. package/langwatch/dist/client/assets/{billing-plans-FUqEPN62.js → billing-plans-BUQp08MI.js} +2 -2
  73. package/langwatch/dist/client/assets/{budgets-BV6_RHrs.js → budgets-CdelE8Hv.js} +2 -2
  74. package/langwatch/dist/client/assets/{cache-rules-CtYA79E_.js → cache-rules-D2m1QlNJ.js} +2 -2
  75. package/langwatch/dist/client/assets/choose-C0LdeUiH.js +2 -0
  76. package/langwatch/dist/client/assets/{command-bar-CaJygoez.js → command-bar-DUK45yin.js} +7 -9
  77. package/langwatch/dist/client/assets/custom-hBq2K4FJ.js +1 -0
  78. package/langwatch/dist/client/assets/{datasets-vLWpH84_.js → datasets-ErNNhmjg.js} +2 -2
  79. package/langwatch/dist/client/assets/{dejaview-DwVR3RGg.js → dejaview-BaD4_v90.js} +2 -2
  80. package/langwatch/dist/client/assets/{dist-SwV3YZv3.js → dist-Cds4Mqhj.js} +4 -6
  81. package/langwatch/dist/client/assets/{edit-CyxsmQmW.js → edit-DpT8ejBV.js} +2 -2
  82. package/langwatch/dist/client/assets/{evaluations-BfgeZMph.js → evaluations-BdQ2Dm2r.js} +2 -2
  83. package/langwatch/dist/client/assets/{evaluations-HSQIMvbX.js → evaluations-C90I4VAr.js} +2 -2
  84. package/langwatch/dist/client/assets/{evaluators-DLHVvnrh.js → evaluators-ig_ugRLt.js} +2 -2
  85. package/langwatch/dist/client/assets/{foundry-Ckq0WjPU.js → foundry-B-X_80pD.js} +2 -2
  86. package/langwatch/dist/client/assets/{gateway-CDSYPZ6w.js → gateway-CS_mtJx-.js} +2 -2
  87. package/langwatch/dist/client/assets/{groups-CCCRUqPj.js → groups-Bp90ChP3.js} +2 -2
  88. package/langwatch/dist/client/assets/{index-Bm6z2fM9.js → index-BEjGS0kI.js} +5 -5
  89. package/langwatch/dist/client/assets/{license-CHOarGWr.js → license-CgnlvyuI.js} +2 -2
  90. package/langwatch/dist/client/assets/{me-CBya_vXs.js → me-DEqhm_KC.js} +2 -2
  91. package/langwatch/dist/client/assets/{members-lIFLh-rh.js → members-CUJANDtH.js} +2 -2
  92. package/langwatch/dist/client/assets/{messages-CG9j8Dz8.js → messages-fQBfCjvp.js} +2 -2
  93. package/langwatch/dist/client/assets/{metrics-C9pzeaI6.js → metrics-DeIxebpD.js} +2 -2
  94. package/langwatch/dist/client/assets/{model-costs-Bc5uqjkl.js → model-costs-C1RbgK--.js} +2 -2
  95. package/langwatch/dist/client/assets/{model-providers-B5UjRgS_.js → model-providers-Pv3ML_-t.js} +2 -2
  96. package/langwatch/dist/client/assets/{my-queue-BkEfiWyR.js → my-queue-BLre2NMr.js} +2 -2
  97. package/langwatch/dist/client/assets/{ops-Cc-g-CMn.js → ops-CCw-FJaT.js} +2 -2
  98. package/langwatch/dist/client/assets/{organization-features-CoIKKHkQ.js → organization-features-rqg-75mI.js} +2 -2
  99. package/langwatch/dist/client/assets/{organizations-DWcQUTzi.js → organizations-DjCzIHVx.js} +2 -2
  100. package/langwatch/dist/client/assets/{persistence-CTQ44vGL.js → persistence-BPvHS0F6.js} +2 -2
  101. package/langwatch/dist/client/assets/{plans-Dq3eFg5K.js → plans-Ch2Ol-Fd.js} +2 -2
  102. package/langwatch/dist/client/assets/{projections-CTNj1QBM.js → projections-it4FOVjm.js} +2 -2
  103. package/langwatch/dist/client/assets/{projects-BxM7C87h.js → projects-CjWZFLfn.js} +2 -2
  104. package/langwatch/dist/client/assets/{prompts-DhXnJT6e.js → prompts-DilmFH_s.js} +2 -2
  105. package/langwatch/dist/client/assets/{providers-DW7VWdqq.js → providers-tlLT_lTF.js} +2 -2
  106. package/langwatch/dist/client/assets/{reports-D3QFKhNP.js → reports-vlrcTrLs.js} +2 -2
  107. package/langwatch/dist/client/assets/{roles-B_0t5DWA.js → roles-DNgi-NQ9.js} +2 -2
  108. package/langwatch/dist/client/assets/{scenarios-BX3XslU0.js → scenarios-BmG_wDkR.js} +2 -2
  109. package/langwatch/dist/client/assets/{scim-DDsLO39r.js → scim-BKr1_FHt.js} +2 -2
  110. package/langwatch/dist/client/assets/{secrets-BvEGwDCy.js → secrets-CU8ocTGv.js} +2 -2
  111. package/langwatch/dist/client/assets/{settings-9giNiAQQ.js → settings-CDzdoYVK.js} +2 -2
  112. package/langwatch/dist/client/assets/{setup-HxXKoVKG.js → setup-nEvn2rjN.js} +2 -2
  113. package/langwatch/dist/client/assets/{subscription-DhyswDze.js → subscription-BPNl_6jF.js} +3 -3
  114. package/langwatch/dist/client/assets/{subscriptions-Dyyau22a.js → subscriptions-D0G-OE5C.js} +2 -2
  115. package/langwatch/dist/client/assets/{teams-DRmeAxzf.js → teams-DThgDQvB.js} +2 -2
  116. package/langwatch/dist/client/assets/{textOverflowHeuristic-JibhpzDV.js → textOverflowHeuristic-DTC8-Ffx.js} +2 -2
  117. package/langwatch/dist/client/assets/{topic-clustering-Bllfw5rZ.js → topic-clustering-BR2Mbpao.js} +2 -2
  118. package/langwatch/dist/client/assets/{topics-CpiGYxqb.js → topics-CI8GoNqp.js} +2 -2
  119. package/langwatch/dist/client/assets/{traceExecutor-CiHXJB0V.js → traceExecutor-CDUGyUaw.js} +2 -2
  120. package/langwatch/dist/client/assets/{usage-BnsstwBY.js → usage-B4mR7ut_.js} +2 -2
  121. package/langwatch/dist/client/assets/{usage-CoyGtJoI.js → usage-C8fbffYi.js} +2 -2
  122. package/langwatch/dist/client/assets/{useAdminResource-SPC5iBHM.js → useAdminResource-SmnnHro6.js} +2 -2
  123. package/langwatch/dist/client/assets/{useAnnotationQueues-2DKZTC7r.js → useAnnotationQueues-CA6Vk--V.js} +2 -2
  124. package/langwatch/dist/client/assets/{useAvailableEvaluators-HndTl2LV.js → useAvailableEvaluators-hmbmcRQr.js} +2 -2
  125. package/langwatch/dist/client/assets/{useDeleteDatasetConfirmation-BgWN6Qqb.js → useDeleteDatasetConfirmation-BCK_zUUe.js} +2 -2
  126. package/langwatch/dist/client/assets/{useWorkflowStore-e1wFCvo2.js → useWorkflowStore-QUJ3J8X9.js} +2 -2
  127. package/langwatch/dist/client/assets/{users-C6wjliCC.js → users-CfhanCfR.js} +2 -2
  128. package/langwatch/dist/client/assets/{users-tF6ZKeV1.js → users-HjuN3o6k.js} +2 -2
  129. package/langwatch/dist/client/assets/{virtual-keys-BL-65S0B.js → virtual-keys-Bj-MhW66.js} +2 -2
  130. package/langwatch/dist/client/assets/{wizard-faGkpZDT.js → wizard-dRWCVVx6.js} +2 -2
  131. package/langwatch/dist/client/assets/{workbench-Oj0s_YR-.js → workbench-CuixH3G1.js} +2 -2
  132. package/langwatch/dist/client/assets/{workflows-Cu9k-Twu.js → workflows-BT6m4Yu9.js} +2 -2
  133. package/langwatch/dist/client/index.html +3 -3
  134. package/langwatch/dist/scenario-child-process.js +20 -10
  135. package/langwatch/package.json +2 -2
  136. package/langwatch/pnpm-lock.yaml +329 -328
  137. package/langwatch/scripts/seed-dogfood-password.ts +163 -0
  138. package/langwatch/src/app/api/workflows/post_event/__tests__/post-event-evaluator.integration.test.ts +458 -0
  139. package/langwatch/src/app/api/workflows/post_event/__tests__/post-event-routing.test.ts +188 -0
  140. package/langwatch/src/app/api/workflows/post_event/__tests__/post-event.integration.test.ts +274 -0
  141. package/langwatch/src/app/api/workflows/post_event/post-event.ts +29 -1
  142. package/langwatch/src/components/agents/AgentCodeEditorDrawer.tsx +4 -5
  143. package/langwatch/src/components/agents/__tests__/AgentCodeEditorDrawer.integration.test.tsx +40 -0
  144. package/langwatch/src/components/evaluations/wizard/hooks/evaluation-wizard-store/slices/factories/__tests__/code-execution-node.factory.unit.test.ts +47 -0
  145. package/langwatch/src/components/evaluations/wizard/hooks/evaluation-wizard-store/slices/factories/code-execution-node.factory.ts +2 -4
  146. package/langwatch/src/components/experiments/BatchEvaluationV2/BatchEvaluationV2EvaluationResults.tsx +6 -1
  147. package/langwatch/src/hooks/usePostHog.ts +11 -0
  148. package/langwatch/src/optimization_studio/__tests__/registry.test.ts +29 -1
  149. package/langwatch/src/optimization_studio/components/Optimize.tsx +17 -3
  150. package/langwatch/src/optimization_studio/components/properties/AgentPropertiesPanel.tsx +4 -5
  151. package/langwatch/src/optimization_studio/hooks/workflowStoreCore.ts +17 -6
  152. package/langwatch/src/optimization_studio/hooks/workflowStoreCore.unit.test.ts +42 -0
  153. package/langwatch/src/optimization_studio/registry.ts +2 -4
  154. package/langwatch/src/optimization_studio/server/lambda/index.ts +12 -2
  155. package/langwatch/src/server/api/routers/workflows.ts +18 -0
  156. package/langwatch/src/server/evaluations-v3/execution/workflowBuilder.ts +3 -2
  157. package/langwatch/src/server/evaluations-v3/services/__tests__/experiment-run.service.getRun-null.unit.test.ts +71 -0
  158. package/langwatch/src/server/evaluations-v3/services/experiment-run.service.ts +18 -9
  159. package/langwatch/src/server/modelProviders/utils.ts +11 -1
  160. package/langwatch/src/server/nlpgo/__tests__/nlpgoFetch.integration.test.ts +248 -0
  161. package/langwatch/src/server/nlpgo/nlpgoFetch.ts +155 -0
  162. package/langwatch/src/server/routes/__tests__/playground-proxy.integration.test.ts +242 -0
  163. package/langwatch/src/server/routes/playground.ts +11 -1
  164. package/langwatch/src/server/routes/workflows.ts +17 -0
  165. package/langwatch/src/server/topicClustering/topicClustering.ts +33 -8
  166. package/langwatch/src/server/workflows/runWorkflow.ts +10 -13
  167. package/langwatch_nlp/langwatch_nlp/studio/execute/execute_component.py +25 -1
  168. package/langwatch_nlp/langwatch_nlp/studio/parser.py +121 -16
  169. package/langwatch_nlp/langwatch_nlp/topic_clustering/topic_naming.py +39 -32
  170. package/langwatch_nlp/scripts/entrypoint.sh +67 -0
  171. package/langwatch_nlp/tests/studio/test_parse.py +198 -0
  172. package/mcp-server/pnpm-lock.yaml +15 -21
  173. package/package.json +1 -1
  174. package/packages/server/dist/cli.cjs +78 -94
  175. package/langwatch/dist/client/assets/ChatWindow-DzB-tNlQ.js +0 -1
  176. package/langwatch/dist/client/assets/_not-found-PEUaWdF3.js +0 -1
  177. package/langwatch/dist/client/assets/_slug_-C-8AjsjC.js +0 -2
  178. package/langwatch/dist/client/assets/choose--PBky27o.js +0 -2
  179. package/langwatch/dist/client/assets/custom-CSiS1liN.js +0 -1
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Pr as n,Ra as r,Ss as i,Xr as a,Zn as o,_s as s,ar as c,bi as l,bs as u,er as d,ja as f,mn as p,mr as m,rc as h,rr as g,tr as _,vr as v,vs as y,wa as b,xs as x,ys as S}from"./command-bar-CaJygoez.js";import{j as C,n as w,r as T}from"./stack-oJ9iWdbl.js";import{t as E}from"./box-BsM8YLGl.js";import{t as D}from"./tooltip-AEm0YeiF.js";import{n as O}from"./toaster-C_DYALhL.js";import{an as k}from"./dist-SwV3YZv3.js";import{h as A}from"./terminal-CfM0q99k.js";import{t as j}from"./heading-D90dlSnH.js";import{t as M}from"./text-CwTrMF8x.js";import{r as N}from"./code-FF_ibTVI.js";import{t as P}from"./h-stack-BKLDJ2vg.js";import{t as F}from"./link-CwZhwOLq.js";import{t as I}from"./spacer-2LJJGbo8.js";import{t as L}from"./v-stack-EOPQ57OZ.js";import{s as R}from"./auth-client-D3UhxhQi.js";import{r as z}from"./next-router-C6sliiV7.js";import{t as B}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as V}from"./file-clock-CnKkOnAG.js";import{t as H}from"./WithPermissionGuard-DD8uo3UK.js";import{t as U}from"./ConfirmDialog-CXIhncvW.js";import{t as W}from"./GatewayLayout-lv1p_6B5.js";import{n as G,r as K,t as q}from"./VirtualKeySecretReveal-DR1VDLy7.js";var J=e(t()),Y=C();function X(){let{project:e,hasPermission:t}=B(),i=z(),o=typeof i.query.id==`string`?i.query.id:``,s=R.virtualKeys.get.useQuery({projectId:e?.id??``,id:o},{enabled:!!e?.id&&!!o}),c=(0,J.useMemo)(()=>{let e=new Date;return{fromDate:new Date(e.getTime()-720*60*60*1e3).toISOString(),toDate:e.toISOString()}},[]),l=R.gatewayUsage.summaryForVirtualKey.useQuery({projectId:e?.id??``,virtualKeyId:o,fromDate:c.fromDate,toDate:c.toDate},{enabled:!!e?.id&&!!o}),u=R.useContext(),d=R.virtualKeys.rotate.useMutation({onSuccess:()=>u.virtualKeys.get.invalidate({projectId:e?.id,id:o})}),p=R.virtualKeys.revoke.useMutation({onSuccess:()=>u.virtualKeys.get.invalidate({projectId:e?.id,id:o})}),[m,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),[y,x]=(0,J.useState)(!1),[S,C]=(0,J.useState)(null),A=t(`virtualKeys:update`),j=t(`virtualKeys:rotate`),H=s.data;return(0,Y.jsxs)(W,{children:[(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(a.Header,{children:[(0,Y.jsx)(P,{children:(0,Y.jsx)(F,{href:`/${e?.slug}/gateway/virtual-keys`,color:`fg.muted`,fontSize:`sm`,children:(0,Y.jsxs)(P,{gap:1,children:[(0,Y.jsx)(N,{size:14}),` Virtual Keys`]})})}),(0,Y.jsx)(a.Heading,{children:H?.name??`Virtual key`}),(0,Y.jsx)(I,{}),H&&(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{href:`/settings/audit-log?targetKind=virtual_key&targetId=${H.id}`,children:(0,Y.jsxs)(w,{variant:`outline`,size:`sm`,children:[(0,Y.jsx)(V,{size:14}),` Audit history`]})}),H.status===`active`&&A&&(0,Y.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>g(!0),children:[(0,Y.jsx)(r,{size:14}),` Edit`]}),H.status===`active`&&j&&(0,Y.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>v(!0),children:[(0,Y.jsx)(f,{size:14}),` Rotate`]}),H.status===`active`&&A&&(0,Y.jsxs)(w,{colorPalette:`red`,variant:`outline`,size:`sm`,onClick:()=>x(!0),children:[(0,Y.jsx)(b,{size:14}),` Revoke`]})]})]}),(0,Y.jsx)(E,{padding:6,width:`full`,maxWidth:`1600px`,marginX:`auto`,children:s.isLoading?(0,Y.jsx)(T,{}):H?(0,Y.jsxs)(L,{align:`stretch`,gap:6,maxWidth:`900px`,children:[(0,Y.jsxs)(Z,{title:`Identity`,children:[(0,Y.jsx)(Q,{label:`ID`,children:(0,Y.jsx)(h,{fontSize:`xs`,children:H.id})}),(0,Y.jsx)(Q,{label:`Prefix`,children:(0,Y.jsxs)(h,{fontSize:`xs`,children:[H.displayPrefix,`…`]})}),(0,Y.jsx)(Q,{label:`Environment`,children:(0,Y.jsx)(k,{colorPalette:H.environment===`live`?`green`:`gray`,children:H.environment})}),(0,Y.jsx)(Q,{label:`Status`,children:(0,Y.jsx)(k,{colorPalette:H.status===`active`?`green`:`red`,children:H.status})}),H.description&&(0,Y.jsx)(Q,{label:`Description`,children:(0,Y.jsx)(M,{fontSize:`sm`,children:H.description})})]}),(0,Y.jsxs)(Z,{title:`Activity`,children:[(0,Y.jsx)(Q,{label:`Last used`,children:H.lastUsedAt?(0,Y.jsx)(D,{content:new Date(H.lastUsedAt).toLocaleString(),children:(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:n(new Date(H.lastUsedAt).getTime())})}):(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`never`})}),(0,Y.jsx)(Q,{label:`Created`,children:(0,Y.jsx)(D,{content:new Date(H.createdAt).toLocaleString(),children:(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:n(new Date(H.createdAt).getTime())})})}),(0,Y.jsx)(Q,{label:`Revision`,children:(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:H.revision})})]}),(0,Y.jsx)(Z,{title:`How to use`,children:(0,Y.jsx)(G,{})}),(0,Y.jsx)(Z,{title:`Provider fallback chain`,children:(0,Y.jsx)(ie,{chain:H.providerChain??[],fallbackIds:H.providerCredentialIds})}),(0,Y.jsx)(ae,{config:H.config}),(0,Y.jsx)(ee,{data:l.data??null})]}):(0,Y.jsx)(M,{color:`fg.muted`,children:`Virtual key not found.`})})]}),e?.id&&H&&(0,Y.jsx)(K,{projectId:e.id,vk:m?H:null,onOpenChange:e=>{e||g(!1)},onSaved:()=>{g(!1),s.refetch()}}),(0,Y.jsx)(U,{open:_,onOpenChange:v,title:`Rotate ${H?.name??`virtual key`}?`,message:`A fresh secret will be minted and shown once. The current secret keeps working for 24h (grace window) so clients can roll over.`,confirmLabel:`Rotate secret`,tone:`warning`,loading:d.isPending,onConfirm:async()=>{if(!(!H||!e))try{let t=await d.mutateAsync({projectId:e.id,id:H.id});C({name:H.name,secret:t.secret}),v(!1)}catch(e){O.create({title:e instanceof Error?e.message:`Failed to rotate key`,type:`error`})}}}),(0,Y.jsx)(U,{open:y,onOpenChange:x,title:`Revoke ${H?.name??`virtual key`}?`,message:`Clients using this key start receiving 401s within ~60 seconds. This cannot be undone — revoked keys are never reactivated.`,confirmLabel:`Revoke key`,tone:`danger`,loading:p.isPending,onConfirm:async()=>{if(!(!H||!e))try{await p.mutateAsync({projectId:e.id,id:H.id}),x(!1)}catch(e){O.create({title:e instanceof Error?e.message:`Failed to revoke key`,type:`error`})}}}),(0,Y.jsx)(q,{open:!!S,onClose:()=>C(null),keyName:S?.name??``,secret:S?.secret??``,kind:`rotate`})]})}function Z({title:e,children:t}){return(0,Y.jsxs)(E,{children:[(0,Y.jsx)(j,{size:`sm`,mb:2,children:e}),(0,Y.jsx)(A,{mb:3}),(0,Y.jsx)(L,{align:`stretch`,gap:2,children:t})]})}function Q({label:e,children:t}){return(0,Y.jsxs)(P,{gap:4,align:`flex-start`,children:[(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,minWidth:`140px`,children:e}),t]})}function ee({data:e}){if(!e)return(0,Y.jsx)(Z,{title:`Usage (last 30 days)`,children:(0,Y.jsx)(T,{size:`sm`})});if(e.totalRequests===0)return(0,Y.jsx)(Z,{title:`Usage (last 30 days)`,children:(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`No debits in the last 30 days. The gateway writes the ledger after a completed request against this virtual key.`})});let t=e.byDay.map(e=>({day:e.day,spendUsd:Number(e.totalUsd),requests:e.requests}));return(0,Y.jsx)(Z,{title:`Usage (last 30 days)`,children:(0,Y.jsxs)(L,{align:`stretch`,gap:4,children:[(0,Y.jsxs)(P,{gap:6,wrap:`wrap`,children:[(0,Y.jsx)($,{label:`Total spend`,value:`$${Number(e.totalUsd).toFixed(2)}`}),(0,Y.jsx)($,{label:`Requests`,value:e.totalRequests.toLocaleString()}),(0,Y.jsx)($,{label:`Avg $/request`,value:te(e.avgUsdPerRequest)}),e.blockedRequests>0&&(0,Y.jsx)($,{label:`Blocked`,value:e.blockedRequests.toLocaleString(),tone:`red`})]}),t.length>=2&&(0,Y.jsx)(E,{borderWidth:`1px`,borderColor:`border.subtle`,borderRadius:`lg`,padding:3,height:`180px`,children:(0,Y.jsx)(v,{width:`100%`,height:`100%`,children:(0,Y.jsxs)(o,{data:t,margin:{top:8,right:8,bottom:0,left:0},children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{id:`vkSpendFill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Y.jsx)(`stop`,{offset:`0%`,stopColor:`#f97316`,stopOpacity:.35}),(0,Y.jsx)(`stop`,{offset:`100%`,stopColor:`#f97316`,stopOpacity:0})]})}),(0,Y.jsx)(c,{strokeDasharray:`3 3`,stroke:`#e2e8f0`,vertical:!1}),(0,Y.jsx)(_,{dataKey:`day`,tick:{fontSize:11,fill:`#64748b`},tickFormatter:e=>e.slice(5),minTickGap:24}),(0,Y.jsx)(d,{tick:{fontSize:11,fill:`#64748b`},tickFormatter:e=>`$${e.toFixed(2)}`,width:56}),(0,Y.jsx)(m,{formatter:(e,t)=>t===`spendUsd`?[`$${Number(e).toFixed(4)}`,`Spend`]:[e,t],labelFormatter:e=>String(e??``),contentStyle:{fontSize:12}}),(0,Y.jsx)(g,{type:`monotone`,dataKey:`spendUsd`,stroke:`#f97316`,strokeWidth:2,fill:`url(#vkSpendFill)`})]})})}),e.byModel.length>0&&(0,Y.jsxs)(L,{align:`stretch`,gap:1,children:[(0,Y.jsx)(M,{fontSize:`xs`,fontWeight:`semibold`,color:`fg.muted`,children:`Spend by model`}),(0,Y.jsx)(P,{gap:2,flexWrap:`wrap`,children:e.byModel.map(e=>(0,Y.jsxs)(k,{variant:`outline`,fontSize:`2xs`,children:[e.model,` · $`,Number(e.totalUsd).toFixed(2),` · `,e.requests]},e.model))})]}),e.recentDebits.length>0&&(0,Y.jsxs)(L,{align:`stretch`,gap:1,children:[(0,Y.jsx)(M,{fontSize:`xs`,fontWeight:`semibold`,color:`fg.muted`,children:`Recent debits`}),(0,Y.jsxs)(x,{size:`sm`,variant:`line`,children:[(0,Y.jsx)(u,{children:(0,Y.jsxs)(i,{children:[(0,Y.jsx)(S,{children:`When`}),(0,Y.jsx)(S,{children:`Model`}),(0,Y.jsx)(S,{children:`Tokens`}),(0,Y.jsx)(S,{children:`Amount`}),(0,Y.jsx)(S,{children:`Latency`})]})}),(0,Y.jsx)(s,{children:e.recentDebits.slice(0,10).map(e=>(0,Y.jsxs)(i,{children:[(0,Y.jsx)(y,{children:(0,Y.jsx)(D,{content:new Date(e.occurredAt).toLocaleString(),children:(0,Y.jsx)(M,{fontSize:`xs`,color:`fg.muted`,children:n(new Date(e.occurredAt).getTime())})})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(h,{fontSize:`xs`,children:e.model})}),(0,Y.jsx)(y,{children:(0,Y.jsxs)(M,{fontSize:`xs`,color:`fg.muted`,children:[e.tokensInput.toLocaleString(),` →`,` `,e.tokensOutput.toLocaleString()]})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(M,{fontSize:`xs`,children:ne(e.amountUsd)})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(M,{fontSize:`xs`,color:`fg.muted`,children:e.durationMs===null?`—`:`${e.durationMs}ms`})})]},e.id))})]})]})]})})}function $({label:e,value:t,tone:n}){return(0,Y.jsxs)(L,{align:`start`,gap:0,children:[(0,Y.jsx)(M,{fontSize:`2xs`,color:`fg.muted`,textTransform:`uppercase`,children:e}),(0,Y.jsx)(M,{fontSize:`xl`,fontWeight:`semibold`,color:n===`red`?`red.600`:void 0,children:t})]})}function te(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t>=1?`$${t.toFixed(4)}`:t>=.01?`$${t.toFixed(5)}`:`$${t.toFixed(6)}`:`—`}function ne(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t>=1?`$${t.toFixed(4)}`:t>=.01?`$${t.toFixed(5)}`:`$${t.toFixed(6)}`:`—`}function re(e){return e&&e in l?l[e]:null}function ie({chain:e,fallbackIds:t}){let n=e.length>0?e:t.map((e,t)=>({providerCredentialId:e,slot:t===0?`primary`:`fallback-${t}`,providerType:``}));return n.length===0?(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`No providers bound.`}):(0,Y.jsxs)(x,{size:`sm`,children:[(0,Y.jsx)(u,{children:(0,Y.jsxs)(i,{children:[(0,Y.jsx)(S,{children:`Order`}),(0,Y.jsx)(S,{children:`Provider`}),(0,Y.jsx)(S,{children:`Slot`}),(0,Y.jsx)(S,{children:`Credential ID`})]})}),(0,Y.jsx)(s,{children:n.map((e,t)=>{let n=re(e.providerType);return(0,Y.jsxs)(i,{children:[(0,Y.jsx)(y,{children:(0,Y.jsxs)(k,{colorPalette:`orange`,children:[`#`,t+1]})}),(0,Y.jsx)(y,{children:(0,Y.jsxs)(P,{gap:2,children:[(0,Y.jsx)(E,{width:`20px`,height:`20px`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,css:{"& > svg":{width:`100%`,height:`100%`}},children:n}),(0,Y.jsx)(M,{fontSize:`sm`,fontWeight:`medium`,children:e.providerType||`—`})]})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(k,{variant:`subtle`,colorPalette:`gray`,children:e.slot})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(h,{fontSize:`xs`,children:e.providerCredentialId})})]},e.providerCredentialId)})})]})}function ae({config:e}){if(!e)return null;let t=e.metadata?.tags??[],n=e.cache?.mode??`respect`,r=e.rateLimits?.rpm??null,i=e.rateLimits?.rpd??null,a=Object.keys(e.modelAliases??{}).length,o=[`tools`,`mcp`,`urls`,`models`].reduce((t,n)=>t+((e.policyRules?.[n])?.deny?.length??0),0),s=(e.guardrails?.pre?.length??0)+(e.guardrails?.post?.length??0)+(e.guardrails?.streamChunk?.length??0),c=n===`force`?`orange`:n===`disable`?`red`:`green`;return(0,Y.jsxs)(Z,{title:`Configuration`,children:[t.length>0&&(0,Y.jsx)(Q,{label:`Tags`,children:(0,Y.jsx)(P,{gap:1,flexWrap:`wrap`,children:t.map(e=>(0,Y.jsx)(k,{variant:`subtle`,colorPalette:`gray`,fontSize:`2xs`,children:e},e))})}),(0,Y.jsx)(Q,{label:`Cache mode`,children:(0,Y.jsxs)(P,{gap:1,children:[(0,Y.jsx)(k,{colorPalette:c,children:n}),n===`force`&&(0,Y.jsxs)(M,{fontSize:`xs`,color:`fg.muted`,children:[`ttl `,e.cache?.ttlS??3600,`s`]})]})}),(0,Y.jsx)(Q,{label:`Rate limits`,children:(0,Y.jsxs)(P,{gap:1,flexWrap:`wrap`,children:[(0,Y.jsxs)(k,{variant:`outline`,fontSize:`2xs`,children:[`rpm `,r??`∞`]}),(0,Y.jsxs)(k,{variant:`outline`,fontSize:`2xs`,children:[`rpd `,i??`∞`]})]})}),(0,Y.jsx)(Q,{label:`Model aliases`,children:a===0?(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`—`}):(0,Y.jsxs)(L,{align:`start`,gap:1,children:[Object.entries(e.modelAliases??{}).slice(0,5).map(([e,t])=>(0,Y.jsxs)(P,{gap:1,fontSize:`xs`,children:[(0,Y.jsx)(h,{fontSize:`xs`,children:e}),(0,Y.jsx)(M,{color:`fg.muted`,children:`→`}),(0,Y.jsx)(h,{fontSize:`xs`,children:t})]},e)),a>5&&(0,Y.jsxs)(M,{fontSize:`xs`,color:`fg.muted`,children:[`+ `,a-5,` more (see Edit drawer)`]})]})}),(0,Y.jsx)(Q,{label:`Policy rules`,children:o===0?(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`—`}):(0,Y.jsx)(L,{align:`start`,gap:1,children:[`tools`,`mcp`,`urls`,`models`].map(t=>{let n=e.policyRules?.[t]?.deny??[];return n.length===0?null:(0,Y.jsxs)(P,{gap:1,flexWrap:`wrap`,fontSize:`xs`,children:[(0,Y.jsxs)(M,{fontWeight:`medium`,minWidth:`48px`,children:[t,`:`]}),n.slice(0,4).map(e=>(0,Y.jsx)(h,{fontSize:`2xs`,colorPalette:`red`,children:e},e)),n.length>4&&(0,Y.jsxs)(M,{color:`fg.muted`,children:[`+ `,n.length-4,` more`]})]},t)})})}),(0,Y.jsx)(Q,{label:`Guardrails`,children:(0,Y.jsx)(M,{fontSize:`sm`,color:s>0?void 0:`fg.muted`,children:s>0?`${s} monitor${s>1?`s`:``} attached (pre/post/stream_chunk)`:`—`})})]})}var oe=H(`virtualKeys:view`,{layoutComponent:p})(X);export{oe as default};
2
- //# sourceMappingURL=_id_-BKBrWGG0.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Pr as n,Ra as r,Ss as i,Xr as a,Zn as o,_s as s,ar as c,bi as l,bs as u,er as d,ja as f,mn as p,mr as m,rc as h,rr as g,tr as _,vr as v,vs as y,wa as b,xs as x,ys as S}from"./command-bar-DUK45yin.js";import{j as C,n as w,r as T}from"./stack-oJ9iWdbl.js";import{t as E}from"./box-BsM8YLGl.js";import{t as D}from"./tooltip-AEm0YeiF.js";import{n as O}from"./toaster-C_DYALhL.js";import{an as k}from"./dist-Cds4Mqhj.js";import{h as A}from"./terminal-CfM0q99k.js";import{t as j}from"./heading-D90dlSnH.js";import{t as M}from"./text-CwTrMF8x.js";import{r as N}from"./code-FF_ibTVI.js";import{t as P}from"./h-stack-BKLDJ2vg.js";import{t as F}from"./link-CwZhwOLq.js";import{t as I}from"./spacer-2LJJGbo8.js";import{t as L}from"./v-stack-EOPQ57OZ.js";import{s as R}from"./auth-client-D3UhxhQi.js";import{r as z}from"./next-router-C6sliiV7.js";import{t as B}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as V}from"./file-clock-CnKkOnAG.js";import{t as H}from"./WithPermissionGuard-B4Jo8E5-.js";import{t as U}from"./ConfirmDialog-M94yLNvP.js";import{t as W}from"./GatewayLayout-LvwwrwMf.js";import{n as G,r as K,t as q}from"./VirtualKeySecretReveal-CRbI1dKQ.js";var J=e(t()),Y=C();function X(){let{project:e,hasPermission:t}=B(),i=z(),o=typeof i.query.id==`string`?i.query.id:``,s=R.virtualKeys.get.useQuery({projectId:e?.id??``,id:o},{enabled:!!e?.id&&!!o}),c=(0,J.useMemo)(()=>{let e=new Date;return{fromDate:new Date(e.getTime()-720*60*60*1e3).toISOString(),toDate:e.toISOString()}},[]),l=R.gatewayUsage.summaryForVirtualKey.useQuery({projectId:e?.id??``,virtualKeyId:o,fromDate:c.fromDate,toDate:c.toDate},{enabled:!!e?.id&&!!o}),u=R.useContext(),d=R.virtualKeys.rotate.useMutation({onSuccess:()=>u.virtualKeys.get.invalidate({projectId:e?.id,id:o})}),p=R.virtualKeys.revoke.useMutation({onSuccess:()=>u.virtualKeys.get.invalidate({projectId:e?.id,id:o})}),[m,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),[y,x]=(0,J.useState)(!1),[S,C]=(0,J.useState)(null),A=t(`virtualKeys:update`),j=t(`virtualKeys:rotate`),H=s.data;return(0,Y.jsxs)(W,{children:[(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(a.Header,{children:[(0,Y.jsx)(P,{children:(0,Y.jsx)(F,{href:`/${e?.slug}/gateway/virtual-keys`,color:`fg.muted`,fontSize:`sm`,children:(0,Y.jsxs)(P,{gap:1,children:[(0,Y.jsx)(N,{size:14}),` Virtual Keys`]})})}),(0,Y.jsx)(a.Heading,{children:H?.name??`Virtual key`}),(0,Y.jsx)(I,{}),H&&(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{href:`/settings/audit-log?targetKind=virtual_key&targetId=${H.id}`,children:(0,Y.jsxs)(w,{variant:`outline`,size:`sm`,children:[(0,Y.jsx)(V,{size:14}),` Audit history`]})}),H.status===`active`&&A&&(0,Y.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>g(!0),children:[(0,Y.jsx)(r,{size:14}),` Edit`]}),H.status===`active`&&j&&(0,Y.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>v(!0),children:[(0,Y.jsx)(f,{size:14}),` Rotate`]}),H.status===`active`&&A&&(0,Y.jsxs)(w,{colorPalette:`red`,variant:`outline`,size:`sm`,onClick:()=>x(!0),children:[(0,Y.jsx)(b,{size:14}),` Revoke`]})]})]}),(0,Y.jsx)(E,{padding:6,width:`full`,maxWidth:`1600px`,marginX:`auto`,children:s.isLoading?(0,Y.jsx)(T,{}):H?(0,Y.jsxs)(L,{align:`stretch`,gap:6,maxWidth:`900px`,children:[(0,Y.jsxs)(Z,{title:`Identity`,children:[(0,Y.jsx)(Q,{label:`ID`,children:(0,Y.jsx)(h,{fontSize:`xs`,children:H.id})}),(0,Y.jsx)(Q,{label:`Prefix`,children:(0,Y.jsxs)(h,{fontSize:`xs`,children:[H.displayPrefix,`…`]})}),(0,Y.jsx)(Q,{label:`Environment`,children:(0,Y.jsx)(k,{colorPalette:H.environment===`live`?`green`:`gray`,children:H.environment})}),(0,Y.jsx)(Q,{label:`Status`,children:(0,Y.jsx)(k,{colorPalette:H.status===`active`?`green`:`red`,children:H.status})}),H.description&&(0,Y.jsx)(Q,{label:`Description`,children:(0,Y.jsx)(M,{fontSize:`sm`,children:H.description})})]}),(0,Y.jsxs)(Z,{title:`Activity`,children:[(0,Y.jsx)(Q,{label:`Last used`,children:H.lastUsedAt?(0,Y.jsx)(D,{content:new Date(H.lastUsedAt).toLocaleString(),children:(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:n(new Date(H.lastUsedAt).getTime())})}):(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`never`})}),(0,Y.jsx)(Q,{label:`Created`,children:(0,Y.jsx)(D,{content:new Date(H.createdAt).toLocaleString(),children:(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:n(new Date(H.createdAt).getTime())})})}),(0,Y.jsx)(Q,{label:`Revision`,children:(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:H.revision})})]}),(0,Y.jsx)(Z,{title:`How to use`,children:(0,Y.jsx)(G,{})}),(0,Y.jsx)(Z,{title:`Provider fallback chain`,children:(0,Y.jsx)(ie,{chain:H.providerChain??[],fallbackIds:H.providerCredentialIds})}),(0,Y.jsx)(ae,{config:H.config}),(0,Y.jsx)(ee,{data:l.data??null})]}):(0,Y.jsx)(M,{color:`fg.muted`,children:`Virtual key not found.`})})]}),e?.id&&H&&(0,Y.jsx)(K,{projectId:e.id,vk:m?H:null,onOpenChange:e=>{e||g(!1)},onSaved:()=>{g(!1),s.refetch()}}),(0,Y.jsx)(U,{open:_,onOpenChange:v,title:`Rotate ${H?.name??`virtual key`}?`,message:`A fresh secret will be minted and shown once. The current secret keeps working for 24h (grace window) so clients can roll over.`,confirmLabel:`Rotate secret`,tone:`warning`,loading:d.isPending,onConfirm:async()=>{if(!(!H||!e))try{let t=await d.mutateAsync({projectId:e.id,id:H.id});C({name:H.name,secret:t.secret}),v(!1)}catch(e){O.create({title:e instanceof Error?e.message:`Failed to rotate key`,type:`error`})}}}),(0,Y.jsx)(U,{open:y,onOpenChange:x,title:`Revoke ${H?.name??`virtual key`}?`,message:`Clients using this key start receiving 401s within ~60 seconds. This cannot be undone — revoked keys are never reactivated.`,confirmLabel:`Revoke key`,tone:`danger`,loading:p.isPending,onConfirm:async()=>{if(!(!H||!e))try{await p.mutateAsync({projectId:e.id,id:H.id}),x(!1)}catch(e){O.create({title:e instanceof Error?e.message:`Failed to revoke key`,type:`error`})}}}),(0,Y.jsx)(q,{open:!!S,onClose:()=>C(null),keyName:S?.name??``,secret:S?.secret??``,kind:`rotate`})]})}function Z({title:e,children:t}){return(0,Y.jsxs)(E,{children:[(0,Y.jsx)(j,{size:`sm`,mb:2,children:e}),(0,Y.jsx)(A,{mb:3}),(0,Y.jsx)(L,{align:`stretch`,gap:2,children:t})]})}function Q({label:e,children:t}){return(0,Y.jsxs)(P,{gap:4,align:`flex-start`,children:[(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,minWidth:`140px`,children:e}),t]})}function ee({data:e}){if(!e)return(0,Y.jsx)(Z,{title:`Usage (last 30 days)`,children:(0,Y.jsx)(T,{size:`sm`})});if(e.totalRequests===0)return(0,Y.jsx)(Z,{title:`Usage (last 30 days)`,children:(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`No debits in the last 30 days. The gateway writes the ledger after a completed request against this virtual key.`})});let t=e.byDay.map(e=>({day:e.day,spendUsd:Number(e.totalUsd),requests:e.requests}));return(0,Y.jsx)(Z,{title:`Usage (last 30 days)`,children:(0,Y.jsxs)(L,{align:`stretch`,gap:4,children:[(0,Y.jsxs)(P,{gap:6,wrap:`wrap`,children:[(0,Y.jsx)($,{label:`Total spend`,value:`$${Number(e.totalUsd).toFixed(2)}`}),(0,Y.jsx)($,{label:`Requests`,value:e.totalRequests.toLocaleString()}),(0,Y.jsx)($,{label:`Avg $/request`,value:te(e.avgUsdPerRequest)}),e.blockedRequests>0&&(0,Y.jsx)($,{label:`Blocked`,value:e.blockedRequests.toLocaleString(),tone:`red`})]}),t.length>=2&&(0,Y.jsx)(E,{borderWidth:`1px`,borderColor:`border.subtle`,borderRadius:`lg`,padding:3,height:`180px`,children:(0,Y.jsx)(v,{width:`100%`,height:`100%`,children:(0,Y.jsxs)(o,{data:t,margin:{top:8,right:8,bottom:0,left:0},children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{id:`vkSpendFill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Y.jsx)(`stop`,{offset:`0%`,stopColor:`#f97316`,stopOpacity:.35}),(0,Y.jsx)(`stop`,{offset:`100%`,stopColor:`#f97316`,stopOpacity:0})]})}),(0,Y.jsx)(c,{strokeDasharray:`3 3`,stroke:`#e2e8f0`,vertical:!1}),(0,Y.jsx)(_,{dataKey:`day`,tick:{fontSize:11,fill:`#64748b`},tickFormatter:e=>e.slice(5),minTickGap:24}),(0,Y.jsx)(d,{tick:{fontSize:11,fill:`#64748b`},tickFormatter:e=>`$${e.toFixed(2)}`,width:56}),(0,Y.jsx)(m,{formatter:(e,t)=>t===`spendUsd`?[`$${Number(e).toFixed(4)}`,`Spend`]:[e,t],labelFormatter:e=>String(e??``),contentStyle:{fontSize:12}}),(0,Y.jsx)(g,{type:`monotone`,dataKey:`spendUsd`,stroke:`#f97316`,strokeWidth:2,fill:`url(#vkSpendFill)`})]})})}),e.byModel.length>0&&(0,Y.jsxs)(L,{align:`stretch`,gap:1,children:[(0,Y.jsx)(M,{fontSize:`xs`,fontWeight:`semibold`,color:`fg.muted`,children:`Spend by model`}),(0,Y.jsx)(P,{gap:2,flexWrap:`wrap`,children:e.byModel.map(e=>(0,Y.jsxs)(k,{variant:`outline`,fontSize:`2xs`,children:[e.model,` · $`,Number(e.totalUsd).toFixed(2),` · `,e.requests]},e.model))})]}),e.recentDebits.length>0&&(0,Y.jsxs)(L,{align:`stretch`,gap:1,children:[(0,Y.jsx)(M,{fontSize:`xs`,fontWeight:`semibold`,color:`fg.muted`,children:`Recent debits`}),(0,Y.jsxs)(x,{size:`sm`,variant:`line`,children:[(0,Y.jsx)(u,{children:(0,Y.jsxs)(i,{children:[(0,Y.jsx)(S,{children:`When`}),(0,Y.jsx)(S,{children:`Model`}),(0,Y.jsx)(S,{children:`Tokens`}),(0,Y.jsx)(S,{children:`Amount`}),(0,Y.jsx)(S,{children:`Latency`})]})}),(0,Y.jsx)(s,{children:e.recentDebits.slice(0,10).map(e=>(0,Y.jsxs)(i,{children:[(0,Y.jsx)(y,{children:(0,Y.jsx)(D,{content:new Date(e.occurredAt).toLocaleString(),children:(0,Y.jsx)(M,{fontSize:`xs`,color:`fg.muted`,children:n(new Date(e.occurredAt).getTime())})})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(h,{fontSize:`xs`,children:e.model})}),(0,Y.jsx)(y,{children:(0,Y.jsxs)(M,{fontSize:`xs`,color:`fg.muted`,children:[e.tokensInput.toLocaleString(),` →`,` `,e.tokensOutput.toLocaleString()]})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(M,{fontSize:`xs`,children:ne(e.amountUsd)})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(M,{fontSize:`xs`,color:`fg.muted`,children:e.durationMs===null?`—`:`${e.durationMs}ms`})})]},e.id))})]})]})]})})}function $({label:e,value:t,tone:n}){return(0,Y.jsxs)(L,{align:`start`,gap:0,children:[(0,Y.jsx)(M,{fontSize:`2xs`,color:`fg.muted`,textTransform:`uppercase`,children:e}),(0,Y.jsx)(M,{fontSize:`xl`,fontWeight:`semibold`,color:n===`red`?`red.600`:void 0,children:t})]})}function te(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t>=1?`$${t.toFixed(4)}`:t>=.01?`$${t.toFixed(5)}`:`$${t.toFixed(6)}`:`—`}function ne(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t>=1?`$${t.toFixed(4)}`:t>=.01?`$${t.toFixed(5)}`:`$${t.toFixed(6)}`:`—`}function re(e){return e&&e in l?l[e]:null}function ie({chain:e,fallbackIds:t}){let n=e.length>0?e:t.map((e,t)=>({providerCredentialId:e,slot:t===0?`primary`:`fallback-${t}`,providerType:``}));return n.length===0?(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`No providers bound.`}):(0,Y.jsxs)(x,{size:`sm`,children:[(0,Y.jsx)(u,{children:(0,Y.jsxs)(i,{children:[(0,Y.jsx)(S,{children:`Order`}),(0,Y.jsx)(S,{children:`Provider`}),(0,Y.jsx)(S,{children:`Slot`}),(0,Y.jsx)(S,{children:`Credential ID`})]})}),(0,Y.jsx)(s,{children:n.map((e,t)=>{let n=re(e.providerType);return(0,Y.jsxs)(i,{children:[(0,Y.jsx)(y,{children:(0,Y.jsxs)(k,{colorPalette:`orange`,children:[`#`,t+1]})}),(0,Y.jsx)(y,{children:(0,Y.jsxs)(P,{gap:2,children:[(0,Y.jsx)(E,{width:`20px`,height:`20px`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,css:{"& > svg":{width:`100%`,height:`100%`}},children:n}),(0,Y.jsx)(M,{fontSize:`sm`,fontWeight:`medium`,children:e.providerType||`—`})]})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(k,{variant:`subtle`,colorPalette:`gray`,children:e.slot})}),(0,Y.jsx)(y,{children:(0,Y.jsx)(h,{fontSize:`xs`,children:e.providerCredentialId})})]},e.providerCredentialId)})})]})}function ae({config:e}){if(!e)return null;let t=e.metadata?.tags??[],n=e.cache?.mode??`respect`,r=e.rateLimits?.rpm??null,i=e.rateLimits?.rpd??null,a=Object.keys(e.modelAliases??{}).length,o=[`tools`,`mcp`,`urls`,`models`].reduce((t,n)=>t+((e.policyRules?.[n])?.deny?.length??0),0),s=(e.guardrails?.pre?.length??0)+(e.guardrails?.post?.length??0)+(e.guardrails?.streamChunk?.length??0),c=n===`force`?`orange`:n===`disable`?`red`:`green`;return(0,Y.jsxs)(Z,{title:`Configuration`,children:[t.length>0&&(0,Y.jsx)(Q,{label:`Tags`,children:(0,Y.jsx)(P,{gap:1,flexWrap:`wrap`,children:t.map(e=>(0,Y.jsx)(k,{variant:`subtle`,colorPalette:`gray`,fontSize:`2xs`,children:e},e))})}),(0,Y.jsx)(Q,{label:`Cache mode`,children:(0,Y.jsxs)(P,{gap:1,children:[(0,Y.jsx)(k,{colorPalette:c,children:n}),n===`force`&&(0,Y.jsxs)(M,{fontSize:`xs`,color:`fg.muted`,children:[`ttl `,e.cache?.ttlS??3600,`s`]})]})}),(0,Y.jsx)(Q,{label:`Rate limits`,children:(0,Y.jsxs)(P,{gap:1,flexWrap:`wrap`,children:[(0,Y.jsxs)(k,{variant:`outline`,fontSize:`2xs`,children:[`rpm `,r??`∞`]}),(0,Y.jsxs)(k,{variant:`outline`,fontSize:`2xs`,children:[`rpd `,i??`∞`]})]})}),(0,Y.jsx)(Q,{label:`Model aliases`,children:a===0?(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`—`}):(0,Y.jsxs)(L,{align:`start`,gap:1,children:[Object.entries(e.modelAliases??{}).slice(0,5).map(([e,t])=>(0,Y.jsxs)(P,{gap:1,fontSize:`xs`,children:[(0,Y.jsx)(h,{fontSize:`xs`,children:e}),(0,Y.jsx)(M,{color:`fg.muted`,children:`→`}),(0,Y.jsx)(h,{fontSize:`xs`,children:t})]},e)),a>5&&(0,Y.jsxs)(M,{fontSize:`xs`,color:`fg.muted`,children:[`+ `,a-5,` more (see Edit drawer)`]})]})}),(0,Y.jsx)(Q,{label:`Policy rules`,children:o===0?(0,Y.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:`—`}):(0,Y.jsx)(L,{align:`start`,gap:1,children:[`tools`,`mcp`,`urls`,`models`].map(t=>{let n=e.policyRules?.[t]?.deny??[];return n.length===0?null:(0,Y.jsxs)(P,{gap:1,flexWrap:`wrap`,fontSize:`xs`,children:[(0,Y.jsxs)(M,{fontWeight:`medium`,minWidth:`48px`,children:[t,`:`]}),n.slice(0,4).map(e=>(0,Y.jsx)(h,{fontSize:`2xs`,colorPalette:`red`,children:e},e)),n.length>4&&(0,Y.jsxs)(M,{color:`fg.muted`,children:[`+ `,n.length-4,` more`]})]},t)})})}),(0,Y.jsx)(Q,{label:`Guardrails`,children:(0,Y.jsx)(M,{fontSize:`sm`,color:s>0?void 0:`fg.muted`,children:s>0?`${s} monitor${s>1?`s`:``} attached (pre/post/stream_chunk)`:`—`})})]})}var oe=H(`virtualKeys:view`,{layoutComponent:p})(X);export{oe as default};
2
+ //# sourceMappingURL=_id_-DxUo4W7J.js.map
@@ -0,0 +1 @@
1
+ import{t as e}from"./index-BEjGS0kI.js";export{e as default};
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Bs as n,Dr as r,Gn as i,Jn as a,Pr as o,Sn as s,Vs as c,gn as l,mn as u,r as ee,wn as d,xn as f,zs as te}from"./command-bar-CaJygoez.js";import{j as p,n as m}from"./stack-oJ9iWdbl.js";import{t as h}from"./box-BsM8YLGl.js";import{f as g}from"./LoadingScreen--vgXk5-2.js";import{r as _}from"./dialog.anatomy-hrluUh9u.js";import{i as v,o as y,r as ne,t as b}from"./tabs-DwV1cIZB.js";import{t as x}from"./heading-D90dlSnH.js";import{t as S}from"./text-CwTrMF8x.js";import{t as C}from"./icon-BwEPrfAc.js";import{t as w}from"./h-stack-BKLDJ2vg.js";import{r as T,t as E}from"./card-CMtKVPVl.js";import{At as D,D as O,E as re,I as k,K as ie,M as ae,V as oe,c as se,dt as ce,g as A,i as j,kt as le,mt as ue,nt as de,s as M}from"./lu-Bf6j_N19.js";import{t as N}from"./container-Ccm3vB5X.js";import{n as P,t as F}from"./link-CwZhwOLq.js";import{t as I}from"./spacer-2LJJGbo8.js";import{t as L}from"./v-stack-EOPQ57OZ.js";import{r as R}from"./dist-C-nHoRjt.js";import{a as z,s as B}from"./auth-client-D3UhxhQi.js";import{r as V}from"./next-router-C6sliiV7.js";import{t as H}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as U}from"./next-link-DuYeiiEe.js";import{t as fe}from"./getSafeReturnToPath-BeAU7d2N.js";var W=e(t()),G=p(),pe=[{title:`Documentation`,description:`Learn how to integrate and use LangWatch effectively`,icon:(0,G.jsx)(se,{size:18}),iconColor:`blue.emphasized`,linkColor:`blue.solid`,background:`blue.subtle`,href:`https://docs.langwatch.ai`,cta:`View documentation`},{title:`Video Tutorials`,description:`Watch step-by-step guides and feature walkthroughs`,icon:(0,G.jsx)(re,{size:22}),iconColor:`red.emphasized`,linkColor:`red.solid`,background:`red.subtle`,href:`https://www.youtube.com/@LangWatch/videos`,cta:`Watch videos`}];function me({resource:e}){return(0,G.jsx)(P,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,_hover:{textDecoration:`none`},height:`full`,width:`full`,children:(0,G.jsx)(L,{align:`start`,padding:4,gap:3,borderRadius:`xl`,background:e.background,transition:`all 0.2s ease-in-out`,_hover:{opacity:.85},height:`full`,width:`full`,children:(0,G.jsxs)(w,{gap:3,align:`start`,children:[(0,G.jsx)(h,{padding:2,borderRadius:`lg`,color:`${e.iconColor}`,children:e.icon}),(0,G.jsxs)(L,{align:`start`,gap:1,flex:1,children:[(0,G.jsx)(S,{fontWeight:`medium`,fontSize:`sm`,children:e.title}),(0,G.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:e.description}),(0,G.jsxs)(w,{color:e.linkColor,fontSize:`xs`,children:[(0,G.jsx)(S,{children:e.cta}),(0,G.jsx)(k,{size:12})]})]})]})})})}function he(){return(0,G.jsxs)(L,{align:`stretch`,gap:3,width:`full`,children:[(0,G.jsx)(x,{children:`Learning resources`}),(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(2, 1fr)`},gap:3,width:`full`,children:pe.map(e=>(0,G.jsx)(me,{resource:e},e.title))}),(0,G.jsxs)(S,{fontSize:`13px`,color:`fg.muted`,paddingTop:2,children:[`Considering LangWatch for your team?`,` `,(0,G.jsx)(F,{href:`https://langwatch.ai/get-a-demo`,isExternal:!0,color:`fg.muted`,textDecoration:`underline`,_hover:{color:`orange.500`},children:`Request a demo`})]})]})}function K(e){return(0,G.jsx)(T,{_hover:{boxShadow:`0 0 0 0 #000, 0 0 0 0 #000, 0px 2px 4px 0px rgba(0, 0, 0, 0.1)`},...e,children:(0,G.jsx)(E,{padding:0,gap:2,children:e.children})})}var ge=e=>{switch(e){case`createProject`:return(0,G.jsx)(A,{size:12});case`syncFirstMessage`:return(0,G.jsx)(de,{size:12});case`inviteTeamMembers`:return(0,G.jsx)(le,{size:12});case`setupModelProviders`:return(0,G.jsx)(ie,{size:12});case`createPrompt`:return(0,G.jsx)(ue,{size:12});case`createWorkflow`:return(0,G.jsx)(D,{size:12});case`createSimulation`:return(0,G.jsx)(ce,{size:12});case`setupEvaluation`:return(0,G.jsx)(oe,{size:12});case`createDataset`:return(0,G.jsx)(ae,{size:12});default:return(0,G.jsx)(A,{size:12})}},q=(e,t)=>[{key:`createProject`,title:`Create your new project`,href:`/settings/teams`,complete:!0},{key:`syncFirstMessage`,title:`Sync your first message`,href:`/${t}/messages`,complete:e.firstMessage},{key:`inviteTeamMembers`,title:`Invite team members`,href:`/settings/members`,complete:(e.teamMembers??0)>1},{key:`setupModelProviders`,title:`Setup your model providers`,href:`/settings/model-providers`,complete:(e.modelProviders??0)>0},{key:`createPrompt`,title:`Create your first versioned prompt`,href:`/${t}/prompts`,complete:(e.prompts??0)>0},{key:`createSimulation`,title:`Create your first agent simulation`,href:`/${t}/simulations`,complete:(e.simulations??0)>0},{key:`setupEvaluation`,title:`Set up your first evaluation`,href:`/${t}/evaluations`,complete:(e.evaluations??0)>0},{key:`createWorkflow`,title:`Create your first workflow`,href:`/${t}/workflows`,complete:(e.workflows??0)>0},{key:`createDataset`,title:`Create a dataset from the messages`,href:`/${t}/datasets`,complete:(e.datasets??0)>0}],J=e=>{let t=e.filter(e=>e.complete).length;return Math.round(t/e.length*100)};function _e({step:e,onClick:t}){return(0,G.jsxs)(w,{gap:2,paddingY:1,paddingX:1,borderRadius:`md`,cursor:e.complete?`default`:`pointer`,onClick:e.complete?void 0:t,_hover:e.complete?{}:{background:`bg.muted`},transition:`all 0.15s`,children:[(0,G.jsx)(h,{padding:1,borderRadius:`full`,background:e.complete?`green.subtle`:`bg.muted`,color:e.complete?`green.solid`:`fg.muted`,children:e.complete?(0,G.jsx)(A,{size:10}):ge(e.key)}),(0,G.jsx)(S,{fontSize:`13px`,color:e.complete?`fg.muted`:`fg`,textDecoration:e.complete?`line-through`:`none`,children:e.title})]})}function ve(){let e=V(),{project:t}=H(),{emit:r}=R(),{data:i,isLoading:a}=B.integrationsChecks.getCheckStatus.useQuery({projectId:t?.id??``},{enabled:!!t?.id});if((0,W.useEffect)(()=>{if(a||!i||!t?.id)return;let e=q(i,t.slug),n=e.filter(e=>e.complete),o=J(e);r(`viewed`,`onboarding_progress`,{project_id:t.id,completion_percentage:o,completed_tasks_count:n.length,total_tasks_count:e.length,all_complete:o===100,has_first_message:i.firstMessage,has_team_members:(i.teamMembers??0)>1,has_model_providers:(i.modelProviders??0)>0,has_prompts:(i.prompts??0)>0,has_simulations:(i.simulations??0)>0,has_evaluations:(i.evaluations??0)>0,has_workflows:(i.workflows??0)>0,has_datasets:(i.datasets??0)>0,count_team_members:i.teamMembers??0,count_model_providers:i.modelProviders??0,count_prompts:i.prompts??0,count_simulations:i.simulations??0,count_evaluations:i.evaluations??0,count_workflows:i.workflows??0,count_datasets:i.datasets??0})},[a]),a||!i||!t)return null;let o=q(i,t.slug),s=J(o);if(s===100)return null;let l=n=>{r(`clicked`,`onboarding_step`,{project_id:t.id,step_key:n.key,step_title:n.title,step_complete:n.complete}),e.push(n.href)},u=[];for(let e=0;e<o.length;e+=3)u.push(o.slice(e,e+3));return(0,G.jsxs)(K,{cursor:`default`,width:`full`,padding:3,gap:2,_hover:{boxShadow:`xs`},children:[(0,G.jsxs)(w,{justify:`space-between`,align:`center`,width:`full`,children:[(0,G.jsx)(w,{gap:3,children:(0,G.jsx)(S,{fontSize:`sm`,fontWeight:`medium`,color:`fg`,children:`Get started with LangWatch`})}),(0,G.jsx)(I,{}),(0,G.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[s,`% completed`]}),(0,G.jsx)(h,{width:`80px`,children:(0,G.jsx)(n,{value:s,colorPalette:`orange`,size:`sm`,children:(0,G.jsx)(c,{borderRadius:`full`,children:(0,G.jsx)(te,{})})})})]}),(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(${u.length}, 1fr)`},gap:2,width:`full`,children:u.map((e,t)=>(0,G.jsx)(L,{align:`stretch`,gap:0,children:e.map(e=>(0,G.jsx)(_e,{step:e,onClick:()=>l(e)},e.key))},t))})]})}var ye=(e,t)=>{let n=f.traces,r=f.simulations,i=f.prompts,a=f.evaluations;return[{title:`Observability`,description:t?`View your traces and monitor performance`:`Set up tracing for your AI application`,icon:(0,G.jsx)(C,{as:n.icon,width:`16px`,height:`16px`,display:`block`}),color:n.color.split(`.`)[0]??`blue`,href:`/${e}/messages`,docsHref:`https://langwatch.ai/docs/integration/quick-start`},{title:`Agent Simulations`,description:`Test your AI agents with simulated conversations`,icon:(0,G.jsx)(C,{as:r.icon,width:`16px`,height:`16px`,display:`block`}),color:r.color.split(`.`)[0]??`pink`,href:`/${e}/simulations`,docsHref:`https://langwatch.ai/docs/agent-simulations/getting-started`},{title:`Prompt Management`,description:`Version and manage your prompts`,icon:(0,G.jsx)(C,{as:i.icon,width:`16px`,height:`16px`,display:`block`}),color:i.color.split(`.`)[0]??`purple`,href:`/${e}/prompts`,docsHref:`https://langwatch.ai/docs/prompt-management/overview`},{title:`Evaluations`,description:`Evaluate your agent or set up real-time evaluations`,icon:(0,G.jsx)(C,{as:a.icon,width:`16px`,height:`16px`,display:`block`}),color:a.color.split(`.`)[0]??`orange`,href:`/${e}/evaluations`,docsHref:`https://langwatch.ai/docs/llm-evaluation`}]};function be({card:e}){return(0,G.jsx)(P,{asChild:!0,_hover:{textDecoration:`none`},height:`full`,children:(0,G.jsx)(U,{href:e.href,children:(0,G.jsxs)(K,{height:`full`,width:`full`,padding:3,children:[(0,G.jsx)(w,{width:`full`,children:(0,G.jsx)(h,{padding:1.5,borderRadius:`md`,background:`${e.color}.subtle`,color:`${e.color}.solid`,children:e.icon})}),(0,G.jsxs)(L,{align:`start`,gap:1,flex:1,children:[(0,G.jsx)(S,{fontWeight:`medium`,fontSize:`sm`,children:e.title}),(0,G.jsx)(S,{fontSize:`xs`,color:`fg.muted`,lineClamp:2,children:e.description})]}),(0,G.jsx)(F,{href:e.docsHref,isExternal:!0,fontSize:`xs`,color:`fg.subtle`,_hover:{color:`${e.color}.500`},onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(w,{gap:1,children:[(0,G.jsx)(S,{children:`Docs`}),(0,G.jsx)(k,{size:10})]})})]})})})}function xe(){let{project:e}=H(),{data:t}=B.integrationsChecks.getCheckStatus.useQuery({projectId:e?.id??``},{enabled:!!e?.id});if(!e)return null;let n=t?.firstMessage??!1,r=ye(e.slug,n);return(0,G.jsxs)(L,{align:`stretch`,gap:3,width:`full`,children:[(0,G.jsx)(x,{children:`What would you like to work on today?`}),(0,G.jsx)(_,{templateColumns:{base:`1fr`,sm:`repeat(2, 1fr)`,lg:`repeat(4, 1fr)`},gap:3,children:r.map(e=>(0,G.jsx)(be,{card:e},e.title))})]})}var Y=e=>{let t=s[e],n=t?f[t]:null;return n?(0,G.jsx)(C,{as:n.icon,width:`14px`,height:`14px`,display:`block`}):(0,G.jsx)(C,{as:f.home.icon,width:`14px`,height:`14px`,display:`block`})},X=e=>{let t=s[e];return(t?f[t]:null)?.color??`gray.500`},Z=e=>{let t=s[e],n=(t?f[t]:null)?.label??`Item`;return n.endsWith(`s`)?n.slice(0,-1):n},Se=e=>{let t=new Map;for(let n of e){let e=t.get(n.type)??[];t.set(n.type,[...e,n])}return t};function Q({item:e}){let t=o(e.updatedAt.getTime()),n=X(e.type),r=Y(e.type);return(0,G.jsx)(P,{asChild:!0,_hover:{textDecoration:`none`},height:`full`,width:`full`,display:`block`,children:(0,G.jsx)(U,{href:e.href,children:(0,G.jsx)(K,{padding:3,height:`full`,children:(0,G.jsxs)(w,{gap:2,align:`start`,width:`full`,children:[(0,G.jsx)(h,{padding:1.5,borderRadius:`md`,background:`${n.split(`.`)[0]}.subtle`,color:`${n.split(`.`)[0]}.solid`,children:r}),(0,G.jsxs)(L,{align:`start`,gap:0,flex:1,minWidth:0,children:[(0,G.jsx)(S,{fontSize:`sm`,lineClamp:1,title:e.name,children:e.name}),(0,G.jsxs)(w,{gap:2,children:[(0,G.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:Z(e.type)}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(S,{fontSize:`xs`,color:`fg.subtle`,children:`•`}),(0,G.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:t})]})]})]})]})})})})}function Ce(){return(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(2, 1fr)`,lg:`repeat(3, 1fr)`},gap:3,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(K,{cursor:`default`,padding:3,children:(0,G.jsxs)(w,{gap:2,children:[(0,G.jsx)(g,{width:`32px`,height:`32px`,borderRadius:`md`}),(0,G.jsxs)(L,{align:`start`,gap:1,flex:1,children:[(0,G.jsx)(g,{height:`14px`,width:`80%`}),(0,G.jsx)(g,{height:`12px`,width:`50%`})]})]})},t))})}function we({items:e}){return(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(2, 1fr)`,lg:`repeat(3, 1fr)`},gap:3,children:e.map(e=>(0,G.jsx)(Q,{item:e},`${e.type}-${e.id}`))})}function Te({items:e}){let t=Se(e);return(0,G.jsx)(L,{gap:4,align:`stretch`,children:Array.from(t.entries()).map(([e,t])=>(0,G.jsxs)(L,{align:`stretch`,gap:2,children:[(0,G.jsxs)(w,{children:[(0,G.jsx)(h,{color:X(e),children:Y(e)}),(0,G.jsxs)(S,{fontSize:`sm`,color:`fg`,children:[Z(e),`s`]}),(0,G.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[`(`,t.length,`)`]})]}),(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(2, 1fr)`,lg:`repeat(3, 1fr)`},gap:3,children:t.map(e=>(0,G.jsx)(Q,{item:e},`${e.type}-${e.id}`))})]},e))})}function Ee(){let{project:e}=H(),{data:t,isLoading:n,error:r,refetch:i}=B.home.getRecentItems.useQuery({projectId:e?.id??``,limit:12},{enabled:!!e?.id});return!n&&!r&&t?.length===0?null:(0,G.jsx)(L,{align:`stretch`,gap:3,width:`full`,children:(0,G.jsxs)(v,{defaultValue:`recents`,variant:`enclosed`,size:`sm`,border:`none`,width:`full`,gap:3,display:`flex`,flexDirection:`column`,children:[(0,G.jsxs)(w,{width:`full`,children:[(0,G.jsx)(x,{children:`Jump right back`}),(0,G.jsx)(I,{}),(0,G.jsxs)(ne,{border:`none`,children:[(0,G.jsx)(y,{value:`recents`,fontSize:`xs`,paddingX:2,paddingY:.5,children:`Recents`}),(0,G.jsx)(y,{value:`by-type`,whiteSpace:`nowrap`,fontSize:`xs`,paddingX:2,paddingY:.5,children:`By type`})]})]}),n&&(0,G.jsx)(Ce,{}),r&&(0,G.jsx)(K,{cursor:`default`,padding:6,children:(0,G.jsxs)(L,{gap:2,width:`full`,children:[(0,G.jsx)(h,{color:`red.500`,children:(0,G.jsx)(O,{size:24})}),(0,G.jsx)(S,{fontSize:`sm`,color:`fg.muted`,children:`Failed to load recent items`}),(0,G.jsx)(S,{fontSize:`xs`,color:`blue.500`,cursor:`pointer`,_hover:{textDecoration:`underline`},onClick:()=>void i(),children:`Retry`})]})}),!n&&!r&&t&&t.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(b,{value:`recents`,paddingTop:0,children:(0,G.jsx)(we,{items:t})}),(0,G.jsx)(b,{value:`by-type`,paddingTop:0,children:(0,G.jsx)(Te,{items:t})})]})]})})}var De=e(r());function $(){let{project:e,organization:t}=H({redirectToOnboarding:!1,redirectToProjectOnboarding:!1}),{isSnoozed:n,snooze:r}=l(e?.id),{openDrawer:i}=ee(),{enabled:a}=d(`release_ui_sdk_radar_banner_card_enabled`,{organizationId:t?.id}),o=B.sdkRadar.getVersionStats.useQuery({projectId:e?.id??``},{enabled:!!e?.id&&a});if(!a||!e||!o.data||!o.data.hasOutdated||n)return null;let s=o.data.sdks.reduce((e,t)=>e+t.versions.filter(e=>e.isOutdated).reduce((e,t)=>e+t.count,0),0),c=o.data.sdks.filter(e=>e.versions.some(e=>e.isOutdated)).map(e=>e.displayName);return(0,G.jsxs)(K,{width:`full`,padding:4,borderColor:`yellow.300`,borderWidth:1,children:[(0,G.jsxs)(w,{width:`full`,gap:2,marginBottom:2,children:[(0,G.jsx)(x,{size:`sm`,color:`orange.500`,children:`SDK Radar: Update Recommended`}),(0,G.jsx)(I,{}),(0,G.jsxs)(m,{size:`xs`,variant:`ghost`,color:`fg.muted`,onClick:r,children:[(0,G.jsx)(M,{size:14}),`Snooze 30 days`]})]}),(0,G.jsxs)(w,{width:`full`,gap:4,children:[(0,G.jsxs)(S,{fontSize:`sm`,color:`fg.muted`,children:[(0,De.default)(s).format(`0,0`),` events in the last 7 days were sent from an outdated`,` `,(0,G.jsx)(S,{as:`span`,fontWeight:`bold`,color:`fg`,children:c.join(`, `)}),` `,`SDK.`]}),(0,G.jsx)(I,{}),(0,G.jsxs)(m,{size:`sm`,variant:`outline`,colorPalette:`orange`,onClick:()=>i(`sdkRadar`,{},{resetStack:!0}),children:[`View details `,(0,G.jsx)(j,{size:12})]})]})]})}function Oe(){let{project:e,hasPermission:t}=H(),n=t(`cost:view`),r={graphId:`tracesOverview`,graphType:`summary`,series:[{name:`Traces`,metric:`metadata.trace_id`,aggregation:`cardinality`,colorSet:a.metadata.trace_id.colorSet},{name:`Threads`,metric:`metadata.thread_id`,aggregation:`cardinality`,colorSet:a.metadata.thread_id.colorSet},{name:`Users`,metric:`metadata.user_id`,aggregation:`cardinality`,colorSet:a.metadata.user_id.colorSet},{name:`Total Tokens`,metric:`performance.total_tokens`,aggregation:`sum`,colorSet:a.performance.total_tokens.colorSet},...n?[{name:`LLM Cost`,metric:`performance.total_cost`,aggregation:`sum`,colorSet:a.performance.total_cost.colorSet}]:[],{name:`Mean Completion Time`,metric:`performance.completion_time`,aggregation:`avg`,colorSet:a.performance.completion_time.colorSet}],includePrevious:!0,timeScale:`full`};return e?(0,G.jsxs)(K,{width:`full`,padding:4,_hover:{boxShadow:`2xs`},children:[(0,G.jsxs)(w,{width:`full`,gap:2,marginBottom:2,children:[(0,G.jsx)(x,{size:`sm`,color:`fg`,children:`Traces Overview`}),(0,G.jsx)(I,{}),(0,G.jsxs)(F,{href:`/${e.slug}/analytics`,fontSize:`xs`,color:`fg.muted`,_hover:{color:`orange.500`},children:[`View dashboards `,(0,G.jsx)(j,{size:12})]})]}),(0,G.jsx)(i,{input:r})]}):null}var ke=e=>{if(!e||!e.trim())return null;let t=e.trim();return t.includes(`@`)?null:t.split(` `)[0]??null},Ae=e=>e<12?`morning`:e<18?`afternoon`:`evening`,je={morning:{named:`Good morning, `,anonymous:`Good morning`},afternoon:{named:`Good afternoon, `,anonymous:`Good afternoon`},evening:{named:`Good evening, `,anonymous:`Good evening`}},Me=({timeOfDay:e,name:t})=>{let{named:n,anonymous:r}=je[e];return t?`${n}${t}`:r};function Ne(){let{data:e}=z(),t=ke(e?.user?.name),[n,r]=(0,W.useState)(`morning`);return(0,W.useEffect)(()=>{r(Ae(new Date().getHours()))},[]),(0,G.jsx)(x,{as:`h1`,size:`lg`,children:Me({timeOfDay:n,name:t})})}function Pe(){return(0,G.jsx)(u,{children:(0,G.jsx)(N,{maxW:`5xl`,padding:6,children:(0,G.jsxs)(L,{gap:6,width:`full`,align:`start`,children:[(0,G.jsx)(Ne,{}),(0,G.jsx)($,{}),(0,G.jsx)(ve,{}),(0,G.jsx)(Oe,{}),(0,G.jsx)(Ee,{}),(0,G.jsx)(xe,{}),(0,G.jsx)(he,{})]})})})}function Fe(){return(0,G.jsx)(Ie,{})}function Ie(){let e=V(),t=e.query.return_to,n=fe(t),r=!!(n&&typeof window<`u`);return(0,W.useEffect)(()=>{r&&n&&e.push(n)},[e,n,r]),r?null:(0,G.jsx)(Pe,{})}export{Fe as default};
2
- //# sourceMappingURL=_project_-Bt1tayHB.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Bs as n,Dr as r,Gn as i,Jn as a,Pr as o,Sn as s,Vs as c,gn as l,mn as u,r as ee,wn as d,xn as f,zs as te}from"./command-bar-DUK45yin.js";import{j as p,n as m}from"./stack-oJ9iWdbl.js";import{t as h}from"./box-BsM8YLGl.js";import{f as g}from"./LoadingScreen--vgXk5-2.js";import{r as _}from"./dialog.anatomy-hrluUh9u.js";import{i as v,o as y,r as ne,t as b}from"./tabs-DwV1cIZB.js";import{t as x}from"./heading-D90dlSnH.js";import{t as S}from"./text-CwTrMF8x.js";import{t as C}from"./icon-BwEPrfAc.js";import{t as w}from"./h-stack-BKLDJ2vg.js";import{r as T,t as E}from"./card-CMtKVPVl.js";import{At as D,D as O,E as re,I as k,K as ie,M as ae,V as oe,c as se,dt as ce,g as A,i as j,kt as le,mt as ue,nt as de,s as M}from"./lu-Bf6j_N19.js";import{t as N}from"./container-Ccm3vB5X.js";import{n as P,t as F}from"./link-CwZhwOLq.js";import{t as I}from"./spacer-2LJJGbo8.js";import{t as L}from"./v-stack-EOPQ57OZ.js";import{r as R}from"./dist-C-nHoRjt.js";import{a as z,s as B}from"./auth-client-D3UhxhQi.js";import{r as V}from"./next-router-C6sliiV7.js";import{t as H}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as U}from"./next-link-DuYeiiEe.js";import{t as fe}from"./getSafeReturnToPath-BeAU7d2N.js";var W=e(t()),G=p(),pe=[{title:`Documentation`,description:`Learn how to integrate and use LangWatch effectively`,icon:(0,G.jsx)(se,{size:18}),iconColor:`blue.emphasized`,linkColor:`blue.solid`,background:`blue.subtle`,href:`https://docs.langwatch.ai`,cta:`View documentation`},{title:`Video Tutorials`,description:`Watch step-by-step guides and feature walkthroughs`,icon:(0,G.jsx)(re,{size:22}),iconColor:`red.emphasized`,linkColor:`red.solid`,background:`red.subtle`,href:`https://www.youtube.com/@LangWatch/videos`,cta:`Watch videos`}];function me({resource:e}){return(0,G.jsx)(P,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,_hover:{textDecoration:`none`},height:`full`,width:`full`,children:(0,G.jsx)(L,{align:`start`,padding:4,gap:3,borderRadius:`xl`,background:e.background,transition:`all 0.2s ease-in-out`,_hover:{opacity:.85},height:`full`,width:`full`,children:(0,G.jsxs)(w,{gap:3,align:`start`,children:[(0,G.jsx)(h,{padding:2,borderRadius:`lg`,color:`${e.iconColor}`,children:e.icon}),(0,G.jsxs)(L,{align:`start`,gap:1,flex:1,children:[(0,G.jsx)(S,{fontWeight:`medium`,fontSize:`sm`,children:e.title}),(0,G.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:e.description}),(0,G.jsxs)(w,{color:e.linkColor,fontSize:`xs`,children:[(0,G.jsx)(S,{children:e.cta}),(0,G.jsx)(k,{size:12})]})]})]})})})}function he(){return(0,G.jsxs)(L,{align:`stretch`,gap:3,width:`full`,children:[(0,G.jsx)(x,{children:`Learning resources`}),(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(2, 1fr)`},gap:3,width:`full`,children:pe.map(e=>(0,G.jsx)(me,{resource:e},e.title))}),(0,G.jsxs)(S,{fontSize:`13px`,color:`fg.muted`,paddingTop:2,children:[`Considering LangWatch for your team?`,` `,(0,G.jsx)(F,{href:`https://langwatch.ai/get-a-demo`,isExternal:!0,color:`fg.muted`,textDecoration:`underline`,_hover:{color:`orange.500`},children:`Request a demo`})]})]})}function K(e){return(0,G.jsx)(T,{_hover:{boxShadow:`0 0 0 0 #000, 0 0 0 0 #000, 0px 2px 4px 0px rgba(0, 0, 0, 0.1)`},...e,children:(0,G.jsx)(E,{padding:0,gap:2,children:e.children})})}var ge=e=>{switch(e){case`createProject`:return(0,G.jsx)(A,{size:12});case`syncFirstMessage`:return(0,G.jsx)(de,{size:12});case`inviteTeamMembers`:return(0,G.jsx)(le,{size:12});case`setupModelProviders`:return(0,G.jsx)(ie,{size:12});case`createPrompt`:return(0,G.jsx)(ue,{size:12});case`createWorkflow`:return(0,G.jsx)(D,{size:12});case`createSimulation`:return(0,G.jsx)(ce,{size:12});case`setupEvaluation`:return(0,G.jsx)(oe,{size:12});case`createDataset`:return(0,G.jsx)(ae,{size:12});default:return(0,G.jsx)(A,{size:12})}},q=(e,t)=>[{key:`createProject`,title:`Create your new project`,href:`/settings/teams`,complete:!0},{key:`syncFirstMessage`,title:`Sync your first message`,href:`/${t}/messages`,complete:e.firstMessage},{key:`inviteTeamMembers`,title:`Invite team members`,href:`/settings/members`,complete:(e.teamMembers??0)>1},{key:`setupModelProviders`,title:`Setup your model providers`,href:`/settings/model-providers`,complete:(e.modelProviders??0)>0},{key:`createPrompt`,title:`Create your first versioned prompt`,href:`/${t}/prompts`,complete:(e.prompts??0)>0},{key:`createSimulation`,title:`Create your first agent simulation`,href:`/${t}/simulations`,complete:(e.simulations??0)>0},{key:`setupEvaluation`,title:`Set up your first evaluation`,href:`/${t}/evaluations`,complete:(e.evaluations??0)>0},{key:`createWorkflow`,title:`Create your first workflow`,href:`/${t}/workflows`,complete:(e.workflows??0)>0},{key:`createDataset`,title:`Create a dataset from the messages`,href:`/${t}/datasets`,complete:(e.datasets??0)>0}],J=e=>{let t=e.filter(e=>e.complete).length;return Math.round(t/e.length*100)};function _e({step:e,onClick:t}){return(0,G.jsxs)(w,{gap:2,paddingY:1,paddingX:1,borderRadius:`md`,cursor:e.complete?`default`:`pointer`,onClick:e.complete?void 0:t,_hover:e.complete?{}:{background:`bg.muted`},transition:`all 0.15s`,children:[(0,G.jsx)(h,{padding:1,borderRadius:`full`,background:e.complete?`green.subtle`:`bg.muted`,color:e.complete?`green.solid`:`fg.muted`,children:e.complete?(0,G.jsx)(A,{size:10}):ge(e.key)}),(0,G.jsx)(S,{fontSize:`13px`,color:e.complete?`fg.muted`:`fg`,textDecoration:e.complete?`line-through`:`none`,children:e.title})]})}function ve(){let e=V(),{project:t}=H(),{emit:r}=R(),{data:i,isLoading:a}=B.integrationsChecks.getCheckStatus.useQuery({projectId:t?.id??``},{enabled:!!t?.id});if((0,W.useEffect)(()=>{if(a||!i||!t?.id)return;let e=q(i,t.slug),n=e.filter(e=>e.complete),o=J(e);r(`viewed`,`onboarding_progress`,{project_id:t.id,completion_percentage:o,completed_tasks_count:n.length,total_tasks_count:e.length,all_complete:o===100,has_first_message:i.firstMessage,has_team_members:(i.teamMembers??0)>1,has_model_providers:(i.modelProviders??0)>0,has_prompts:(i.prompts??0)>0,has_simulations:(i.simulations??0)>0,has_evaluations:(i.evaluations??0)>0,has_workflows:(i.workflows??0)>0,has_datasets:(i.datasets??0)>0,count_team_members:i.teamMembers??0,count_model_providers:i.modelProviders??0,count_prompts:i.prompts??0,count_simulations:i.simulations??0,count_evaluations:i.evaluations??0,count_workflows:i.workflows??0,count_datasets:i.datasets??0})},[a]),a||!i||!t)return null;let o=q(i,t.slug),s=J(o);if(s===100)return null;let l=n=>{r(`clicked`,`onboarding_step`,{project_id:t.id,step_key:n.key,step_title:n.title,step_complete:n.complete}),e.push(n.href)},u=[];for(let e=0;e<o.length;e+=3)u.push(o.slice(e,e+3));return(0,G.jsxs)(K,{cursor:`default`,width:`full`,padding:3,gap:2,_hover:{boxShadow:`xs`},children:[(0,G.jsxs)(w,{justify:`space-between`,align:`center`,width:`full`,children:[(0,G.jsx)(w,{gap:3,children:(0,G.jsx)(S,{fontSize:`sm`,fontWeight:`medium`,color:`fg`,children:`Get started with LangWatch`})}),(0,G.jsx)(I,{}),(0,G.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[s,`% completed`]}),(0,G.jsx)(h,{width:`80px`,children:(0,G.jsx)(n,{value:s,colorPalette:`orange`,size:`sm`,children:(0,G.jsx)(c,{borderRadius:`full`,children:(0,G.jsx)(te,{})})})})]}),(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(${u.length}, 1fr)`},gap:2,width:`full`,children:u.map((e,t)=>(0,G.jsx)(L,{align:`stretch`,gap:0,children:e.map(e=>(0,G.jsx)(_e,{step:e,onClick:()=>l(e)},e.key))},t))})]})}var ye=(e,t)=>{let n=f.traces,r=f.simulations,i=f.prompts,a=f.evaluations;return[{title:`Observability`,description:t?`View your traces and monitor performance`:`Set up tracing for your AI application`,icon:(0,G.jsx)(C,{as:n.icon,width:`16px`,height:`16px`,display:`block`}),color:n.color.split(`.`)[0]??`blue`,href:`/${e}/messages`,docsHref:`https://langwatch.ai/docs/integration/quick-start`},{title:`Agent Simulations`,description:`Test your AI agents with simulated conversations`,icon:(0,G.jsx)(C,{as:r.icon,width:`16px`,height:`16px`,display:`block`}),color:r.color.split(`.`)[0]??`pink`,href:`/${e}/simulations`,docsHref:`https://langwatch.ai/docs/agent-simulations/getting-started`},{title:`Prompt Management`,description:`Version and manage your prompts`,icon:(0,G.jsx)(C,{as:i.icon,width:`16px`,height:`16px`,display:`block`}),color:i.color.split(`.`)[0]??`purple`,href:`/${e}/prompts`,docsHref:`https://langwatch.ai/docs/prompt-management/overview`},{title:`Evaluations`,description:`Evaluate your agent or set up real-time evaluations`,icon:(0,G.jsx)(C,{as:a.icon,width:`16px`,height:`16px`,display:`block`}),color:a.color.split(`.`)[0]??`orange`,href:`/${e}/evaluations`,docsHref:`https://langwatch.ai/docs/llm-evaluation`}]};function be({card:e}){return(0,G.jsx)(P,{asChild:!0,_hover:{textDecoration:`none`},height:`full`,children:(0,G.jsx)(U,{href:e.href,children:(0,G.jsxs)(K,{height:`full`,width:`full`,padding:3,children:[(0,G.jsx)(w,{width:`full`,children:(0,G.jsx)(h,{padding:1.5,borderRadius:`md`,background:`${e.color}.subtle`,color:`${e.color}.solid`,children:e.icon})}),(0,G.jsxs)(L,{align:`start`,gap:1,flex:1,children:[(0,G.jsx)(S,{fontWeight:`medium`,fontSize:`sm`,children:e.title}),(0,G.jsx)(S,{fontSize:`xs`,color:`fg.muted`,lineClamp:2,children:e.description})]}),(0,G.jsx)(F,{href:e.docsHref,isExternal:!0,fontSize:`xs`,color:`fg.subtle`,_hover:{color:`${e.color}.500`},onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(w,{gap:1,children:[(0,G.jsx)(S,{children:`Docs`}),(0,G.jsx)(k,{size:10})]})})]})})})}function xe(){let{project:e}=H(),{data:t}=B.integrationsChecks.getCheckStatus.useQuery({projectId:e?.id??``},{enabled:!!e?.id});if(!e)return null;let n=t?.firstMessage??!1,r=ye(e.slug,n);return(0,G.jsxs)(L,{align:`stretch`,gap:3,width:`full`,children:[(0,G.jsx)(x,{children:`What would you like to work on today?`}),(0,G.jsx)(_,{templateColumns:{base:`1fr`,sm:`repeat(2, 1fr)`,lg:`repeat(4, 1fr)`},gap:3,children:r.map(e=>(0,G.jsx)(be,{card:e},e.title))})]})}var Y=e=>{let t=s[e],n=t?f[t]:null;return n?(0,G.jsx)(C,{as:n.icon,width:`14px`,height:`14px`,display:`block`}):(0,G.jsx)(C,{as:f.home.icon,width:`14px`,height:`14px`,display:`block`})},X=e=>{let t=s[e];return(t?f[t]:null)?.color??`gray.500`},Z=e=>{let t=s[e],n=(t?f[t]:null)?.label??`Item`;return n.endsWith(`s`)?n.slice(0,-1):n},Se=e=>{let t=new Map;for(let n of e){let e=t.get(n.type)??[];t.set(n.type,[...e,n])}return t};function Q({item:e}){let t=o(e.updatedAt.getTime()),n=X(e.type),r=Y(e.type);return(0,G.jsx)(P,{asChild:!0,_hover:{textDecoration:`none`},height:`full`,width:`full`,display:`block`,children:(0,G.jsx)(U,{href:e.href,children:(0,G.jsx)(K,{padding:3,height:`full`,children:(0,G.jsxs)(w,{gap:2,align:`start`,width:`full`,children:[(0,G.jsx)(h,{padding:1.5,borderRadius:`md`,background:`${n.split(`.`)[0]}.subtle`,color:`${n.split(`.`)[0]}.solid`,children:r}),(0,G.jsxs)(L,{align:`start`,gap:0,flex:1,minWidth:0,children:[(0,G.jsx)(S,{fontSize:`sm`,lineClamp:1,title:e.name,children:e.name}),(0,G.jsxs)(w,{gap:2,children:[(0,G.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:Z(e.type)}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(S,{fontSize:`xs`,color:`fg.subtle`,children:`•`}),(0,G.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:t})]})]})]})]})})})})}function Ce(){return(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(2, 1fr)`,lg:`repeat(3, 1fr)`},gap:3,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(K,{cursor:`default`,padding:3,children:(0,G.jsxs)(w,{gap:2,children:[(0,G.jsx)(g,{width:`32px`,height:`32px`,borderRadius:`md`}),(0,G.jsxs)(L,{align:`start`,gap:1,flex:1,children:[(0,G.jsx)(g,{height:`14px`,width:`80%`}),(0,G.jsx)(g,{height:`12px`,width:`50%`})]})]})},t))})}function we({items:e}){return(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(2, 1fr)`,lg:`repeat(3, 1fr)`},gap:3,children:e.map(e=>(0,G.jsx)(Q,{item:e},`${e.type}-${e.id}`))})}function Te({items:e}){let t=Se(e);return(0,G.jsx)(L,{gap:4,align:`stretch`,children:Array.from(t.entries()).map(([e,t])=>(0,G.jsxs)(L,{align:`stretch`,gap:2,children:[(0,G.jsxs)(w,{children:[(0,G.jsx)(h,{color:X(e),children:Y(e)}),(0,G.jsxs)(S,{fontSize:`sm`,color:`fg`,children:[Z(e),`s`]}),(0,G.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[`(`,t.length,`)`]})]}),(0,G.jsx)(_,{templateColumns:{base:`1fr`,md:`repeat(2, 1fr)`,lg:`repeat(3, 1fr)`},gap:3,children:t.map(e=>(0,G.jsx)(Q,{item:e},`${e.type}-${e.id}`))})]},e))})}function Ee(){let{project:e}=H(),{data:t,isLoading:n,error:r,refetch:i}=B.home.getRecentItems.useQuery({projectId:e?.id??``,limit:12},{enabled:!!e?.id});return!n&&!r&&t?.length===0?null:(0,G.jsx)(L,{align:`stretch`,gap:3,width:`full`,children:(0,G.jsxs)(v,{defaultValue:`recents`,variant:`enclosed`,size:`sm`,border:`none`,width:`full`,gap:3,display:`flex`,flexDirection:`column`,children:[(0,G.jsxs)(w,{width:`full`,children:[(0,G.jsx)(x,{children:`Jump right back`}),(0,G.jsx)(I,{}),(0,G.jsxs)(ne,{border:`none`,children:[(0,G.jsx)(y,{value:`recents`,fontSize:`xs`,paddingX:2,paddingY:.5,children:`Recents`}),(0,G.jsx)(y,{value:`by-type`,whiteSpace:`nowrap`,fontSize:`xs`,paddingX:2,paddingY:.5,children:`By type`})]})]}),n&&(0,G.jsx)(Ce,{}),r&&(0,G.jsx)(K,{cursor:`default`,padding:6,children:(0,G.jsxs)(L,{gap:2,width:`full`,children:[(0,G.jsx)(h,{color:`red.500`,children:(0,G.jsx)(O,{size:24})}),(0,G.jsx)(S,{fontSize:`sm`,color:`fg.muted`,children:`Failed to load recent items`}),(0,G.jsx)(S,{fontSize:`xs`,color:`blue.500`,cursor:`pointer`,_hover:{textDecoration:`underline`},onClick:()=>void i(),children:`Retry`})]})}),!n&&!r&&t&&t.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(b,{value:`recents`,paddingTop:0,children:(0,G.jsx)(we,{items:t})}),(0,G.jsx)(b,{value:`by-type`,paddingTop:0,children:(0,G.jsx)(Te,{items:t})})]})]})})}var De=e(r());function $(){let{project:e,organization:t}=H({redirectToOnboarding:!1,redirectToProjectOnboarding:!1}),{isSnoozed:n,snooze:r}=l(e?.id),{openDrawer:i}=ee(),{enabled:a}=d(`release_ui_sdk_radar_banner_card_enabled`,{organizationId:t?.id}),o=B.sdkRadar.getVersionStats.useQuery({projectId:e?.id??``},{enabled:!!e?.id&&a});if(!a||!e||!o.data||!o.data.hasOutdated||n)return null;let s=o.data.sdks.reduce((e,t)=>e+t.versions.filter(e=>e.isOutdated).reduce((e,t)=>e+t.count,0),0),c=o.data.sdks.filter(e=>e.versions.some(e=>e.isOutdated)).map(e=>e.displayName);return(0,G.jsxs)(K,{width:`full`,padding:4,borderColor:`yellow.300`,borderWidth:1,children:[(0,G.jsxs)(w,{width:`full`,gap:2,marginBottom:2,children:[(0,G.jsx)(x,{size:`sm`,color:`orange.500`,children:`SDK Radar: Update Recommended`}),(0,G.jsx)(I,{}),(0,G.jsxs)(m,{size:`xs`,variant:`ghost`,color:`fg.muted`,onClick:r,children:[(0,G.jsx)(M,{size:14}),`Snooze 30 days`]})]}),(0,G.jsxs)(w,{width:`full`,gap:4,children:[(0,G.jsxs)(S,{fontSize:`sm`,color:`fg.muted`,children:[(0,De.default)(s).format(`0,0`),` events in the last 7 days were sent from an outdated`,` `,(0,G.jsx)(S,{as:`span`,fontWeight:`bold`,color:`fg`,children:c.join(`, `)}),` `,`SDK.`]}),(0,G.jsx)(I,{}),(0,G.jsxs)(m,{size:`sm`,variant:`outline`,colorPalette:`orange`,onClick:()=>i(`sdkRadar`,{},{resetStack:!0}),children:[`View details `,(0,G.jsx)(j,{size:12})]})]})]})}function Oe(){let{project:e,hasPermission:t}=H(),n=t(`cost:view`),r={graphId:`tracesOverview`,graphType:`summary`,series:[{name:`Traces`,metric:`metadata.trace_id`,aggregation:`cardinality`,colorSet:a.metadata.trace_id.colorSet},{name:`Threads`,metric:`metadata.thread_id`,aggregation:`cardinality`,colorSet:a.metadata.thread_id.colorSet},{name:`Users`,metric:`metadata.user_id`,aggregation:`cardinality`,colorSet:a.metadata.user_id.colorSet},{name:`Total Tokens`,metric:`performance.total_tokens`,aggregation:`sum`,colorSet:a.performance.total_tokens.colorSet},...n?[{name:`LLM Cost`,metric:`performance.total_cost`,aggregation:`sum`,colorSet:a.performance.total_cost.colorSet}]:[],{name:`Mean Completion Time`,metric:`performance.completion_time`,aggregation:`avg`,colorSet:a.performance.completion_time.colorSet}],includePrevious:!0,timeScale:`full`};return e?(0,G.jsxs)(K,{width:`full`,padding:4,_hover:{boxShadow:`2xs`},children:[(0,G.jsxs)(w,{width:`full`,gap:2,marginBottom:2,children:[(0,G.jsx)(x,{size:`sm`,color:`fg`,children:`Traces Overview`}),(0,G.jsx)(I,{}),(0,G.jsxs)(F,{href:`/${e.slug}/analytics`,fontSize:`xs`,color:`fg.muted`,_hover:{color:`orange.500`},children:[`View dashboards `,(0,G.jsx)(j,{size:12})]})]}),(0,G.jsx)(i,{input:r})]}):null}var ke=e=>{if(!e||!e.trim())return null;let t=e.trim();return t.includes(`@`)?null:t.split(` `)[0]??null},Ae=e=>e<12?`morning`:e<18?`afternoon`:`evening`,je={morning:{named:`Good morning, `,anonymous:`Good morning`},afternoon:{named:`Good afternoon, `,anonymous:`Good afternoon`},evening:{named:`Good evening, `,anonymous:`Good evening`}},Me=({timeOfDay:e,name:t})=>{let{named:n,anonymous:r}=je[e];return t?`${n}${t}`:r};function Ne(){let{data:e}=z(),t=ke(e?.user?.name),[n,r]=(0,W.useState)(`morning`);return(0,W.useEffect)(()=>{r(Ae(new Date().getHours()))},[]),(0,G.jsx)(x,{as:`h1`,size:`lg`,children:Me({timeOfDay:n,name:t})})}function Pe(){return(0,G.jsx)(u,{children:(0,G.jsx)(N,{maxW:`5xl`,padding:6,children:(0,G.jsxs)(L,{gap:6,width:`full`,align:`start`,children:[(0,G.jsx)(Ne,{}),(0,G.jsx)($,{}),(0,G.jsx)(ve,{}),(0,G.jsx)(Oe,{}),(0,G.jsx)(Ee,{}),(0,G.jsx)(xe,{}),(0,G.jsx)(he,{})]})})})}function Fe(){return(0,G.jsx)(Ie,{})}function Ie(){let e=V(),t=e.query.return_to,n=fe(t),r=!!(n&&typeof window<`u`);return(0,W.useEffect)(()=>{r&&n&&e.push(n)},[e,n,r]),r?null:(0,G.jsx)(Pe,{})}export{Fe as default};
2
+ //# sourceMappingURL=_project_-_UUt5Ar9.js.map
@@ -1,7 +1,7 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Bs as n,Cn as r,Vs as i,Xr as a,mn as o,zs as s}from"./command-bar-CaJygoez.js";import{j as c,n as l,r as u}from"./stack-oJ9iWdbl.js";import{t as d}from"./box-BsM8YLGl.js";import{an as f}from"./dist-SwV3YZv3.js";import{t as p}from"./text-CwTrMF8x.js";import{i as m,r as h}from"./code-FF_ibTVI.js";import{t as g}from"./h-stack-BKLDJ2vg.js";import{r as _,t as v}from"./card-CMtKVPVl.js";import{t as y}from"./link-CwZhwOLq.js";import{t as b}from"./simple-grid-C3IW90zo.js";import{n as x,r as S,t as C}from"./stat-CHoKZ9Rr.js";import{c as w,i as T,l as E,n as D,t as O}from"./ReplayStateBadge-ChyX1KUG.js";import{t as k}from"./v-stack-EOPQ57OZ.js";import{s as A}from"./auth-client-D3UhxhQi.js";import{r as j}from"./next-router-C6sliiV7.js";import{t as M}from"./OpsPageShell-DJ1WlI6-.js";import{r as N}from"./PhaseTimeline-DXfTjBZX.js";var P=e(t()),F=c();function I(){let e=(...e)=>{let t=``,n=0;for(let[r,i]of e)r>n&&(t+=` `.repeat(r-n)),t+=i,n=r+i.length;return t},t=`/|═=`,n=`=═|\\`,r=`· · · ·`,i=e=>`─`.repeat(e);return[[e([5,`O`],[13,r],[33,`O`]),e([4,`/|\\`],[32,`/|\\`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,`/|\\`],[18,`°`],[32,`/|\\`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,t],[13,r],[32,`/|\\`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,t],[8,i(11)+`▶`],[32,`/|\\`]),e([4,`/ \\`],[15,`pew!`],[32,`/ \\`])],[e([5,`O`],[32,`*`],[33,`O`]),e([4,t],[8,`· · · · ·`],[32,`/|\\`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[32,`\\O`]),e([4,t],[8,`· · ·`],[33,`|`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,`/|\\`],[13,r],[31,n]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,`/|\\`],[7,`◀`+i(11)],[31,n]),e([4,`/ \\`],[20,`!wep`],[32,`/ \\`])],[e([6,`*`],[5,`O`],[33,`O`]),e([4,`/|\\`],[7,`· · · · ·`],[31,n]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O/`],[33,`O`]),e([5,`|`],[7,`· · ·`],[31,n]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[19,`·`],[33,`O`]),e([4,t],[13,r],[31,n]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,t],[8,i(4)+`▶`],[18,`✶`],[20,`◀`+i(4)],[31,n]),e([4,`/ \\`],[13,`pew! !wep`],[32,`/ \\`])],[e([5,`O`],[15,`\\`],[17,`*`],[19,`|`],[21,`*`],[23,`/`],[33,`O`]),e([4,t],[13,i(2)],[16,`★`],[18,`★`],[20,`★`],[23,i(2)],[31,n]),e([4,`/ \\`],[15,`/`],[17,`*`],[19,`|`],[21,`*`],[23,`\\`],[32,`/ \\`])],[e([5,`O`],[12,`~ ~ ~ ~ ~`],[33,`O`]),e([4,`/|\\`],[11,`~ ~ ~ ~ ~ ~`],[32,`/|\\`]),e([4,`/ \\`],[12,`~ ~ ~ ~ ~`],[32,`/ \\`])]]}var L=I();function R(e,t){if(e===`replay`){let e=[3,4,5,6,7,8,9,10,11];return L[e[Math.floor(t/3)%e.length]]}if(e===`write`){let e=[11,12,12,13,13];return L[e[Math.floor(t/3)%e.length]]}if(e===`drain`){let e=[0,0,1,0,0];return L[e[Math.floor(t/4)%e.length]]}if(e===`cutoff`){let e=[0,2,6,10];return L[e[Math.floor(t/4)%e.length]]}return L[0]}function z({phase:e}){let[t,n]=(0,P.useState)(0),r=(0,P.useRef)(t);return r.current=t,(0,P.useEffect)(()=>{let e=setInterval(()=>{n(e=>e+1)},200);return()=>clearInterval(e)},[]),(0,F.jsx)(d,{fontFamily:`mono`,fontSize:`14px`,lineHeight:`1.3`,whiteSpace:`pre`,textAlign:`center`,color:`orange.400`,userSelect:`none`,children:R(e,t).map((e,t)=>(0,F.jsx)(d,{children:e},t))})}var B=`
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Bs as n,Cn as r,Vs as i,Xr as a,mn as o,zs as s}from"./command-bar-DUK45yin.js";import{j as c,n as l,r as u}from"./stack-oJ9iWdbl.js";import{t as d}from"./box-BsM8YLGl.js";import{an as f}from"./dist-Cds4Mqhj.js";import{t as p}from"./text-CwTrMF8x.js";import{i as m,r as h}from"./code-FF_ibTVI.js";import{t as g}from"./h-stack-BKLDJ2vg.js";import{r as _,t as v}from"./card-CMtKVPVl.js";import{t as y}from"./link-CwZhwOLq.js";import{t as b}from"./simple-grid-C3IW90zo.js";import{n as x,r as S,t as C}from"./stat-CHoKZ9Rr.js";import{c as w,i as T,l as E,n as D,t as O}from"./ReplayStateBadge-ChyX1KUG.js";import{t as k}from"./v-stack-EOPQ57OZ.js";import{s as A}from"./auth-client-D3UhxhQi.js";import{r as j}from"./next-router-C6sliiV7.js";import{t as M}from"./OpsPageShell-C_mTziRS.js";import{r as N}from"./PhaseTimeline-DXfTjBZX.js";var P=e(t()),F=c();function I(){let e=(...e)=>{let t=``,n=0;for(let[r,i]of e)r>n&&(t+=` `.repeat(r-n)),t+=i,n=r+i.length;return t},t=`/|═=`,n=`=═|\\`,r=`· · · ·`,i=e=>`─`.repeat(e);return[[e([5,`O`],[13,r],[33,`O`]),e([4,`/|\\`],[32,`/|\\`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,`/|\\`],[18,`°`],[32,`/|\\`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,t],[13,r],[32,`/|\\`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,t],[8,i(11)+`▶`],[32,`/|\\`]),e([4,`/ \\`],[15,`pew!`],[32,`/ \\`])],[e([5,`O`],[32,`*`],[33,`O`]),e([4,t],[8,`· · · · ·`],[32,`/|\\`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[32,`\\O`]),e([4,t],[8,`· · ·`],[33,`|`]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,`/|\\`],[13,r],[31,n]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,`/|\\`],[7,`◀`+i(11)],[31,n]),e([4,`/ \\`],[20,`!wep`],[32,`/ \\`])],[e([6,`*`],[5,`O`],[33,`O`]),e([4,`/|\\`],[7,`· · · · ·`],[31,n]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O/`],[33,`O`]),e([5,`|`],[7,`· · ·`],[31,n]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[19,`·`],[33,`O`]),e([4,t],[13,r],[31,n]),e([4,`/ \\`],[32,`/ \\`])],[e([5,`O`],[33,`O`]),e([4,t],[8,i(4)+`▶`],[18,`✶`],[20,`◀`+i(4)],[31,n]),e([4,`/ \\`],[13,`pew! !wep`],[32,`/ \\`])],[e([5,`O`],[15,`\\`],[17,`*`],[19,`|`],[21,`*`],[23,`/`],[33,`O`]),e([4,t],[13,i(2)],[16,`★`],[18,`★`],[20,`★`],[23,i(2)],[31,n]),e([4,`/ \\`],[15,`/`],[17,`*`],[19,`|`],[21,`*`],[23,`\\`],[32,`/ \\`])],[e([5,`O`],[12,`~ ~ ~ ~ ~`],[33,`O`]),e([4,`/|\\`],[11,`~ ~ ~ ~ ~ ~`],[32,`/|\\`]),e([4,`/ \\`],[12,`~ ~ ~ ~ ~`],[32,`/ \\`])]]}var L=I();function R(e,t){if(e===`replay`){let e=[3,4,5,6,7,8,9,10,11];return L[e[Math.floor(t/3)%e.length]]}if(e===`write`){let e=[11,12,12,13,13];return L[e[Math.floor(t/3)%e.length]]}if(e===`drain`){let e=[0,0,1,0,0];return L[e[Math.floor(t/4)%e.length]]}if(e===`cutoff`){let e=[0,2,6,10];return L[e[Math.floor(t/4)%e.length]]}return L[0]}function z({phase:e}){let[t,n]=(0,P.useState)(0),r=(0,P.useRef)(t);return r.current=t,(0,P.useEffect)(()=>{let e=setInterval(()=>{n(e=>e+1)},200);return()=>clearInterval(e)},[]),(0,F.jsx)(d,{fontFamily:`mono`,fontSize:`14px`,lineHeight:`1.3`,whiteSpace:`pre`,textAlign:`center`,color:`orange.400`,userSelect:`none`,children:R(e,t).map((e,t)=>(0,F.jsx)(d,{children:e},t))})}var B=`
2
2
  @keyframes meshPulse {
3
3
  0%, 100% { background-position: 0% 50%; }
4
4
  50% { background-position: 100% 50%; }
5
5
  }
6
6
  `;function V({runId:e}){let t=D(),n=A.ops.getReplayRun.useQuery({runId:e},{refetchInterval:!1}),i=A.ops.cancelReplay.useMutation({onSuccess:()=>{t.refetch()}}),{hasAccess:a}=r(),o=t.data,s=n.data,c=o?.runId===e&&o.state!==`idle`,f=c&&o?.state===`running`,_=O(c?o?.state??`idle`:s?.state??`idle`),v=c&&o&&o.aggregatesTotal>0?Math.round(o.aggregatesProcessed/o.aggregatesTotal*100):0,b=f?{background:`linear-gradient(135deg, rgba(251,146,60,0.05) 0%, rgba(251,146,60,0.12) 25%, rgba(234,88,12,0.08) 50%, rgba(251,146,60,0.12) 75%, rgba(251,146,60,0.05) 100%)`,backgroundSize:`200% 200%`,animation:`meshPulse 4s ease infinite`}:{},x=t.isLoading||n.isLoading,S=c||s;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{children:B}),(0,F.jsxs)(d,{style:b,borderRadius:`lg`,padding:4,children:[(0,F.jsx)(g,{marginBottom:4,children:(0,F.jsx)(y,{href:`/ops/projections`,_hover:{textDecoration:`none`},children:(0,F.jsxs)(g,{gap:1,color:`fg.muted`,_hover:{color:`fg`},children:[(0,F.jsx)(h,{size:14}),(0,F.jsx)(p,{textStyle:`xs`,children:`Back to Projections`})]})})}),x&&(0,F.jsx)(m,{paddingY:20,children:(0,F.jsx)(u,{size:`lg`})}),!x&&!S&&(0,F.jsx)(m,{paddingY:20,children:(0,F.jsxs)(k,{gap:2,children:[(0,F.jsx)(p,{textStyle:`sm`,color:`fg.muted`,children:`No replay found for this run ID.`}),(0,F.jsx)(y,{href:`/ops/projections`,children:(0,F.jsx)(l,{size:`sm`,variant:`outline`,children:`Back to Projections`})})]})}),S&&c&&o&&(0,F.jsx)(H,{status:o,stateColor:_,progressPercent:v,isRunning:!!f,hasAccess:a,cancelMutation:i}),S&&!c&&s&&(0,F.jsx)(U,{entry:s,stateColor:_})]})]})}function H({status:e,stateColor:t,progressPercent:r,isRunning:a,hasAccess:o,cancelMutation:c}){let u=(0,P.useMemo)(()=>{if(!e.startedAt||!e.eventsProcessed)return null;let t=(Date.now()-new Date(e.startedAt).getTime())/1e3;return t<1?null:Math.round(e.eventsProcessed/t)},[e.startedAt,e.eventsProcessed]);return(0,F.jsxs)(k,{align:`stretch`,gap:4,children:[(0,F.jsx)(N,{currentPhase:e.currentPhase,completedState:a?null:e.state}),(0,F.jsxs)(b,{columns:4,gap:1,children:[(0,F.jsxs)(x,{children:[(0,F.jsx)(C,{children:`Aggregates`}),(0,F.jsxs)(S,{textStyle:`lg`,children:[e.aggregatesProcessed,e.aggregatesTotal>0&&` / ${e.aggregatesTotal}`]})]}),(0,F.jsxs)(x,{children:[(0,F.jsx)(C,{children:`Events`}),(0,F.jsx)(S,{textStyle:`lg`,children:e.eventsProcessed.toLocaleString()})]}),(0,F.jsxs)(x,{children:[(0,F.jsx)(C,{children:`Rate`}),(0,F.jsx)(S,{textStyle:`lg`,children:u===null?`—`:`${u.toLocaleString()}/s`})]}),(0,F.jsxs)(x,{children:[(0,F.jsx)(C,{children:`Elapsed`}),(0,F.jsx)(S,{textStyle:`lg`,children:e.startedAt?T(e.startedAt,e.completedAt):`—`})]})]}),a&&e.aggregatesTotal>0&&(0,F.jsxs)(k,{align:`stretch`,gap:1,children:[(0,F.jsx)(n,{size:`sm`,value:r,colorPalette:`orange`,children:(0,F.jsx)(i,{children:(0,F.jsx)(s,{})})}),(0,F.jsxs)(p,{textStyle:`xs`,color:`fg.muted`,textAlign:`end`,children:[r,`%`]})]}),(0,F.jsx)(_,{children:(0,F.jsx)(v,{padding:4,children:(0,F.jsxs)(k,{align:`stretch`,gap:3,children:[(0,F.jsxs)(g,{justify:`space-between`,children:[(0,F.jsxs)(g,{gap:2,children:[(0,F.jsx)(E,{colorPalette:t,children:(0,F.jsx)(w,{})}),(0,F.jsxs)(p,{textStyle:`sm`,fontWeight:`semibold`,children:[`Replay`,` `,e.state===`running`?`in progress`:e.state]}),e.currentProjection&&a&&(0,F.jsx)(f,{size:`sm`,variant:`subtle`,children:e.currentProjection})]}),a&&o&&(0,F.jsx)(l,{size:`xs`,colorPalette:`red`,variant:`outline`,loading:c.isPending,onClick:()=>c.mutate(),children:`Cancel Replay`})]}),e.description&&(0,F.jsx)(p,{textStyle:`xs`,color:`fg.muted`,children:e.description}),e.state===`failed`&&e.error&&(0,F.jsx)(d,{bg:`red.subtle`,padding:3,borderRadius:`md`,children:(0,F.jsx)(p,{textStyle:`xs`,color:`red.500`,children:e.error})}),e.startedAt&&e.userName&&(0,F.jsxs)(p,{textStyle:`xs`,color:`fg.muted`,children:[`Started by `,e.userName]}),(0,F.jsx)(g,{gap:2,flexWrap:`wrap`,children:e.projectionNames.map(e=>(0,F.jsx)(f,{size:`sm`,variant:`subtle`,children:e},e))}),a&&(0,F.jsx)(m,{overflow:`hidden`,maxHeight:`60px`,children:(0,F.jsx)(d,{transform:`scale(0.75)`,transformOrigin:`center`,children:(0,F.jsx)(z,{phase:e.currentPhase})})})]})})})]})}function U({entry:e,stateColor:t}){return(0,F.jsxs)(k,{align:`stretch`,gap:4,children:[(0,F.jsx)(N,{currentPhase:null,completedState:e.state}),(0,F.jsx)(_,{children:(0,F.jsx)(v,{padding:4,children:(0,F.jsxs)(k,{align:`stretch`,gap:3,children:[(0,F.jsxs)(g,{gap:2,children:[(0,F.jsx)(E,{colorPalette:t,children:(0,F.jsx)(w,{})}),(0,F.jsxs)(p,{textStyle:`sm`,fontWeight:`semibold`,children:[`Replay `,e.state]})]}),e.description&&(0,F.jsx)(p,{textStyle:`xs`,color:`fg.muted`,children:e.description}),(0,F.jsxs)(g,{gap:4,flexWrap:`wrap`,children:[(0,F.jsxs)(p,{textStyle:`xs`,color:`fg.muted`,children:[e.aggregatesProcessed.toLocaleString(),` aggregates`]}),(0,F.jsxs)(p,{textStyle:`xs`,color:`fg.muted`,children:[e.eventsProcessed.toLocaleString(),` events`]}),(0,F.jsxs)(p,{textStyle:`xs`,color:`fg.muted`,children:[`Duration: `,T(e.startedAt,e.completedAt)]}),e.completedAt&&(0,F.jsxs)(p,{textStyle:`xs`,color:`fg.muted`,children:[e.state===`completed`?`Completed`:`Ended`,` at`,` `,new Date(e.completedAt).toLocaleString()]}),e.userName&&(0,F.jsxs)(p,{textStyle:`xs`,color:`fg.muted`,children:[`Started by `,e.userName]})]}),e.state===`failed`&&e.error&&(0,F.jsxs)(d,{bg:`red.subtle`,padding:3,borderRadius:`md`,borderWidth:`1px`,borderColor:`red.200`,children:[(0,F.jsx)(p,{textStyle:`xs`,fontWeight:`medium`,color:`red.500`,marginBottom:1,children:`Error`}),(0,F.jsx)(p,{textStyle:`xs`,color:`red.500`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,children:e.error})]}),(0,F.jsx)(g,{gap:2,flexWrap:`wrap`,children:e.projectionNames.map(e=>(0,F.jsx)(f,{size:`sm`,variant:`subtle`,children:e},e))}),e.tenantIds.length>0&&(0,F.jsxs)(k,{align:`stretch`,gap:1,children:[(0,F.jsx)(p,{textStyle:`xs`,color:`fg.muted`,children:`Tenants`}),(0,F.jsx)(g,{gap:1,flexWrap:`wrap`,children:e.tenantIds.map(e=>(0,F.jsx)(f,{size:`xs`,variant:`outline`,children:e},e))})]})]})})})]})}function W(){let e=j().query.runId;return(0,F.jsx)(M,{children:(0,F.jsxs)(o,{children:[(0,F.jsx)(a.Header,{children:(0,F.jsx)(a.Heading,{children:`Replay Progress`})}),(0,F.jsx)(a.Container,{children:(0,F.jsx)(V,{runId:e})})]})})}export{W as default};
7
- //# sourceMappingURL=_runId_-CfvnDt5H.js.map
7
+ //# sourceMappingURL=_runId_-Dimwzp48.js.map
@@ -0,0 +1,2 @@
1
+ import e from"./wizard-dRWCVVx6.js";var t=e;export{t as default};
2
+ //# sourceMappingURL=_slug_-BMvKBwS_.js.map
@@ -1,2 +1,2 @@
1
- import{ac as e,oc as t}from"./command-bar-CaJygoez.js";import{j as n}from"./stack-oJ9iWdbl.js";import{t as r}from"./tooltip-AEm0YeiF.js";import{t as i}from"./heading-D90dlSnH.js";import{t as a}from"./text-CwTrMF8x.js";import{t as o}from"./h-stack-BKLDJ2vg.js";import{t as s}from"./container-Ccm3vB5X.js";import{t as c}from"./v-stack-EOPQ57OZ.js";import{s as l}from"./auth-client-D3UhxhQi.js";import{n as u}from"./useAnnotationQueues-2DKZTC7r.js";import{r as d}from"./next-router-C6sliiV7.js";import{t as f}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as p}from"./AnnotationsTable-BDAkYaz6.js";var m=n();function h(){let n=d(),{project:h}=f(),{slug:g}=n.query,_=l.annotation.getQueueBySlugOrId.useQuery({projectId:h?.id??``,slug:g},{enabled:!!h?.id&&typeof g==`string`&&!!g}),v=_.data?.members?.map(e=>e.user);return(0,m.jsx)(u,{children:(0,m.jsx)(s,{maxWidth:`calc(100vw - 330px)`,padding:0,margin:0,children:(0,m.jsx)(p,{noDataTitle:`No queued annotations for this queue`,noDataDescription:`Add a message to this queue to get started.`,tableHeader:(0,m.jsx)(()=>_.data?(0,m.jsxs)(c,{width:`full`,align:`start`,children:[(0,m.jsx)(i,{size:`lg`,children:_.data?.name}),(0,m.jsxs)(o,{children:[(0,m.jsx)(a,{fontSize:`sm`,children:`Members: `}),v?.map(n=>(0,m.jsx)(r,{content:n.name,children:(0,m.jsx)(t,{size:`xs`,children:(0,m.jsx)(e,{name:n.name??``})})},n.id))]})]}):null,{}),queueId:_.data?.id??``})})})}export{h as default};
2
- //# sourceMappingURL=_slug_-DZAdl0QS.js.map
1
+ import{ac as e,oc as t}from"./command-bar-DUK45yin.js";import{j as n}from"./stack-oJ9iWdbl.js";import{t as r}from"./tooltip-AEm0YeiF.js";import{t as i}from"./heading-D90dlSnH.js";import{t as a}from"./text-CwTrMF8x.js";import{t as o}from"./h-stack-BKLDJ2vg.js";import{t as s}from"./container-Ccm3vB5X.js";import{t as c}from"./v-stack-EOPQ57OZ.js";import{s as l}from"./auth-client-D3UhxhQi.js";import{n as u}from"./useAnnotationQueues-CA6Vk--V.js";import{r as d}from"./next-router-C6sliiV7.js";import{t as f}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as p}from"./AnnotationsTable-uS_9SQ-g.js";var m=n();function h(){let n=d(),{project:h}=f(),{slug:g}=n.query,_=l.annotation.getQueueBySlugOrId.useQuery({projectId:h?.id??``,slug:g},{enabled:!!h?.id&&typeof g==`string`&&!!g}),v=_.data?.members?.map(e=>e.user);return(0,m.jsx)(u,{children:(0,m.jsx)(s,{maxWidth:`calc(100vw - 330px)`,padding:0,margin:0,children:(0,m.jsx)(p,{noDataTitle:`No queued annotations for this queue`,noDataDescription:`Add a message to this queue to get started.`,tableHeader:(0,m.jsx)(()=>_.data?(0,m.jsxs)(c,{width:`full`,align:`start`,children:[(0,m.jsx)(i,{size:`lg`,children:_.data?.name}),(0,m.jsxs)(o,{children:[(0,m.jsx)(a,{fontSize:`sm`,children:`Members: `}),v?.map(n=>(0,m.jsx)(r,{content:n.name,children:(0,m.jsx)(t,{size:`xs`,children:(0,m.jsx)(e,{name:n.name??``})})},n.id))]})]}):null,{}),queueId:_.data?.id??``})})})}export{h as default};
2
+ //# sourceMappingURL=_slug_-CE6VoDSC.js.map
@@ -1,4 +1,4 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$t as n,Fa as r,G as i,H as a,K as o,La as s,Pa as c,Qa as l,Rr as u,Si as d,U as f,V as p,Vr as m,W as h,Xt as g,Yi as _,Zt as v,ao as y,at as b,bt as x,cc as S,dt as C,ei as w,en as T,ft as E,gs as D,hi as O,lt as k,ma as A,mn as j,mt as ee,n as M,nn as te,oa as ne,ps as N,qi as P,r as re,ro as ie,sa as ae,tn as oe,ut as se,wa as ce,xo as F,ya as le,yt as I,za as ue}from"./command-bar-CaJygoez.js";import{D as de,j as fe,n as L,r as R}from"./stack-oJ9iWdbl.js";import{t as z}from"./box-BsM8YLGl.js";import{f as B,h as pe}from"./LoadingScreen--vgXk5-2.js";import{t as V}from"./tooltip-AEm0YeiF.js";import{i as me,n as H}from"./toaster-C_DYALhL.js";import{Bt as he,Kt as ge,Yt as _e,_ as ve,f as U,g as ye,h as be,m as xe,n as Se,p as Ce,u as we,v as Te,y as Ee}from"./dist-SwV3YZv3.js";import{t as De}from"./terminal-CfM0q99k.js";import{c as Oe,d as ke,i as Ae,o as je}from"./tracking-DbhAKeey.js";import{t as Me}from"./heading-D90dlSnH.js";import{t as W}from"./text-CwTrMF8x.js";import{n as Ne}from"./code-FF_ibTVI.js";import{t as Pe}from"./input-C7emsUCL.js";import{t as Fe}from"./icon-BwEPrfAc.js";import{t as G}from"./h-stack-BKLDJ2vg.js";import{a as Ie,i as Le,n as Re,r as ze}from"./alert-SnQmACl1.js";import{$ as K,C as Be,D as Ve,Et as q,Mt as He,O as Ue,Ot as We,Pt as Ge,R as Ke,U as qe,V as Je,b as Ye,bt as Xe,dt as Ze,et as Qe,ft as $e,g as et,j as tt,k as nt,pt as rt,r as it,ut as at,v as ot,w as st}from"./lu-Bf6j_N19.js";import{n as ct,t as lt}from"./link-CwZhwOLq.js";import{t as ut}from"./spacer-2LJJGbo8.js";import{t as J}from"./v-stack-EOPQ57OZ.js";import{t as dt}from"./posthogErrorCapture-50j08Hs1.js";import{h as ft,s as Y,y as pt}from"./auth-client-D3UhxhQi.js";import{r as mt}from"./next-router-C6sliiV7.js";import{t as X}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as Z}from"./createLucideIcon-BJKFyRLS.js";import{a as ht,i as gt,n as _t,o as vt,r as yt,t as bt}from"./textOverflowHeuristic-JibhpzDV.js";import{t as xt}from"./cloud-QpryyEx-.js";import{t as St}from"./download-X34ozaiD.js";import{t as Ct}from"./square-9W0gaHHd.js";import{t as wt}from"./upload-KqBaezR7.js";import{t as Tt}from"./next-link-DuYeiiEe.js";import{t as Et}from"./persistence-CTQ44vGL.js";import{i as Dt,n as Ot,r as kt,t as At}from"./lib-BYJUJC_x.js";import{n as jt,r as Mt,t as Nt}from"./PassRateIndicator-BvWYud47.js";var Pt=Z(`list-chevrons-down-up`,[[`path`,{d:`M3 5h8`,key:`18g2rq`}],[`path`,{d:`M3 12h8`,key:`1xfjp6`}],[`path`,{d:`M3 19h8`,key:`fpbke4`}],[`path`,{d:`m15 5 3 3 3-3`,key:`1t4thf`}],[`path`,{d:`m15 19 3-3 3 3`,key:`y4ckd2`}]]),Ft=Z(`list-chevrons-up-down`,[[`path`,{d:`M3 5h8`,key:`18g2rq`}],[`path`,{d:`M3 12h8`,key:`1xfjp6`}],[`path`,{d:`M3 19h8`,key:`fpbke4`}],[`path`,{d:`m15 8 3-3 3 3`,key:`bc4io6`}],[`path`,{d:`m15 16 3 3 3-3`,key:`9wmg1l`}]]),It=Z(`redo-2`,[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]),Lt=Z(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Rt=Z(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),zt=Z(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Q=e(t()),$=fe();function Bt({evaluationState:e,datasetState:t,evaluationError:n,datasetError:r}){let i=e===`error`||t===`error`?{icon:(0,$.jsx)(ie,{size:14}),text:`Failed to save`,color:`red.fg`}:e===`saving`||t===`saving`?{icon:(0,$.jsx)(c,{size:12}),text:`Saving...`,color:`fg.muted`}:(e===`saved`||e===`idle`)&&(t===`saved`||t===`idle`)?{icon:(0,$.jsx)(Ne,{size:14}),text:`Saved`,color:`fg.subtle`}:{icon:(0,$.jsx)(xt,{size:14}),text:``,color:`fg.subtle`};return(0,$.jsx)(V,{content:(()=>{let i=[];return e===`saving`?i.push(`Saving evaluation state...`):e===`saved`?i.push(`Evaluation state saved`):e===`error`&&i.push(`Evaluation: ${n??`Failed to save`}`),t===`saving`?i.push(`Syncing dataset records...`):t===`saved`?i.push(`Dataset records synced`):t===`error`&&i.push(`Dataset: ${r??`Failed to sync`}`),i.length>0?i.join(`
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$t as n,Fa as r,G as i,H as a,K as o,La as s,Pa as c,Qa as l,Rr as u,Si as d,U as f,V as p,Vr as m,W as h,Xt as g,Yi as _,Zt as v,ao as y,at as b,bt as x,cc as S,dt as C,ei as w,en as T,ft as E,gs as D,hi as O,lt as k,ma as A,mn as j,mt as ee,n as M,nn as te,oa as ne,ps as N,qi as P,r as re,ro as ie,sa as ae,tn as oe,ut as se,wa as ce,xo as F,ya as le,yt as I,za as ue}from"./command-bar-DUK45yin.js";import{D as de,j as fe,n as L,r as R}from"./stack-oJ9iWdbl.js";import{t as z}from"./box-BsM8YLGl.js";import{f as B,h as pe}from"./LoadingScreen--vgXk5-2.js";import{t as V}from"./tooltip-AEm0YeiF.js";import{i as me,n as H}from"./toaster-C_DYALhL.js";import{Bt as he,Kt as ge,Yt as _e,_ as ve,f as U,g as ye,h as be,m as xe,n as Se,p as Ce,u as we,v as Te,y as Ee}from"./dist-Cds4Mqhj.js";import{t as De}from"./terminal-CfM0q99k.js";import{c as Oe,d as ke,i as Ae,o as je}from"./tracking-DbhAKeey.js";import{t as Me}from"./heading-D90dlSnH.js";import{t as W}from"./text-CwTrMF8x.js";import{n as Ne}from"./code-FF_ibTVI.js";import{t as Pe}from"./input-C7emsUCL.js";import{t as Fe}from"./icon-BwEPrfAc.js";import{t as G}from"./h-stack-BKLDJ2vg.js";import{a as Ie,i as Le,n as Re,r as ze}from"./alert-SnQmACl1.js";import{$ as K,C as Be,D as Ve,Et as q,Mt as He,O as Ue,Ot as We,Pt as Ge,R as Ke,U as qe,V as Je,b as Ye,bt as Xe,dt as Ze,et as Qe,ft as $e,g as et,j as tt,k as nt,pt as rt,r as it,ut as at,v as ot,w as st}from"./lu-Bf6j_N19.js";import{n as ct,t as lt}from"./link-CwZhwOLq.js";import{t as ut}from"./spacer-2LJJGbo8.js";import{t as J}from"./v-stack-EOPQ57OZ.js";import{t as dt}from"./posthogErrorCapture-50j08Hs1.js";import{h as ft,s as Y,y as pt}from"./auth-client-D3UhxhQi.js";import{r as mt}from"./next-router-C6sliiV7.js";import{t as X}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as Z}from"./createLucideIcon-BJKFyRLS.js";import{a as ht,i as gt,n as _t,o as vt,r as yt,t as bt}from"./textOverflowHeuristic-DTC8-Ffx.js";import{t as xt}from"./cloud-QpryyEx-.js";import{t as St}from"./download-X34ozaiD.js";import{t as Ct}from"./square-9W0gaHHd.js";import{t as wt}from"./upload-KqBaezR7.js";import{t as Tt}from"./next-link-DuYeiiEe.js";import{t as Et}from"./persistence-BPvHS0F6.js";import{i as Dt,n as Ot,r as kt,t as At}from"./lib-BYJUJC_x.js";import{n as jt,r as Mt,t as Nt}from"./PassRateIndicator-BvWYud47.js";var Pt=Z(`list-chevrons-down-up`,[[`path`,{d:`M3 5h8`,key:`18g2rq`}],[`path`,{d:`M3 12h8`,key:`1xfjp6`}],[`path`,{d:`M3 19h8`,key:`fpbke4`}],[`path`,{d:`m15 5 3 3 3-3`,key:`1t4thf`}],[`path`,{d:`m15 19 3-3 3 3`,key:`y4ckd2`}]]),Ft=Z(`list-chevrons-up-down`,[[`path`,{d:`M3 5h8`,key:`18g2rq`}],[`path`,{d:`M3 12h8`,key:`1xfjp6`}],[`path`,{d:`M3 19h8`,key:`fpbke4`}],[`path`,{d:`m15 8 3-3 3 3`,key:`bc4io6`}],[`path`,{d:`m15 16 3 3 3-3`,key:`9wmg1l`}]]),It=Z(`redo-2`,[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]),Lt=Z(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Rt=Z(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),zt=Z(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Q=e(t()),$=fe();function Bt({evaluationState:e,datasetState:t,evaluationError:n,datasetError:r}){let i=e===`error`||t===`error`?{icon:(0,$.jsx)(ie,{size:14}),text:`Failed to save`,color:`red.fg`}:e===`saving`||t===`saving`?{icon:(0,$.jsx)(c,{size:12}),text:`Saving...`,color:`fg.muted`}:(e===`saved`||e===`idle`)&&(t===`saved`||t===`idle`)?{icon:(0,$.jsx)(Ne,{size:14}),text:`Saved`,color:`fg.subtle`}:{icon:(0,$.jsx)(xt,{size:14}),text:``,color:`fg.subtle`};return(0,$.jsx)(V,{content:(()=>{let i=[];return e===`saving`?i.push(`Saving evaluation state...`):e===`saved`?i.push(`Evaluation state saved`):e===`error`&&i.push(`Evaluation: ${n??`Failed to save`}`),t===`saving`?i.push(`Syncing dataset records...`):t===`saved`?i.push(`Dataset records synced`):t===`error`&&i.push(`Dataset: ${r??`Failed to sync`}`),i.length>0?i.join(`
2
2
  `):`All changes saved`})(),children:(0,$.jsxs)(G,{gap:1.5,fontSize:`xs`,color:i.color,cursor:`default`,paddingX:2,paddingY:1,borderRadius:`md`,_hover:{bg:`bg.subtle`},children:[(0,$.jsx)(z,{children:i.icon}),i.text&&(0,$.jsx)(W,{children:i.text})]})})}function Vt({value:e,onSave:t,isLoading:n=!1}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{r&&s.current&&(s.current.focus(),s.current.select())},[r]);let c=()=>{o(e||``),i(!0)},l=()=>{let n=a.trim();n&&n!==e&&t(n),i(!1),o(``)},u=()=>{i(!1),o(``)};return n?(0,$.jsx)(B,{height:`28px`,width:`180px`}):r?(0,$.jsx)(Pe,{ref:s,value:a,onChange:e=>o(e.target.value),onBlur:l,onKeyDown:e=>{e.key===`Enter`&&l(),e.key===`Escape`&&u()},fontSize:`md`,fontWeight:`500`,variant:`flushed`,width:`auto`,minWidth:`200px`,marginY:-2}):(0,$.jsxs)(G,{cursor:`pointer`,onClick:c,_hover:{"& .edit-icon":{opacity:1}},children:[(0,$.jsx)(Me,{size:`md`,children:e||``}),(0,$.jsx)(z,{className:`edit-icon`,opacity:0,transition:`opacity 0.2s`,color:`fg.subtle`,children:(0,$.jsx)(ue,{size:14})})]})}var Ht=()=>{let{project:e}=X(),t=(0,Q.useRef)(null),n=(0,Q.useRef)(0),{datasets:r,pendingSavedChanges:i,clearPendingChange:a,setAutosaveStatus:o}=E(e=>({datasets:e.datasets,pendingSavedChanges:e.pendingSavedChanges,clearPendingChange:e.clearPendingChange,setAutosaveStatus:e.setAutosaveStatus})),s=Y.datasetRecord.update.useMutation(),c=Y.datasetRecord.deleteMany.useMutation(),l=(0,Q.useRef)(s);l.current=s;let u=(0,Q.useRef)(c);u.current=c;let d=(0,Q.useRef)(i);d.current=i;let f=(0,Q.useRef)(r);f.current=r,(0,Q.useEffect)(()=>()=>{t.current&&clearTimeout(t.current)},[]);let p=(0,Q.useCallback)(()=>{o(`dataset`,`saved`),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{o(`dataset`,`idle`)},2e3)},[o]),m=(0,Q.useCallback)(()=>{n.current+=1,o(`dataset`,`saving`)},[o]),h=(0,Q.useCallback)(()=>{n.current=Math.max(0,n.current-1),n.current===0&&p()},[p]),g=(0,Q.useCallback)(e=>{n.current=Math.max(0,n.current-1),o(`dataset`,`error`,e.message)},[o]);(0,Q.useEffect)(()=>{if(!e?.id)return;let t=Object.keys(i);if(t.length===0)return;let n=setTimeout(()=>{for(let n of t){let t=d.current[n];if(!t)continue;let r=f.current.find(e=>e.type===`saved`&&e.datasetId===n),i=[],o=[];for(let[e,n]of Object.entries(t))!n||Object.keys(n).length===0||(`_delete`in n&&n._delete===!0?i.push(e):o.push({recordId:e,changes:n}));if(i.length>0&&(m(),u.current.mutate({projectId:e.id,datasetId:n,recordIds:i},{onSuccess:()=>{for(let e of i)a(n,e);h()},onError:e=>{console.error(`Failed to delete saved records:`,e),g(e)}})),r?.savedRecords&&o.length>0)for(let{recordId:t}of o){let i=r.savedRecords.find(e=>e.id===t);if(!i)continue;let{id:o,...s}=i;m(),l.current.mutate({projectId:e.id,datasetId:n,recordId:t,updatedRecord:s},{onSuccess:()=>{a(n,t),h()},onError:e=>{console.error(`Failed to sync saved record:`,e),g(e)}})}}},500);return()=>clearTimeout(n)},[i,e?.id,a,m,h,g])},Ut=new Set([`id`,`selected`]),Wt=e=>{let t=Object.entries(e).filter(([e])=>!e.startsWith(`_`)&&!Ut.has(e)).map(([,e])=>e);return t.length===0?!0:t.every(e=>e==null?!0:typeof e==`string`?e.trim()===``:!1)},Gt=({scope:e,targetIds:t,datasetRows:n})=>{let r=[];if(e.type===`evaluator-all-rows`){for(let t of Object.keys(e.precomputedTargetOutputs)){let i=Number(t);i>=0&&i<n.length&&r.push({rowIndex:i,targetId:e.targetId})}return r}let i;switch(e.type){case`full`:i=n.map((e,t)=>t);break;case`rows`:i=e.rowIndices.filter(e=>e>=0&&e<n.length);break;case`target`:i=n.map((e,t)=>t);break;case`cell`:i=[e.rowIndex];break;default:i=[]}let a;switch(e.type){case`full`:case`rows`:a=t;break;case`target`:case`cell`:a=[e.targetId];break;default:a=[]}for(let e of i){let i=n[e];if(i&&!Wt(i))for(let n of a)t.includes(n)&&r.push({rowIndex:e,targetId:n})}return r},Kt=e=>new Set(e.map(e=>`${e.rowIndex}:${e.targetId}`)),qt=(e,t,n)=>e.has(`${t}:${n}`),Jt=(e,t,n)=>{let r=0;for(let i=0;i<=n;i++)e.has(`${i}:${t}`)&&r++;return r},Yt=()=>{let{project:e}=X(),[t,n]=(0,Q.useState)(`idle`),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)({completed:0,total:0}),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),{experimentId:p,experimentSlug:m,name:h,datasets:g,activeDatasetId:_,targets:v,evaluators:y,concurrency:b,setResults:x,clearResults:S}=E(Se(e=>({experimentId:e.experimentId,experimentSlug:e.experimentSlug,name:e.name,datasets:e.datasets,activeDatasetId:e.activeDatasetId,targets:e.targets,evaluators:e.evaluators,concurrency:e.ui.concurrency,setResults:e.setResults,clearResults:e.clearResults}))),C=g.find(e=>e.id===_)??g[0],w=(0,Q.useCallback)((e,t,n,r)=>{E.setState(i=>{let a=[...i.results.targetOutputs[t]??[]];a[e]=n;let o=i.results.targetMetadata;if(r){let n=[...i.results.targetMetadata[t]??[]];n[e]=r,o={...i.results.targetMetadata,[t]:n}}let s=new Set(i.results.runningEvaluators??[]);for(let n of i.evaluators)s.add(`${e}:${t}:${n.id}`);return{results:{...i.results,targetOutputs:{...i.results.targetOutputs,[t]:a},targetMetadata:o,runningEvaluators:s}}})},[]),T=(0,Q.useCallback)((e,t,n)=>{E.setState(r=>{let i=[...r.results.errors[t]??[]];return i[e]=n,{results:{...r.results,errors:{...r.results.errors,[t]:i}}}})},[]),D=(0,Q.useCallback)((e,t,n,r)=>{E.setState(i=>{let a=i.results.evaluatorResults[t]??{},o=[...a[n]??[]];o[e]=r;let s=i.results.runningEvaluators;if(s){let r=`${e}:${t}:${n}`;s.has(r)&&(s=new Set(s),s.delete(r),s.size===0&&(s=void 0))}return{results:{...i.results,evaluatorResults:{...i.results.evaluatorResults,[t]:{...a,[n]:o}},runningEvaluators:s}}})},[]),O=(0,Q.useCallback)(e=>{switch(e.type){case`execution_started`:i(e.runId),o({completed:0,total:e.total}),x({runId:e.runId,status:`running`,progress:0,total:e.total});break;case`cell_started`:break;case`target_result`:e.error?T(e.rowIndex,e.targetId,e.error):w(e.rowIndex,e.targetId,e.output,{cost:e.cost,duration:e.duration,traceId:e.traceId}),e.cost&&c(t=>t+e.cost);break;case`evaluator_result`:D(e.rowIndex,e.targetId,e.evaluatorId,e.result);break;case`progress`:o({completed:e.completed,total:e.total}),x({progress:e.completed,total:e.total});break;case`error`:e.rowIndex!==void 0&&e.targetId?e.evaluatorId?D(e.rowIndex,e.targetId,e.evaluatorId,{status:`error`,error_type:`EvaluatorError`,details:e.message,traceback:[]}):T(e.rowIndex,e.targetId,e.message):(u(e.message),x({status:`error`}),H.create({title:`Execution Error`,description:e.message,type:`error`}));break;case`stopped`:n(`stopped`),f(!1),x({status:`stopped`});break;case`done`:n(`completed`),f(!1),x({status:`success`});break}},[x,w,T,D]),k=(0,Q.useCallback)(async(t={type:`full`})=>{if(!e?.id||!C){H.create({title:`Cannot execute`,description:`No project or dataset selected`,type:`error`});return}n(`running`),u(null),c(0),t.type===`full`&&E.setState(e=>({ui:{...e.ui,hasRunThisSession:!0}}));let r=C.inline?.records?ge(C.inline.records):C.savedRecords??[],i=Gt({scope:t,targetIds:v.map(e=>e.id),datasetRows:r}),a=Kt(i);if(o({completed:0,total:i.length}),t.type===`full`)x({status:`running`,executingCells:a,progress:0,total:i.length,targetOutputs:{},targetMetadata:{},evaluatorResults:{},errors:{}});else{let e=t.type===`evaluator-all-rows`||t.type===`evaluator`;E.setState(n=>{let r=n.results.executingCells,o=r?new Set([...r,...a]):a,s=(e,t,n)=>{let r=e[t];if(!r||r[n]===void 0)return e;let i=[...r];return i[n]=void 0,{...e,[t]:i}},c={...n.results.targetOutputs},l={...n.results.targetMetadata},u={...n.results.errors},d={...n.results.evaluatorResults},f=e&&`evaluatorId`in t?t.evaluatorId:void 0,p=f?[f]:n.evaluators.map(e=>e.id);for(let t of i){e||(c=s(c,t.targetId,t.rowIndex),l=s(l,t.targetId,t.rowIndex),u=s(u,t.targetId,t.rowIndex)),d[t.targetId]||(d[t.targetId]={});let n={...d[t.targetId]};for(let r of p){let i=n[r];if(e){let e=i?[...i]:[];e[t.rowIndex]={status:`running`},n[r]=e}else if(i&&i[t.rowIndex]!==void 0){let e=[...i];e[t.rowIndex]=void 0,n[r]=e}}d[t.targetId]=n}return{results:{...n.results,status:`running`,executingCells:o,targetOutputs:c,targetMetadata:l,errors:u,evaluatorResults:d}}})}let s=C.columns??[],l={projectId:e.id,experimentId:p??void 0,experimentSlug:m??void 0,name:h||`Evaluation`,dataset:{id:C.id,name:C.name,type:C.type??`inline`,inline:C.inline,datasetId:C.datasetId,columns:s,savedRecords:C.savedRecords},targets:v.map(e=>({id:e.id,type:e.type,promptId:e.promptId,promptVersionId:e.promptVersionId,promptVersionNumber:e.promptVersionNumber,dbAgentId:e.dbAgentId,agentType:e.agentType,httpConfig:e.httpConfig,targetEvaluatorId:e.targetEvaluatorId,inputs:e.inputs,outputs:e.outputs,mappings:e.mappings,localPromptConfig:e.localPromptConfig,localEvaluatorConfig:e.localEvaluatorConfig})),evaluators:y.map(e=>({id:e.id,evaluatorType:e.evaluatorType,inputs:e.inputs,mappings:e.mappings,dbEvaluatorId:e.dbEvaluatorId,localEvaluatorConfig:e.localEvaluatorConfig})),scope:t,concurrency:b},d=()=>{E.setState(e=>{let t=e.results.executingCells?new Set([...e.results.executingCells].filter(e=>!a.has(e))):void 0;t?.size===0&&(t=void 0);let n=e.results.runningEvaluators?new Set([...e.results.runningEvaluators].filter(e=>{let t=e.split(`:`);if(t.length>=2){let e=`${t[0]}:${t[1]}`;return!a.has(e)}return!0})):void 0;n?.size===0&&(n=void 0);let r=(t?.size??0)>0||(n?.size??0)>0||e.results.status===`stopped`;return{results:{...e.results,executingCells:t,runningEvaluators:n,status:r?e.results.status:`success`}}})};try{await we({endpoint:`/api/evaluations/v3/execute`,payload:l,onEvent:O,shouldStopProcessing:e=>e.type===`done`||e.type===`stopped`,timeout:3e4,chunkTimeout:3e5,onError:e=>{n(`error`),u(e.message),f(!1),d(),H.create({title:`Execution Failed`,description:e.message,type:`error`})}}),d()}catch(e){let t=e instanceof Error?e.message:`Unknown error`;n(`error`),u(t),f(!1),d()}},[e?.id,C,p,m,h,v,y,b,O,x]),A=(0,Q.useCallback)(async()=>{if(!(!e?.id||!r)){f(!0);try{if(!(await fetch(`/api/evaluations/v3/abort`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectId:e.id,runId:r})})).ok)throw Error(`Failed to abort execution`)}catch(e){f(!1);let t=e instanceof Error?e.message:`Failed to abort`;H.create({title:`Abort Failed`,description:t,type:`error`})}}},[e?.id,r]),j=(0,Q.useCallback)(()=>{n(`idle`),i(null),o({completed:0,total:0}),c(0),u(null),f(!1),S()},[S]);return{status:t,runId:r,progress:a,totalCost:s,error:l,isAborting:d,execute:k,rerunEvaluator:(0,Q.useCallback)(async(e,t,n)=>{let r=E.getState(),i=r.results.targetOutputs[t]?.[e],a=r.results.targetMetadata[t]?.[e]?.traceId;D(e,t,n,{status:`running`}),await k({type:`evaluator`,rowIndex:e,targetId:t,evaluatorId:n,targetOutput:i,traceId:a})},[k,D]),runEvaluatorOnAllRows:(0,Q.useCallback)(async(e,t)=>{let n=E.getState(),r=n.results.targetOutputs[e]??[],i=n.results.targetMetadata[e]??[],a={},o={};for(let e=0;e<r.length;e++)r[e]!==void 0&&r[e]!==null&&(a[e]=r[e],o[e]=i[e]?.traceId);Object.keys(a).length!==0&&await k({type:`evaluator-all-rows`,targetId:e,evaluatorId:t,precomputedTargetOutputs:a,traceIds:o})},[k,D]),abort:A,reset:j}},Xt=({targetId:e,updateTarget:t,setTargetMapping:n,removeTargetMapping:r,getActiveDatasetId:i,getDatasets:a})=>({onLocalConfigChange:n=>{t(e,{localPromptConfig:n})},onSave:n=>{t(e,{name:n.name,promptId:n.id,promptVersionId:n.versionId,promptVersionNumber:n.version,localPromptConfig:void 0,inputs:n.inputs?.map(e=>({identifier:e.identifier,type:e.type})),outputs:n.outputs?.map(e=>({identifier:e.identifier,type:e.type}))})},onVersionChange:n=>{t(e,{promptVersionId:n.versionId,promptVersionNumber:n.version,localPromptConfig:void 0,inputs:n.inputs?.map(e=>({identifier:e.identifier,type:e.type})),outputs:n.outputs?.map(e=>({identifier:e.identifier,type:e.type}))})},onInputMappingsChange:(t,o)=>{let s=i(),c=a();o?n(e,s,t,I(o,e=>c.some(t=>t.id===e))):r(e,s,t)}}),Zt=(e,t)=>{let n=e.mappings[t]??{},r={};for(let[e,t]of Object.entries(n))r[e]=x(t);return r},Qt=e=>{let t=document.querySelector(`[data-target-column="${e}"]`);if(!t)return;let n=t.parentElement;for(;n&&n!==document.body;){let e=window.getComputedStyle(n);if(e.overflow===`auto`||e.overflowX===`auto`)break;n=n.parentElement}if(!n||n===document.body)return;let r=t.getBoundingClientRect(),i=window.innerWidth-456,a=r.right-i;n.scrollBy({left:a,behavior:`smooth`})},$t=()=>{let{openDrawer:e}=re(),{project:t}=X(),n=Y.useContext(),{datasets:r,activeDatasetId:i,updateTarget:a,setTargetMapping:o,removeTargetMapping:s}=E(Se(e=>({datasets:e.datasets,activeDatasetId:e.activeDatasetId,updateTarget:e.updateTarget,setTargetMapping:e.setTargetMapping,removeTargetMapping:e.removeTargetMapping}))),c=(0,Q.useCallback)(e=>r.some(t=>t.id===e),[r]),l=(0,Q.useCallback)(()=>{let e=r.find(e=>e.id===i);return e?[{id:e.id,name:e.name,type:`dataset`,fields:e.columns.map(e=>({name:e.name,type:he(e.type)}))}]:[]},[r,i]);return{openTargetEditor:(0,Q.useCallback)(async r=>{if(r.type===`prompt`){let t=l(),n=Zt(r,i);M(`promptEditor`,Xt({targetId:r.id,updateTarget:a,setTargetMapping:o,removeTargetMapping:s,getActiveDatasetId:()=>E.getState().activeDatasetId,getDatasets:()=>E.getState().datasets}));let c=r.localPromptConfig;e(`promptEditor`,{promptId:r.promptId,promptVersionId:r.promptVersionId,initialLocalConfig:c,availableSources:t,inputMappings:n,urlParams:{targetId:r.id}},{resetStack:!0}),requestAnimationFrame(()=>{Qt(r.id)})}else if(r.type===`agent`&&r.dbAgentId)try{let a=await n.agents.getById.fetch({projectId:t?.id??``,id:r.dbAgentId});if(a?.type===`workflow`){let e=a.config.workflowId;if(e){let n=`/${t?.slug}/studio/${e}`;window.open(n,`_blank`)}}else if(a?.type===`http`){let t=l(),n=Zt(r,i);M(`agentHttpEditor`,{onInputMappingsChange:(e,t)=>{let n=E.getState().activeDatasetId,i=E.getState().datasets;t?o(r.id,n,e,I(t,e=>i.some(t=>t.id===e))):s(r.id,n,e)}}),e(`agentHttpEditor`,{availableSources:t,inputMappings:n,urlParams:{targetId:r.id,agentId:r.dbAgentId??``}}),requestAnimationFrame(()=>{Qt(r.id)})}else{let t=l(),n=Zt(r,i);M(`agentCodeEditor`,{onInputMappingsChange:(e,t)=>{let n=E.getState().activeDatasetId,i=E.getState().datasets;t?o(r.id,n,e,I(t,e=>i.some(t=>t.id===e))):s(r.id,n,e)}}),e(`agentCodeEditor`,{availableSources:t,inputMappings:n,urlParams:{targetId:r.id,agentId:r.dbAgentId??``}}),requestAnimationFrame(()=>{Qt(r.id)})}}catch(e){console.error(`Failed to fetch agent:`,e)}else if(r.type===`evaluator`&&r.targetEvaluatorId){let t=l(),n=Zt(r,i);M(`evaluatorEditor`,te({targetId:r.id,updateTarget:a,onMappingChange:(e,t)=>{let n=E.getState().activeDatasetId,i=E.getState().datasets;t?o(r.id,n,e,I(t,e=>i.some(t=>t.id===e))):s(r.id,n,e)}}));let c={availableSources:t,initialMappings:n},u=r.localEvaluatorConfig;e(`evaluatorEditor`,{evaluatorId:r.targetEvaluatorId,mappingsConfig:c,initialLocalConfig:u,urlParams:{targetId:r.id}}),requestAnimationFrame(()=>{Qt(r.id)})}},[l,i,a,o,s,e,n.agents.getById,t?.id,t?.slug]),buildAvailableSources:l,isDatasetSource:c}},en=e=>{let{project:t}=X(),n=E(e=>e.setSavedDatasetRecords),r=(0,Q.useRef)(!1),i=e?.type===`saved`&&!!e.datasetId&&!e.savedRecords,a=Y.datasetRecord.getAll.useQuery({projectId:t?.id??``,datasetId:e?.datasetId??``},{enabled:!!t?.id&&i});return(0,Q.useEffect)(()=>{if(!e||!i||!a.data||r.current)return;r.current=!0;let t=(a.data.datasetRecords??[]).map(t=>({id:t.id,...Object.fromEntries(e.columns.map(e=>{let n=t.entry?.[e.name];return n==null?[e.name,``]:typeof n==`string`?[e.name,n]:[e.name,JSON.stringify(n)]}))}));n(e.id,t)},[e,i,a.data,n]),(0,Q.useEffect)(()=>{r.current=!1},[e?.id]),{isLoading:a.isLoading&&i}},tn=()=>{let e=E(e=>e.datasets).filter(e=>e.type===`saved`&&e.datasetId&&!e.savedRecords);return{isLoading:e.length>0,loadingCount:e.length,datasetsToLoad:e}},nn=({projectId:e,addDataset:t,setActiveDataset:n})=>{let[r,i]=(0,Q.useState)(null),a=Y.datasetRecord.getAll.useQuery({projectId:e??``,datasetId:r?.datasetId??``},{enabled:!!e&&!!r});return(0,Q.useEffect)(()=>{if(r&&a.data&&!a.isLoading){let{datasetId:e,name:o,columnTypes:s}=r,c=s.map((e,t)=>({id:`${e.name}_${t}`,name:e.name,type:e.type})),l=(a.data?.datasetRecords??[]).map(e=>({id:e.id,...Object.fromEntries(s.map(t=>{let n=e.entry?.[t.name];return n==null?[t.name,``]:typeof n==`string`?[t.name,n]:[t.name,JSON.stringify(n)]}))})),u={id:`saved_${e}`,name:o,type:`saved`,datasetId:e,columns:c,savedRecords:l};t(u),n(u.id),i(null)}},[r,a.data,a.isLoading,t,n]),{loadSavedDataset:i,isLoading:a.isLoading&&!!r}},rn=(e,t)=>{let n=[];n.push({id:`__checkbox__`,type:`checkbox`});for(let t of e)n.push({id:t.id,type:`dataset`});for(let e of t)n.push({id:`target.${e.id}`,type:`target`});return n},an=({datasetColumns:e,targets:t,displayRowCount:n,editingCell:r,selectedCell:i,setSelectedCell:a,setEditingCell:o,toggleRowSelection:s})=>{let c=rn(e,t);return(0,Q.useEffect)(()=>{let e=e=>{if(r||!i)return;let t=c.findIndex(e=>e.id===i.columnId);if(t===-1)return;let l=c[t];switch(e.key){case`Enter`:case` `:e.preventDefault(),l?.type===`checkbox`?s(i.row):l?.type===`dataset`&&o({row:i.row,columnId:i.columnId});break;case`ArrowUp`:e.preventDefault(),i.row>0&&a({row:i.row-1,columnId:i.columnId});break;case`ArrowDown`:e.preventDefault(),i.row<n-1&&a({row:i.row+1,columnId:i.columnId});break;case`ArrowLeft`:e.preventDefault(),t>0&&a({row:i.row,columnId:c[t-1].id});break;case`ArrowRight`:e.preventDefault(),t<c.length-1&&a({row:i.row,columnId:c[t+1].id});break;case`Tab`:e.preventDefault(),e.shiftKey?t>0?a({row:i.row,columnId:c[t-1].id}):i.row>0&&a({row:i.row-1,columnId:c[c.length-1].id}):t<c.length-1?a({row:i.row,columnId:c[t+1].id}):i.row<n-1&&a({row:i.row+1,columnId:c[0].id});break;case`Escape`:e.preventDefault(),a(void 0);break}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r,i,c,n,a,o,s]),c},on=(e,t)=>e.filter(e=>t.some(t=>{let n=e[t];return n!==void 0&&n!==``})),sn=(e,t)=>{let n=Math.max(...Object.values(t).map(e=>e.length),0),r=[];for(let i=0;i<n;i++){let n={};for(let r of e)n[r.name]=t[r.id]?.[i]??``;r.push(n)}return on(r,e.map(e=>e.name))},cn=5e3,ln=143,un=600,dn=[`json`,`list`,`chat_messages`,`spans`,`rag_contexts`,`annotations`,`evaluations`],fn=e=>{let t=e.trim().toLowerCase();return t===``||t===`true`||t===`1`?{valid:!0,normalized:t===``?``:`true`}:t===`false`||t===`0`?{valid:!0,normalized:`false`}:{valid:!1}},pn=e=>{let t=e.trim();if(t===``)return{valid:!0,normalized:``};let n=t;if(t.includes(`,`)&&!t.includes(`.`)&&(n=t.replace(`,`,`.`)),!/^-?\d+(\.\d+)?$/.test(n))return{valid:!1};let r=parseFloat(n);return!isNaN(r)&&isFinite(r)?{valid:!0,normalized:String(r)}:{valid:!1}},mn=e=>{if(!e||typeof e!=`string`)return{formatted:e,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return{formatted:e,isJson:!1};try{let e=JSON.parse(t);return{formatted:JSON.stringify(e,null,2),isJson:!0}}catch{return{formatted:e,isJson:!1}}},hn=(e,t)=>e.length<=t?{text:e,truncated:!1}:{text:e.slice(0,t)+`…`,truncated:!0};function gn({value:e,row:t,columnId:n,datasetId:r,dataType:i}){let{setCellValue:a,setEditingCell:o,ui:s,toggleCellExpanded:c}=E(e=>({setCellValue:e.setCellValue,setEditingCell:e.setEditingCell,ui:e.ui,toggleCellExpanded:e.toggleCellExpanded})),l=s.rowHeightMode,u=`${t}-${n}`,d=s.expandedCells.has(u),f=s.editingCell?.row===t&&s.editingCell?.columnId===n,[p,m]=(0,Q.useState)(e),[h,g]=(0,Q.useState)({}),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(f)if(v(!1),i&&dn.includes(i)){let{formatted:t}=mn(e);m(t)}else m(e)},[f,e,i]);let[x,S]=(0,Q.useState)(void 0);(0,Q.useLayoutEffect)(()=>{if(f&&y.current){let e=y.current.closest(`td`);if(e){let t=e.getBoundingClientRect();S(Math.max(80,t.height+16-28)),g({position:`fixed`,top:t.top-8,left:t.left-8,width:Math.max(t.width+16,250),minHeight:t.height+16,zIndex:1e3})}setTimeout(()=>{b.current&&(b.current.focus(),b.current.select())},0)}},[f]);let C=(0,Q.useCallback)(()=>{if(i===`boolean`){let e=fn(p);if(!e.valid){v(!0);return}a(r,t,n,e.normalized),v(!1),o(void 0);return}if(i===`number`){let e=pn(p);if(!e.valid){v(!0);return}a(r,t,n,e.normalized),v(!1),o(void 0);return}a(r,t,n,p),o(void 0)},[r,t,n,p,i,a,o]),w=(0,Q.useCallback)(()=>{m(e),v(!1),o(void 0)},[e,o]),T=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),e.stopPropagation(),C()):e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),w()):e.key===`Tab`&&(e.preventDefault(),e.stopPropagation(),C())},[C,w]),O=(0,Q.useCallback)(()=>{setTimeout(()=>{w()},100)},[w]),k=(0,Q.useMemo)(()=>{let t=i&&dn.includes(i),{formatted:n,isJson:r}=t?mn(e):{formatted:e,isJson:!1},{text:a,truncated:o}=hn(n,cn);return{text:a,isJson:t&&r,truncated:o}},[e,i]),A=(0,Q.useRef)(null),[j,ee]=(0,Q.useState)(!1),[M,te]=(0,Q.useState)(null),N=(0,Q.useRef)(null),P=(0,Q.useRef)(!1),re=(0,Q.useRef)(0),ie=(0,Q.useRef)(0),oe=l===`compact`&&!d&&bt(k.text);(0,Q.useEffect)(()=>{d||te(null)},[d]);let se=l===`compact`&&!d&&oe,ce=M===null?`${un}px`:`${M}px`,F=(0,Q.useCallback)(e=>{e.stopPropagation(),P.current||c(t,n)},[c,t,n]),le=(0,Q.useRef)(!1),I=(0,Q.useRef)(!1),ue=(0,Q.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),P.current=!1,re.current=e.clientY,le.current=!d,I.current=!1,d?A.current&&(ie.current=M??A.current.scrollHeight):ie.current=ln;let r=e=>{let r=e.clientY-re.current;if(Math.abs(r)>3&&(P.current=!0),P.current){let e=Math.max(ln,ie.current+r);N.current=e,te(e),le.current&&!I.current&&(I.current=!0,c(t,n))}},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),P.current&&N.current!==null&&N.current<=ln&&((I.current||!le.current)&&c(t,n),te(null),N.current=null),setTimeout(()=>{P.current=!1},50)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[d,c,t,n,M]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(z,{ref:y,"data-testid":`cell-${t}-${n}`,height:`100%`,minHeight:`20px`,fontSize:k.isJson?`12px`:`13px`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,opacity:+!f,fontFamily:k.isJson?`mono`:void 0,position:`relative`,onMouseEnter:()=>ee(!0),onMouseLeave:()=>ee(!1),children:[(0,$.jsx)(z,{ref:A,height:`100%`,maxHeight:se||l===`compact`&&!d?`${ln}px`:d?ce:void 0,overflow:se||l===`compact`&&!d?`hidden`:d?`auto`:void 0,children:i===`image`&&e&&ae(e)?(0,$.jsx)(ne,{src:ae(e),minWidth:`24px`,minHeight:`24px`,maxHeight:`80px`,maxWidth:`100%`,expandable:!0}):(0,$.jsxs)($.Fragment,{children:[k.text,k.truncated&&(0,$.jsx)(z,{as:`span`,color:`fg.subtle`,fontSize:`11px`,marginLeft:1,children:`(truncated)`})]})}),se&&(0,$.jsx)(z,{position:`absolute`,bottom:`-8px`,left:`-12px`,right:`-12px`,height:`40px`,cursor:`pointer`,onClick:F,className:`cell-fade-overlay`,css:{background:`linear-gradient(to bottom, transparent, var(--chakra-colors-bg-panel))`,"tr:hover &":{background:`linear-gradient(to bottom, transparent, var(--chakra-colors-bg-subtle))`},"tr[data-selected='true'] &":{background:`linear-gradient(to bottom, transparent, var(--chakra-colors-blue-subtle))`}}}),l===`compact`&&(d||j&&oe)&&(0,$.jsx)(z,{position:`absolute`,bottom:`-8px`,left:`-10px`,right:`-10px`,height:`20px`,cursor:`ns-resize`,onMouseDown:ue,onClick:F,display:`flex`,alignItems:`center`,justifyContent:`center`,opacity:.5,transition:`opacity 0.15s`,_hover:{opacity:1},css:{background:`var(--cell-bg, var(--chakra-colors-bg-panel))`},children:(0,$.jsx)(z,{width:`40px`,height:`4px`,borderRadius:`full`,bg:`gray.emphasized`,_hover:{bg:`gray.emphasized`},transition:`background 0.15s`})})]}),f&&(0,$.jsx)(me,{children:(0,$.jsxs)(z,{style:h,bg:`bg.panel`,borderRadius:`md`,boxShadow:_?`0 0 0 2px var(--chakra-colors-red-solid), 0 4px 12px rgba(0,0,0,0.15)`:`0 0 0 2px var(--chakra-colors-blue-solid), 0 4px 12px rgba(0,0,0,0.15)`,overflow:`hidden`,position:`relative`,children:[(0,$.jsx)(D,{ref:b,value:p,onChange:e=>{m(e.target.value),v(!1)},onKeyDown:T,onBlur:O,minHeight:x?`${x}px`:`80px`,resize:`vertical`,border:`none`,borderRadius:`0`,fontSize:`13px`,padding:2,_focus:{outline:`none`,boxShadow:`none`}}),i===`boolean`&&(0,$.jsxs)(G,{position:`absolute`,bottom:`32px`,left:2,gap:1,children:[(0,$.jsx)(L,{size:`xs`,variant:p.toLowerCase()===`true`?`solid`:`outline`,colorPalette:`green`,onClick:()=>{a(r,t,n,`true`),o(void 0)},onMouseDown:e=>e.preventDefault(),children:`true`}),(0,$.jsx)(L,{size:`xs`,variant:p.toLowerCase()===`false`?`solid`:`outline`,colorPalette:`red`,onClick:()=>{a(r,t,n,`false`),o(void 0)},onMouseDown:e=>e.preventDefault(),children:`false`})]}),(0,$.jsx)(z,{paddingX:2,paddingY:1,fontSize:`10px`,color:_?`red.fg`:`fg.muted`,borderTop:`1px solid`,borderColor:_?`red.muted`:`border.muted`,bg:_?`red.subtle`:`bg.subtle`,children:_?i===`boolean`?`Invalid value. Use: true, false, 1, or 0`:`Invalid number`:`Enter to save • Escape to cancel • Shift+Enter for newline`})]})})]})}var _n=({cell:e,rowIndex:t,activeDatasetId:n,isLoading:r})=>{let{selectedCell:i,setSelectedCell:a,setEditingCell:o,toggleRowSelection:s}=E(e=>({selectedCell:e.ui.selectedCell,setSelectedCell:e.setSelectedCell,setEditingCell:e.setEditingCell,toggleRowSelection:e.toggleRowSelection})),c=e.column.columnDef.meta;if(!c)return(0,$.jsx)(`td`,{children:At(e.column.columnDef.cell,e.getContext())},e.id);let l=i?.row===t&&i?.columnId===c.columnId,u=()=>{a({row:t,columnId:c.columnId})},d=()=>{c.columnType===`dataset`?(a({row:t,columnId:c.columnId}),o({row:t,columnId:c.columnId})):c.columnType===`checkbox`&&s(t)},f={outline:l?`2px solid var(--chakra-colors-blue-500)`:`none`,outlineOffset:`-1px`,position:l?`relative`:void 0,zIndex:l?5:void 0,height:`100%`};return r&&c.columnType!==`checkbox`?(0,$.jsx)(`td`,{children:(0,$.jsxs)(J,{align:`stretch`,gap:1,children:[(0,$.jsx)(B,{height:`14px`,width:`100%`}),(0,$.jsx)(B,{height:`14px`,width:`100%`}),(0,$.jsx)(B,{height:`14px`,width:`80%`})]})},e.id):c.columnType===`dataset`?(0,$.jsx)(`td`,{onClick:u,onDoubleClick:d,style:f,children:(0,$.jsx)(gn,{value:e.getValue()??``,row:t,columnId:c.columnId,datasetId:n,dataType:c.dataType})},e.id):(0,$.jsx)(`td`,{onClick:u,onDoubleClick:d,style:{...f,verticalAlign:`top`},children:At(e.column.columnDef.cell,e.getContext())},e.id)};function vn({onSelectExisting:e,onUploadCSV:t,onEditDataset:n,onSaveAsDataset:i}){let{datasets:a,activeDatasetId:o,setActiveDataset:s,addDataset:c,removeDataset:u}=E(e=>({datasets:e.datasets,activeDatasetId:e.activeDatasetId,setActiveDataset:e.setActiveDataset,addDataset:e.addDataset,removeDataset:e.removeDataset})),d=(0,Q.useMemo)(()=>{let e=a[0];return e?e.columns:[{id:`input`,name:`input`,type:`string`},{id:`expected_output`,name:`expected_output`,type:`string`}]},[a]),f=()=>{let e=b(`dataset`).toString(),t=d.map(e=>({...e})),n={};for(let e of t)n[e.id]=[``,``,``];c({id:e,name:`Dataset ${a.length+1}`,type:`inline`,inline:{columns:t,records:n},columns:t}),s(e)},p=e=>{a.length<=1||u(e)};return(0,$.jsxs)(G,{gap:2,flexWrap:`nowrap`,alignItems:`center`,overflow:`auto`,width:`full`,children:[(0,$.jsx)(W,{fontWeight:`semibold`,fontSize:`sm`,color:`fg`,paddingRight:2,children:`Datasets`}),a.map(e=>(0,$.jsx)(yn,{dataset:e,isActive:e.id===o,onSelect:()=>s(e.id),onRemove:()=>p(e.id),onSaveAs:()=>i(e),canRemove:a.length>1},e.id)),(0,$.jsxs)(P.Root,{positioning:{placement:`bottom-start`},children:[(0,$.jsx)(P.Trigger,{asChild:!0,children:(0,$.jsx)(Ge,{"aria-label":`Add dataset`,size:`xs`,variant:`ghost`,color:`fg.muted`,_hover:{color:`fg`,bg:`bg.subtle`},children:(0,$.jsx)(r,{size:14})})}),(0,$.jsxs)(P.Content,{minWidth:`200px`,children:[(0,$.jsx)(P.Item,{value:`select`,onClick:e,children:(0,$.jsxs)(G,{gap:2,children:[(0,$.jsx)(l,{size:14}),(0,$.jsx)(W,{children:`Select existing dataset`})]})}),(0,$.jsx)(P.Item,{value:`upload`,onClick:t,children:(0,$.jsxs)(G,{gap:2,children:[(0,$.jsx)(wt,{size:14}),(0,$.jsx)(W,{children:`Upload CSV`})]})}),(0,$.jsx)(P.Item,{value:`new`,onClick:f,children:(0,$.jsxs)(G,{gap:2,children:[(0,$.jsx)(r,{size:14}),(0,$.jsx)(W,{children:`Create new`})]})})]})]}),(0,$.jsx)(ut,{}),(0,$.jsx)(Ge,{"aria-label":`Edit dataset columns`,size:`xs`,variant:`ghost`,color:`fg.muted`,_hover:{color:`fg`,bg:`bg.subtle`},onClick:n,children:(0,$.jsx)(Lt,{size:14})})]})}function yn({dataset:e,isActive:t,onSelect:n,onRemove:r,onSaveAs:i,canRemove:a}){let o=e.type===`saved`;return t?(0,$.jsxs)(P.Root,{positioning:{placement:`bottom-start`},children:[(0,$.jsx)(P.Trigger,{asChild:!0,children:(0,$.jsx)(L,{size:`xs`,variant:`outline`,bg:`bg.muted`,borderColor:`border.emphasized`,paddingX:2,paddingY:1,height:`auto`,_hover:{bg:`bg.emphasized`},"data-testid":`dataset-tab-${e.id}`,children:(0,$.jsxs)(G,{gap:1,children:[(0,$.jsx)(l,{size:12,color:o?`var(--chakra-colors-blue-500)`:`currentColor`}),(0,$.jsx)(W,{fontSize:`12px`,fontWeight:`semibold`,children:e.name}),(0,$.jsx)(y,{size:10})]})})}),(0,$.jsxs)(P.Content,{minWidth:`180px`,children:[e.type===`inline`&&(0,$.jsx)(P.Item,{value:`save`,onClick:i,children:(0,$.jsxs)(G,{gap:2,children:[(0,$.jsx)(St,{size:14}),(0,$.jsx)(W,{children:`Save as dataset`})]})}),e.type===`inline`&&(0,$.jsx)(z,{borderTopWidth:`1px`,borderColor:`border`,my:1}),(0,$.jsx)(P.Item,{value:`remove`,onClick:r,disabled:!a,children:(0,$.jsxs)(G,{gap:2,children:[(0,$.jsx)(ce,{size:14}),(0,$.jsx)(W,{children:`Remove from workbench`})]})})]})]}):(0,$.jsx)(L,{size:`xs`,variant:`ghost`,onClick:n,paddingX:2,paddingY:1,height:`auto`,_hover:{bg:`bg.subtle`},"data-testid":`dataset-tab-${e.id}`,children:(0,$.jsxs)(G,{gap:1,children:[(0,$.jsx)(l,{size:12,color:o?`var(--chakra-colors-blue-500)`:`currentColor`}),(0,$.jsx)(W,{fontSize:`12px`,fontWeight:`medium`,children:e.name})]})})}function bn({colSpan:e,color:t,icon:n,children:r,paddingLeft:i=`12px`}){return(0,$.jsx)(`th`,{colSpan:e,style:{padding:`12px 12px`,paddingLeft:i,textAlign:`left`,borderBottom:`1px solid var(--chakra-colors-border)`,backgroundColor:`var(--chakra-colors-bg-panel)`,height:`48px`},children:(0,$.jsxs)(G,{gap:2,children:[(0,$.jsx)(u,{color:t,size:`sm`,icon:n}),r]})})}var xn=Q.memo(function({colSpan:e,activeDataset:t,datasetHandlers:n,isLoading:r}){return(0,$.jsx)(bn,{colSpan:e,color:`blue.emphasized`,icon:(0,$.jsx)(l,{size:14}),paddingLeft:`52px`,children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(W,{fontWeight:`semibold`,fontSize:`sm`,color:`fg`,children:`Dataset`}),(0,$.jsx)(B,{height:`20px`,width:`150px`})]}):t&&n?(0,$.jsx)(vn,{onSelectExisting:n.onSelectExisting,onUploadCSV:n.onUploadCSV,onEditDataset:n.onEditDataset,onSaveAsDataset:n.onSaveAsDataset}):(0,$.jsx)(W,{fontWeight:`semibold`,fontSize:`sm`,color:`fg`,children:`Dataset`})})});function Sn({selectedCount:e,onRun:t,onStop:n,onDelete:r,onClear:i,isRunning:a=!1,isAborting:o=!1}){let[c,l]=(0,Q.useState)(!1);return e===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(G,{position:`fixed`,bottom:4,left:`50%`,transform:`translateX(-50%)`,paddingX:4,paddingY:2,borderRadius:`lg`,boxShadow:`lg`,gap:3,zIndex:100,bg:`bg.panel`,children:[(0,$.jsxs)(W,{fontSize:`sm`,"data-testid":`selection-count`,children:[e,` selected`]}),(0,$.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{a&&n?n():t()},disabled:o,"data-testid":`selection-run-btn`,children:o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{size:`xs`}),` Stopping...`]}):a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ct,{size:16}),` Stop`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s,{size:16}),` Run`]})}),(0,$.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>{l(!0)},disabled:a,"data-testid":`selection-delete-btn`,children:[(0,$.jsx)(ce,{size:16}),` Delete`]}),(0,$.jsx)(L,{size:`sm`,variant:`ghost`,onClick:i,"data-testid":`selection-clear-btn`,children:(0,$.jsx)(le,{size:16})})]}),(0,$.jsx)(Te,{open:c,onOpenChange:({open:e})=>l(e),children:(0,$.jsxs)(be,{children:[(0,$.jsx)(ve,{children:(0,$.jsxs)(Ee,{children:[`Delete `,e,` row`,e>1?`s`:``,`?`]})}),(0,$.jsx)(xe,{}),(0,$.jsx)(Ce,{children:(0,$.jsxs)(W,{children:[`Are you sure you want to delete `,e,` selected row`,e>1?`s`:``,`?`]})}),(0,$.jsxs)(ye,{children:[(0,$.jsx)(L,{variant:`outline`,onClick:()=>l(!1),"data-testid":`delete-cancel-btn`,children:`Cancel`}),(0,$.jsx)(L,{colorPalette:`red`,onClick:()=>{r(),l(!1)},"data-testid":`delete-confirm-btn`,children:`Delete`})]})]})})]})}function Cn(e){let t=e.match(/litellm\.(\w+):\s*.+?\s+-\s+(.*)/s);if(t){let[,n,r]=t,i=wn(r??e);return{type:Tn(n??``),message:i}}let n=e.match(/^(\w+Error|Exception)\('([\s\S]+?)'\)/s);if(n){let[,t,r]=n,i=r;try{if(r){let e=r.replace(/\\([\\'"])/g,(e,t)=>t);i=JSON.parse(`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`)}}catch{}return{type:`unknown`,message:i?`${t}\n${i}`:e}}return{type:`unknown`,message:e}}function wn(e){if(!e.trim().startsWith(`{`))return e;try{let t=JSON.parse(e);return typeof t.error==`string`?t.error:t.error?.message??t.message??e}catch{return e}}function Tn(e){return{NotFoundError:`not_found`,BadRequestError:`bad_request`,AuthenticationError:`auth`,RateLimitError:`rate_limit`,APIConnectionError:`connection`}[e]??`unknown`}var En=e=>{let{project:t}=X(),{data:n,isLoading:r}=Y.prompts.getByIdOrHandle.useQuery({idOrHandle:e.promptId??``,projectId:t?.id??``},{enabled:e.type===`prompt`&&!!e.promptId&&!!t?.id}),{data:i,isLoading:a}=Y.agents.getById.useQuery({id:e.dbAgentId??``,projectId:t?.id??``},{enabled:e.type===`agent`&&!!e.dbAgentId&&!!t?.id}),{data:o,isLoading:s}=Y.evaluators.getById.useQuery({id:e.targetEvaluatorId??``,projectId:t?.id??``},{enabled:e.type===`evaluator`&&!!e.targetEvaluatorId&&!!t?.id});return e.type===`prompt`?e.promptId&&r?``:e.promptId?n?.handle??``:`New Prompt`:e.type===`agent`?a?``:i?.name??``:e.type===`evaluator`?s?``:o?.name??``:``},Dn=(e,t,n,r)=>{let i=t.targetOutputs[e]??[],a=t.targetMetadata?.[e]??[],o=t.errors[e]??[],s=t.evaluatorResults[e]??{},c=0,l=0,u=[],d=[];for(let e=0;e<r;e++){let t=i[e]!==void 0&&i[e]!==null,r=!!o[e],f=n.length===0||n.every(t=>{let n=s[t.id]?.[e];if(n==null)return!1;let r=ht(n);return r.status!==`pending`&&r.status!==`running`});(t||r)&&f&&c++,r&&l++;let p=a[e];p&&(p.cost!==void 0&&p.cost!==null&&u.push(p.cost),p.duration!==void 0&&p.duration!==null&&d.push(p.duration))}let p=f(d),m=f(u),h=n.map(e=>{let t=s[e.id]??[],n=0,i=0,a=0,o=0,c=0,l=0,u=0;for(let e=0;e<r;e++){let r=t[e];if(r==null)continue;let s=ht(r);s.status===`pending`||s.status===`running`||(n++,s.status===`passed`?(i++,u++):s.status===`failed`?(a++,u++):s.status===`error`&&o++,s.score!==void 0&&s.score!==null&&(c+=s.score,l++))}return{evaluatorId:e.id,total:n,passed:i,failed:a,errors:o,passRate:u>0?i/u*100:null,averageScore:l>0?c/l:null}}),g=h.reduce((e,t)=>e+t.passed+t.failed,0),_=h.reduce((e,t)=>e+t.passed,0),v=g>0?_/g*100:null;h.reduce((e,t)=>t.averageScore===null?e:{sum:e.sum+t.averageScore*t.total,count:e.count+t.total},{sum:0,count:0});let y=h.filter(e=>e.averageScore!==null),b=y.length>0?y.reduce((e,t)=>e+(t.averageScore??0),0)/y.length:null;return{targetId:e,completedRows:c,totalRows:r,errorRows:l,evaluators:h,overallPassRate:v,overallAverageScore:b,averageCost:m?.avg??null,totalCost:m?.total??null,averageLatency:p?.avg??null,totalDuration:p?.total??null,latencyStats:p,costStats:m}},On=e=>e===null?`-`:`${Math.round(e)}%`,kn=e=>{let{project:t}=X(),n=Y.useQueries(n=>e.map(e=>n.evaluators.getById({id:e.dbEvaluatorId??``,projectId:t?.id??``},{enabled:!!e.dbEvaluatorId&&!!t?.id,staleTime:6e4})));return(0,Q.useMemo)(()=>new Map(e.map((e,t)=>[e.id,e.localEvaluatorConfig?.name??n[t]?.data?.name??e.id])),[e.map((e,t)=>{let r=e.localEvaluatorConfig?.name??n[t]?.data?.name??e.id;return`${e.id}:${r}`}).join(`|`)])},An=e=>kn([e]).get(e.id)??e.id,jn=de`
3
3
  0%, 100% { transform: scale(1); }
4
4
  50% { transform: scale(1.2); }
@@ -50,4 +50,4 @@ echo $STATUS_RESPONSE | jq '.summary'
50
50
  if [ "$STATUS" = "failed" ]; then
51
51
  exit 1
52
52
  fi`;function fr(){let e=E.temporal,t=(0,Q.useSyncExternalStore)(e.subscribe,()=>e.getState().pastStates.length,()=>0),n=(0,Q.useSyncExternalStore)(e.subscribe,()=>e.getState().futureStates.length,()=>0),r=t>0,i=n>0,a=(0,Q.useCallback)(()=>{C()},[]),o=(0,Q.useCallback)(()=>{se()},[]);return(0,Q.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)return;let n=navigator.platform.toUpperCase().indexOf(`MAC`)>=0,r=n?e.metaKey:e.ctrlKey;r&&e.key===`z`&&!e.shiftKey?(e.preventDefault(),a()):(r&&e.key===`z`&&e.shiftKey||r&&e.key===`y`&&!n)&&(e.preventDefault(),o())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a,o]),(0,$.jsxs)(G,{gap:1,children:[(0,$.jsx)(Ge,{"aria-label":`Undo`,title:`Undo (Cmd+Z)`,variant:`ghost`,size:`sm`,onClick:a,disabled:!r,color:r?`fg.muted`:`fg.subtle`,_hover:r?{bg:`bg.subtle`}:{},children:(0,$.jsx)(zt,{size:18})}),(0,$.jsx)(Ge,{"aria-label":`Redo`,title:`Redo (Cmd+Shift+Z)`,variant:`ghost`,size:`sm`,onClick:o,disabled:!i,color:i?`fg.muted`:`fg.subtle`,_hover:i?{bg:`bg.subtle`}:{},children:(0,$.jsx)(It,{size:18})})]})}var pr=1500,mr=JSON.stringify(Et(ee())),hr=()=>{let{project:e}=X(),t=mt(),n=pt(),r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),{experimentId:o,experimentSlug:s,name:c,datasets:l,activeDatasetId:u,evaluators:d,targets:f,results:p,hiddenColumns:m,concurrency:h,setExperimentId:g,setExperimentSlug:_,setName:v,setAutosaveStatus:y,loadState:b}=E(Se(e=>({experimentId:e.experimentId,experimentSlug:e.experimentSlug,name:e.name,datasets:e.datasets,activeDatasetId:e.activeDatasetId,evaluators:e.evaluators,targets:e.targets,results:e.results,hiddenColumns:e.ui.hiddenColumns,concurrency:e.ui.concurrency,setExperimentId:e.setExperimentId,setExperimentSlug:e.setExperimentSlug,setName:e.setName,setAutosaveStatus:e.setAutosaveStatus,loadState:e.loadState}))),x=Et({experimentId:o,experimentSlug:s,name:c,datasets:l,activeDatasetId:u,evaluators:d,targets:f,results:p,pendingSavedChanges:{},ui:{selectedRows:new Set,columnWidths:{},rowHeightMode:`compact`,expandedCells:new Set,hiddenColumns:m,autosaveStatus:{evaluation:`idle`,dataset:`idle`},concurrency:h,hasRunThisSession:!1}}),S=JSON.stringify(x),C=Y.experiments.saveEvaluationsV3.useMutation(),w=t.query.slug;a.current===w&&s!==w&&(a.current=null);let T=!!e&&!!w&&s!==w&&a.current!==w,D=Y.experiments.getEvaluationsV3BySlug.useQuery({projectId:e?.id??``,experimentSlug:w??``},{enabled:T});(0,Q.useEffect)(()=>{e&&s&&w!==s&&t.replace(`/${e.slug}/experiments/workbench/${s}`,void 0,{shallow:!0})},[s,e?.slug]),(0,Q.useEffect)(()=>{D.data&&a.current!==w&&(a.current=w??null,g(D.data.id),_(D.data.slug),D.data.workbenchState&&b&&b(D.data.workbenchState))},[D.data,w,g,_,b]),(0,Q.useEffect)(()=>()=>{i.current&&clearTimeout(i.current),r.current&&clearTimeout(r.current),w&&n.invalidateQueries({predicate:e=>{let t=e.queryKey;if(!Array.isArray(t)||t.length<2)return!1;let[n]=t;return Array.isArray(n)?n[0]===`experiments`&&n[1]===`getEvaluationsV3BySlug`:!1}})},[n,w]);let O=(0,Q.useCallback)(()=>{y(`evaluation`,`saved`),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{y(`evaluation`,`idle`)},2e3)},[y]);(0,Q.useEffect)(()=>{if(e&&!D.isLoading&&!T&&o&&c&&S!==mr)return r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{y(`evaluation`,`saving`),(async()=>{try{let t=await C.mutateAsync({projectId:e.id,experimentId:o,state:x});g(t.id),_(t.slug),t.name&&t.name!==c&&v(t.name),O()}catch(t){console.error(`Failed to autosave evaluations v3:`,t),y(`evaluation`,`error`,t instanceof Error?t.message:`Unknown error`),H.create({title:`Failed to autosave evaluation`,type:`error`,meta:{closable:!0}}),dt(t,{extra:{context:`Failed to autosave evaluations v3`,projectId:e.id,persistedState:x}})}})()},pr),()=>{r.current&&clearTimeout(r.current)}},[S,e?.id,T,o,D.isLoading]);let k=ft(D.error)||D.error?.data?.code===`NOT_FOUND`||D.error?.data?.httpStatus===404,A=D.isError&&k,j=Y.useContext(),ee=(0,Q.useCallback)(()=>{a.current=null,j.experiments.getEvaluationsV3BySlug.reset({projectId:e?.id??``,experimentSlug:w??``})},[e?.id,w,j]);return{isLoading:D.isLoading,isSaving:C.isPending,existingExperiment:D.data,isNotFound:A,isError:D.isError&&!k,error:D.error,reset:ee}},gr=3e4,_r=()=>{let{project:e}=X(),t=(0,Q.useRef)(null),n=(0,Q.useRef)(!0),r=E(Se(e=>e.ui.concurrency??10)),i=Math.max(1,Math.floor(r/2)),a=Y.evaluations.warmupLambda.useMutation(),o=(0,Q.useRef)(a.mutate);o.current=a.mutate;let s=(0,Q.useCallback)(()=>{!n.current||!e||o.current({projectId:e.id,count:i})},[e,i]);return(0,Q.useEffect)(()=>{if(!e)return;s(),t.current=setInterval(s,gr);let r=()=>{n.current=!document.hidden,document.hidden?t.current&&=(clearInterval(t.current),null):(s(),t.current&&clearInterval(t.current),t.current=setInterval(s,gr))};return document.addEventListener(`visibilitychange`,r),()=>{t.current&&=(clearInterval(t.current),null),document.removeEventListener(`visibilitychange`,r)}},[e,s]),null};function vr(){let e=mt(),{project:t}=X(),n=e.query.slug,{name:r,setName:i,datasets:a,reset:o,autosaveStatus:s}=E(e=>({name:e.name,setName:e.setName,datasets:e.datasets,reset:e.reset,autosaveStatus:e.ui.autosaveStatus})),{isLoading:c,isNotFound:l,isError:u,error:d,reset:f}=hr(),{isLoading:p}=tn();return _r(),(0,Q.useEffect)(()=>()=>{f(),o()},[]),(0,Q.useEffect)(()=>{if(!(typeof window>`u`||!(`$crisp`in window)))return window.$crisp.push([`do`,`chat:hide`]),()=>{window.$crisp.push([`do`,`chat:show`])}},[]),!n||l?(0,$.jsx)(j,{backgroundColor:`bg.panel`,compactMenu:!0,children:(0,$.jsx)(z,{padding:6,children:(0,$.jsxs)(Le,{status:`warning`,children:[(0,$.jsx)(ze,{}),(0,$.jsx)(Ie,{children:`Experiment not found`}),(0,$.jsx)(Re,{children:`The experiment you're looking for doesn't exist or you don't have access to it.`})]})})}):u?(0,$.jsx)(j,{backgroundColor:`bg.panel`,compactMenu:!0,children:(0,$.jsx)(z,{padding:6,children:(0,$.jsxs)(Le,{status:`error`,children:[(0,$.jsx)(ze,{}),(0,$.jsx)(Ie,{children:`Failed to load experiment`}),(0,$.jsx)(Re,{children:d?.message??`An unexpected error occurred while loading the experiment.`})]})})}):(0,$.jsxs)(j,{backgroundColor:`bg.panel`,compactMenu:!0,children:[(0,$.jsxs)(J,{width:`full`,height:`calc(100vh - 50px)`,gap:0,align:`stretch`,overflow:`hidden`,children:[(0,$.jsxs)(G,{paddingX:6,paddingY:3,flexShrink:0,children:[(0,$.jsx)(Vt,{value:r,onSave:i,isLoading:c}),(0,$.jsx)(ut,{}),(0,$.jsxs)(G,{gap:2,children:[(0,$.jsx)(Bt,{evaluationState:s.evaluation,datasetState:s.dataset,evaluationError:s.evaluationError,datasetError:s.datasetError}),(0,$.jsx)(fr,{}),(0,$.jsx)(or,{disabled:c}),(0,$.jsx)($n,{disabled:c}),(0,$.jsx)(er,{disabled:c||p})]})]}),(0,$.jsx)(z,{flex:1,position:`relative`,overflow:`hidden`,marginLeft:4,marginTop:2,borderTopLeftRadius:`xl`,borderLeft:`1px solid`,borderTop:`1px solid`,borderColor:`border.emphasized`,bg:`bg.panel`,children:(0,$.jsx)(z,{position:`absolute`,inset:0,overflow:`auto`,children:(0,$.jsx)(Qn,{isLoadingExperiment:c,isLoadingDatasets:p})})})]}),(0,$.jsx)(nr,{datasets:a})]})}export{vr as default};
53
- //# sourceMappingURL=_slug_-DmoWXjKT.js.map
53
+ //# sourceMappingURL=_slug_-OiOLG1Mv.js.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Hi as n,Q as r,X as i,ha as a}from"./command-bar-CaJygoez.js";import{j as o,n as s}from"./stack-oJ9iWdbl.js";import{f as c}from"./LoadingScreen--vgXk5-2.js";import{n as l}from"./toaster-C_DYALhL.js";import{h as u}from"./terminal-CfM0q99k.js";import{t as d}from"./heading-D90dlSnH.js";import{t as f}from"./text-CwTrMF8x.js";import{t as p}from"./h-stack-BKLDJ2vg.js";import{r as m,t as h}from"./card-CMtKVPVl.js";import{t as g}from"./v-stack-EOPQ57OZ.js";import{b as _,m as v,s as y}from"./auth-client-D3UhxhQi.js";import{r as b}from"./next-router-C6sliiV7.js";import{t as x}from"./useOrganizationTeamProject-DC0iozx2.js";import{l as S,s as C}from"./index.esm-X7lxUoP1.js";import{t as w}from"./SettingsLayout-CLCGxMAe.js";import{n as T,t as E}from"./WithPermissionGuard-DD8uo3UK.js";var D=e(t()),O=o();function k(e){return typeof e==`object`&&!!e&&`id`in e&&`name`in e&&typeof e.id==`string`&&typeof e.name==`string`}function A(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function j(e,t){return e&&k(e)?{label:e.name,value:`custom:${e.id}`,description:e.description??(A(e.permissions)?`${e.permissions.length} permissions`:`Custom role`),isCustom:!0,customRoleId:e.id}:r[t]}function M(e){return{userId:{label:`${e.user.name} (${e.user.email})`,value:e.user.id},role:j(e.assignedRole,e.role),saved:!0}}function N(){let e=b().query.team,{organization:t}=x(),n=y.team.getTeamWithMembers.useQuery({slug:e,organizationId:t?.id??``},{enabled:typeof e==`string`&&!!t?.id});if(n.error){let e=n.error;if(e instanceof _&&e.data?.code===`UNAUTHORIZED`)return(0,O.jsx)(w,{children:(0,O.jsx)(g,{paddingX:4,paddingY:6,gap:4,align:`start`,children:(0,O.jsx)(T,{permission:`team:view`,message:`You don't have permission to view this team. Please contact your team administrator for access.`})})})}return n.isLoading||!n.data?(0,O.jsx)(w,{children:(0,O.jsxs)(g,{paddingX:4,paddingY:6,gap:6,width:`full`,maxWidth:`920px`,align:`start`,children:[(0,O.jsxs)(p,{gap:`8px`,children:[(0,O.jsx)(c,{height:`20px`,width:`60px`}),(0,O.jsx)(c,{height:`20px`,width:`12px`}),(0,O.jsx)(c,{height:`20px`,width:`120px`})]}),(0,O.jsx)(c,{height:`32px`,width:`200px`}),(0,O.jsx)(m,{width:`full`,children:(0,O.jsx)(h,{paddingY:4,children:(0,O.jsxs)(g,{gap:4,align:`start`,children:[(0,O.jsxs)(g,{gap:2,align:`start`,width:`full`,children:[(0,O.jsx)(c,{height:`16px`,width:`80px`}),(0,O.jsx)(c,{height:`40px`,width:`full`})]}),(0,O.jsxs)(g,{gap:2,align:`start`,width:`full`,children:[(0,O.jsx)(c,{height:`16px`,width:`100px`}),(0,O.jsx)(c,{height:`40px`,width:`full`})]})]})})})]})}):(0,O.jsx)(P,{team:n.data})}function P({team:e}){let t=(0,D.useCallback)(e=>({name:e.name,members:e.members.map(M)}),[]),[r,o]=(0,D.useState)(t(e)),c=C({defaultValues:r});(0,D.useEffect)(()=>{let n=t(e);o(n),c.reset(n)},[e,t,c]);let{handleSubmit:x,control:T}=c,E=S({control:T}),k=y.team.update.useMutation(),A=y.team.archiveById.useMutation(),j=y.useContext(),N=b(),P=a(t=>{n(t,r)||(o(t),k.mutate({teamId:e.id,name:t.name,members:t.members.map(e=>({userId:e.userId?.value??``,role:e.role.value,customRoleId:e.role.customRoleId}))},{onSuccess:()=>{l.create({title:`Team updated successfully`,type:`success`,duration:2e3,meta:{closable:!0}}),j.organization.getAll.refetch()},onError:e=>{v(e)||e instanceof _&&e.data?.code===`UNAUTHORIZED`&&l.create({title:`You need to be an administrator of the organization to update this team`,type:`error`,duration:5e3,meta:{closable:!0}})}}))},250);return(0,D.useEffect)(()=>{x(P)()},[E,x,P]),(0,O.jsx)(w,{children:(0,O.jsxs)(g,{gap:8,align:`start`,width:`full`,children:[(0,O.jsx)(i,{organizationId:e.organizationId,team:e,form:c,onSubmit:P,isLoading:k.isLoading}),(0,O.jsx)(u,{}),(0,O.jsxs)(g,{align:`start`,gap:3,width:`full`,children:[(0,O.jsx)(d,{size:`sm`,color:`red.500`,children:`Danger Zone`}),(0,O.jsx)(m,{width:`full`,borderColor:`red.200`,children:(0,O.jsx)(h,{children:(0,O.jsxs)(p,{justify:`space-between`,children:[(0,O.jsxs)(g,{align:`start`,gap:0,children:[(0,O.jsx)(f,{fontWeight:`medium`,children:`Archive this team`}),(0,O.jsx)(f,{fontSize:`sm`,color:`fg.muted`,children:`Hides the team and all its projects. Contact LangWatch support to restore it.`})]}),(0,O.jsx)(s,{colorPalette:`red`,variant:`outline`,size:`sm`,onClick:()=>{confirm(`Archive "${e.name}"? This will hide the team and all its projects. Contact LangWatch support to restore it.`)&&A.mutate({teamId:e.id},{onSuccess:()=>{N.push(`/settings/teams`)},onError:()=>{l.create({title:`Failed to archive team`,type:`error`,duration:5e3,meta:{closable:!0}})}})},disabled:A.isLoading,children:`Archive team`})]})})})]})]})})}var F=E(`team:view`,{layoutComponent:w})(N);export{F as default};
2
- //# sourceMappingURL=_team_-DL_wKSWK.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Hi as n,Q as r,X as i,ha as a}from"./command-bar-DUK45yin.js";import{j as o,n as s}from"./stack-oJ9iWdbl.js";import{f as c}from"./LoadingScreen--vgXk5-2.js";import{n as l}from"./toaster-C_DYALhL.js";import{h as u}from"./terminal-CfM0q99k.js";import{t as d}from"./heading-D90dlSnH.js";import{t as f}from"./text-CwTrMF8x.js";import{t as p}from"./h-stack-BKLDJ2vg.js";import{r as m,t as h}from"./card-CMtKVPVl.js";import{t as g}from"./v-stack-EOPQ57OZ.js";import{b as _,m as v,s as y}from"./auth-client-D3UhxhQi.js";import{r as b}from"./next-router-C6sliiV7.js";import{t as x}from"./useOrganizationTeamProject-DC0iozx2.js";import{l as S,s as C}from"./index.esm-X7lxUoP1.js";import{t as w}from"./SettingsLayout--1gdEuhv.js";import{n as T,t as E}from"./WithPermissionGuard-B4Jo8E5-.js";var D=e(t()),O=o();function k(e){return typeof e==`object`&&!!e&&`id`in e&&`name`in e&&typeof e.id==`string`&&typeof e.name==`string`}function A(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function j(e,t){return e&&k(e)?{label:e.name,value:`custom:${e.id}`,description:e.description??(A(e.permissions)?`${e.permissions.length} permissions`:`Custom role`),isCustom:!0,customRoleId:e.id}:r[t]}function M(e){return{userId:{label:`${e.user.name} (${e.user.email})`,value:e.user.id},role:j(e.assignedRole,e.role),saved:!0}}function N(){let e=b().query.team,{organization:t}=x(),n=y.team.getTeamWithMembers.useQuery({slug:e,organizationId:t?.id??``},{enabled:typeof e==`string`&&!!t?.id});if(n.error){let e=n.error;if(e instanceof _&&e.data?.code===`UNAUTHORIZED`)return(0,O.jsx)(w,{children:(0,O.jsx)(g,{paddingX:4,paddingY:6,gap:4,align:`start`,children:(0,O.jsx)(T,{permission:`team:view`,message:`You don't have permission to view this team. Please contact your team administrator for access.`})})})}return n.isLoading||!n.data?(0,O.jsx)(w,{children:(0,O.jsxs)(g,{paddingX:4,paddingY:6,gap:6,width:`full`,maxWidth:`920px`,align:`start`,children:[(0,O.jsxs)(p,{gap:`8px`,children:[(0,O.jsx)(c,{height:`20px`,width:`60px`}),(0,O.jsx)(c,{height:`20px`,width:`12px`}),(0,O.jsx)(c,{height:`20px`,width:`120px`})]}),(0,O.jsx)(c,{height:`32px`,width:`200px`}),(0,O.jsx)(m,{width:`full`,children:(0,O.jsx)(h,{paddingY:4,children:(0,O.jsxs)(g,{gap:4,align:`start`,children:[(0,O.jsxs)(g,{gap:2,align:`start`,width:`full`,children:[(0,O.jsx)(c,{height:`16px`,width:`80px`}),(0,O.jsx)(c,{height:`40px`,width:`full`})]}),(0,O.jsxs)(g,{gap:2,align:`start`,width:`full`,children:[(0,O.jsx)(c,{height:`16px`,width:`100px`}),(0,O.jsx)(c,{height:`40px`,width:`full`})]})]})})})]})}):(0,O.jsx)(P,{team:n.data})}function P({team:e}){let t=(0,D.useCallback)(e=>({name:e.name,members:e.members.map(M)}),[]),[r,o]=(0,D.useState)(t(e)),c=C({defaultValues:r});(0,D.useEffect)(()=>{let n=t(e);o(n),c.reset(n)},[e,t,c]);let{handleSubmit:x,control:T}=c,E=S({control:T}),k=y.team.update.useMutation(),A=y.team.archiveById.useMutation(),j=y.useContext(),N=b(),P=a(t=>{n(t,r)||(o(t),k.mutate({teamId:e.id,name:t.name,members:t.members.map(e=>({userId:e.userId?.value??``,role:e.role.value,customRoleId:e.role.customRoleId}))},{onSuccess:()=>{l.create({title:`Team updated successfully`,type:`success`,duration:2e3,meta:{closable:!0}}),j.organization.getAll.refetch()},onError:e=>{v(e)||e instanceof _&&e.data?.code===`UNAUTHORIZED`&&l.create({title:`You need to be an administrator of the organization to update this team`,type:`error`,duration:5e3,meta:{closable:!0}})}}))},250);return(0,D.useEffect)(()=>{x(P)()},[E,x,P]),(0,O.jsx)(w,{children:(0,O.jsxs)(g,{gap:8,align:`start`,width:`full`,children:[(0,O.jsx)(i,{organizationId:e.organizationId,team:e,form:c,onSubmit:P,isLoading:k.isLoading}),(0,O.jsx)(u,{}),(0,O.jsxs)(g,{align:`start`,gap:3,width:`full`,children:[(0,O.jsx)(d,{size:`sm`,color:`red.500`,children:`Danger Zone`}),(0,O.jsx)(m,{width:`full`,borderColor:`red.200`,children:(0,O.jsx)(h,{children:(0,O.jsxs)(p,{justify:`space-between`,children:[(0,O.jsxs)(g,{align:`start`,gap:0,children:[(0,O.jsx)(f,{fontWeight:`medium`,children:`Archive this team`}),(0,O.jsx)(f,{fontSize:`sm`,color:`fg.muted`,children:`Hides the team and all its projects. Contact LangWatch support to restore it.`})]}),(0,O.jsx)(s,{colorPalette:`red`,variant:`outline`,size:`sm`,onClick:()=>{confirm(`Archive "${e.name}"? This will hide the team and all its projects. Contact LangWatch support to restore it.`)&&A.mutate({teamId:e.id},{onSuccess:()=>{N.push(`/settings/teams`)},onError:()=>{l.create({title:`Failed to archive team`,type:`error`,duration:5e3,meta:{closable:!0}})}})},disabled:A.isLoading,children:`Archive team`})]})})})]})]})})}var F=E(`team:view`,{layoutComponent:w})(N);export{F as default};
2
+ //# sourceMappingURL=_team_-DKvmwO_5.js.map
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatWindow-DzB-tNlQ.js","assets/ChatWindow-CRDnlP-Q.js","assets/chunk-Bj-mKKzh.js","assets/dist-SwV3YZv3.js","assets/prop-types-DifpXm68.js","assets/react-C7JcuhbW.js","assets/toaster-C_DYALhL.js","assets/stack-oJ9iWdbl.js","assets/h-stack-BKLDJ2vg.js","assets/create-slot-recipe-context-B6DU0msX.js","assets/tooltip-AEm0YeiF.js","assets/dist-frWhjLir.js","assets/text-CwTrMF8x.js","assets/tabs-DwV1cIZB.js","assets/resize-observer-DYemxxJj.js","assets/auth-client-D3UhxhQi.js","assets/box-BsM8YLGl.js","assets/lu-Bf6j_N19.js","assets/dialog.anatomy-hrluUh9u.js","assets/group-Bwj__Orb.js","assets/heading-D90dlSnH.js","assets/link-CwZhwOLq.js","assets/next-link-DuYeiiEe.js","assets/chunk-OE4NN4TA-VhKiHPk0.js","assets/preload-helper-rov5CBGT.js","assets/v-stack-EOPQ57OZ.js","assets/useOrganizationTeamProject-DC0iozx2.js","assets/types-B5pOLKPA.js","assets/usePublicEnv-1QvVAhAk.js","assets/useRequiredSession-DE4JSglk.js","assets/next-router-C6sliiV7.js","assets/src-COIGcvxD.js","assets/value-BjB45jgo.js","assets/isObjectLike-Bu248tFs.js","assets/now-DJRfNbvM.js","assets/isSymbol-j0dCIlP_.js","assets/__vite-browser-external-BYi-AMuK.js","assets/input-C7emsUCL.js","assets/index.esm-X7lxUoP1.js","assets/useWorkflowStore-e1wFCvo2.js"])))=>i.map(i=>d[i]);
2
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{t as n}from"./preload-helper-rov5CBGT.js";import{j as r}from"./stack-oJ9iWdbl.js";import{t as i}from"./box-BsM8YLGl.js";import{i as a,t as o}from"./LoadingScreen--vgXk5-2.js";import{r as s}from"./card-CMtKVPVl.js";import{s as c}from"./auth-client-D3UhxhQi.js";import{r as l}from"./next-router-C6sliiV7.js";import{t as u}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as d}from"./next-dynamic-CldmZdeI.js";var f=e(t()),p=r(),m=d(()=>n(()=>import(`./ChatWindow-DzB-tNlQ.js`).then(e=>e.ChatBox),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])),{ssr:!1,loading:()=>(0,p.jsx)(o,{})});function h(){let e=l(),{project:t}=u(),n=e.query.workflow,r=c.optimization.getPublishedWorkflow.useQuery({workflowId:n,projectId:t?.id??``},{enabled:!!t?.id&&!!n}),[d,h]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{h(!0)},[]),!d||!e.isReady||r.isLoading?(0,p.jsx)(o,{}):r.data?(0,p.jsx)(i,{height:`100vh`,children:(0,p.jsxs)(i,{height:`full`,bg:`bg.muted`,p:16,pt:4,children:[(0,p.jsx)(a,{}),(0,p.jsx)(s,{height:`90%`,bg:`bg.panel`,p:5,mt:4,children:(0,p.jsx)(m,{useApi:!0,workflowId:n,nodes:r.data.dsl?.nodes,edges:r.data.dsl?.edges})})]})}):(0,p.jsx)(i,{p:8,children:`Workflow not found.`})}function g(){return(0,p.jsx)(h,{})}export{g as default};
3
- //# sourceMappingURL=_workflow_-DcMXLPUe.js.map
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatWindow-DFEmNXQL.js","assets/ChatWindow-C0XSteVJ.js","assets/chunk-Bj-mKKzh.js","assets/dist-Cds4Mqhj.js","assets/prop-types-DifpXm68.js","assets/react-C7JcuhbW.js","assets/toaster-C_DYALhL.js","assets/stack-oJ9iWdbl.js","assets/h-stack-BKLDJ2vg.js","assets/create-slot-recipe-context-B6DU0msX.js","assets/tooltip-AEm0YeiF.js","assets/dist-frWhjLir.js","assets/text-CwTrMF8x.js","assets/tabs-DwV1cIZB.js","assets/resize-observer-DYemxxJj.js","assets/auth-client-D3UhxhQi.js","assets/box-BsM8YLGl.js","assets/lu-Bf6j_N19.js","assets/dialog.anatomy-hrluUh9u.js","assets/group-Bwj__Orb.js","assets/heading-D90dlSnH.js","assets/link-CwZhwOLq.js","assets/next-link-DuYeiiEe.js","assets/chunk-OE4NN4TA-VhKiHPk0.js","assets/preload-helper-rov5CBGT.js","assets/v-stack-EOPQ57OZ.js","assets/useOrganizationTeamProject-DC0iozx2.js","assets/types-B5pOLKPA.js","assets/usePublicEnv-1QvVAhAk.js","assets/useRequiredSession-DE4JSglk.js","assets/next-router-C6sliiV7.js","assets/src-COIGcvxD.js","assets/value-BjB45jgo.js","assets/isObjectLike-Bu248tFs.js","assets/now-DJRfNbvM.js","assets/isSymbol-j0dCIlP_.js","assets/__vite-browser-external-BYi-AMuK.js","assets/input-C7emsUCL.js","assets/index.esm-X7lxUoP1.js","assets/useWorkflowStore-QUJ3J8X9.js"])))=>i.map(i=>d[i]);
2
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{t as n}from"./preload-helper-rov5CBGT.js";import{j as r}from"./stack-oJ9iWdbl.js";import{t as i}from"./box-BsM8YLGl.js";import{i as a,t as o}from"./LoadingScreen--vgXk5-2.js";import{r as s}from"./card-CMtKVPVl.js";import{s as c}from"./auth-client-D3UhxhQi.js";import{r as l}from"./next-router-C6sliiV7.js";import{t as u}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as d}from"./next-dynamic-CldmZdeI.js";var f=e(t()),p=r(),m=d(()=>n(()=>import(`./ChatWindow-DFEmNXQL.js`).then(e=>e.ChatBox),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])),{ssr:!1,loading:()=>(0,p.jsx)(o,{})});function h(){let e=l(),{project:t}=u(),n=e.query.workflow,r=c.optimization.getPublishedWorkflow.useQuery({workflowId:n,projectId:t?.id??``},{enabled:!!t?.id&&!!n}),[d,h]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{h(!0)},[]),!d||!e.isReady||r.isLoading?(0,p.jsx)(o,{}):r.data?(0,p.jsx)(i,{height:`100vh`,children:(0,p.jsxs)(i,{height:`full`,bg:`bg.muted`,p:16,pt:4,children:[(0,p.jsx)(a,{}),(0,p.jsx)(s,{height:`90%`,bg:`bg.panel`,p:5,mt:4,children:(0,p.jsx)(m,{useApi:!0,workflowId:n,nodes:r.data.dsl?.nodes,edges:r.data.dsl?.edges})})]})}):(0,p.jsx)(i,{p:8,children:`Workflow not found.`})}function g(){return(0,p.jsx)(h,{})}export{g as default};
3
+ //# sourceMappingURL=_workflow_-FkilKiB-.js.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{j as n}from"./stack-oJ9iWdbl.js";import{s as r}from"./auth-client-D3UhxhQi.js";import{i,t as a}from"./OptimizationStudio-BlozXjcN.js";import{n as o,t as s}from"./useWorkflowStore-e1wFCvo2.js";import{t as c}from"./next-error-XienPTyn.js";var l=e(t()),u=n();function d(){let{workflow:e}=i(),{reset:t,setWorkflow:n,setAutosavedWorkflow:d,setLastCommittedWorkflow:f,setCurrentVersionId:p}=o(({reset:e,setWorkflow:t,setAutosavedWorkflow:n,setLastCommittedWorkflow:r,setCurrentVersionId:i})=>({reset:e,setWorkflow:t,setAutosavedWorkflow:n,setLastCommittedWorkflow:r,setCurrentVersionId:i})),{clear:m}=s.temporal.getState(),h=r.useContext();return(0,l.useEffect)(()=>()=>{h.workflow.getById.invalidate()},[]),(0,l.useEffect)(()=>{let r=e.data?.currentVersion?.dsl;r?(d(void 0),n({...r,workflow_id:e.data?.id,nodes:(r.nodes??[]).map(e=>({...e,selected:!1}))}),f(r),p(e.data?.currentVersion?.id)):(t(),m())},[!!e.data]),e.isFetched&&!e.data?(0,u.jsx)(c,{statusCode:404}):(0,u.jsx)(a,{})}export{d as default};
2
- //# sourceMappingURL=_workflow_-NI9bac7d.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{j as n}from"./stack-oJ9iWdbl.js";import{s as r}from"./auth-client-D3UhxhQi.js";import{i,t as a}from"./OptimizationStudio-D2zpsmJj.js";import{n as o,t as s}from"./useWorkflowStore-QUJ3J8X9.js";import{t as c}from"./next-error-XienPTyn.js";var l=e(t()),u=n();function d(){let{workflow:e}=i(),{reset:t,setWorkflow:n,setAutosavedWorkflow:d,setLastCommittedWorkflow:f,setCurrentVersionId:p}=o(({reset:e,setWorkflow:t,setAutosavedWorkflow:n,setLastCommittedWorkflow:r,setCurrentVersionId:i})=>({reset:e,setWorkflow:t,setAutosavedWorkflow:n,setLastCommittedWorkflow:r,setCurrentVersionId:i})),{clear:m}=s.temporal.getState(),h=r.useContext();return(0,l.useEffect)(()=>()=>{h.workflow.getById.invalidate()},[]),(0,l.useEffect)(()=>{let r=e.data?.currentVersion?.dsl;r?(d(void 0),n({...r,workflow_id:e.data?.id,nodes:(r.nodes??[]).map(e=>({...e,selected:!1}))}),f(r),p(e.data?.currentVersion?.id)):(t(),m())},[!!e.data]),e.isFetched&&!e.data?(0,u.jsx)(c,{statusCode:404}):(0,u.jsx)(a,{})}export{d as default};
2
+ //# sourceMappingURL=_workflow_-gJZppg3h.js.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Ss as n,_s as r,bs as i,ho as a,vs as o,xa as s,xs as c,ys as l}from"./command-bar-CaJygoez.js";import{j as u,n as d,r as f}from"./stack-oJ9iWdbl.js";import{t as p}from"./box-BsM8YLGl.js";import{an as m}from"./dist-SwV3YZv3.js";import{h}from"./terminal-CfM0q99k.js";import{t as g}from"./heading-D90dlSnH.js";import{t as _}from"./text-CwTrMF8x.js";import{t as v}from"./h-stack-BKLDJ2vg.js";import{r as y,t as b}from"./card-CMtKVPVl.js";import{t as x}from"./spacer-2LJJGbo8.js";import{t as S}from"./v-stack-EOPQ57OZ.js";import{s as C}from"./auth-client-D3UhxhQi.js";import{c as w,t as T}from"./useOrganizationTeamProject-DC0iozx2.js";import{n as E,t as D}from"./SettingsLayout-CLCGxMAe.js";import{t as O}from"./ContactSalesBlock-CijLBwRC.js";import{t as k}from"./WithPermissionGuard-DD8uo3UK.js";var A=e(t()),j=w(),M=u();function N(e){return e===`ADMIN`?`red`:e===`MEMBER`?`blue`:e===`VIEWER`?`gray`:`purple`}function P(e){return e===j.RoleBindingScopeType.ORGANIZATION?`orange`:e===j.RoleBindingScopeType.TEAM?`teal`:`purple`}function F(e){return e===j.RoleBindingScopeType.ORGANIZATION?`Org`:e===j.RoleBindingScopeType.TEAM?`Team`:`Project`}function I(e){let t=new Map;for(let n of e){let e=n.userId??n.groupId??`unknown`;t.has(e)||t.set(e,{key:e,userId:n.userId,userName:n.userName,userEmail:n.userEmail,groupId:n.groupId,groupName:n.groupName,groupScimSource:n.groupScimSource,bindings:[]}),t.get(e).bindings.push(n)}return[...t.values()].sort((e,t)=>{let n=e.userName??e.groupName??e.userEmail??``,r=t.userName??t.groupName??t.userEmail??``;return n.localeCompare(r)})}function L({principal:e}){return e.userId?(0,M.jsxs)(v,{gap:2,children:[(0,M.jsx)(a,{id:e.userId,name:e.userName??e.userEmail??`?`,size:`xs`}),(0,M.jsxs)(S,{gap:0,align:`start`,children:[e.userName&&(0,M.jsx)(_,{fontWeight:`medium`,fontSize:`sm`,children:e.userName}),(0,M.jsx)(_,{fontSize:`xs`,color:`fg.muted`,children:e.userEmail??``})]})]}):(0,M.jsxs)(v,{gap:2,children:[(0,M.jsx)(p,{width:`6`,height:`6`,borderRadius:`full`,bg:`blue.subtle`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,children:(0,M.jsx)(s,{size:12})}),(0,M.jsxs)(S,{gap:0,align:`start`,children:[(0,M.jsx)(_,{fontWeight:`medium`,fontSize:`sm`,children:e.groupName??`Unknown group`}),e.groupScimSource&&(0,M.jsx)(m,{size:`xs`,colorPalette:`blue`,children:e.groupScimSource.toUpperCase()})]})]})}function R({bindings:e}){return(0,M.jsx)(S,{gap:1,align:`end`,children:e.map(e=>(0,M.jsxs)(v,{gap:1,children:[(0,M.jsx)(m,{colorPalette:N(e.role),size:`sm`,children:e.customRoleName??e.role}),(0,M.jsx)(_,{fontSize:`xs`,color:`fg.muted`,children:`on`}),(0,M.jsxs)(m,{colorPalette:P(e.scopeType),size:`sm`,children:[F(e.scopeType),` · `,e.scopeName??e.scopeId.slice(0,8)+`…`]})]},e.id))})}var z=[{label:`All`,value:`ALL`},{label:`Org`,value:j.RoleBindingScopeType.ORGANIZATION},{label:`Team`,value:j.RoleBindingScopeType.TEAM},{label:`Project`,value:j.RoleBindingScopeType.PROJECT}];function B({active:e,onChange:t}){return(0,M.jsx)(v,{gap:1,children:z.map(n=>(0,M.jsx)(d,{size:`sm`,variant:e===n.value?`subtle`:`ghost`,colorPalette:e===n.value?`blue`:`gray`,onClick:()=>t(n.value),children:n.label},n.value))})}function V(){let{organization:e}=T(),{isEnterprise:t,isLoading:a}=E(),[s,u]=(0,A.useState)(`ALL`),{data:d,isLoading:m}=C.roleBinding.listForOrg.useQuery({organizationId:e?.id??``},{enabled:!!e?.id&&t});if(a||!e)return(0,M.jsx)(D,{children:(0,M.jsx)(f,{})});if(!t)return(0,M.jsx)(D,{children:(0,M.jsx)(p,{width:`full`,children:(0,M.jsx)(O,{})})});let w=I(s===`ALL`?d??[]:(d??[]).filter(e=>e.scopeType===s));return(0,M.jsx)(D,{children:(0,M.jsxs)(S,{align:`start`,gap:6,width:`full`,children:[(0,M.jsxs)(S,{align:`start`,gap:1,width:`full`,children:[(0,M.jsx)(g,{as:`h2`,children:`Access Audit`}),(0,M.jsx)(_,{color:`fg.muted`,fontSize:`sm`,children:`All role bindings in this organization.`})]}),(0,M.jsx)(h,{}),(0,M.jsxs)(v,{width:`full`,children:[(0,M.jsx)(B,{active:s,onChange:u}),(0,M.jsx)(x,{}),d&&(0,M.jsxs)(_,{fontSize:`sm`,color:`fg.muted`,children:[w.length,` `,w.length===1?`principal`:`principals`]})]}),(0,M.jsx)(y,{width:`full`,overflow:`hidden`,children:(0,M.jsx)(b,{paddingY:0,paddingX:0,children:m?(0,M.jsx)(p,{padding:8,display:`flex`,justifyContent:`center`,children:(0,M.jsx)(f,{})}):w.length===0?(0,M.jsx)(p,{padding:8,textAlign:`center`,children:(0,M.jsx)(_,{color:`fg.muted`,children:`No role bindings found.`})}):(0,M.jsxs)(c,{variant:`line`,size:`md`,width:`full`,children:[(0,M.jsx)(i,{children:(0,M.jsxs)(n,{children:[(0,M.jsx)(l,{width:`240px`,children:`Who`}),(0,M.jsx)(l,{textAlign:`right`,children:`Access`})]})}),(0,M.jsx)(r,{children:w.map(e=>(0,M.jsxs)(n,{children:[(0,M.jsx)(o,{children:(0,M.jsx)(L,{principal:e})}),(0,M.jsx)(o,{children:(0,M.jsx)(R,{bindings:e.bindings})})]},e.key))})]})})})]})})}var H=k(`organization:manage`,{layoutComponent:D})(V);export{H as default};
2
- //# sourceMappingURL=access-audit-CFwNwusI.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Ss as n,_s as r,bs as i,ho as a,vs as o,xa as s,xs as c,ys as l}from"./command-bar-DUK45yin.js";import{j as u,n as d,r as f}from"./stack-oJ9iWdbl.js";import{t as p}from"./box-BsM8YLGl.js";import{an as m}from"./dist-Cds4Mqhj.js";import{h}from"./terminal-CfM0q99k.js";import{t as g}from"./heading-D90dlSnH.js";import{t as _}from"./text-CwTrMF8x.js";import{t as v}from"./h-stack-BKLDJ2vg.js";import{r as y,t as b}from"./card-CMtKVPVl.js";import{t as x}from"./spacer-2LJJGbo8.js";import{t as S}from"./v-stack-EOPQ57OZ.js";import{s as C}from"./auth-client-D3UhxhQi.js";import{c as w,t as T}from"./useOrganizationTeamProject-DC0iozx2.js";import{n as E,t as D}from"./SettingsLayout--1gdEuhv.js";import{t as O}from"./ContactSalesBlock-CnnuZ8iI.js";import{t as k}from"./WithPermissionGuard-B4Jo8E5-.js";var A=e(t()),j=w(),M=u();function N(e){return e===`ADMIN`?`red`:e===`MEMBER`?`blue`:e===`VIEWER`?`gray`:`purple`}function P(e){return e===j.RoleBindingScopeType.ORGANIZATION?`orange`:e===j.RoleBindingScopeType.TEAM?`teal`:`purple`}function F(e){return e===j.RoleBindingScopeType.ORGANIZATION?`Org`:e===j.RoleBindingScopeType.TEAM?`Team`:`Project`}function I(e){let t=new Map;for(let n of e){let e=n.userId??n.groupId??`unknown`;t.has(e)||t.set(e,{key:e,userId:n.userId,userName:n.userName,userEmail:n.userEmail,groupId:n.groupId,groupName:n.groupName,groupScimSource:n.groupScimSource,bindings:[]}),t.get(e).bindings.push(n)}return[...t.values()].sort((e,t)=>{let n=e.userName??e.groupName??e.userEmail??``,r=t.userName??t.groupName??t.userEmail??``;return n.localeCompare(r)})}function L({principal:e}){return e.userId?(0,M.jsxs)(v,{gap:2,children:[(0,M.jsx)(a,{id:e.userId,name:e.userName??e.userEmail??`?`,size:`xs`}),(0,M.jsxs)(S,{gap:0,align:`start`,children:[e.userName&&(0,M.jsx)(_,{fontWeight:`medium`,fontSize:`sm`,children:e.userName}),(0,M.jsx)(_,{fontSize:`xs`,color:`fg.muted`,children:e.userEmail??``})]})]}):(0,M.jsxs)(v,{gap:2,children:[(0,M.jsx)(p,{width:`6`,height:`6`,borderRadius:`full`,bg:`blue.subtle`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,children:(0,M.jsx)(s,{size:12})}),(0,M.jsxs)(S,{gap:0,align:`start`,children:[(0,M.jsx)(_,{fontWeight:`medium`,fontSize:`sm`,children:e.groupName??`Unknown group`}),e.groupScimSource&&(0,M.jsx)(m,{size:`xs`,colorPalette:`blue`,children:e.groupScimSource.toUpperCase()})]})]})}function R({bindings:e}){return(0,M.jsx)(S,{gap:1,align:`end`,children:e.map(e=>(0,M.jsxs)(v,{gap:1,children:[(0,M.jsx)(m,{colorPalette:N(e.role),size:`sm`,children:e.customRoleName??e.role}),(0,M.jsx)(_,{fontSize:`xs`,color:`fg.muted`,children:`on`}),(0,M.jsxs)(m,{colorPalette:P(e.scopeType),size:`sm`,children:[F(e.scopeType),` · `,e.scopeName??e.scopeId.slice(0,8)+`…`]})]},e.id))})}var z=[{label:`All`,value:`ALL`},{label:`Org`,value:j.RoleBindingScopeType.ORGANIZATION},{label:`Team`,value:j.RoleBindingScopeType.TEAM},{label:`Project`,value:j.RoleBindingScopeType.PROJECT}];function B({active:e,onChange:t}){return(0,M.jsx)(v,{gap:1,children:z.map(n=>(0,M.jsx)(d,{size:`sm`,variant:e===n.value?`subtle`:`ghost`,colorPalette:e===n.value?`blue`:`gray`,onClick:()=>t(n.value),children:n.label},n.value))})}function V(){let{organization:e}=T(),{isEnterprise:t,isLoading:a}=E(),[s,u]=(0,A.useState)(`ALL`),{data:d,isLoading:m}=C.roleBinding.listForOrg.useQuery({organizationId:e?.id??``},{enabled:!!e?.id&&t});if(a||!e)return(0,M.jsx)(D,{children:(0,M.jsx)(f,{})});if(!t)return(0,M.jsx)(D,{children:(0,M.jsx)(p,{width:`full`,children:(0,M.jsx)(O,{})})});let w=I(s===`ALL`?d??[]:(d??[]).filter(e=>e.scopeType===s));return(0,M.jsx)(D,{children:(0,M.jsxs)(S,{align:`start`,gap:6,width:`full`,children:[(0,M.jsxs)(S,{align:`start`,gap:1,width:`full`,children:[(0,M.jsx)(g,{as:`h2`,children:`Access Audit`}),(0,M.jsx)(_,{color:`fg.muted`,fontSize:`sm`,children:`All role bindings in this organization.`})]}),(0,M.jsx)(h,{}),(0,M.jsxs)(v,{width:`full`,children:[(0,M.jsx)(B,{active:s,onChange:u}),(0,M.jsx)(x,{}),d&&(0,M.jsxs)(_,{fontSize:`sm`,color:`fg.muted`,children:[w.length,` `,w.length===1?`principal`:`principals`]})]}),(0,M.jsx)(y,{width:`full`,overflow:`hidden`,children:(0,M.jsx)(b,{paddingY:0,paddingX:0,children:m?(0,M.jsx)(p,{padding:8,display:`flex`,justifyContent:`center`,children:(0,M.jsx)(f,{})}):w.length===0?(0,M.jsx)(p,{padding:8,textAlign:`center`,children:(0,M.jsx)(_,{color:`fg.muted`,children:`No role bindings found.`})}):(0,M.jsxs)(c,{variant:`line`,size:`md`,width:`full`,children:[(0,M.jsx)(i,{children:(0,M.jsxs)(n,{children:[(0,M.jsx)(l,{width:`240px`,children:`Who`}),(0,M.jsx)(l,{textAlign:`right`,children:`Access`})]})}),(0,M.jsx)(r,{children:w.map(e=>(0,M.jsxs)(n,{children:[(0,M.jsx)(o,{children:(0,M.jsx)(L,{principal:e})}),(0,M.jsx)(o,{children:(0,M.jsx)(R,{bindings:e.bindings})})]},e.key))})]})})})]})})}var H=k(`organization:manage`,{layoutComponent:D})(V);export{H as default};
2
+ //# sourceMappingURL=access-audit-xcUVYMMT.js.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$a as n,$s as r,Fa as i,Ka as a,Lt as o,Pa as s,Pr as c,Qs as l,Rt as u,Xa as d,Xr as f,Xs as p,Ys as m,Zs as h,ba as g,co as _,jr as ee,mn as v,qi as y,r as b,uo as x,zt as S}from"./command-bar-CaJygoez.js";import{j as C}from"./stack-oJ9iWdbl.js";import{t as w}from"./box-BsM8YLGl.js";import{f as T}from"./LoadingScreen--vgXk5-2.js";import{r as E}from"./dialog.anatomy-hrluUh9u.js";import{n as D}from"./toaster-C_DYALhL.js";import{a as O}from"./terminal-CfM0q99k.js";import{i as k}from"./tracking-DbhAKeey.js";import{t as A}from"./text-CwTrMF8x.js";import{i as j,t as M}from"./code-FF_ibTVI.js";import{t as N}from"./h-stack-BKLDJ2vg.js";import{r as P,t as F}from"./card-CMtKVPVl.js";import{Et as I,O as L,ut as R}from"./lu-Bf6j_N19.js";import{t as z}from"./spacer-2LJJGbo8.js";import{t as B}from"./v-stack-EOPQ57OZ.js";import{g as V,m as H,s as U}from"./auth-client-D3UhxhQi.js";import{r as W}from"./next-router-C6sliiV7.js";import{t as G}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as K}from"./WithPermissionGuard-DD8uo3UK.js";var q=e(t()),J=C(),Y={signature:O,code:M,http:a,workflow:g},X={signature:`Prompt`,code:`Code`,http:`HTTP`,workflow:`Workflow`};function Z({agent:e,onClick:t,onEdit:r,onDelete:i,onOpenWorkflow:a,onReplicate:o,onPushToCopies:l,onSyncFromSource:u,onViewHistory:f}){let p=Y[e.type]??_,m=X[e.type]??e.type,h=!!e.copiedFromAgentId,g=(e._count?.copiedAgents??0)>0;return(0,J.jsx)(P,{variant:`elevated`,onClick:e=>{e.target.closest(`.js-inner-menu`)||t?.()},cursor:`pointer`,height:`142px`,transition:`all 0.2s ease-in-out`,"data-testid":`agent-card-${e.id}`,children:(0,J.jsx)(F,{padding:4,children:(0,J.jsxs)(B,{align:`start`,gap:2,height:`full`,children:[(0,J.jsxs)(N,{width:`full`,children:[(0,J.jsx)(w,{bg:`blue.subtle`,padding:1,borderRadius:`md`,children:(0,J.jsx)(p,{size:18,color:`var(--chakra-colors-blue-fg)`})}),(0,J.jsx)(z,{}),(r||i)&&(0,J.jsxs)(y.Root,{children:[(0,J.jsx)(y.Trigger,{className:`js-inner-menu`,onClick:e=>e.stopPropagation(),children:(0,J.jsx)(d,{size:16})}),(0,J.jsxs)(y.Content,{className:`js-inner-menu`,portalled:!1,children:[r&&(0,J.jsxs)(y.Item,{value:`edit`,onClick:e=>{e.stopPropagation(),r()},children:[(0,J.jsx)(R,{size:14}),`Edit`]}),e.type===`workflow`&&a&&(0,J.jsxs)(y.Item,{value:`open-workflow`,onClick:e=>{e.stopPropagation(),a()},"data-testid":`agent-open-workflow-${e.id}`,children:[(0,J.jsx)(k,{size:14}),`Open Workflow`]}),h&&u&&(0,J.jsxs)(y.Item,{value:`sync`,onClick:e=>{e.stopPropagation(),u()},children:[(0,J.jsx)(s,{size:14}),` Update from source`]}),g&&l&&(0,J.jsxs)(y.Item,{value:`push`,onClick:e=>{e.stopPropagation(),l()},children:[(0,J.jsx)(x,{size:14}),` Push to replicas`]}),o&&(0,J.jsxs)(y.Item,{value:`replicate`,onClick:e=>{e.stopPropagation(),o()},children:[(0,J.jsx)(n,{size:14}),` Replicate to another project`]}),f&&(0,J.jsxs)(y.Item,{value:`view-history`,onClick:e=>{e.stopPropagation(),f()},children:[(0,J.jsx)(L,{size:14}),`View history`]}),i&&(0,J.jsxs)(y.Item,{value:`delete`,color:`red.500`,onClick:e=>{e.stopPropagation(),i()},children:[(0,J.jsx)(I,{size:14}),`Delete`]})]})]})]}),(0,J.jsx)(z,{}),(0,J.jsx)(A,{color:`fg.muted`,fontSize:`sm`,fontWeight:500,children:e.name}),(0,J.jsxs)(A,{color:`fg.subtle`,fontSize:`12px`,children:[m,` • `,c(new Date(e.updatedAt).getTime())]})]})})})}function Q(e){switch(e){case`code`:return`agentCodeEditor`;case`http`:return`agentHttpEditor`;case`workflow`:return`agentWorkflowEditor`;case`signature`:throw Error(`Unhandled agent type: ${e} — signature agents have no editor drawer`);default:throw Error(`Unhandled agent type: ${e}`)}}var $=V(`CopyAgentDialog`),te=({open:e,onClose:t,onSuccess:n,agentId:r,agentName:i})=>{let{project:a}=G(),o=U.agents.copy.useMutation(),s=u(`evaluations:manage`);return a?(0,J.jsx)(S,{open:e,onClose:t,onSuccess:n,title:`Replicate Agent`,entityLabel:`Agent`,sourceName:i,sourceId:r,sourceProjectId:a.id,projects:s,onCopy:async({projectId:e,sourceProjectId:t})=>{await o.mutateAsync({agentId:r,projectId:e,sourceProjectId:t})},isLoading:o.isLoading,logError:$.error.bind($)}):null};function ne(){let e=U.useContext();return U.agents.pushToCopies.useMutation({onSuccess:(t,n)=>{e.agents.getAll.invalidate({projectId:n.projectId})}})}var re=({open:e,onClose:t,agentId:n,agentName:r})=>{let{project:i}=G(),a=ne(),[s,c]=(0,q.useState)(new Set),{data:l,isLoading:u,error:d}=U.agents.getCopies.useQuery({projectId:i?.id??``,agentId:n},{enabled:e&&!!i?.id&&!!n}),[f,p]=(0,q.useState)([]);return(0,q.useEffect)(()=>{l&&(p(l),c(new Set(l.map(e=>e.id))))},[l]),(0,J.jsx)(o,{open:e,onClose:t,entityLabel:`Agent`,sourceName:r,copies:f,isLoading:u,error:d?{message:d.message}:null,selectedCopyIds:s,onToggleCopy:e=>{let t=new Set(s);t.has(e)?t.delete(e):t.add(e),c(t)},onPush:async()=>a.mutateAsync({agentId:n,projectId:i.id,copyIds:Array.from(s)}),pushLoading:a.isLoading,onSuccess:()=>c(new Set)})};function ie(){let{project:e,hasPermission:t}=G(),{openDrawer:n}=b(),a=U.useContext(),o=W(),[s,c]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),[g,y]=(0,q.useState)(null),x=U.agents.syncFromSource.useMutation({onSuccess:(e,t)=>{a.agents.getAll.invalidate({projectId:t.projectId}),D.create({title:`Agent updated`,description:`Agent has been updated from source.`,type:`success`,meta:{closable:!0}})},onError:e=>{H(e)||D.create({title:`Error updating agent`,description:e.message??`Please try again later.`,type:`error`})}}),S=(0,q.useCallback)(t=>{e?.id&&x.mutate({projectId:e.id,agentId:t})},[e?.id,x]),C=U.agents.getAll.useQuery({projectId:e?.id??``},{enabled:!!e}),w=U.agents.getRelatedEntities.useQuery({id:s?.id??``,projectId:e?.id??``},{enabled:!!s&&!!e?.id}),O=U.agents.delete.useMutation({onSuccess:()=>{a.agents.getAll.invalidate({projectId:e?.id??``}),a.licenseEnforcement.checkLimit.invalidate()}}),k=U.agents.cascadeArchive.useMutation({onSuccess:t=>{c(null),a.agents.getAll.invalidate({projectId:e?.id??``}),a.licenseEnforcement.checkLimit.invalidate(),D.create({title:`Agent deleted`,description:t.archivedWorkflow?`Also deleted: 1 workflow`:void 0,type:`success`,meta:{closable:!0}})},onError:()=>{D.create({title:`Error deleting agent`,description:`Please try again later.`,type:`error`})}}),A=e=>{n(Q(e.type),{urlParams:{agentId:e.id}})},M=e=>{c(e)},N=()=>{!s||!e||(w.data?.workflow?k.mutate({id:s.id,projectId:e.id}):O.mutate({id:s.id,projectId:e.id},{onSuccess:()=>{c(null),D.create({title:`Agent deleted`,type:`success`,meta:{closable:!0}})},onError:()=>{D.create({title:`Error deleting agent`,description:`Please try again later.`,type:`error`})}}))},P=t=>{t.workflowId&&e?.slug&&o.push(`/${e.slug}/studio/${t.workflowId}`)},F=C.data&&C.data.length>0,I=!C.isLoading&&!F;return(0,J.jsxs)(v,{children:[(0,J.jsxs)(f.Header,{children:[(0,J.jsx)(f.Heading,{children:`Agents`}),(0,J.jsx)(z,{}),(0,J.jsxs)(f.HeaderButton,{onClick:()=>n(`agentTypeSelector`),children:[(0,J.jsx)(i,{size:16}),` New Agent`]})]}),I?(0,J.jsx)(j,{flex:1,padding:6,children:(0,J.jsx)(l,{children:(0,J.jsxs)(m,{children:[(0,J.jsx)(h,{children:(0,J.jsx)(_,{size:32})}),(0,J.jsx)(r,{children:`No agents yet`}),(0,J.jsx)(p,{children:`Create reusable agents for your evaluations.`}),(0,J.jsxs)(f.HeaderButton,{onClick:()=>n(`agentTypeSelector`),children:[(0,J.jsx)(i,{size:16}),` Create your first agent`]})]})})}):(0,J.jsx)(B,{gap:6,width:`full`,align:`start`,padding:6,children:(0,J.jsxs)(E,{templateColumns:`repeat(auto-fill, minmax(300px, 1fr))`,gap:4,width:`full`,children:[C.isLoading&&Array.from({length:3}).map((e,t)=>(0,J.jsx)(T,{height:`100px`,borderRadius:`md`},t)),C.data?.map(e=>(0,J.jsx)(Z,{agent:e,onClick:()=>A(e),onEdit:()=>A(e),onDelete:()=>M(e),onOpenWorkflow:e.type===`workflow`?()=>P(e):void 0,onReplicate:()=>d({id:e.id,name:e.name}),onPushToCopies:()=>y({id:e.id,name:e.name}),onSyncFromSource:()=>S(e.id),onViewHistory:()=>n(`agentHistory`,{urlParams:{agentId:e.id,agentName:e.name}})},e.id))]})}),(0,J.jsx)(ee,{open:!!s,onClose:()=>c(null),onConfirm:N,isLoading:k.isPending||O.isPending,isLoadingRelated:w.isLoading,entityType:`agent`,entityName:s?.name??``,relatedEntities:{workflows:w.data?.workflow?[w.data.workflow]:[]}}),(0,J.jsx)(te,{open:!!u,onClose:()=>d(null),onSuccess:()=>void a.agents.getAll.invalidate({projectId:e?.id??``}),agentId:u?.id??``,agentName:u?.name??``}),(0,J.jsx)(re,{open:!!g,onClose:()=>y(null),agentId:g?.id??``,agentName:g?.name??``})]})}var ae=K(`evaluations:view`,{layoutComponent:v})(ie);export{ae as default};
2
- //# sourceMappingURL=agents-Di4XRwcn.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$a as n,$s as r,Fa as i,Ka as a,Lt as o,Pa as s,Pr as c,Qs as l,Rt as u,Xa as d,Xr as f,Xs as p,Ys as m,Zs as h,ba as g,co as _,jr as ee,mn as v,qi as y,r as b,uo as x,zt as S}from"./command-bar-DUK45yin.js";import{j as C}from"./stack-oJ9iWdbl.js";import{t as w}from"./box-BsM8YLGl.js";import{f as T}from"./LoadingScreen--vgXk5-2.js";import{r as E}from"./dialog.anatomy-hrluUh9u.js";import{n as D}from"./toaster-C_DYALhL.js";import{a as O}from"./terminal-CfM0q99k.js";import{i as k}from"./tracking-DbhAKeey.js";import{t as A}from"./text-CwTrMF8x.js";import{i as j,t as M}from"./code-FF_ibTVI.js";import{t as N}from"./h-stack-BKLDJ2vg.js";import{r as P,t as F}from"./card-CMtKVPVl.js";import{Et as I,O as L,ut as R}from"./lu-Bf6j_N19.js";import{t as z}from"./spacer-2LJJGbo8.js";import{t as B}from"./v-stack-EOPQ57OZ.js";import{g as V,m as H,s as U}from"./auth-client-D3UhxhQi.js";import{r as W}from"./next-router-C6sliiV7.js";import{t as G}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as K}from"./WithPermissionGuard-B4Jo8E5-.js";var q=e(t()),J=C(),Y={signature:O,code:M,http:a,workflow:g},X={signature:`Prompt`,code:`Code`,http:`HTTP`,workflow:`Workflow`};function Z({agent:e,onClick:t,onEdit:r,onDelete:i,onOpenWorkflow:a,onReplicate:o,onPushToCopies:l,onSyncFromSource:u,onViewHistory:f}){let p=Y[e.type]??_,m=X[e.type]??e.type,h=!!e.copiedFromAgentId,g=(e._count?.copiedAgents??0)>0;return(0,J.jsx)(P,{variant:`elevated`,onClick:e=>{e.target.closest(`.js-inner-menu`)||t?.()},cursor:`pointer`,height:`142px`,transition:`all 0.2s ease-in-out`,"data-testid":`agent-card-${e.id}`,children:(0,J.jsx)(F,{padding:4,children:(0,J.jsxs)(B,{align:`start`,gap:2,height:`full`,children:[(0,J.jsxs)(N,{width:`full`,children:[(0,J.jsx)(w,{bg:`blue.subtle`,padding:1,borderRadius:`md`,children:(0,J.jsx)(p,{size:18,color:`var(--chakra-colors-blue-fg)`})}),(0,J.jsx)(z,{}),(r||i)&&(0,J.jsxs)(y.Root,{children:[(0,J.jsx)(y.Trigger,{className:`js-inner-menu`,onClick:e=>e.stopPropagation(),children:(0,J.jsx)(d,{size:16})}),(0,J.jsxs)(y.Content,{className:`js-inner-menu`,portalled:!1,children:[r&&(0,J.jsxs)(y.Item,{value:`edit`,onClick:e=>{e.stopPropagation(),r()},children:[(0,J.jsx)(R,{size:14}),`Edit`]}),e.type===`workflow`&&a&&(0,J.jsxs)(y.Item,{value:`open-workflow`,onClick:e=>{e.stopPropagation(),a()},"data-testid":`agent-open-workflow-${e.id}`,children:[(0,J.jsx)(k,{size:14}),`Open Workflow`]}),h&&u&&(0,J.jsxs)(y.Item,{value:`sync`,onClick:e=>{e.stopPropagation(),u()},children:[(0,J.jsx)(s,{size:14}),` Update from source`]}),g&&l&&(0,J.jsxs)(y.Item,{value:`push`,onClick:e=>{e.stopPropagation(),l()},children:[(0,J.jsx)(x,{size:14}),` Push to replicas`]}),o&&(0,J.jsxs)(y.Item,{value:`replicate`,onClick:e=>{e.stopPropagation(),o()},children:[(0,J.jsx)(n,{size:14}),` Replicate to another project`]}),f&&(0,J.jsxs)(y.Item,{value:`view-history`,onClick:e=>{e.stopPropagation(),f()},children:[(0,J.jsx)(L,{size:14}),`View history`]}),i&&(0,J.jsxs)(y.Item,{value:`delete`,color:`red.500`,onClick:e=>{e.stopPropagation(),i()},children:[(0,J.jsx)(I,{size:14}),`Delete`]})]})]})]}),(0,J.jsx)(z,{}),(0,J.jsx)(A,{color:`fg.muted`,fontSize:`sm`,fontWeight:500,children:e.name}),(0,J.jsxs)(A,{color:`fg.subtle`,fontSize:`12px`,children:[m,` • `,c(new Date(e.updatedAt).getTime())]})]})})})}function Q(e){switch(e){case`code`:return`agentCodeEditor`;case`http`:return`agentHttpEditor`;case`workflow`:return`agentWorkflowEditor`;case`signature`:throw Error(`Unhandled agent type: ${e} — signature agents have no editor drawer`);default:throw Error(`Unhandled agent type: ${e}`)}}var $=V(`CopyAgentDialog`),te=({open:e,onClose:t,onSuccess:n,agentId:r,agentName:i})=>{let{project:a}=G(),o=U.agents.copy.useMutation(),s=u(`evaluations:manage`);return a?(0,J.jsx)(S,{open:e,onClose:t,onSuccess:n,title:`Replicate Agent`,entityLabel:`Agent`,sourceName:i,sourceId:r,sourceProjectId:a.id,projects:s,onCopy:async({projectId:e,sourceProjectId:t})=>{await o.mutateAsync({agentId:r,projectId:e,sourceProjectId:t})},isLoading:o.isLoading,logError:$.error.bind($)}):null};function ne(){let e=U.useContext();return U.agents.pushToCopies.useMutation({onSuccess:(t,n)=>{e.agents.getAll.invalidate({projectId:n.projectId})}})}var re=({open:e,onClose:t,agentId:n,agentName:r})=>{let{project:i}=G(),a=ne(),[s,c]=(0,q.useState)(new Set),{data:l,isLoading:u,error:d}=U.agents.getCopies.useQuery({projectId:i?.id??``,agentId:n},{enabled:e&&!!i?.id&&!!n}),[f,p]=(0,q.useState)([]);return(0,q.useEffect)(()=>{l&&(p(l),c(new Set(l.map(e=>e.id))))},[l]),(0,J.jsx)(o,{open:e,onClose:t,entityLabel:`Agent`,sourceName:r,copies:f,isLoading:u,error:d?{message:d.message}:null,selectedCopyIds:s,onToggleCopy:e=>{let t=new Set(s);t.has(e)?t.delete(e):t.add(e),c(t)},onPush:async()=>a.mutateAsync({agentId:n,projectId:i.id,copyIds:Array.from(s)}),pushLoading:a.isLoading,onSuccess:()=>c(new Set)})};function ie(){let{project:e,hasPermission:t}=G(),{openDrawer:n}=b(),a=U.useContext(),o=W(),[s,c]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),[g,y]=(0,q.useState)(null),x=U.agents.syncFromSource.useMutation({onSuccess:(e,t)=>{a.agents.getAll.invalidate({projectId:t.projectId}),D.create({title:`Agent updated`,description:`Agent has been updated from source.`,type:`success`,meta:{closable:!0}})},onError:e=>{H(e)||D.create({title:`Error updating agent`,description:e.message??`Please try again later.`,type:`error`})}}),S=(0,q.useCallback)(t=>{e?.id&&x.mutate({projectId:e.id,agentId:t})},[e?.id,x]),C=U.agents.getAll.useQuery({projectId:e?.id??``},{enabled:!!e}),w=U.agents.getRelatedEntities.useQuery({id:s?.id??``,projectId:e?.id??``},{enabled:!!s&&!!e?.id}),O=U.agents.delete.useMutation({onSuccess:()=>{a.agents.getAll.invalidate({projectId:e?.id??``}),a.licenseEnforcement.checkLimit.invalidate()}}),k=U.agents.cascadeArchive.useMutation({onSuccess:t=>{c(null),a.agents.getAll.invalidate({projectId:e?.id??``}),a.licenseEnforcement.checkLimit.invalidate(),D.create({title:`Agent deleted`,description:t.archivedWorkflow?`Also deleted: 1 workflow`:void 0,type:`success`,meta:{closable:!0}})},onError:()=>{D.create({title:`Error deleting agent`,description:`Please try again later.`,type:`error`})}}),A=e=>{n(Q(e.type),{urlParams:{agentId:e.id}})},M=e=>{c(e)},N=()=>{!s||!e||(w.data?.workflow?k.mutate({id:s.id,projectId:e.id}):O.mutate({id:s.id,projectId:e.id},{onSuccess:()=>{c(null),D.create({title:`Agent deleted`,type:`success`,meta:{closable:!0}})},onError:()=>{D.create({title:`Error deleting agent`,description:`Please try again later.`,type:`error`})}}))},P=t=>{t.workflowId&&e?.slug&&o.push(`/${e.slug}/studio/${t.workflowId}`)},F=C.data&&C.data.length>0,I=!C.isLoading&&!F;return(0,J.jsxs)(v,{children:[(0,J.jsxs)(f.Header,{children:[(0,J.jsx)(f.Heading,{children:`Agents`}),(0,J.jsx)(z,{}),(0,J.jsxs)(f.HeaderButton,{onClick:()=>n(`agentTypeSelector`),children:[(0,J.jsx)(i,{size:16}),` New Agent`]})]}),I?(0,J.jsx)(j,{flex:1,padding:6,children:(0,J.jsx)(l,{children:(0,J.jsxs)(m,{children:[(0,J.jsx)(h,{children:(0,J.jsx)(_,{size:32})}),(0,J.jsx)(r,{children:`No agents yet`}),(0,J.jsx)(p,{children:`Create reusable agents for your evaluations.`}),(0,J.jsxs)(f.HeaderButton,{onClick:()=>n(`agentTypeSelector`),children:[(0,J.jsx)(i,{size:16}),` Create your first agent`]})]})})}):(0,J.jsx)(B,{gap:6,width:`full`,align:`start`,padding:6,children:(0,J.jsxs)(E,{templateColumns:`repeat(auto-fill, minmax(300px, 1fr))`,gap:4,width:`full`,children:[C.isLoading&&Array.from({length:3}).map((e,t)=>(0,J.jsx)(T,{height:`100px`,borderRadius:`md`},t)),C.data?.map(e=>(0,J.jsx)(Z,{agent:e,onClick:()=>A(e),onEdit:()=>A(e),onDelete:()=>M(e),onOpenWorkflow:e.type===`workflow`?()=>P(e):void 0,onReplicate:()=>d({id:e.id,name:e.name}),onPushToCopies:()=>y({id:e.id,name:e.name}),onSyncFromSource:()=>S(e.id),onViewHistory:()=>n(`agentHistory`,{urlParams:{agentId:e.id,agentName:e.name}})},e.id))]})}),(0,J.jsx)(ee,{open:!!s,onClose:()=>c(null),onConfirm:N,isLoading:k.isPending||O.isPending,isLoadingRelated:w.isLoading,entityType:`agent`,entityName:s?.name??``,relatedEntities:{workflows:w.data?.workflow?[w.data.workflow]:[]}}),(0,J.jsx)(te,{open:!!u,onClose:()=>d(null),onSuccess:()=>void a.agents.getAll.invalidate({projectId:e?.id??``}),agentId:u?.id??``,agentName:u?.name??``}),(0,J.jsx)(re,{open:!!g,onClose:()=>y(null),agentId:g?.id??``,agentName:g?.name??``})]})}var ae=K(`evaluations:view`,{layoutComponent:v})(ie);export{ae as default};
2
+ //# sourceMappingURL=agents-D32g91cu.js.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{$i as t,Qi as n,Zr as r,ea as i,is as a}from"./command-bar-CaJygoez.js";import{j as o,n as s}from"./stack-oJ9iWdbl.js";import{t as c}from"./heading-D90dlSnH.js";import{t as l}from"./h-stack-BKLDJ2vg.js";import{t as u}from"./container-Ccm3vB5X.js";import{t as d}from"./spacer-2LJJGbo8.js";import{s as f}from"./auth-client-D3UhxhQi.js";import{n as p}from"./useAnnotationQueues-2DKZTC7r.js";import{r as m}from"./next-router-C6sliiV7.js";import{t as h}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as g}from"./AnnotationsTable-BDAkYaz6.js";import{t as _}from"./getSingleQueryParam-DjQoQARs.js";var v=e(r()),y=o();function b(){let{project:e}=h(),r=m(),{filterParams:o,queryOpts:b,nonEmptyFilters:x}=n(),S=Object.keys(x).length>0,C=f.traces.getAllForProject.useQuery({...o,query:_(r.query.query),groupBy:`none`,pageOffset:0,pageSize:1e4,sortBy:_(r.query.sortBy),sortDirection:_(r.query.orderBy)},b),{period:{startDate:w,endDate:T},setPeriod:E}=i(),D;if(S){let t=C.data?.groups.flatMap(e=>e.map(e=>e.trace_id))??[];D=f.annotation.getByTraceIds.useQuery({projectId:e?.id??``,traceIds:t},{enabled:e?.id!==void 0})}else D=f.annotation.getAll.useQuery({projectId:e?.id??``,startDate:w,endDate:T},{enabled:!!e});let O=D.data?.map(e=>e.traceId),k=f.traces.getTracesWithSpans.useQuery({projectId:e?.id??``,traceIds:O??[]},{enabled:!!e?.id,refetchOnWindowFocus:!1}),A=(e=>{let t=e.reduce((e,t)=>{e[t.traceId]||(e[t.traceId]={traceId:t.traceId,annotations:[],trace:k.data?.find(e=>e.trace_id===t.traceId)});let n={...t,user:t.user},r=e[t.traceId];return r&&r.annotations.push(n),e},{});return Object.values(t)})(D.data??[]),j=()=>{let e=[`User`,`Input`,`Output`,`Expected Output`,`Comment`,`Trace ID`,`Rating`,`Scoring`,`Created At`],t=D?.data?.map(e=>{let t=k.data?.find(t=>t.trace_id===e.traceId);return[e.user?.name??``,t?.input?.value??``,t?.output?.value??``,e.expectedOutput??``,e.comment??``,e.traceId??``,e.isThumbsUp?`Thumbs Up`:`Thumbs Down`,JSON.stringify(e.scoreOptions??{}),e.createdAt?.toLocaleString()??``]})??[],n=v.default.unparse({fields:e,data:t}),r=window.URL.createObjectURL(new Blob([n])),i=document.createElement(`a`);i.href=r;let a=`Traces - ${new Date().toISOString().split(`T`)[0]}.csv`;i.setAttribute(`download`,a),document.body.appendChild(i),i.click(),i.remove()},M=(0,y.jsxs)(l,{width:`full`,align:`top`,children:[(0,y.jsx)(c,{as:`h1`,size:`lg`,paddingTop:1,children:`All Annotations`}),(0,y.jsx)(d,{}),(0,y.jsxs)(s,{colorPalette:`black`,minWidth:`fit-content`,variant:`ghost`,onClick:()=>j(),children:[`Export all `,(0,y.jsx)(a,{style:{marginLeft:`8px`}})]}),(0,y.jsx)(t,{period:{startDate:w,endDate:T},setPeriod:E})]});return(0,y.jsx)(p,{children:(0,y.jsx)(u,{maxW:`calc(100vw - 330px)`,padding:0,margin:0,children:(0,y.jsx)(g,{groupedAnnotations:A,allAnnotationsLoading:D.isLoading||k.isLoading,heading:`Annotations`,isDone:!0,tableHeader:M,noDataTitle:`No recent annotations yet, change the date range to see more or annotate your messages`,noDataDescription:`Annotate your messages to add more context and improve your analysis.`})})})}export{b as default};
2
- //# sourceMappingURL=all-C273mlDB.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{$i as t,Qi as n,Zr as r,ea as i,is as a}from"./command-bar-DUK45yin.js";import{j as o,n as s}from"./stack-oJ9iWdbl.js";import{t as c}from"./heading-D90dlSnH.js";import{t as l}from"./h-stack-BKLDJ2vg.js";import{t as u}from"./container-Ccm3vB5X.js";import{t as d}from"./spacer-2LJJGbo8.js";import{s as f}from"./auth-client-D3UhxhQi.js";import{n as p}from"./useAnnotationQueues-CA6Vk--V.js";import{r as m}from"./next-router-C6sliiV7.js";import{t as h}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as g}from"./AnnotationsTable-uS_9SQ-g.js";import{t as _}from"./getSingleQueryParam-DjQoQARs.js";var v=e(r()),y=o();function b(){let{project:e}=h(),r=m(),{filterParams:o,queryOpts:b,nonEmptyFilters:x}=n(),S=Object.keys(x).length>0,C=f.traces.getAllForProject.useQuery({...o,query:_(r.query.query),groupBy:`none`,pageOffset:0,pageSize:1e4,sortBy:_(r.query.sortBy),sortDirection:_(r.query.orderBy)},b),{period:{startDate:w,endDate:T},setPeriod:E}=i(),D;if(S){let t=C.data?.groups.flatMap(e=>e.map(e=>e.trace_id))??[];D=f.annotation.getByTraceIds.useQuery({projectId:e?.id??``,traceIds:t},{enabled:e?.id!==void 0})}else D=f.annotation.getAll.useQuery({projectId:e?.id??``,startDate:w,endDate:T},{enabled:!!e});let O=D.data?.map(e=>e.traceId),k=f.traces.getTracesWithSpans.useQuery({projectId:e?.id??``,traceIds:O??[]},{enabled:!!e?.id,refetchOnWindowFocus:!1}),A=(e=>{let t=e.reduce((e,t)=>{e[t.traceId]||(e[t.traceId]={traceId:t.traceId,annotations:[],trace:k.data?.find(e=>e.trace_id===t.traceId)});let n={...t,user:t.user},r=e[t.traceId];return r&&r.annotations.push(n),e},{});return Object.values(t)})(D.data??[]),j=()=>{let e=[`User`,`Input`,`Output`,`Expected Output`,`Comment`,`Trace ID`,`Rating`,`Scoring`,`Created At`],t=D?.data?.map(e=>{let t=k.data?.find(t=>t.trace_id===e.traceId);return[e.user?.name??``,t?.input?.value??``,t?.output?.value??``,e.expectedOutput??``,e.comment??``,e.traceId??``,e.isThumbsUp?`Thumbs Up`:`Thumbs Down`,JSON.stringify(e.scoreOptions??{}),e.createdAt?.toLocaleString()??``]})??[],n=v.default.unparse({fields:e,data:t}),r=window.URL.createObjectURL(new Blob([n])),i=document.createElement(`a`);i.href=r;let a=`Traces - ${new Date().toISOString().split(`T`)[0]}.csv`;i.setAttribute(`download`,a),document.body.appendChild(i),i.click(),i.remove()},M=(0,y.jsxs)(l,{width:`full`,align:`top`,children:[(0,y.jsx)(c,{as:`h1`,size:`lg`,paddingTop:1,children:`All Annotations`}),(0,y.jsx)(d,{}),(0,y.jsxs)(s,{colorPalette:`black`,minWidth:`fit-content`,variant:`ghost`,onClick:()=>j(),children:[`Export all `,(0,y.jsx)(a,{style:{marginLeft:`8px`}})]}),(0,y.jsx)(t,{period:{startDate:w,endDate:T},setPeriod:E})]});return(0,y.jsx)(p,{children:(0,y.jsx)(u,{maxW:`calc(100vw - 330px)`,padding:0,margin:0,children:(0,y.jsx)(g,{groupedAnnotations:A,allAnnotationsLoading:D.isLoading||k.isLoading,heading:`Annotations`,isDone:!0,tableHeader:M,noDataTitle:`No recent annotations yet, change the date range to see more or annotate your messages`,noDataDescription:`Annotate your messages to add more context and improve your analysis.`})})})}export{b as default};
2
+ //# sourceMappingURL=all-vnREzDZj.js.map