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

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 (171) 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-DDh108-i.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-TNQ6uyis.js} +4 -4
  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/scripts/seed-dogfood-password.ts +163 -0
  135. package/langwatch/src/app/api/workflows/post_event/__tests__/post-event-evaluator.integration.test.ts +458 -0
  136. package/langwatch/src/app/api/workflows/post_event/__tests__/post-event-routing.test.ts +180 -0
  137. package/langwatch/src/app/api/workflows/post_event/__tests__/post-event.integration.test.ts +274 -0
  138. package/langwatch/src/app/api/workflows/post_event/post-event.ts +29 -1
  139. package/langwatch/src/components/agents/AgentCodeEditorDrawer.tsx +4 -5
  140. package/langwatch/src/components/agents/__tests__/AgentCodeEditorDrawer.integration.test.tsx +40 -0
  141. package/langwatch/src/components/evaluations/wizard/hooks/evaluation-wizard-store/slices/factories/__tests__/code-execution-node.factory.unit.test.ts +47 -0
  142. package/langwatch/src/components/evaluations/wizard/hooks/evaluation-wizard-store/slices/factories/code-execution-node.factory.ts +2 -4
  143. package/langwatch/src/components/experiments/BatchEvaluationV2/BatchEvaluationV2EvaluationResults.tsx +6 -1
  144. package/langwatch/src/optimization_studio/__tests__/registry.test.ts +29 -1
  145. package/langwatch/src/optimization_studio/components/Optimize.tsx +17 -3
  146. package/langwatch/src/optimization_studio/components/properties/AgentPropertiesPanel.tsx +4 -5
  147. package/langwatch/src/optimization_studio/hooks/workflowStoreCore.ts +17 -6
  148. package/langwatch/src/optimization_studio/hooks/workflowStoreCore.unit.test.ts +42 -0
  149. package/langwatch/src/optimization_studio/registry.ts +2 -4
  150. package/langwatch/src/optimization_studio/server/lambda/index.ts +12 -2
  151. package/langwatch/src/server/api/routers/workflows.ts +18 -0
  152. package/langwatch/src/server/evaluations-v3/execution/workflowBuilder.ts +3 -2
  153. package/langwatch/src/server/evaluations-v3/services/__tests__/experiment-run.service.getRun-null.unit.test.ts +71 -0
  154. package/langwatch/src/server/evaluations-v3/services/experiment-run.service.ts +18 -9
  155. package/langwatch/src/server/modelProviders/utils.ts +11 -1
  156. package/langwatch/src/server/nlpgo/__tests__/nlpgoFetch.integration.test.ts +248 -0
  157. package/langwatch/src/server/nlpgo/nlpgoFetch.ts +142 -0
  158. package/langwatch/src/server/routes/__tests__/playground-proxy.integration.test.ts +242 -0
  159. package/langwatch/src/server/routes/playground.ts +11 -1
  160. package/langwatch/src/server/routes/workflows.ts +17 -0
  161. package/langwatch/src/server/topicClustering/topicClustering.ts +33 -8
  162. package/langwatch/src/server/workflows/runWorkflow.ts +10 -13
  163. package/langwatch_nlp/langwatch_nlp/topic_clustering/topic_naming.py +39 -32
  164. package/langwatch_nlp/scripts/entrypoint.sh +67 -0
  165. package/package.json +1 -1
  166. package/packages/server/dist/cli.cjs +67 -94
  167. package/langwatch/dist/client/assets/ChatWindow-DzB-tNlQ.js +0 -1
  168. package/langwatch/dist/client/assets/_not-found-PEUaWdF3.js +0 -1
  169. package/langwatch/dist/client/assets/_slug_-C-8AjsjC.js +0 -2
  170. package/langwatch/dist/client/assets/choose--PBky27o.js +0 -2
  171. 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{t as n}from"./prop-types-DifpXm68.js";import{Bo as r,Un as i,ho as a,ls as o,mn as s,ns as c,r as l}from"./command-bar-CaJygoez.js";import{j as u}from"./stack-oJ9iWdbl.js";import{Qt as d}from"./dist-SwV3YZv3.js";import{h as f}from"./terminal-CfM0q99k.js";import{t as p}from"./text-CwTrMF8x.js";import{t as m}from"./h-stack-BKLDJ2vg.js";import{t as h}from"./v-stack-EOPQ57OZ.js";import{s as g}from"./auth-client-D3UhxhQi.js";import{r as _}from"./next-router-C6sliiV7.js";import{t as v}from"./useOrganizationTeamProject-DC0iozx2.js";import{r as y}from"./useRequiredSession-DE4JSglk.js";import{t as b}from"./MenuLink-b_JZtGfc.js";var x=e(t()),S=e(n());function C(){return C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},C.apply(this,arguments)}function w(e,t){if(e==null)return{};var n=T(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function T(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var E=(0,x.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=w(e,[`color`,`size`]);return x.createElement(`svg`,C({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),x.createElement(`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`}),x.createElement(`path`,{d:`M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`}))});E.propTypes={color:S.default.string,size:S.default.oneOfType([S.default.string,S.default.number])},E.displayName=`Inbox`;var D=u();function O({children:e,isSubscription:t}){let{data:n}=y(),u=n?.user,{project:x}=v(),{isLiteMember:S}=i(),C=g.annotation.getPendingItemsCount.useQuery({projectId:x?.id??``},{enabled:!!x?.id}),w=g.annotation.getAssignedItemsCount.useQuery({projectId:x?.id??``},{enabled:!!x?.id}),T=g.annotation.getQueueItemsCounts.useQuery({projectId:x?.id??``},{enabled:!!x?.id}),O={inbox:(0,D.jsx)(E,{width:20,height:20}),queues:(0,D.jsx)(r,{width:20,height:20}),myQueues:(0,D.jsx)(a,{size:`2xs`,width:5,height:5,name:u?.name??``}),all:(0,D.jsx)(c,{width:20,height:20}),done:(0,D.jsx)(o,{width:20,height:20})},k=_(),{openDrawer:A}=l();return(0,D.jsx)(s,{children:(0,D.jsxs)(m,{align:`start`,width:`full`,height:`full`,gap:0,position:`relative`,children:[(0,D.jsxs)(h,{align:`start`,paddingY:5,borderRightWidth:`1px`,borderColor:`border.emphasized`,fontSize:`14px`,minWidth:`240px`,height:`full`,gap:1,display:t?`none`:`flex`,children:[(0,D.jsx)(p,{fontSize:`md`,fontWeight:`500`,paddingX:4,paddingY:2,children:`Annotations`}),(0,D.jsxs)(h,{px:2,w:`full`,children:[(0,D.jsx)(b,{href:`/${x?.slug}/annotations`,icon:O.inbox,menuEnd:(0,D.jsx)(p,{fontSize:`xs`,fontWeight:`500`,children:C.data&&C.data>0?C.data:``}),isSelectedAnnotation:k.pathname===`/[project]/annotations`,children:`Inbox`}),(0,D.jsxs)(b,{href:`/${x?.slug}/annotations/me`,isSelectedAnnotation:k.pathname===`/[project]/annotations/me`,icon:O.myQueues,menuEnd:(0,D.jsx)(p,{fontSize:`xs`,fontWeight:`500`,children:w.data&&w.data>0?w.data:``}),children:[u?.name?.split(` `)[0],` (You)`]}),(0,D.jsx)(b,{href:`/${x?.slug}/annotations/all`,icon:O.all,isSelectedAnnotation:k.pathname===`/[project]/annotations/all`,children:`All`}),(0,D.jsx)(f,{}),(0,D.jsxs)(m,{width:`full`,justify:`space-between`,paddingRight:3,children:[(0,D.jsx)(p,{fontSize:`sm`,fontWeight:`500`,paddingX:4,paddingY:2,children:`My Queues`}),!S&&(0,D.jsx)(d,{onClick:()=>A(`addAnnotationQueue`,void 0),width:18,height:18,cursor:`pointer`})]}),T.data?.map(e=>(0,D.jsx)(b,{href:`/${x?.slug}/annotations/${e.slug}`,isSelectedAnnotation:k.pathname===`/${x?.slug}/annotations/${e.slug}`,icon:O.queues,menuEnd:(0,D.jsx)(p,{fontSize:`xs`,fontWeight:`500`,children:e.pendingCount>0?e.pendingCount:``}),children:e.name},e.id))]})]}),e]})})}function k({selectedAnnotations:e,queueId:t,showQueueAndUser:n,allQueueItems:r}={selectedAnnotations:`pending`,showQueueAndUser:!1,allQueueItems:!1}){let{project:i}=v(),a=_(),o=parseInt(a.query.pageOffset)||0,s=parseInt(a.query.pageSize)||25,c=g.annotation.getOptimizedAnnotationQueues.useQuery({projectId:i?.id??``,selectedAnnotations:e??`pending`,pageSize:s??25,pageOffset:o??0,queueId:t??``,showQueueAndUser:n??!1,allQueueItems:r??!1},{enabled:!!i,refetchOnWindowFocus:!1}),l=g.annotationScore.getAll.useQuery({projectId:i?.id??``},{enabled:!!i}),u=(0,x.useMemo)(()=>{if(!c.data)return{assignedQueueItems:[],totalCount:0};let{assignedQueueItems:e,totalCount:t}=c.data;return{assignedQueueItems:e,totalCount:t}},[c.data]);return{assignedQueueItems:u.assignedQueueItems,totalCount:u.totalCount,scoreOptions:l,queuesLoading:c.isLoading}}export{O as n,k as t};
2
- //# sourceMappingURL=useAnnotationQueues-2DKZTC7r.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{t as n}from"./prop-types-DifpXm68.js";import{Bo as r,Un as i,ho as a,ls as o,mn as s,ns as c,r as l}from"./command-bar-DUK45yin.js";import{j as u}from"./stack-oJ9iWdbl.js";import{Qt as d}from"./dist-Cds4Mqhj.js";import{h as f}from"./terminal-CfM0q99k.js";import{t as p}from"./text-CwTrMF8x.js";import{t as m}from"./h-stack-BKLDJ2vg.js";import{t as h}from"./v-stack-EOPQ57OZ.js";import{s as g}from"./auth-client-D3UhxhQi.js";import{r as _}from"./next-router-C6sliiV7.js";import{t as v}from"./useOrganizationTeamProject-DC0iozx2.js";import{r as y}from"./useRequiredSession-DE4JSglk.js";import{t as b}from"./MenuLink-b_JZtGfc.js";var x=e(t()),S=e(n());function C(){return C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},C.apply(this,arguments)}function w(e,t){if(e==null)return{};var n=T(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function T(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var E=(0,x.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=w(e,[`color`,`size`]);return x.createElement(`svg`,C({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),x.createElement(`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`}),x.createElement(`path`,{d:`M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`}))});E.propTypes={color:S.default.string,size:S.default.oneOfType([S.default.string,S.default.number])},E.displayName=`Inbox`;var D=u();function O({children:e,isSubscription:t}){let{data:n}=y(),u=n?.user,{project:x}=v(),{isLiteMember:S}=i(),C=g.annotation.getPendingItemsCount.useQuery({projectId:x?.id??``},{enabled:!!x?.id}),w=g.annotation.getAssignedItemsCount.useQuery({projectId:x?.id??``},{enabled:!!x?.id}),T=g.annotation.getQueueItemsCounts.useQuery({projectId:x?.id??``},{enabled:!!x?.id}),O={inbox:(0,D.jsx)(E,{width:20,height:20}),queues:(0,D.jsx)(r,{width:20,height:20}),myQueues:(0,D.jsx)(a,{size:`2xs`,width:5,height:5,name:u?.name??``}),all:(0,D.jsx)(c,{width:20,height:20}),done:(0,D.jsx)(o,{width:20,height:20})},k=_(),{openDrawer:A}=l();return(0,D.jsx)(s,{children:(0,D.jsxs)(m,{align:`start`,width:`full`,height:`full`,gap:0,position:`relative`,children:[(0,D.jsxs)(h,{align:`start`,paddingY:5,borderRightWidth:`1px`,borderColor:`border.emphasized`,fontSize:`14px`,minWidth:`240px`,height:`full`,gap:1,display:t?`none`:`flex`,children:[(0,D.jsx)(p,{fontSize:`md`,fontWeight:`500`,paddingX:4,paddingY:2,children:`Annotations`}),(0,D.jsxs)(h,{px:2,w:`full`,children:[(0,D.jsx)(b,{href:`/${x?.slug}/annotations`,icon:O.inbox,menuEnd:(0,D.jsx)(p,{fontSize:`xs`,fontWeight:`500`,children:C.data&&C.data>0?C.data:``}),isSelectedAnnotation:k.pathname===`/[project]/annotations`,children:`Inbox`}),(0,D.jsxs)(b,{href:`/${x?.slug}/annotations/me`,isSelectedAnnotation:k.pathname===`/[project]/annotations/me`,icon:O.myQueues,menuEnd:(0,D.jsx)(p,{fontSize:`xs`,fontWeight:`500`,children:w.data&&w.data>0?w.data:``}),children:[u?.name?.split(` `)[0],` (You)`]}),(0,D.jsx)(b,{href:`/${x?.slug}/annotations/all`,icon:O.all,isSelectedAnnotation:k.pathname===`/[project]/annotations/all`,children:`All`}),(0,D.jsx)(f,{}),(0,D.jsxs)(m,{width:`full`,justify:`space-between`,paddingRight:3,children:[(0,D.jsx)(p,{fontSize:`sm`,fontWeight:`500`,paddingX:4,paddingY:2,children:`My Queues`}),!S&&(0,D.jsx)(d,{onClick:()=>A(`addAnnotationQueue`,void 0),width:18,height:18,cursor:`pointer`})]}),T.data?.map(e=>(0,D.jsx)(b,{href:`/${x?.slug}/annotations/${e.slug}`,isSelectedAnnotation:k.pathname===`/${x?.slug}/annotations/${e.slug}`,icon:O.queues,menuEnd:(0,D.jsx)(p,{fontSize:`xs`,fontWeight:`500`,children:e.pendingCount>0?e.pendingCount:``}),children:e.name},e.id))]})]}),e]})})}function k({selectedAnnotations:e,queueId:t,showQueueAndUser:n,allQueueItems:r}={selectedAnnotations:`pending`,showQueueAndUser:!1,allQueueItems:!1}){let{project:i}=v(),a=_(),o=parseInt(a.query.pageOffset)||0,s=parseInt(a.query.pageSize)||25,c=g.annotation.getOptimizedAnnotationQueues.useQuery({projectId:i?.id??``,selectedAnnotations:e??`pending`,pageSize:s??25,pageOffset:o??0,queueId:t??``,showQueueAndUser:n??!1,allQueueItems:r??!1},{enabled:!!i,refetchOnWindowFocus:!1}),l=g.annotationScore.getAll.useQuery({projectId:i?.id??``},{enabled:!!i}),u=(0,x.useMemo)(()=>{if(!c.data)return{assignedQueueItems:[],totalCount:0};let{assignedQueueItems:e,totalCount:t}=c.data;return{assignedQueueItems:e,totalCount:t}},[c.data]);return{assignedQueueItems:u.assignedQueueItems,totalCount:u.totalCount,scoreOptions:l,queuesLoading:c.isLoading}}export{O as n,k as t};
2
+ //# sourceMappingURL=useAnnotationQueues-CA6Vk--V.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,H as r}from"./dist-SwV3YZv3.js";import{s as i}from"./auth-client-D3UhxhQi.js";import{t as a}from"./useOrganizationTeamProject-DC0iozx2.js";var o=e(t()),s=()=>{let{project:e}=a(),t=i.evaluations.availableCustomEvaluators.useQuery({projectId:e?.id??``},{enabled:!!e});return(0,o.useMemo)(()=>{if(t.data)return{...n,...Object.fromEntries((t.data??[]).map(e=>{let{inputs:t}=r(JSON.parse(JSON.stringify(e.versions[0]?.dsl))?.edges,JSON.parse(JSON.stringify(e.versions[0]?.dsl))?.nodes),n=t.map(e=>e.identifier);return[`custom/${e.id}`,{name:e.name,description:e.description,category:`custom`,isGuardrail:!1,requiredFields:n,optionalFields:[],settings:{},result:{},envVars:[]}]}))}},[t.data])};export{s as t};
2
- //# sourceMappingURL=useAvailableEvaluators-HndTl2LV.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{A as n,H as r}from"./dist-Cds4Mqhj.js";import{s as i}from"./auth-client-D3UhxhQi.js";import{t as a}from"./useOrganizationTeamProject-DC0iozx2.js";var o=e(t()),s=()=>{let{project:e}=a(),t=i.evaluations.availableCustomEvaluators.useQuery({projectId:e?.id??``},{enabled:!!e});return(0,o.useMemo)(()=>{if(t.data)return{...n,...Object.fromEntries((t.data??[]).map(e=>{let{inputs:t}=r(JSON.parse(JSON.stringify(e.versions[0]?.dsl))?.edges,JSON.parse(JSON.stringify(e.versions[0]?.dsl))?.nodes),n=t.map(e=>e.identifier);return[`custom/${e.id}`,{name:e.name,description:e.description,category:`custom`,isGuardrail:!1,requiredFields:n,optionalFields:[],settings:{},result:{},envVars:[]}]}))}},[t.data])};export{s as t};
2
+ //# sourceMappingURL=useAvailableEvaluators-hmbmcRQr.js.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{wi as n}from"./command-bar-CaJygoez.js";import{j as r}from"./stack-oJ9iWdbl.js";var i=e(t()),a=r();function o(e){let[t,r]=(0,i.useState)(!1),[o,s]=(0,i.useState)(),c=({id:e,name:t})=>{s({id:e,name:t}),r(!0)},l=()=>{o&&e({id:o.id,name:o.name}),r(!1),s(void 0)};return{showDeleteDialog:c,DeleteDialog:()=>(0,a.jsx)(n,{title:`Are you really sure?`,description:`Deleting "${o?.name??`this dataset`}" cannot be undone. Type 'delete' below to confirm:`,open:t,onClose:()=>{r(!1),s(void 0)},onConfirm:l})}}export{o as t};
2
- //# sourceMappingURL=useDeleteDatasetConfirmation-BgWN6Qqb.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{wi as n}from"./command-bar-DUK45yin.js";import{j as r}from"./stack-oJ9iWdbl.js";var i=e(t()),a=r();function o(e){let[t,r]=(0,i.useState)(!1),[o,s]=(0,i.useState)(),c=({id:e,name:t})=>{s({id:e,name:t}),r(!0)},l=()=>{o&&e({id:o.id,name:o.name}),r(!1),s(void 0)};return{showDeleteDialog:c,DeleteDialog:()=>(0,a.jsx)(n,{title:`Are you really sure?`,description:`Deleting "${o?.name??`this dataset`}" cannot be undone. Type 'delete' below to confirm:`,open:t,onClose:()=>{r(!1),s(void 0)},onConfirm:l})}}export{o as t};
2
+ //# sourceMappingURL=useDeleteDatasetConfirmation-BCK_zUUe.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{L as r,T as i,d as a,l as o,n as s,t as c}from"./dist-SwV3YZv3.js";import{l}from"./auth-client-D3UhxhQi.js";var u=e(a()),d=e(t()),f=n(),p=d.createContext({isInsideWizard:!1}),m=({isInsideWizard:e,children:t})=>(0,f.jsx)(p.Provider,{value:{isInsideWizard:e},children:t}),h=()=>d.useContext(p),g=l()(c(r,{handleSet:e=>o(t=>{t.nodes?.some(e=>e.dragging)||e(t)},100,{leading:!0,trailing:!1}),equality:(e,t)=>{let n=e=>({name:e.name,icon:e.icon,description:e.description,version:void 0,default_llm:e.default_llm,edges:e.edges.map(e=>{let t={...e};return delete t.selected,t}),nodes:e.nodes.map(e=>{let t={...e,data:{...e.data}};return delete t.selected,delete t.data.execution_state,t})});return(0,u.default)(n(e),n(t))}})),_=((...e)=>{let{isInsideWizard:t}=d.useContext(p),n=e[0]??(e=>e),r=e[1];return t?i(s(({workflowStore:e})=>n(e)),r):g(n,r)});export{h as i,_ as n,m as r,g as t};
2
- //# sourceMappingURL=useWorkflowStore-e1wFCvo2.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{L as r,T as i,d as a,l as o,n as s,t as c}from"./dist-Cds4Mqhj.js";import{l}from"./auth-client-D3UhxhQi.js";var u=e(a()),d=e(t()),f=n(),p=d.createContext({isInsideWizard:!1}),m=({isInsideWizard:e,children:t})=>(0,f.jsx)(p.Provider,{value:{isInsideWizard:e},children:t}),h=()=>d.useContext(p),g=l()(c(r,{handleSet:e=>o(t=>{t.nodes?.some(e=>e.dragging)||e(t)},100,{leading:!0,trailing:!1}),equality:(e,t)=>{let n=e=>({name:e.name,icon:e.icon,description:e.description,version:void 0,default_llm:e.default_llm,edges:e.edges.map(e=>{let t={...e};return delete t.selected,t}),nodes:e.nodes.map(e=>{let t={...e,data:{...e.data}};return delete t.selected,delete t.data.execution_state,t})});return(0,u.default)(n(e),n(t))}})),_=((...e)=>{let{isInsideWizard:t}=d.useContext(p),n=e[0]??(e=>e),r=e[1];return t?i(s(({workflowStore:e})=>n(e)),r):g(n,r)});export{h as i,_ as n,m as r,g as t};
2
+ //# sourceMappingURL=useWorkflowStore-QUJ3J8X9.js.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Do as n,Ra as r,Ss as i,Xa as a,_s as o,bs as s,fa as c,ga as l,gs as u,hs as d,qi as f,vs as p,xs as m,ys as h}from"./command-bar-CaJygoez.js";import{j as g,n as _}from"./stack-oJ9iWdbl.js";import{t as v}from"./box-BsM8YLGl.js";import{n as y}from"./toaster-C_DYALhL.js";import{an as b,f as x}from"./dist-SwV3YZv3.js";import{t as S}from"./text-CwTrMF8x.js";import{a as C,r as w}from"./field-CnUiixMS.js";import{t as T}from"./input-C7emsUCL.js";import{t as E}from"./h-stack-BKLDJ2vg.js";import{n as D}from"./link-CwZhwOLq.js";import{t as O}from"./spacer-2LJJGbo8.js";import{t as k}from"./v-stack-EOPQ57OZ.js";import{t as A}from"./createLucideIcon-BJKFyRLS.js";import{t as j}from"./next-link-DuYeiiEe.js";import{a as M,c as N,i as P,l as F,n as I,o as L,r as R,u as z}from"./useAdminResource-SPC5iBHM.js";var B=A(`user-check`,[[`path`,{d:`m16 11 2 2 4-4`,key:`9rsbq5`}],[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),V=e(t()),H=g(),U=25;function W(){let[e,t]=(0,V.useState)(1),[n,c]=(0,V.useState)(``),[u]=l(n,300),[d,g]=(0,V.useState)(null),[_,y]=(0,V.useState)(null),x=I(`user`,{pagination:{page:e,perPage:U},sort:{field:`createdAt`,order:`DESC`},filter:u?{query:u}:{}});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M,{title:`Users`,searchValue:n,onSearchChange:e=>{c(e),t(1)},searchPlaceholder:`Search by ID, name, email, org, or project`,isLoading:x.isLoading,isFetching:x.isFetching,error:x.error,pagination:{page:e,perPage:U,total:x.data?.total??0,onPageChange:t},children:(0,H.jsxs)(m,{variant:`line`,size:`md`,width:`full`,children:[(0,H.jsx)(s,{children:(0,H.jsxs)(i,{children:[(0,H.jsx)(h,{children:`ID`}),(0,H.jsx)(h,{children:`Name`}),(0,H.jsx)(h,{children:`Email`}),(0,H.jsx)(h,{children:`Organizations`}),(0,H.jsx)(h,{children:`Projects`}),(0,H.jsx)(h,{children:`Created`}),(0,H.jsx)(h,{children:`Last login`}),(0,H.jsx)(h,{children:`Status`}),(0,H.jsx)(h,{width:`60px`,textAlign:`right`})]})}),(0,H.jsxs)(o,{children:[x.data?.data.length===0&&(0,H.jsx)(i,{children:(0,H.jsx)(p,{colSpan:9,children:(0,H.jsx)(S,{color:`fg.muted`,textAlign:`center`,paddingY:6,children:`No users match your search.`})})}),x.data?.data.map(e=>(0,H.jsxs)(i,{children:[(0,H.jsx)(p,{fontFamily:`mono`,fontSize:`xs`,color:`fg.muted`,maxW:`110px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,title:e.id,children:e.id}),(0,H.jsx)(p,{children:e.name??(0,H.jsx)(L,{})}),(0,H.jsx)(p,{children:e.email??(0,H.jsx)(L,{})}),(0,H.jsx)(p,{children:(0,H.jsx)(q,{refs:e.organizations,resource:`organizations`})}),(0,H.jsx)(p,{children:(0,H.jsx)(q,{refs:e.projects,resource:`projects`})}),(0,H.jsx)(p,{children:N(e.createdAt)}),(0,H.jsx)(p,{children:F(e.lastLoginAt)}),(0,H.jsx)(p,{children:e.deactivatedAt?(0,H.jsx)(b,{colorPalette:`red`,size:`sm`,children:`Deactivated`}):e.pendingSsoSetup?(0,H.jsx)(b,{colorPalette:`yellow`,size:`sm`,children:`Pending SSO`}):e.emailVerified?(0,H.jsx)(b,{colorPalette:`green`,size:`sm`,children:`Active`}):(0,H.jsx)(b,{colorPalette:`gray`,size:`sm`,children:`Unverified`})}),(0,H.jsx)(p,{textAlign:`right`,children:(0,H.jsx)(v,{width:`full`,height:`full`,display:`flex`,justifyContent:`end`,children:(0,H.jsxs)(f.Root,{children:[(0,H.jsx)(f.Trigger,{children:(0,H.jsx)(a,{size:16})}),(0,H.jsxs)(f.Content,{children:[(0,H.jsxs)(f.Item,{value:`edit`,onClick:()=>g(e),children:[(0,H.jsx)(r,{size:16}),`Edit`]}),!e.deactivatedAt&&(0,H.jsxs)(f.Item,{value:`impersonate`,onClick:()=>y(e),children:[(0,H.jsx)(B,{size:16}),`Impersonate`]})]})]})})})]},e.id))]})]})}),(0,H.jsx)(K,{user:d,onClose:()=>g(null)}),(0,H.jsx)(G,{user:_,onClose:()=>y(null)})]})}function G({user:e,onClose:t}){let[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{e&&r(``)},[e]),(0,H.jsx)(x.Root,{open:!!e,onOpenChange:({open:e})=>{!e&&!i&&t()},children:(0,H.jsxs)(x.Content,{children:[(0,H.jsx)(x.Header,{children:(0,H.jsx)(x.Title,{children:`Impersonate user`})}),(0,H.jsx)(x.CloseTrigger,{disabled:i}),(0,H.jsx)(x.Body,{children:(0,H.jsxs)(k,{gap:3,align:`stretch`,children:[(0,H.jsxs)(S,{fontSize:`sm`,color:`fg.muted`,children:[`You will sign in as`,` `,(0,H.jsx)(S,{as:`span`,fontWeight:`semibold`,color:`fg`,children:e?.name??e?.email??e?.id}),`. The reason below is saved to the audit log.`]}),(0,H.jsxs)(C,{required:!0,children:[(0,H.jsx)(w,{children:`Reason`}),(0,H.jsx)(u,{rows:3,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Debugging a stuck trace reported by support ticket #…`,disabled:i})]})]})}),(0,H.jsx)(x.Footer,{children:(0,H.jsxs)(E,{width:`full`,children:[(0,H.jsx)(O,{}),(0,H.jsx)(_,{variant:`ghost`,onClick:t,disabled:i,children:`Cancel`}),(0,H.jsx)(_,{onClick:async()=>{if(!e)return;let t=n.trim();if(!t){y.create({title:`Reason is required`,description:`Saved to the audit log alongside the impersonation.`,type:`error`,duration:3e3,meta:{closable:!0}});return}a(!0);try{await P({userIdToImpersonate:e.id,reason:t}),window.location.href=`/`}catch(e){y.create({title:`Impersonation failed`,description:e instanceof Error?e.message:String(e),type:`error`,duration:5e3,meta:{closable:!0}}),a(!1)}},loading:i,colorPalette:`orange`,children:`Impersonate`})]})})]})})}function K({user:e,onClose:t}){let r=R(`user`),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{e&&(a(e.name??``),s(e.email??``),l(e.image??``),d(!!e.emailVerified),p(!!e.pendingSsoSetup),h(!!e.deactivatedAt))},[e]),(0,H.jsx)(n.Root,{open:!!e,onOpenChange:({open:e})=>{e||t()},size:`md`,children:(0,H.jsxs)(n.Content,{children:[(0,H.jsx)(n.Header,{children:(0,H.jsx)(n.Title,{children:`Edit User`})}),(0,H.jsx)(n.CloseTrigger,{}),(0,H.jsx)(n.Body,{children:e&&(0,H.jsxs)(k,{gap:4,align:`stretch`,children:[(0,H.jsxs)(C,{children:[(0,H.jsx)(w,{children:`Name`}),(0,H.jsx)(T,{value:i,onChange:e=>a(e.target.value)})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(w,{children:`Email`}),(0,H.jsx)(T,{type:`email`,value:o,onChange:e=>s(e.target.value)})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(w,{children:`Avatar URL`}),(0,H.jsx)(T,{type:`url`,value:c,onChange:e=>l(e.target.value),placeholder:`https://…`})]}),(0,H.jsx)(J,{label:`Email verified`,hint:`Flip manually after an out-of-band verification.`,checked:u,onChange:d}),(0,H.jsx)(J,{label:`Pending SSO setup`,hint:`Allows first-time SSO provider linking.`,checked:f,onChange:p}),(0,H.jsx)(J,{label:`Deactivated`,hint:`Revokes sessions + blocks new logins until reactivated.`,checked:m,onChange:h}),(0,H.jsxs)(k,{align:`start`,gap:0,pt:2,children:[(0,H.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[`User ID: `,e.id]}),(0,H.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[`Created: `,F(e.createdAt)]}),(0,H.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[`Last login: `,F(e.lastLoginAt)]})]})]})}),(0,H.jsx)(n.Footer,{children:(0,H.jsxs)(E,{width:`full`,children:[(0,H.jsx)(O,{}),(0,H.jsx)(_,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,H.jsx)(_,{loading:r.isPending,onClick:()=>{if(!e)return;let n={};if(i!==(e.name??``)&&(n.name=i),o!==(e.email??``)&&(n.email=o),c!==(e.image??``)&&(n.image=c||null),u!==!!e.emailVerified&&(n.emailVerified=u),f!==!!e.pendingSsoSetup&&(n.pendingSsoSetup=f),m!==!!e.deactivatedAt&&(n.deactivatedAt=m?new Date().toISOString():null),Object.keys(n).length===0){t();return}r.mutate({id:e.id,data:n},{onSuccess:()=>{y.create({title:`User updated`,type:`success`,duration:3e3,meta:{closable:!0}}),t()},onError:e=>y.create({title:`Update failed`,description:e.message,type:`error`,duration:5e3,meta:{closable:!0}})})},children:`Save`})]})})]})})}function q({refs:e,resource:t}){return typeof e==`string`?e?(0,H.jsx)(S,{fontSize:`xs`,children:e}):(0,H.jsx)(L,{}):!Array.isArray(e)||e.length===0?(0,H.jsx)(L,{}):(0,H.jsx)(d,{gap:1,children:e.map(e=>(0,H.jsx)(D,{asChild:!0,fontSize:`xs`,color:`fg`,_hover:{textDecoration:`underline`},children:(0,H.jsx)(j,{href:`/ops/backoffice/${t}?q=${e.id}`,children:(0,H.jsx)(v,{as:`span`,paddingX:2,paddingY:.5,borderRadius:`md`,borderWidth:`1px`,borderColor:`border.emphasized`,background:`bg.subtle`,children:e.name})})},e.id))})}function J({label:e,hint:t,checked:n,onChange:r}){return(0,H.jsx)(C,{children:(0,H.jsxs)(E,{width:`full`,children:[(0,H.jsxs)(k,{align:`start`,gap:0,children:[(0,H.jsx)(w,{children:e}),(0,H.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:t})]}),(0,H.jsx)(O,{}),(0,H.jsx)(c,{checked:n,onCheckedChange:e=>r(e.checked)})]})})}function Y(){return(0,H.jsx)(z,{children:(0,H.jsx)(W,{})})}export{Y as default};
2
- //# sourceMappingURL=users-C6wjliCC.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Do as n,Ra as r,Ss as i,Xa as a,_s as o,bs as s,fa as c,ga as l,gs as u,hs as d,qi as f,vs as p,xs as m,ys as h}from"./command-bar-DUK45yin.js";import{j as g,n as _}from"./stack-oJ9iWdbl.js";import{t as v}from"./box-BsM8YLGl.js";import{n as y}from"./toaster-C_DYALhL.js";import{an as b,f as x}from"./dist-Cds4Mqhj.js";import{t as S}from"./text-CwTrMF8x.js";import{a as C,r as w}from"./field-CnUiixMS.js";import{t as T}from"./input-C7emsUCL.js";import{t as E}from"./h-stack-BKLDJ2vg.js";import{n as D}from"./link-CwZhwOLq.js";import{t as O}from"./spacer-2LJJGbo8.js";import{t as k}from"./v-stack-EOPQ57OZ.js";import{t as A}from"./createLucideIcon-BJKFyRLS.js";import{t as j}from"./next-link-DuYeiiEe.js";import{a as M,c as N,i as P,l as F,n as I,o as L,r as R,u as z}from"./useAdminResource-SmnnHro6.js";var B=A(`user-check`,[[`path`,{d:`m16 11 2 2 4-4`,key:`9rsbq5`}],[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),V=e(t()),H=g(),U=25;function W(){let[e,t]=(0,V.useState)(1),[n,c]=(0,V.useState)(``),[u]=l(n,300),[d,g]=(0,V.useState)(null),[_,y]=(0,V.useState)(null),x=I(`user`,{pagination:{page:e,perPage:U},sort:{field:`createdAt`,order:`DESC`},filter:u?{query:u}:{}});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M,{title:`Users`,searchValue:n,onSearchChange:e=>{c(e),t(1)},searchPlaceholder:`Search by ID, name, email, org, or project`,isLoading:x.isLoading,isFetching:x.isFetching,error:x.error,pagination:{page:e,perPage:U,total:x.data?.total??0,onPageChange:t},children:(0,H.jsxs)(m,{variant:`line`,size:`md`,width:`full`,children:[(0,H.jsx)(s,{children:(0,H.jsxs)(i,{children:[(0,H.jsx)(h,{children:`ID`}),(0,H.jsx)(h,{children:`Name`}),(0,H.jsx)(h,{children:`Email`}),(0,H.jsx)(h,{children:`Organizations`}),(0,H.jsx)(h,{children:`Projects`}),(0,H.jsx)(h,{children:`Created`}),(0,H.jsx)(h,{children:`Last login`}),(0,H.jsx)(h,{children:`Status`}),(0,H.jsx)(h,{width:`60px`,textAlign:`right`})]})}),(0,H.jsxs)(o,{children:[x.data?.data.length===0&&(0,H.jsx)(i,{children:(0,H.jsx)(p,{colSpan:9,children:(0,H.jsx)(S,{color:`fg.muted`,textAlign:`center`,paddingY:6,children:`No users match your search.`})})}),x.data?.data.map(e=>(0,H.jsxs)(i,{children:[(0,H.jsx)(p,{fontFamily:`mono`,fontSize:`xs`,color:`fg.muted`,maxW:`110px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,title:e.id,children:e.id}),(0,H.jsx)(p,{children:e.name??(0,H.jsx)(L,{})}),(0,H.jsx)(p,{children:e.email??(0,H.jsx)(L,{})}),(0,H.jsx)(p,{children:(0,H.jsx)(q,{refs:e.organizations,resource:`organizations`})}),(0,H.jsx)(p,{children:(0,H.jsx)(q,{refs:e.projects,resource:`projects`})}),(0,H.jsx)(p,{children:N(e.createdAt)}),(0,H.jsx)(p,{children:F(e.lastLoginAt)}),(0,H.jsx)(p,{children:e.deactivatedAt?(0,H.jsx)(b,{colorPalette:`red`,size:`sm`,children:`Deactivated`}):e.pendingSsoSetup?(0,H.jsx)(b,{colorPalette:`yellow`,size:`sm`,children:`Pending SSO`}):e.emailVerified?(0,H.jsx)(b,{colorPalette:`green`,size:`sm`,children:`Active`}):(0,H.jsx)(b,{colorPalette:`gray`,size:`sm`,children:`Unverified`})}),(0,H.jsx)(p,{textAlign:`right`,children:(0,H.jsx)(v,{width:`full`,height:`full`,display:`flex`,justifyContent:`end`,children:(0,H.jsxs)(f.Root,{children:[(0,H.jsx)(f.Trigger,{children:(0,H.jsx)(a,{size:16})}),(0,H.jsxs)(f.Content,{children:[(0,H.jsxs)(f.Item,{value:`edit`,onClick:()=>g(e),children:[(0,H.jsx)(r,{size:16}),`Edit`]}),!e.deactivatedAt&&(0,H.jsxs)(f.Item,{value:`impersonate`,onClick:()=>y(e),children:[(0,H.jsx)(B,{size:16}),`Impersonate`]})]})]})})})]},e.id))]})]})}),(0,H.jsx)(K,{user:d,onClose:()=>g(null)}),(0,H.jsx)(G,{user:_,onClose:()=>y(null)})]})}function G({user:e,onClose:t}){let[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{e&&r(``)},[e]),(0,H.jsx)(x.Root,{open:!!e,onOpenChange:({open:e})=>{!e&&!i&&t()},children:(0,H.jsxs)(x.Content,{children:[(0,H.jsx)(x.Header,{children:(0,H.jsx)(x.Title,{children:`Impersonate user`})}),(0,H.jsx)(x.CloseTrigger,{disabled:i}),(0,H.jsx)(x.Body,{children:(0,H.jsxs)(k,{gap:3,align:`stretch`,children:[(0,H.jsxs)(S,{fontSize:`sm`,color:`fg.muted`,children:[`You will sign in as`,` `,(0,H.jsx)(S,{as:`span`,fontWeight:`semibold`,color:`fg`,children:e?.name??e?.email??e?.id}),`. The reason below is saved to the audit log.`]}),(0,H.jsxs)(C,{required:!0,children:[(0,H.jsx)(w,{children:`Reason`}),(0,H.jsx)(u,{rows:3,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Debugging a stuck trace reported by support ticket #…`,disabled:i})]})]})}),(0,H.jsx)(x.Footer,{children:(0,H.jsxs)(E,{width:`full`,children:[(0,H.jsx)(O,{}),(0,H.jsx)(_,{variant:`ghost`,onClick:t,disabled:i,children:`Cancel`}),(0,H.jsx)(_,{onClick:async()=>{if(!e)return;let t=n.trim();if(!t){y.create({title:`Reason is required`,description:`Saved to the audit log alongside the impersonation.`,type:`error`,duration:3e3,meta:{closable:!0}});return}a(!0);try{await P({userIdToImpersonate:e.id,reason:t}),window.location.href=`/`}catch(e){y.create({title:`Impersonation failed`,description:e instanceof Error?e.message:String(e),type:`error`,duration:5e3,meta:{closable:!0}}),a(!1)}},loading:i,colorPalette:`orange`,children:`Impersonate`})]})})]})})}function K({user:e,onClose:t}){let r=R(`user`),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{e&&(a(e.name??``),s(e.email??``),l(e.image??``),d(!!e.emailVerified),p(!!e.pendingSsoSetup),h(!!e.deactivatedAt))},[e]),(0,H.jsx)(n.Root,{open:!!e,onOpenChange:({open:e})=>{e||t()},size:`md`,children:(0,H.jsxs)(n.Content,{children:[(0,H.jsx)(n.Header,{children:(0,H.jsx)(n.Title,{children:`Edit User`})}),(0,H.jsx)(n.CloseTrigger,{}),(0,H.jsx)(n.Body,{children:e&&(0,H.jsxs)(k,{gap:4,align:`stretch`,children:[(0,H.jsxs)(C,{children:[(0,H.jsx)(w,{children:`Name`}),(0,H.jsx)(T,{value:i,onChange:e=>a(e.target.value)})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(w,{children:`Email`}),(0,H.jsx)(T,{type:`email`,value:o,onChange:e=>s(e.target.value)})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(w,{children:`Avatar URL`}),(0,H.jsx)(T,{type:`url`,value:c,onChange:e=>l(e.target.value),placeholder:`https://…`})]}),(0,H.jsx)(J,{label:`Email verified`,hint:`Flip manually after an out-of-band verification.`,checked:u,onChange:d}),(0,H.jsx)(J,{label:`Pending SSO setup`,hint:`Allows first-time SSO provider linking.`,checked:f,onChange:p}),(0,H.jsx)(J,{label:`Deactivated`,hint:`Revokes sessions + blocks new logins until reactivated.`,checked:m,onChange:h}),(0,H.jsxs)(k,{align:`start`,gap:0,pt:2,children:[(0,H.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[`User ID: `,e.id]}),(0,H.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[`Created: `,F(e.createdAt)]}),(0,H.jsxs)(S,{fontSize:`xs`,color:`fg.muted`,children:[`Last login: `,F(e.lastLoginAt)]})]})]})}),(0,H.jsx)(n.Footer,{children:(0,H.jsxs)(E,{width:`full`,children:[(0,H.jsx)(O,{}),(0,H.jsx)(_,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,H.jsx)(_,{loading:r.isPending,onClick:()=>{if(!e)return;let n={};if(i!==(e.name??``)&&(n.name=i),o!==(e.email??``)&&(n.email=o),c!==(e.image??``)&&(n.image=c||null),u!==!!e.emailVerified&&(n.emailVerified=u),f!==!!e.pendingSsoSetup&&(n.pendingSsoSetup=f),m!==!!e.deactivatedAt&&(n.deactivatedAt=m?new Date().toISOString():null),Object.keys(n).length===0){t();return}r.mutate({id:e.id,data:n},{onSuccess:()=>{y.create({title:`User updated`,type:`success`,duration:3e3,meta:{closable:!0}}),t()},onError:e=>y.create({title:`Update failed`,description:e.message,type:`error`,duration:5e3,meta:{closable:!0}})})},children:`Save`})]})})]})})}function q({refs:e,resource:t}){return typeof e==`string`?e?(0,H.jsx)(S,{fontSize:`xs`,children:e}):(0,H.jsx)(L,{}):!Array.isArray(e)||e.length===0?(0,H.jsx)(L,{}):(0,H.jsx)(d,{gap:1,children:e.map(e=>(0,H.jsx)(D,{asChild:!0,fontSize:`xs`,color:`fg`,_hover:{textDecoration:`underline`},children:(0,H.jsx)(j,{href:`/ops/backoffice/${t}?q=${e.id}`,children:(0,H.jsx)(v,{as:`span`,paddingX:2,paddingY:.5,borderRadius:`md`,borderWidth:`1px`,borderColor:`border.emphasized`,background:`bg.subtle`,children:e.name})})},e.id))})}function J({label:e,hint:t,checked:n,onChange:r}){return(0,H.jsx)(C,{children:(0,H.jsxs)(E,{width:`full`,children:[(0,H.jsxs)(k,{align:`start`,gap:0,children:[(0,H.jsx)(w,{children:e}),(0,H.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:t})]}),(0,H.jsx)(O,{}),(0,H.jsx)(c,{checked:n,onCheckedChange:e=>r(e.checked)})]})})}function Y(){return(0,H.jsx)(z,{children:(0,H.jsx)(W,{})})}export{Y as default};
2
+ //# sourceMappingURL=users-CfhanCfR.js.map
@@ -1,2 +1,2 @@
1
- import{$s as e,Gn as t,Qi as n,Qs as r,Ss as i,Xs as a,Ys as o,_s as s,bs as c,r as l,un as u,vs as d,xs as f,ys as p}from"./command-bar-CaJygoez.js";import{j as m}from"./stack-oJ9iWdbl.js";import{t as h}from"./box-BsM8YLGl.js";import{s as g}from"./tabs-DwV1cIZB.js";import{t as _}from"./tooltip-AEm0YeiF.js";import{f as v}from"./terminal-CfM0q99k.js";import{t as y}from"./heading-D90dlSnH.js";import{t as b}from"./text-CwTrMF8x.js";import{i as x}from"./code-FF_ibTVI.js";import{t as S}from"./h-stack-BKLDJ2vg.js";import{n as C,r as w,t as T}from"./card-CMtKVPVl.js";import{n as E}from"./link-CwZhwOLq.js";import{t as D}from"./simple-grid-C3IW90zo.js";import{t as O}from"./v-stack-EOPQ57OZ.js";import{s as k}from"./auth-client-D3UhxhQi.js";import{t as A}from"./WithPermissionGuard-DD8uo3UK.js";import{t as j}from"./GraphsLayout-BJ68J9e-.js";import{t as M}from"./ChartCard-D14PUg_d.js";var N=m(),P=()=>{let{filterParams:e,queryOpts:t}=n(),r=k.analytics.feedbacks.useQuery(e,t),{openDrawer:a}=l();return r.isLoading?(0,N.jsx)(h,{children:`Loading...`}):r.error?(0,N.jsx)(h,{children:`An error occurred`}):(0,N.jsx)(O,{align:`start`,gap:4,children:(0,N.jsxs)(f,{variant:`line`,padding:0,margin:0,children:[(0,N.jsx)(c,{children:(0,N.jsxs)(i,{children:[(0,N.jsx)(p,{width:`48px`,paddingLeft:0}),(0,N.jsx)(p,{children:`Feedback`}),(0,N.jsx)(p,{width:`250px`,children:`Date`}),(0,N.jsx)(p,{width:`180px`,textAlign:`center`,children:`Open Message`})]})}),(0,N.jsxs)(s,{children:[r.data?.events.length===0&&(0,N.jsx)(i,{children:(0,N.jsxs)(d,{colSpan:4,children:[`No written feedbacks received yet, check out our`,` `,(0,N.jsx)(`a`,{href:`https://docs.langwatch.ai/docs/user-events/thumbs-up-down`,target:`_blank`,style:{textDecoration:`underline`},children:`docs`}),` `,`on how to integrate`]})}),r.data?.events.map((e,t)=>{let n=e.metrics?.find(e=>e.key===`vote`)?.value,r=e.event_details?.find(e=>e.key===`feedback`)?.value;return(0,N.jsxs)(i,{onClick:()=>{a(`traceDetails`,{traceId:e.trace_id})},cursor:`pointer`,children:[(0,N.jsx)(d,{paddingLeft:0,textAlign:`center`,paddingRight:`0`,children:n===1?`👍`:n===-1?`👎`:`-`}),(0,N.jsx)(d,{children:(0,N.jsx)(_,{content:r,children:(0,N.jsx)(b,{lineClamp:1,wordBreak:`break-all`,display:`block`,children:r})})}),(0,N.jsx)(d,{children:new Date(e.timestamps.started_at??e.timestamps.inserted_at).toLocaleString()}),(0,N.jsx)(d,{children:(0,N.jsx)(x,{children:e.trace_id&&(0,N.jsx)(E,{onClick:()=>{a(`traceDetails`,{traceId:e.trace_id})},children:(0,N.jsx)(v,{})})})})]},t)})]})]})})},F=1440,I={graphId:`userTracesSummary`,graphType:`summary`,series:[{name:`Traces count`,colorSet:`orangeTones`,metric:`metadata.trace_id`,aggregation:`cardinality`},{name:`Average traces per user`,colorSet:`orangeTones`,metric:`metadata.trace_id`,aggregation:`cardinality`,pipeline:{field:`user_id`,aggregation:`avg`}},{name:`Users count`,colorSet:`blueTones`,metric:`metadata.user_id`,aggregation:`cardinality`}],includePrevious:!1,timeScale:F,height:300},L={graphId:`dailyUsers`,graphType:`area`,series:[{name:`Users count`,colorSet:`blueTones`,metric:`metadata.user_id`,aggregation:`cardinality`}],includePrevious:!0,timeScale:F,height:300},R={graphId:`dailyThreads`,graphType:`area`,series:[{name:`Threads count`,colorSet:`greenTones`,metric:`metadata.thread_id`,aggregation:`cardinality`}],includePrevious:!0,timeScale:F,height:300},z={graphId:`userLeaderboard`,graphType:`horizontal_bar`,series:[{name:`Traces count`,colorSet:`colors`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`metadata.user_id`,excludeUnknownBuckets:!0,includePrevious:!1,timeScale:`full`,height:300},B={graphId:`maxTracesPerThread`,graphType:`scatter`,series:[{name:`Maximum traces count per thread`,colorSet:`blueTones`,metric:`metadata.trace_id`,aggregation:`cardinality`,pipeline:{field:`thread_id`,aggregation:`max`}}],includePrevious:!0,timeScale:F,connected:!1,height:300},V={graphId:`userThreadsSummary`,graphType:`summary`,series:[{name:`Threads count`,colorSet:`greenTones`,metric:`metadata.thread_id`,aggregation:`cardinality`},{name:`Average threads per user`,colorSet:`greenTones`,metric:`metadata.thread_id`,aggregation:`cardinality`,pipeline:{field:`user_id`,aggregation:`avg`}},{name:`Average thread duration`,colorSet:`purpleTones`,metric:`threads.average_duration_per_thread`,aggregation:`avg`,pipeline:{field:`user_id`,aggregation:`avg`}}],includePrevious:!1,timeScale:F,height:300},H={graphId:`tracesByLabel`,graphType:`horizontal_bar`,series:[{name:`Traces count`,colorSet:`colors`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`metadata.labels`,excludeUnknownBuckets:!0,includePrevious:!1,timeScale:`full`,height:300},U={graphId:`tracesByCustomer`,graphType:`horizontal_bar`,series:[{name:`Traces count`,colorSet:`colors`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`metadata.customer_id`,excludeUnknownBuckets:!0,includePrevious:!1,timeScale:`full`,height:300},W=(0,N.jsx)(r,{size:`sm`,paddingY:10,children:(0,N.jsx)(o,{children:(0,N.jsxs)(O,{textAlign:`center`,children:[(0,N.jsx)(e,{textStyle:`sm`,children:`No user data yet`}),(0,N.jsxs)(a,{textStyle:`xs`,children:[`Start tracking users to see metrics here.`,` `,(0,N.jsx)(`a`,{href:`https://langwatch.ai/docs/integration/metadata-and-labels`,target:`_blank`,rel:`noopener noreferrer`,style:{textDecoration:`underline`},children:`Learn how to set up`})]})]})})});function G(){return(0,N.jsx)(j,{title:`Users`,children:(0,N.jsxs)(S,{alignItems:`start`,width:`full`,gap:6,children:[(0,N.jsxs)(D,{templateColumns:`repeat(4, 1fr)`,gap:5,width:`100%`,children:[(0,N.jsx)(g,{colSpan:2,display:`inline-grid`,children:(0,N.jsxs)(w,{overflow:`auto`,children:[(0,N.jsx)(C,{children:(0,N.jsx)(y,{size:`sm`,children:`User Traces`})}),(0,N.jsx)(T,{children:(0,N.jsx)(t,{input:I,emptyState:W})})]})}),(0,N.jsx)(g,{colSpan:2,display:`inline-grid`,children:(0,N.jsxs)(w,{overflow:`auto`,children:[(0,N.jsx)(C,{children:(0,N.jsx)(y,{size:`sm`,children:`User Threads`})}),(0,N.jsx)(T,{children:(0,N.jsx)(t,{input:V,emptyState:W})})]})}),(0,N.jsx)(M,{title:`Daily Users`,colSpan:2,children:(0,N.jsx)(t,{input:L,emptyState:W})}),(0,N.jsx)(M,{title:`Daily Threads`,colSpan:2,children:(0,N.jsx)(t,{input:R})}),(0,N.jsx)(M,{title:`Max Traces Per Thread`,colSpan:2,children:(0,N.jsx)(t,{input:B})}),(0,N.jsx)(M,{title:`User Leaderboard`,colSpan:2,children:(0,N.jsx)(t,{input:z,emptyState:W})}),(0,N.jsx)(M,{title:`Traces by Label`,colSpan:2,children:(0,N.jsx)(t,{input:H})}),(0,N.jsx)(M,{title:`Traces by Customer`,colSpan:2,children:(0,N.jsx)(t,{input:U,emptyState:W})}),(0,N.jsx)(M,{title:`User Feedbacks`,colSpan:4,children:(0,N.jsx)(P,{})})]}),(0,N.jsx)(u,{hideTopics:!0})]})})}var K=A(`analytics:view`)(G);export{K as default};
2
- //# sourceMappingURL=users-tF6ZKeV1.js.map
1
+ import{$s as e,Gn as t,Qi as n,Qs as r,Ss as i,Xs as a,Ys as o,_s as s,bs as c,r as l,un as u,vs as d,xs as f,ys as p}from"./command-bar-DUK45yin.js";import{j as m}from"./stack-oJ9iWdbl.js";import{t as h}from"./box-BsM8YLGl.js";import{s as g}from"./tabs-DwV1cIZB.js";import{t as _}from"./tooltip-AEm0YeiF.js";import{f as v}from"./terminal-CfM0q99k.js";import{t as y}from"./heading-D90dlSnH.js";import{t as b}from"./text-CwTrMF8x.js";import{i as x}from"./code-FF_ibTVI.js";import{t as S}from"./h-stack-BKLDJ2vg.js";import{n as C,r as w,t as T}from"./card-CMtKVPVl.js";import{n as E}from"./link-CwZhwOLq.js";import{t as D}from"./simple-grid-C3IW90zo.js";import{t as O}from"./v-stack-EOPQ57OZ.js";import{s as k}from"./auth-client-D3UhxhQi.js";import{t as A}from"./WithPermissionGuard-B4Jo8E5-.js";import{t as j}from"./GraphsLayout-DJ-HI9N1.js";import{t as M}from"./ChartCard-s5fMPo7b.js";var N=m(),P=()=>{let{filterParams:e,queryOpts:t}=n(),r=k.analytics.feedbacks.useQuery(e,t),{openDrawer:a}=l();return r.isLoading?(0,N.jsx)(h,{children:`Loading...`}):r.error?(0,N.jsx)(h,{children:`An error occurred`}):(0,N.jsx)(O,{align:`start`,gap:4,children:(0,N.jsxs)(f,{variant:`line`,padding:0,margin:0,children:[(0,N.jsx)(c,{children:(0,N.jsxs)(i,{children:[(0,N.jsx)(p,{width:`48px`,paddingLeft:0}),(0,N.jsx)(p,{children:`Feedback`}),(0,N.jsx)(p,{width:`250px`,children:`Date`}),(0,N.jsx)(p,{width:`180px`,textAlign:`center`,children:`Open Message`})]})}),(0,N.jsxs)(s,{children:[r.data?.events.length===0&&(0,N.jsx)(i,{children:(0,N.jsxs)(d,{colSpan:4,children:[`No written feedbacks received yet, check out our`,` `,(0,N.jsx)(`a`,{href:`https://docs.langwatch.ai/docs/user-events/thumbs-up-down`,target:`_blank`,style:{textDecoration:`underline`},children:`docs`}),` `,`on how to integrate`]})}),r.data?.events.map((e,t)=>{let n=e.metrics?.find(e=>e.key===`vote`)?.value,r=e.event_details?.find(e=>e.key===`feedback`)?.value;return(0,N.jsxs)(i,{onClick:()=>{a(`traceDetails`,{traceId:e.trace_id})},cursor:`pointer`,children:[(0,N.jsx)(d,{paddingLeft:0,textAlign:`center`,paddingRight:`0`,children:n===1?`👍`:n===-1?`👎`:`-`}),(0,N.jsx)(d,{children:(0,N.jsx)(_,{content:r,children:(0,N.jsx)(b,{lineClamp:1,wordBreak:`break-all`,display:`block`,children:r})})}),(0,N.jsx)(d,{children:new Date(e.timestamps.started_at??e.timestamps.inserted_at).toLocaleString()}),(0,N.jsx)(d,{children:(0,N.jsx)(x,{children:e.trace_id&&(0,N.jsx)(E,{onClick:()=>{a(`traceDetails`,{traceId:e.trace_id})},children:(0,N.jsx)(v,{})})})})]},t)})]})]})})},F=1440,I={graphId:`userTracesSummary`,graphType:`summary`,series:[{name:`Traces count`,colorSet:`orangeTones`,metric:`metadata.trace_id`,aggregation:`cardinality`},{name:`Average traces per user`,colorSet:`orangeTones`,metric:`metadata.trace_id`,aggregation:`cardinality`,pipeline:{field:`user_id`,aggregation:`avg`}},{name:`Users count`,colorSet:`blueTones`,metric:`metadata.user_id`,aggregation:`cardinality`}],includePrevious:!1,timeScale:F,height:300},L={graphId:`dailyUsers`,graphType:`area`,series:[{name:`Users count`,colorSet:`blueTones`,metric:`metadata.user_id`,aggregation:`cardinality`}],includePrevious:!0,timeScale:F,height:300},R={graphId:`dailyThreads`,graphType:`area`,series:[{name:`Threads count`,colorSet:`greenTones`,metric:`metadata.thread_id`,aggregation:`cardinality`}],includePrevious:!0,timeScale:F,height:300},z={graphId:`userLeaderboard`,graphType:`horizontal_bar`,series:[{name:`Traces count`,colorSet:`colors`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`metadata.user_id`,excludeUnknownBuckets:!0,includePrevious:!1,timeScale:`full`,height:300},B={graphId:`maxTracesPerThread`,graphType:`scatter`,series:[{name:`Maximum traces count per thread`,colorSet:`blueTones`,metric:`metadata.trace_id`,aggregation:`cardinality`,pipeline:{field:`thread_id`,aggregation:`max`}}],includePrevious:!0,timeScale:F,connected:!1,height:300},V={graphId:`userThreadsSummary`,graphType:`summary`,series:[{name:`Threads count`,colorSet:`greenTones`,metric:`metadata.thread_id`,aggregation:`cardinality`},{name:`Average threads per user`,colorSet:`greenTones`,metric:`metadata.thread_id`,aggregation:`cardinality`,pipeline:{field:`user_id`,aggregation:`avg`}},{name:`Average thread duration`,colorSet:`purpleTones`,metric:`threads.average_duration_per_thread`,aggregation:`avg`,pipeline:{field:`user_id`,aggregation:`avg`}}],includePrevious:!1,timeScale:F,height:300},H={graphId:`tracesByLabel`,graphType:`horizontal_bar`,series:[{name:`Traces count`,colorSet:`colors`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`metadata.labels`,excludeUnknownBuckets:!0,includePrevious:!1,timeScale:`full`,height:300},U={graphId:`tracesByCustomer`,graphType:`horizontal_bar`,series:[{name:`Traces count`,colorSet:`colors`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`metadata.customer_id`,excludeUnknownBuckets:!0,includePrevious:!1,timeScale:`full`,height:300},W=(0,N.jsx)(r,{size:`sm`,paddingY:10,children:(0,N.jsx)(o,{children:(0,N.jsxs)(O,{textAlign:`center`,children:[(0,N.jsx)(e,{textStyle:`sm`,children:`No user data yet`}),(0,N.jsxs)(a,{textStyle:`xs`,children:[`Start tracking users to see metrics here.`,` `,(0,N.jsx)(`a`,{href:`https://langwatch.ai/docs/integration/metadata-and-labels`,target:`_blank`,rel:`noopener noreferrer`,style:{textDecoration:`underline`},children:`Learn how to set up`})]})]})})});function G(){return(0,N.jsx)(j,{title:`Users`,children:(0,N.jsxs)(S,{alignItems:`start`,width:`full`,gap:6,children:[(0,N.jsxs)(D,{templateColumns:`repeat(4, 1fr)`,gap:5,width:`100%`,children:[(0,N.jsx)(g,{colSpan:2,display:`inline-grid`,children:(0,N.jsxs)(w,{overflow:`auto`,children:[(0,N.jsx)(C,{children:(0,N.jsx)(y,{size:`sm`,children:`User Traces`})}),(0,N.jsx)(T,{children:(0,N.jsx)(t,{input:I,emptyState:W})})]})}),(0,N.jsx)(g,{colSpan:2,display:`inline-grid`,children:(0,N.jsxs)(w,{overflow:`auto`,children:[(0,N.jsx)(C,{children:(0,N.jsx)(y,{size:`sm`,children:`User Threads`})}),(0,N.jsx)(T,{children:(0,N.jsx)(t,{input:V,emptyState:W})})]})}),(0,N.jsx)(M,{title:`Daily Users`,colSpan:2,children:(0,N.jsx)(t,{input:L,emptyState:W})}),(0,N.jsx)(M,{title:`Daily Threads`,colSpan:2,children:(0,N.jsx)(t,{input:R})}),(0,N.jsx)(M,{title:`Max Traces Per Thread`,colSpan:2,children:(0,N.jsx)(t,{input:B})}),(0,N.jsx)(M,{title:`User Leaderboard`,colSpan:2,children:(0,N.jsx)(t,{input:z,emptyState:W})}),(0,N.jsx)(M,{title:`Traces by Label`,colSpan:2,children:(0,N.jsx)(t,{input:H})}),(0,N.jsx)(M,{title:`Traces by Customer`,colSpan:2,children:(0,N.jsx)(t,{input:U,emptyState:W})}),(0,N.jsx)(M,{title:`User Feedbacks`,colSpan:4,children:(0,N.jsx)(P,{})})]}),(0,N.jsx)(u,{hideTopics:!0})]})})}var K=A(`analytics:view`)(G);export{K as default};
2
+ //# sourceMappingURL=users-HjuN3o6k.js.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$s as n,Do as r,Fa as i,Pr as a,Qs as o,Ra as s,Ss as c,Ua as l,Xa as u,Xr as d,Xs as f,Ys as p,Zs as m,_s as h,bi as g,bs as _,gs as v,ja as y,mn as b,qa as x,qi as S,va as C,vs as w,wa as ee,xs as te,ys as T}from"./command-bar-CaJygoez.js";import{j as E,n as D,r as O}from"./stack-oJ9iWdbl.js";import{t as k}from"./box-BsM8YLGl.js";import{t as A}from"./tooltip-AEm0YeiF.js";import{n as j}from"./toaster-C_DYALhL.js";import{an as M}from"./dist-SwV3YZv3.js";import{c as ne,h as N,n as P}from"./terminal-CfM0q99k.js";import{r as F,t as I}from"./native-select-B51i56CE.js";import{t as L}from"./text-CwTrMF8x.js";import{a as R,n as z,r as B}from"./field-CnUiixMS.js";import{t as V}from"./input-C7emsUCL.js";import{t as H}from"./h-stack-BKLDJ2vg.js";import{r as re,t as ie}from"./card-CMtKVPVl.js";import{t as ae}from"./link-CwZhwOLq.js";import{t as U}from"./spacer-2LJJGbo8.js";import{t as W}from"./v-stack-EOPQ57OZ.js";import{s as G}from"./auth-client-D3UhxhQi.js";import{r as oe}from"./next-router-C6sliiV7.js";import{t as se}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as K}from"./ban-90mrVpKK.js";import{t as q}from"./WithPermissionGuard-DD8uo3UK.js";import{n as J,t as Y}from"./ConfirmDialog-CXIhncvW.js";import{t as ce}from"./GatewayErrorPanel-DvE9U2dS.js";import{t as le}from"./GatewayLayout-lv1p_6B5.js";import{r as ue,t as de}from"./VirtualKeySecretReveal-DR1VDLy7.js";var X=e(t()),Z=E();function fe({projectId:e,open:t,onOpenChange:n,onCreated:i}){let[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(`live`),[p,m]=(0,X.useState)([]),h=G.useContext(),_=G.gatewayProviders.list.useQuery({projectId:e},{enabled:t&&!!e}),y=G.virtualKeys.create.useMutation({onSuccess:async()=>{await h.virtualKeys.list.invalidate({projectId:e})}}),b=(0,X.useMemo)(()=>_.data??[],[_.data]),x=()=>{o(``),c(``),u(``),f(`live`),m([])},S=()=>{y.isPending||(x(),n(!1))},C=async()=>{if(!a||p.length===0){j.create({title:`Name and at least one provider are required`,type:`error`});return}try{let t=l.split(`,`).map(e=>e.trim()).filter(e=>e.length>0),r=await y.mutateAsync({projectId:e,name:a,description:s||void 0,environment:d,providerCredentialIds:p,config:t.length>0?{metadata:{tags:t}}:void 0});i({id:r.virtualKey.id,name:r.virtualKey.name,secret:r.secret}),x(),n(!1)}catch(e){j.create({title:e instanceof Error?e.message:`Failed to create virtual key`,type:`error`})}},w=e=>{m(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,Z.jsx)(r.Root,{open:t,onOpenChange:e=>S(),placement:`end`,size:`md`,children:(0,Z.jsxs)(r.Content,{children:[(0,Z.jsxs)(r.Header,{children:[(0,Z.jsx)(r.Title,{children:`New virtual key`}),(0,Z.jsx)(r.CloseTrigger,{})]}),(0,Z.jsx)(r.Body,{children:(0,Z.jsxs)(W,{align:`stretch`,gap:4,children:[(0,Z.jsxs)(R,{required:!0,children:[(0,Z.jsxs)(B,{children:[`Name`,(0,Z.jsx)(J,{description:`Human-readable identifier shown in the list and audit log. Typical pattern: 'prod-openai' or 'codex-cli-team-ml'. Must be unique within the project.`,docHref:`/ai-gateway/virtual-keys#creating-a-vk`})]}),(0,Z.jsx)(V,{value:a,onChange:e=>o(e.target.value),placeholder:`e.g. codex-prod`,maxLength:128,autoFocus:!0})]}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(B,{children:`Description`}),(0,Z.jsx)(v,{value:s,onChange:e=>c(e.target.value),placeholder:`Optional. Shown in the list.`})]}),(0,Z.jsxs)(R,{children:[(0,Z.jsxs)(B,{children:[`Tags`,(0,Z.jsx)(J,{description:`Comma-separated tags attached to this VK. Cache-control rules match VKs on tags using AND-subset semantics — a rule matcher of ['tier=enterprise'] fires for any VK carrying that tag.`,docHref:`/ai-gateway/cache-control#cache-rules`})]}),(0,Z.jsx)(V,{value:l,onChange:e=>u(e.target.value),placeholder:`e.g. tier=enterprise, team=ml`}),(0,Z.jsx)(z,{children:`Comma-separated. Cache-control rules match VKs on tags as AND-subset.`})]}),(0,Z.jsxs)(R,{children:[(0,Z.jsxs)(B,{children:[`Environment`,(0,Z.jsx)(J,{description:`Live keys mint 'lw_vk_live_' prefix; test keys mint 'lw_vk_test_'. Prefix is the accident-prevention signal — the gateway rejects test keys against production providers when 'live-only' mode is set on the org.`,docHref:`/ai-gateway/virtual-keys#format`})]}),(0,Z.jsx)(F,{size:`sm`,children:(0,Z.jsxs)(I,{value:d,onChange:e=>f(e.target.value??`live`),children:[(0,Z.jsx)(`option`,{value:`live`,children:`Live`}),(0,Z.jsx)(`option`,{value:`test`,children:`Test`})]})}),(0,Z.jsx)(z,{children:`Shape-of-key prefix (lw_vk_live_ vs lw_vk_test_) for accident-prevention.`})]}),(0,Z.jsxs)(R,{required:!0,children:[(0,Z.jsxs)(B,{children:[`Provider fallback chain`,(0,Z.jsx)(J,{description:`Ordered list of provider bindings. The gateway tries #1 first, then #2 on 5xx/timeout/rate-limit/circuit-breaker. Re-order with drag after creating (not wired yet — use the edit drawer for now).`,docHref:`/ai-gateway/concepts#fallback-chain`})]}),(0,Z.jsx)(W,{align:`stretch`,gap:2,children:_.isLoading?(0,Z.jsxs)(H,{children:[(0,Z.jsx)(O,{size:`sm`}),(0,Z.jsx)(L,{fontSize:`sm`,children:`Loading providers…`})]}):b.length===0?(0,Z.jsxs)(W,{align:`stretch`,gap:2,borderWidth:`1px`,borderColor:`orange.200`,borderRadius:`md`,background:`orange.50`,padding:3,children:[(0,Z.jsx)(L,{fontSize:`sm`,fontWeight:`medium`,children:`No provider bindings yet`}),(0,Z.jsxs)(L,{fontSize:`xs`,color:`fg.muted`,children:[`A virtual key routes requests through`,` `,(0,Z.jsx)(`strong`,{children:`provider bindings`}),` — wrappers around your configured LLM credentials that carry gateway settings (rate limits, fallback priority). Create at least one before minting a VK.`]}),(0,Z.jsx)(H,{children:(0,Z.jsx)(D,{size:`xs`,colorPalette:`orange`,onClick:()=>{n(!1),typeof window<`u`&&(window.location.href=window.location.pathname.replace(/\/gateway.*$/,`/gateway/providers`))},children:`Go to Providers →`})})]}):b.map(e=>{let t=p.includes(e.id),n=e.modelProviderName??e.provider??``,r=n in g?g[n]:null;return(0,Z.jsxs)(H,{border:`1px solid`,borderColor:t?`orange.400`:`border.subtle`,borderRadius:`md`,paddingX:3,paddingY:2,cursor:`pointer`,onClick:()=>w(e.id),children:[(0,Z.jsx)(k,{width:`20px`,height:`20px`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,css:{"& > svg":{width:`100%`,height:`100%`}},children:r}),(0,Z.jsxs)(W,{align:`start`,gap:0,children:[(0,Z.jsx)(L,{fontSize:`sm`,fontWeight:`medium`,children:n||e.id}),(0,Z.jsxs)(L,{fontSize:`xs`,color:`fg.muted`,children:[`slot: `,e.slot??`primary`]})]}),(0,Z.jsx)(U,{}),t&&(0,Z.jsxs)(M,{colorPalette:`orange`,children:[`#`,p.indexOf(e.id)+1]})]},e.id)})}),(0,Z.jsx)(z,{children:`Select one or more provider credentials. Order controls fallback priority; re-order with drag later.`})]}),(0,Z.jsx)(N,{}),(0,Z.jsx)(Q,{})]})}),(0,Z.jsx)(r.Footer,{children:(0,Z.jsxs)(H,{width:`full`,children:[(()=>{let e=[];return a||e.push(`name`),p.length===0&&e.push(`at least one provider`),e.length===0?null:(0,Z.jsxs)(L,{fontSize:`xs`,color:`fg.muted`,children:[`Missing: `,e.join(`, `)]})})(),(0,Z.jsx)(U,{}),(0,Z.jsx)(D,{variant:`ghost`,onClick:S,disabled:y.isPending,children:`Cancel`}),(0,Z.jsx)(D,{colorPalette:`orange`,onClick:C,loading:y.isPending,disabled:!a||p.length===0,children:`Create`})]})})]})})}function Q(){return(0,Z.jsxs)(W,{align:`stretch`,gap:2,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(L,{fontSize:`sm`,fontWeight:`semibold`,children:`What else you get (configurable after create)`}),(0,Z.jsx)(M,{colorPalette:`gray`,fontSize:`2xs`,children:`preview`})]}),(0,Z.jsx)(k,{borderWidth:`1px`,borderColor:`border.subtle`,borderRadius:`md`,padding:3,children:(0,Z.jsx)(W,{align:`stretch`,gap:3,children:[{icon:(0,Z.jsx)(C,{size:14}),label:`Cache control`,defaultValue:`respect`,detail:`Provider-agnostic passthrough — Anthropic cache_control, OpenAI/Azure automatic, Gemini cachedContent. Switch to disable/force post-create.`},{icon:(0,Z.jsx)(P,{size:14}),label:`Guardrails`,defaultValue:`none`,detail:`Attach pre/post/stream_chunk monitors (checkType=AS_GUARDRAIL). Block-by-default, opt-in fail-open per direction.`},{icon:(0,Z.jsx)(K,{size:14}),label:`Blocked patterns`,defaultValue:`none`,detail:`RE2 regex deny/allow for tools, MCP servers, URLs, and models. Enforced pre-provider-dispatch (zero cost).`},{icon:(0,Z.jsx)(x,{size:14}),label:`Rate limits`,defaultValue:`unlimited`,detail:`Per-VK RPM + RPD (TPM in v1.1). 429 + Retry-After emitted by the gateway.`}].map(e=>(0,Z.jsxs)(H,{align:`start`,gap:3,children:[(0,Z.jsx)(k,{color:`fg.muted`,mt:1,children:e.icon}),(0,Z.jsxs)(W,{align:`start`,gap:0,flex:1,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(L,{fontSize:`sm`,fontWeight:`medium`,children:e.label}),(0,Z.jsxs)(M,{variant:`subtle`,colorPalette:`gray`,fontSize:`2xs`,children:[`default: `,e.defaultValue]})]}),(0,Z.jsx)(L,{fontSize:`xs`,color:`fg.muted`,children:e.detail})]})]},e.label))})}),(0,Z.jsx)(L,{fontSize:`xs`,color:`fg.muted`,children:`Open the key's edit drawer after creation to configure any of these.`})]})}function $(){let{project:e,hasPermission:t}=se(),r=oe(),g=t(`virtualKeys:create`),v=t(`virtualKeys:rotate`),b=t(`virtualKeys:update`),x=t(`virtualKeys:update`),C=G.useContext(),E=G.virtualKeys.list.useQuery({projectId:e?.id??``},{enabled:!!e?.id}),N=G.virtualKeys.rotate.useMutation({onSuccess:()=>C.virtualKeys.list.invalidate({projectId:e?.id})}),P=G.virtualKeys.revoke.useMutation({onSuccess:()=>C.virtualKeys.list.invalidate({projectId:e?.id})}),[F,I]=(0,X.useState)(!1),[R,z]=(0,X.useState)(null),[B,V]=(0,X.useState)(null),[K,q]=(0,X.useState)(null),[J,Q]=(0,X.useState)(null),$=E.data??[];return(0,Z.jsxs)(le,{children:[(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(d.Header,{children:[(0,Z.jsx)(d.Heading,{children:`Virtual Keys`}),(0,Z.jsx)(U,{}),g&&(0,Z.jsxs)(D,{colorPalette:`orange`,size:`sm`,onClick:()=>I(!0),children:[(0,Z.jsx)(i,{size:14}),` New virtual key`]})]}),(0,Z.jsx)(k,{padding:6,width:`full`,maxWidth:`1600px`,marginX:`auto`,children:E.isLoading?(0,Z.jsx)(O,{}):E.isError?(0,Z.jsx)(ce,{title:`Failed to load virtual keys`,error:E.error,onRetry:()=>E.refetch()}):$.length===0?(0,Z.jsx)(o,{children:(0,Z.jsxs)(p,{children:[(0,Z.jsx)(m,{children:(0,Z.jsx)(l,{size:32})}),(0,Z.jsx)(n,{children:`No virtual keys yet`}),(0,Z.jsx)(f,{children:`Mint your first virtual key to route requests through the LangWatch AI Gateway with budgets, guardrails, and per-tenant tracing attached.`}),g&&(0,Z.jsxs)(D,{colorPalette:`orange`,onClick:()=>I(!0),mt:2,children:[(0,Z.jsx)(i,{size:14}),` New virtual key`]})]})}):(0,Z.jsx)(re,{width:`full`,overflow:`hidden`,children:(0,Z.jsx)(ie,{paddingY:0,paddingX:0,children:(0,Z.jsxs)(te,{variant:`line`,size:`md`,width:`full`,children:[(0,Z.jsx)(_,{children:(0,Z.jsxs)(c,{children:[(0,Z.jsx)(T,{children:`Name`}),(0,Z.jsx)(T,{children:`Prefix`}),(0,Z.jsx)(T,{children:`Environment`}),(0,Z.jsx)(T,{children:`Status`}),(0,Z.jsx)(T,{children:`Providers`}),(0,Z.jsx)(T,{children:`Last used`}),(0,Z.jsx)(T,{})]})}),(0,Z.jsx)(h,{children:$.map(t=>(0,Z.jsxs)(c,{cursor:`pointer`,_hover:{bg:`bg.subtle`},onClick:()=>void r.push(`/${e?.slug}/gateway/virtual-keys/${t.id}`),children:[(0,Z.jsx)(w,{children:(0,Z.jsxs)(W,{align:`start`,gap:1,children:[(0,Z.jsx)(ae,{href:`/${e?.slug}/gateway/virtual-keys/${t.id}`,fontWeight:`medium`,children:t.name}),t.description&&(0,Z.jsx)(L,{fontSize:`xs`,color:`fg.muted`,children:t.description}),(()=>{let e=t.config?.metadata?.tags??[];return e.length===0?null:(0,Z.jsx)(H,{gap:1,flexWrap:`wrap`,children:e.map(e=>(0,Z.jsx)(M,{variant:`subtle`,colorPalette:`gray`,fontSize:`2xs`,children:e},e))})})()]})}),(0,Z.jsx)(w,{children:(0,Z.jsxs)(L,{fontFamily:`mono`,fontSize:`xs`,children:[t.displayPrefix,`…`]})}),(0,Z.jsx)(w,{children:(0,Z.jsx)(M,{colorPalette:t.environment===`live`?`green`:`gray`,children:t.environment})}),(0,Z.jsx)(w,{children:(0,Z.jsx)(M,{colorPalette:t.status===`active`?`green`:`red`,children:t.status})}),(0,Z.jsx)(w,{children:(0,Z.jsx)(pe,{chain:t.providerChain??[],fallbackLength:t.fallbackChainLength})}),(0,Z.jsx)(w,{children:t.lastUsedAt?(0,Z.jsx)(A,{content:new Date(t.lastUsedAt).toLocaleString(),children:(0,Z.jsx)(L,{fontSize:`sm`,children:a(new Date(t.lastUsedAt).getTime())})}):(0,Z.jsx)(L,{fontSize:`sm`,color:`fg.muted`,children:`never`})}),(0,Z.jsx)(w,{onClick:e=>e.stopPropagation(),cursor:`default`,children:t.status===`active`&&(0,Z.jsxs)(S.Root,{children:[(0,Z.jsx)(S.Trigger,{asChild:!0,children:(0,Z.jsx)(D,{variant:`ghost`,size:`xs`,"aria-label":`Actions`,children:(0,Z.jsx)(u,{size:14})})}),(0,Z.jsxs)(S.Content,{children:[(0,Z.jsxs)(S.Item,{value:`details`,onClick:()=>void r.push(`/${e?.slug}/gateway/virtual-keys/${t.id}`),children:[(0,Z.jsx)(ne,{size:14}),` Details`]}),x&&(0,Z.jsxs)(S.Item,{value:`edit`,onClick:()=>V(t),children:[(0,Z.jsx)(s,{size:14}),` Edit`]}),v&&(0,Z.jsxs)(S.Item,{value:`rotate`,onClick:()=>q({id:t.id,name:t.name}),children:[(0,Z.jsx)(y,{size:14}),` Rotate secret`]}),b&&(0,Z.jsxs)(S.Item,{value:`revoke`,onClick:()=>Q({id:t.id,name:t.name}),children:[(0,Z.jsx)(ee,{size:14}),` Revoke`]})]})]})})]},t.id))})]})})})})]}),e?.id&&(0,Z.jsx)(fe,{projectId:e.id,open:F,onOpenChange:I,onCreated:e=>z({...e,kind:`create`})}),(0,Z.jsx)(de,{open:!!R,onClose:()=>z(null),keyName:R?.name??``,secret:R?.secret??``,kind:R?.kind??`create`}),e?.id&&(0,Z.jsx)(ue,{projectId:e.id,vk:B,onOpenChange:e=>{e||V(null)},onSaved:()=>{V(null),E.refetch()}}),(0,Z.jsx)(Y,{open:!!K,onOpenChange:e=>{e||q(null)},title:`Rotate ${K?.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:N.isPending,onConfirm:async()=>{if(!(!K||!e?.id))try{let t=await N.mutateAsync({projectId:e.id,id:K.id});z({id:t.virtualKey.id,name:K.name,secret:t.secret,kind:`rotate`}),q(null)}catch(e){j.create({title:e instanceof Error?e.message:`Failed to rotate key`,type:`error`})}}}),(0,Z.jsx)(Y,{open:!!J,onOpenChange:e=>{e||Q(null)},title:`Revoke ${J?.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(!(!J||!e?.id))try{await P.mutateAsync({projectId:e.id,id:J.id}),Q(null)}catch(e){j.create({title:e instanceof Error?e.message:`Failed to revoke key`,type:`error`})}}})]})}function pe({chain:e,fallbackLength:t}){return e.length===0?(0,Z.jsx)(L,{fontSize:`sm`,children:t}):(0,Z.jsx)(A,{content:e.map(e=>e.providerType).join(` → `),children:(0,Z.jsx)(H,{gap:1,children:e.map((t,n)=>{let r=t.providerType in g?g[t.providerType]:null;return(0,Z.jsxs)(H,{gap:1,align:`center`,children:[(0,Z.jsx)(k,{width:`16px`,height:`16px`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,opacity:n===0?1:.6,css:{"& > svg":{width:`100%`,height:`100%`}},children:r}),n<e.length-1&&(0,Z.jsx)(L,{fontSize:`2xs`,color:`fg.muted`,children:`→`})]},t.providerCredentialId)})})})}var me=q(`virtualKeys:view`,{layoutComponent:b})($);export{me as default};
2
- //# sourceMappingURL=virtual-keys-BL-65S0B.js.map
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$s as n,Do as r,Fa as i,Pr as a,Qs as o,Ra as s,Ss as c,Ua as l,Xa as u,Xr as d,Xs as f,Ys as p,Zs as m,_s as h,bi as g,bs as _,gs as v,ja as y,mn as b,qa as x,qi as S,va as C,vs as w,wa as ee,xs as te,ys as T}from"./command-bar-DUK45yin.js";import{j as E,n as D,r as O}from"./stack-oJ9iWdbl.js";import{t as k}from"./box-BsM8YLGl.js";import{t as A}from"./tooltip-AEm0YeiF.js";import{n as j}from"./toaster-C_DYALhL.js";import{an as M}from"./dist-Cds4Mqhj.js";import{c as ne,h as N,n as P}from"./terminal-CfM0q99k.js";import{r as F,t as I}from"./native-select-B51i56CE.js";import{t as L}from"./text-CwTrMF8x.js";import{a as R,n as z,r as B}from"./field-CnUiixMS.js";import{t as V}from"./input-C7emsUCL.js";import{t as H}from"./h-stack-BKLDJ2vg.js";import{r as re,t as ie}from"./card-CMtKVPVl.js";import{t as ae}from"./link-CwZhwOLq.js";import{t as U}from"./spacer-2LJJGbo8.js";import{t as W}from"./v-stack-EOPQ57OZ.js";import{s as G}from"./auth-client-D3UhxhQi.js";import{r as oe}from"./next-router-C6sliiV7.js";import{t as se}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as K}from"./ban-90mrVpKK.js";import{t as q}from"./WithPermissionGuard-B4Jo8E5-.js";import{n as J,t as Y}from"./ConfirmDialog-M94yLNvP.js";import{t as ce}from"./GatewayErrorPanel-BsaYQEie.js";import{t as le}from"./GatewayLayout-LvwwrwMf.js";import{r as ue,t as de}from"./VirtualKeySecretReveal-CRbI1dKQ.js";var X=e(t()),Z=E();function fe({projectId:e,open:t,onOpenChange:n,onCreated:i}){let[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(`live`),[p,m]=(0,X.useState)([]),h=G.useContext(),_=G.gatewayProviders.list.useQuery({projectId:e},{enabled:t&&!!e}),y=G.virtualKeys.create.useMutation({onSuccess:async()=>{await h.virtualKeys.list.invalidate({projectId:e})}}),b=(0,X.useMemo)(()=>_.data??[],[_.data]),x=()=>{o(``),c(``),u(``),f(`live`),m([])},S=()=>{y.isPending||(x(),n(!1))},C=async()=>{if(!a||p.length===0){j.create({title:`Name and at least one provider are required`,type:`error`});return}try{let t=l.split(`,`).map(e=>e.trim()).filter(e=>e.length>0),r=await y.mutateAsync({projectId:e,name:a,description:s||void 0,environment:d,providerCredentialIds:p,config:t.length>0?{metadata:{tags:t}}:void 0});i({id:r.virtualKey.id,name:r.virtualKey.name,secret:r.secret}),x(),n(!1)}catch(e){j.create({title:e instanceof Error?e.message:`Failed to create virtual key`,type:`error`})}},w=e=>{m(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,Z.jsx)(r.Root,{open:t,onOpenChange:e=>S(),placement:`end`,size:`md`,children:(0,Z.jsxs)(r.Content,{children:[(0,Z.jsxs)(r.Header,{children:[(0,Z.jsx)(r.Title,{children:`New virtual key`}),(0,Z.jsx)(r.CloseTrigger,{})]}),(0,Z.jsx)(r.Body,{children:(0,Z.jsxs)(W,{align:`stretch`,gap:4,children:[(0,Z.jsxs)(R,{required:!0,children:[(0,Z.jsxs)(B,{children:[`Name`,(0,Z.jsx)(J,{description:`Human-readable identifier shown in the list and audit log. Typical pattern: 'prod-openai' or 'codex-cli-team-ml'. Must be unique within the project.`,docHref:`/ai-gateway/virtual-keys#creating-a-vk`})]}),(0,Z.jsx)(V,{value:a,onChange:e=>o(e.target.value),placeholder:`e.g. codex-prod`,maxLength:128,autoFocus:!0})]}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(B,{children:`Description`}),(0,Z.jsx)(v,{value:s,onChange:e=>c(e.target.value),placeholder:`Optional. Shown in the list.`})]}),(0,Z.jsxs)(R,{children:[(0,Z.jsxs)(B,{children:[`Tags`,(0,Z.jsx)(J,{description:`Comma-separated tags attached to this VK. Cache-control rules match VKs on tags using AND-subset semantics — a rule matcher of ['tier=enterprise'] fires for any VK carrying that tag.`,docHref:`/ai-gateway/cache-control#cache-rules`})]}),(0,Z.jsx)(V,{value:l,onChange:e=>u(e.target.value),placeholder:`e.g. tier=enterprise, team=ml`}),(0,Z.jsx)(z,{children:`Comma-separated. Cache-control rules match VKs on tags as AND-subset.`})]}),(0,Z.jsxs)(R,{children:[(0,Z.jsxs)(B,{children:[`Environment`,(0,Z.jsx)(J,{description:`Live keys mint 'lw_vk_live_' prefix; test keys mint 'lw_vk_test_'. Prefix is the accident-prevention signal — the gateway rejects test keys against production providers when 'live-only' mode is set on the org.`,docHref:`/ai-gateway/virtual-keys#format`})]}),(0,Z.jsx)(F,{size:`sm`,children:(0,Z.jsxs)(I,{value:d,onChange:e=>f(e.target.value??`live`),children:[(0,Z.jsx)(`option`,{value:`live`,children:`Live`}),(0,Z.jsx)(`option`,{value:`test`,children:`Test`})]})}),(0,Z.jsx)(z,{children:`Shape-of-key prefix (lw_vk_live_ vs lw_vk_test_) for accident-prevention.`})]}),(0,Z.jsxs)(R,{required:!0,children:[(0,Z.jsxs)(B,{children:[`Provider fallback chain`,(0,Z.jsx)(J,{description:`Ordered list of provider bindings. The gateway tries #1 first, then #2 on 5xx/timeout/rate-limit/circuit-breaker. Re-order with drag after creating (not wired yet — use the edit drawer for now).`,docHref:`/ai-gateway/concepts#fallback-chain`})]}),(0,Z.jsx)(W,{align:`stretch`,gap:2,children:_.isLoading?(0,Z.jsxs)(H,{children:[(0,Z.jsx)(O,{size:`sm`}),(0,Z.jsx)(L,{fontSize:`sm`,children:`Loading providers…`})]}):b.length===0?(0,Z.jsxs)(W,{align:`stretch`,gap:2,borderWidth:`1px`,borderColor:`orange.200`,borderRadius:`md`,background:`orange.50`,padding:3,children:[(0,Z.jsx)(L,{fontSize:`sm`,fontWeight:`medium`,children:`No provider bindings yet`}),(0,Z.jsxs)(L,{fontSize:`xs`,color:`fg.muted`,children:[`A virtual key routes requests through`,` `,(0,Z.jsx)(`strong`,{children:`provider bindings`}),` — wrappers around your configured LLM credentials that carry gateway settings (rate limits, fallback priority). Create at least one before minting a VK.`]}),(0,Z.jsx)(H,{children:(0,Z.jsx)(D,{size:`xs`,colorPalette:`orange`,onClick:()=>{n(!1),typeof window<`u`&&(window.location.href=window.location.pathname.replace(/\/gateway.*$/,`/gateway/providers`))},children:`Go to Providers →`})})]}):b.map(e=>{let t=p.includes(e.id),n=e.modelProviderName??e.provider??``,r=n in g?g[n]:null;return(0,Z.jsxs)(H,{border:`1px solid`,borderColor:t?`orange.400`:`border.subtle`,borderRadius:`md`,paddingX:3,paddingY:2,cursor:`pointer`,onClick:()=>w(e.id),children:[(0,Z.jsx)(k,{width:`20px`,height:`20px`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,css:{"& > svg":{width:`100%`,height:`100%`}},children:r}),(0,Z.jsxs)(W,{align:`start`,gap:0,children:[(0,Z.jsx)(L,{fontSize:`sm`,fontWeight:`medium`,children:n||e.id}),(0,Z.jsxs)(L,{fontSize:`xs`,color:`fg.muted`,children:[`slot: `,e.slot??`primary`]})]}),(0,Z.jsx)(U,{}),t&&(0,Z.jsxs)(M,{colorPalette:`orange`,children:[`#`,p.indexOf(e.id)+1]})]},e.id)})}),(0,Z.jsx)(z,{children:`Select one or more provider credentials. Order controls fallback priority; re-order with drag later.`})]}),(0,Z.jsx)(N,{}),(0,Z.jsx)(Q,{})]})}),(0,Z.jsx)(r.Footer,{children:(0,Z.jsxs)(H,{width:`full`,children:[(()=>{let e=[];return a||e.push(`name`),p.length===0&&e.push(`at least one provider`),e.length===0?null:(0,Z.jsxs)(L,{fontSize:`xs`,color:`fg.muted`,children:[`Missing: `,e.join(`, `)]})})(),(0,Z.jsx)(U,{}),(0,Z.jsx)(D,{variant:`ghost`,onClick:S,disabled:y.isPending,children:`Cancel`}),(0,Z.jsx)(D,{colorPalette:`orange`,onClick:C,loading:y.isPending,disabled:!a||p.length===0,children:`Create`})]})})]})})}function Q(){return(0,Z.jsxs)(W,{align:`stretch`,gap:2,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(L,{fontSize:`sm`,fontWeight:`semibold`,children:`What else you get (configurable after create)`}),(0,Z.jsx)(M,{colorPalette:`gray`,fontSize:`2xs`,children:`preview`})]}),(0,Z.jsx)(k,{borderWidth:`1px`,borderColor:`border.subtle`,borderRadius:`md`,padding:3,children:(0,Z.jsx)(W,{align:`stretch`,gap:3,children:[{icon:(0,Z.jsx)(C,{size:14}),label:`Cache control`,defaultValue:`respect`,detail:`Provider-agnostic passthrough — Anthropic cache_control, OpenAI/Azure automatic, Gemini cachedContent. Switch to disable/force post-create.`},{icon:(0,Z.jsx)(P,{size:14}),label:`Guardrails`,defaultValue:`none`,detail:`Attach pre/post/stream_chunk monitors (checkType=AS_GUARDRAIL). Block-by-default, opt-in fail-open per direction.`},{icon:(0,Z.jsx)(K,{size:14}),label:`Blocked patterns`,defaultValue:`none`,detail:`RE2 regex deny/allow for tools, MCP servers, URLs, and models. Enforced pre-provider-dispatch (zero cost).`},{icon:(0,Z.jsx)(x,{size:14}),label:`Rate limits`,defaultValue:`unlimited`,detail:`Per-VK RPM + RPD (TPM in v1.1). 429 + Retry-After emitted by the gateway.`}].map(e=>(0,Z.jsxs)(H,{align:`start`,gap:3,children:[(0,Z.jsx)(k,{color:`fg.muted`,mt:1,children:e.icon}),(0,Z.jsxs)(W,{align:`start`,gap:0,flex:1,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(L,{fontSize:`sm`,fontWeight:`medium`,children:e.label}),(0,Z.jsxs)(M,{variant:`subtle`,colorPalette:`gray`,fontSize:`2xs`,children:[`default: `,e.defaultValue]})]}),(0,Z.jsx)(L,{fontSize:`xs`,color:`fg.muted`,children:e.detail})]})]},e.label))})}),(0,Z.jsx)(L,{fontSize:`xs`,color:`fg.muted`,children:`Open the key's edit drawer after creation to configure any of these.`})]})}function $(){let{project:e,hasPermission:t}=se(),r=oe(),g=t(`virtualKeys:create`),v=t(`virtualKeys:rotate`),b=t(`virtualKeys:update`),x=t(`virtualKeys:update`),C=G.useContext(),E=G.virtualKeys.list.useQuery({projectId:e?.id??``},{enabled:!!e?.id}),N=G.virtualKeys.rotate.useMutation({onSuccess:()=>C.virtualKeys.list.invalidate({projectId:e?.id})}),P=G.virtualKeys.revoke.useMutation({onSuccess:()=>C.virtualKeys.list.invalidate({projectId:e?.id})}),[F,I]=(0,X.useState)(!1),[R,z]=(0,X.useState)(null),[B,V]=(0,X.useState)(null),[K,q]=(0,X.useState)(null),[J,Q]=(0,X.useState)(null),$=E.data??[];return(0,Z.jsxs)(le,{children:[(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(d.Header,{children:[(0,Z.jsx)(d.Heading,{children:`Virtual Keys`}),(0,Z.jsx)(U,{}),g&&(0,Z.jsxs)(D,{colorPalette:`orange`,size:`sm`,onClick:()=>I(!0),children:[(0,Z.jsx)(i,{size:14}),` New virtual key`]})]}),(0,Z.jsx)(k,{padding:6,width:`full`,maxWidth:`1600px`,marginX:`auto`,children:E.isLoading?(0,Z.jsx)(O,{}):E.isError?(0,Z.jsx)(ce,{title:`Failed to load virtual keys`,error:E.error,onRetry:()=>E.refetch()}):$.length===0?(0,Z.jsx)(o,{children:(0,Z.jsxs)(p,{children:[(0,Z.jsx)(m,{children:(0,Z.jsx)(l,{size:32})}),(0,Z.jsx)(n,{children:`No virtual keys yet`}),(0,Z.jsx)(f,{children:`Mint your first virtual key to route requests through the LangWatch AI Gateway with budgets, guardrails, and per-tenant tracing attached.`}),g&&(0,Z.jsxs)(D,{colorPalette:`orange`,onClick:()=>I(!0),mt:2,children:[(0,Z.jsx)(i,{size:14}),` New virtual key`]})]})}):(0,Z.jsx)(re,{width:`full`,overflow:`hidden`,children:(0,Z.jsx)(ie,{paddingY:0,paddingX:0,children:(0,Z.jsxs)(te,{variant:`line`,size:`md`,width:`full`,children:[(0,Z.jsx)(_,{children:(0,Z.jsxs)(c,{children:[(0,Z.jsx)(T,{children:`Name`}),(0,Z.jsx)(T,{children:`Prefix`}),(0,Z.jsx)(T,{children:`Environment`}),(0,Z.jsx)(T,{children:`Status`}),(0,Z.jsx)(T,{children:`Providers`}),(0,Z.jsx)(T,{children:`Last used`}),(0,Z.jsx)(T,{})]})}),(0,Z.jsx)(h,{children:$.map(t=>(0,Z.jsxs)(c,{cursor:`pointer`,_hover:{bg:`bg.subtle`},onClick:()=>void r.push(`/${e?.slug}/gateway/virtual-keys/${t.id}`),children:[(0,Z.jsx)(w,{children:(0,Z.jsxs)(W,{align:`start`,gap:1,children:[(0,Z.jsx)(ae,{href:`/${e?.slug}/gateway/virtual-keys/${t.id}`,fontWeight:`medium`,children:t.name}),t.description&&(0,Z.jsx)(L,{fontSize:`xs`,color:`fg.muted`,children:t.description}),(()=>{let e=t.config?.metadata?.tags??[];return e.length===0?null:(0,Z.jsx)(H,{gap:1,flexWrap:`wrap`,children:e.map(e=>(0,Z.jsx)(M,{variant:`subtle`,colorPalette:`gray`,fontSize:`2xs`,children:e},e))})})()]})}),(0,Z.jsx)(w,{children:(0,Z.jsxs)(L,{fontFamily:`mono`,fontSize:`xs`,children:[t.displayPrefix,`…`]})}),(0,Z.jsx)(w,{children:(0,Z.jsx)(M,{colorPalette:t.environment===`live`?`green`:`gray`,children:t.environment})}),(0,Z.jsx)(w,{children:(0,Z.jsx)(M,{colorPalette:t.status===`active`?`green`:`red`,children:t.status})}),(0,Z.jsx)(w,{children:(0,Z.jsx)(pe,{chain:t.providerChain??[],fallbackLength:t.fallbackChainLength})}),(0,Z.jsx)(w,{children:t.lastUsedAt?(0,Z.jsx)(A,{content:new Date(t.lastUsedAt).toLocaleString(),children:(0,Z.jsx)(L,{fontSize:`sm`,children:a(new Date(t.lastUsedAt).getTime())})}):(0,Z.jsx)(L,{fontSize:`sm`,color:`fg.muted`,children:`never`})}),(0,Z.jsx)(w,{onClick:e=>e.stopPropagation(),cursor:`default`,children:t.status===`active`&&(0,Z.jsxs)(S.Root,{children:[(0,Z.jsx)(S.Trigger,{asChild:!0,children:(0,Z.jsx)(D,{variant:`ghost`,size:`xs`,"aria-label":`Actions`,children:(0,Z.jsx)(u,{size:14})})}),(0,Z.jsxs)(S.Content,{children:[(0,Z.jsxs)(S.Item,{value:`details`,onClick:()=>void r.push(`/${e?.slug}/gateway/virtual-keys/${t.id}`),children:[(0,Z.jsx)(ne,{size:14}),` Details`]}),x&&(0,Z.jsxs)(S.Item,{value:`edit`,onClick:()=>V(t),children:[(0,Z.jsx)(s,{size:14}),` Edit`]}),v&&(0,Z.jsxs)(S.Item,{value:`rotate`,onClick:()=>q({id:t.id,name:t.name}),children:[(0,Z.jsx)(y,{size:14}),` Rotate secret`]}),b&&(0,Z.jsxs)(S.Item,{value:`revoke`,onClick:()=>Q({id:t.id,name:t.name}),children:[(0,Z.jsx)(ee,{size:14}),` Revoke`]})]})]})})]},t.id))})]})})})})]}),e?.id&&(0,Z.jsx)(fe,{projectId:e.id,open:F,onOpenChange:I,onCreated:e=>z({...e,kind:`create`})}),(0,Z.jsx)(de,{open:!!R,onClose:()=>z(null),keyName:R?.name??``,secret:R?.secret??``,kind:R?.kind??`create`}),e?.id&&(0,Z.jsx)(ue,{projectId:e.id,vk:B,onOpenChange:e=>{e||V(null)},onSaved:()=>{V(null),E.refetch()}}),(0,Z.jsx)(Y,{open:!!K,onOpenChange:e=>{e||q(null)},title:`Rotate ${K?.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:N.isPending,onConfirm:async()=>{if(!(!K||!e?.id))try{let t=await N.mutateAsync({projectId:e.id,id:K.id});z({id:t.virtualKey.id,name:K.name,secret:t.secret,kind:`rotate`}),q(null)}catch(e){j.create({title:e instanceof Error?e.message:`Failed to rotate key`,type:`error`})}}}),(0,Z.jsx)(Y,{open:!!J,onOpenChange:e=>{e||Q(null)},title:`Revoke ${J?.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(!(!J||!e?.id))try{await P.mutateAsync({projectId:e.id,id:J.id}),Q(null)}catch(e){j.create({title:e instanceof Error?e.message:`Failed to revoke key`,type:`error`})}}})]})}function pe({chain:e,fallbackLength:t}){return e.length===0?(0,Z.jsx)(L,{fontSize:`sm`,children:t}):(0,Z.jsx)(A,{content:e.map(e=>e.providerType).join(` → `),children:(0,Z.jsx)(H,{gap:1,children:e.map((t,n)=>{let r=t.providerType in g?g[t.providerType]:null;return(0,Z.jsxs)(H,{gap:1,align:`center`,children:[(0,Z.jsx)(k,{width:`16px`,height:`16px`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,opacity:n===0?1:.6,css:{"& > svg":{width:`100%`,height:`100%`}},children:r}),n<e.length-1&&(0,Z.jsx)(L,{fontSize:`2xs`,color:`fg.muted`,children:`→`})]},t.providerCredentialId)})})})}var me=q(`virtualKeys:view`,{layoutComponent:b})($);export{me as default};
2
+ //# sourceMappingURL=virtual-keys-Bj-MhW66.js.map