@langwatch/server 3.1.0-beta.4 → 3.1.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/langwatch/ee/admin/ImpersonationBanner.tsx +61 -0
- package/langwatch/ee/admin/ImpersonationSwitchBackMenuItem.tsx +30 -0
- package/langwatch/ee/admin/__tests__/ImpersonationBanner.integration.test.tsx +82 -0
- package/langwatch/ee/admin/__tests__/impersonation.service.unit.test.ts +231 -0
- package/langwatch/ee/admin/backoffice/BackofficeTable.tsx +200 -0
- package/langwatch/ee/admin/backoffice/__tests__/adminClient.unit.test.ts +147 -0
- package/langwatch/ee/admin/backoffice/__tests__/dateInputToISO.unit.test.ts +42 -0
- package/langwatch/ee/admin/backoffice/__tests__/userVisibility.unit.test.ts +174 -0
- package/langwatch/ee/admin/backoffice/adminClient.ts +114 -0
- package/langwatch/ee/admin/backoffice/resources/OrganizationFeaturesView.tsx +373 -0
- package/langwatch/ee/admin/backoffice/resources/OrganizationsView.tsx +677 -0
- package/langwatch/ee/admin/backoffice/resources/ProjectsView.tsx +647 -0
- package/langwatch/ee/admin/backoffice/resources/SubscriptionsView.tsx +628 -0
- package/langwatch/ee/admin/backoffice/resources/UsersView.tsx +556 -0
- package/langwatch/ee/admin/backoffice/useAdminResource.ts +104 -0
- package/langwatch/ee/admin/backoffice/userVisibility.ts +105 -0
- package/langwatch/ee/admin/impersonation.service.ts +170 -0
- package/langwatch/ee/admin/isAdmin.ts +9 -0
- package/langwatch/ee/admin/routes/admin.ts +531 -0
- package/langwatch/ee/admin/safeSelects.ts +64 -0
- package/langwatch/ee/billing/__tests__/customerService.unit.test.ts +183 -0
- package/langwatch/ee/billing/__tests__/growthSeatEvent.unit.test.ts +213 -0
- package/langwatch/ee/billing/__tests__/licensePurchaseHandler.unit.test.ts +250 -0
- package/langwatch/ee/billing/__tests__/notification.service.unit.test.ts +768 -0
- package/langwatch/ee/billing/__tests__/planLimits.unit.test.ts +19 -0
- package/langwatch/ee/billing/__tests__/planProvider.unit.test.ts +440 -0
- package/langwatch/ee/billing/__tests__/planTypes.unit.test.ts +32 -0
- package/langwatch/ee/billing/__tests__/pricing.unit.test.ts +54 -0
- package/langwatch/ee/billing/__tests__/seatEventSubscription.unit.test.ts +717 -0
- package/langwatch/ee/billing/__tests__/stripe.integration.test.ts +344 -0
- package/langwatch/ee/billing/__tests__/stripePrices.types.unit.test.ts +27 -0
- package/langwatch/ee/billing/__tests__/stripePricesLoader.unit.test.ts +72 -0
- package/langwatch/ee/billing/__tests__/subscription.service.unit.test.ts +730 -0
- package/langwatch/ee/billing/__tests__/subscriptionItemCalculator.unit.test.ts +176 -0
- package/langwatch/ee/billing/__tests__/usage-limit.service.unit.test.ts +706 -0
- package/langwatch/ee/billing/__tests__/usageReportingService.integration.test.ts +421 -0
- package/langwatch/ee/billing/__tests__/usageReportingService.unit.test.ts +515 -0
- package/langwatch/ee/billing/__tests__/webhookService.unit.test.ts +958 -0
- package/langwatch/ee/billing/currencyRouter.ts +18 -0
- package/langwatch/ee/billing/errors.ts +129 -0
- package/langwatch/ee/billing/index.ts +67 -0
- package/langwatch/ee/billing/middleware.ts +17 -0
- package/langwatch/ee/billing/notifications/notification.service.ts +651 -0
- package/langwatch/ee/billing/notifications/repositories/notification.repository.ts +51 -0
- package/langwatch/ee/billing/notifications/types.ts +9 -0
- package/langwatch/ee/billing/notifications/usage-limit.service.ts +622 -0
- package/langwatch/ee/billing/nurturing/hooks/activityTracking.ts +90 -0
- package/langwatch/ee/billing/nurturing/hooks/activityTracking.unit.test.ts +237 -0
- package/langwatch/ee/billing/nurturing/hooks/featureAdoption.ts +120 -0
- package/langwatch/ee/billing/nurturing/hooks/featureAdoption.unit.test.ts +324 -0
- package/langwatch/ee/billing/nurturing/hooks/index.ts +17 -0
- package/langwatch/ee/billing/nurturing/hooks/productInterest.ts +68 -0
- package/langwatch/ee/billing/nurturing/hooks/productInterest.unit.test.ts +138 -0
- package/langwatch/ee/billing/nurturing/hooks/promptCreation.integration.test.ts +288 -0
- package/langwatch/ee/billing/nurturing/hooks/promptCreation.ts +131 -0
- package/langwatch/ee/billing/nurturing/hooks/promptCreation.unit.test.ts +134 -0
- package/langwatch/ee/billing/nurturing/hooks/signupIdentification.ts +101 -0
- package/langwatch/ee/billing/nurturing/hooks/signupIdentification.unit.test.ts +317 -0
- package/langwatch/ee/billing/nurturing/hooks/subscriptionSync.ts +49 -0
- package/langwatch/ee/billing/nurturing/hooks/subscriptionSync.unit.test.ts +170 -0
- package/langwatch/ee/billing/nurturing/hooks/userSync.ts +143 -0
- package/langwatch/ee/billing/nurturing/hooks/userSync.unit.test.ts +307 -0
- package/langwatch/ee/billing/nurturing/nurturing.service.ts +179 -0
- package/langwatch/ee/billing/nurturing/nurturing.service.unit.test.ts +266 -0
- package/langwatch/ee/billing/nurturing/nurturing.service.wiring.unit.test.ts +109 -0
- package/langwatch/ee/billing/nurturing/types.ts +125 -0
- package/langwatch/ee/billing/planLimits.ts +190 -0
- package/langwatch/ee/billing/planProvider.ts +119 -0
- package/langwatch/ee/billing/planTypes.ts +53 -0
- package/langwatch/ee/billing/pricing.ts +57 -0
- package/langwatch/ee/billing/services/billableEventsQuery.ts +248 -0
- package/langwatch/ee/billing/services/customerService.ts +90 -0
- package/langwatch/ee/billing/services/licensePurchaseHandler.ts +73 -0
- package/langwatch/ee/billing/services/seatEventSubscription.ts +351 -0
- package/langwatch/ee/billing/services/seatSyncService.ts +34 -0
- package/langwatch/ee/billing/services/subscription.repository.ts +203 -0
- package/langwatch/ee/billing/services/subscription.service.ts +549 -0
- package/langwatch/ee/billing/services/subscriptionItemCalculator.ts +249 -0
- package/langwatch/ee/billing/services/usageReportingService.ts +301 -0
- package/langwatch/ee/billing/services/webhookService.ts +858 -0
- package/langwatch/ee/billing/stripe/stripeCatalog.json +1781 -0
- package/langwatch/ee/billing/stripe/stripeClient.ts +13 -0
- package/langwatch/ee/billing/stripe/stripePriceCatalog.ts +70 -0
- package/langwatch/ee/billing/stripe/stripePrices.types.ts +118 -0
- package/langwatch/ee/billing/subscriptionRouter.ts +202 -0
- package/langwatch/ee/billing/types.ts +102 -0
- package/langwatch/ee/billing/utils/currency.ts +99 -0
- package/langwatch/ee/billing/utils/growthSeatEvent.ts +137 -0
- package/langwatch/ee/licensing/__tests__/constants.unit.test.ts +56 -0
- package/langwatch/ee/licensing/__tests__/defaults.unit.test.ts +192 -0
- package/langwatch/ee/licensing/__tests__/fixtures/testKeys.ts +86 -0
- package/langwatch/ee/licensing/__tests__/fixtures/testLicenses.ts +92 -0
- package/langwatch/ee/licensing/__tests__/licenseGenerationService.unit.test.ts +232 -0
- package/langwatch/ee/licensing/__tests__/licenseHandler.integration.test.ts +419 -0
- package/langwatch/ee/licensing/__tests__/planMapping.unit.test.ts +195 -0
- package/langwatch/ee/licensing/__tests__/planTemplates.unit.test.ts +193 -0
- package/langwatch/ee/licensing/__tests__/signing.unit.test.ts +164 -0
- package/langwatch/ee/licensing/__tests__/validation.unit.test.ts +281 -0
- package/langwatch/ee/licensing/client.ts +29 -0
- package/langwatch/ee/licensing/constants.ts +195 -0
- package/langwatch/ee/licensing/defaults.ts +55 -0
- package/langwatch/ee/licensing/errors.ts +11 -0
- package/langwatch/ee/licensing/index.ts +52 -0
- package/langwatch/ee/licensing/licenseGenerationService.ts +87 -0
- package/langwatch/ee/licensing/licenseHandler.ts +308 -0
- package/langwatch/ee/licensing/planInfo.ts +46 -0
- package/langwatch/ee/licensing/planMapping.ts +37 -0
- package/langwatch/ee/licensing/planTemplates.ts +109 -0
- package/langwatch/ee/licensing/server.ts +43 -0
- package/langwatch/ee/licensing/signing.ts +43 -0
- package/langwatch/ee/licensing/types.ts +156 -0
- package/langwatch/ee/licensing/validation.ts +107 -0
- package/langwatch/ee/managed-providers/ManagedModelProviderAlert.tsx +29 -0
- package/langwatch/ee/managed-providers/managedBedrockConfig.ts +226 -0
- package/langwatch/ee/saas/ExtraFooterComponents.tsx +169 -0
- package/langwatch/package.json +1 -1
- package/langwatch/pnpm-workspace.yaml +0 -1
- package/mcp-server/.env.example +2 -0
- package/mcp-server/.eslintrc.cjs +36 -0
- package/mcp-server/CHANGELOG.md +165 -0
- package/mcp-server/CONTRIBUTING.md +96 -0
- package/mcp-server/README.md +172 -0
- package/mcp-server/dist/archive-scenario-WJ2A7ETN.js +19 -0
- package/mcp-server/dist/archive-suite-4JOM4SSL.js +15 -0
- package/mcp-server/dist/assign-prompt-tag-GL7EAAF3.js +19 -0
- package/mcp-server/dist/chunk-2GT7IFWK.js +40 -0
- package/mcp-server/dist/chunk-2WPLXEKF.js +127 -0
- package/mcp-server/dist/chunk-4AUB2BIA.js +71 -0
- package/mcp-server/dist/chunk-BWWY5KEF.js +71 -0
- package/mcp-server/dist/chunk-CCWCIJJ3.js +22 -0
- package/mcp-server/dist/chunk-EGH5RPXM.js +25 -0
- package/mcp-server/dist/chunk-EUQDVOSU.js +39 -0
- package/mcp-server/dist/chunk-HYMIWO3U.js +44 -0
- package/mcp-server/dist/chunk-IE4M5OGE.js +42 -0
- package/mcp-server/dist/chunk-LUMEZEHL.js +48 -0
- package/mcp-server/dist/chunk-NUFPTHKU.js +9 -0
- package/mcp-server/dist/chunk-UDHJYT6P.js +1567 -0
- package/mcp-server/dist/chunk-WQG2DFHX.js +86 -0
- package/mcp-server/dist/chunk-WVI5CJ6S.js +21 -0
- package/mcp-server/dist/chunk-ZVS4UKN2.js +35 -0
- package/mcp-server/dist/chunk-ZXKLPC2E.js +27 -0
- package/mcp-server/dist/config.d.ts +17 -0
- package/mcp-server/dist/config.js +13 -0
- package/mcp-server/dist/create-agent-MBOOT3XK.js +23 -0
- package/mcp-server/dist/create-annotation-XMV6A7ED.js +24 -0
- package/mcp-server/dist/create-dashboard-VRKLFVZJ.js +18 -0
- package/mcp-server/dist/create-dataset-7HQPZCRE.js +22 -0
- package/mcp-server/dist/create-dataset-records-2NIVFYTV.js +22 -0
- package/mcp-server/dist/create-evaluator-WYFRFLRC.js +27 -0
- package/mcp-server/dist/create-mcp-server.d.ts +8 -0
- package/mcp-server/dist/create-mcp-server.js +8 -0
- package/mcp-server/dist/create-prompt-IEN7O6JT.js +39 -0
- package/mcp-server/dist/create-prompt-tag-CAEZ45VO.js +17 -0
- package/mcp-server/dist/create-scenario-6YHSMGLP.js +26 -0
- package/mcp-server/dist/create-suite-H5XOFDE5.js +38 -0
- package/mcp-server/dist/delete-agent-JKTNBWAA.js +18 -0
- package/mcp-server/dist/delete-annotation-ACMDV6QO.js +17 -0
- package/mcp-server/dist/delete-dashboard-VJSR7CRU.js +18 -0
- package/mcp-server/dist/delete-dataset-RTTTWP4D.js +20 -0
- package/mcp-server/dist/delete-dataset-records-KNQTIPQK.js +21 -0
- package/mcp-server/dist/delete-evaluator-7FVC5WM4.js +15 -0
- package/mcp-server/dist/delete-prompt-tag-ZMZUAGFW.js +17 -0
- package/mcp-server/dist/delete-workflow-EYQ3T4RQ.js +17 -0
- package/mcp-server/dist/discover-evaluator-schema-H23XCLNE.js +1402 -0
- package/mcp-server/dist/discover-scenario-schema-MEEEVND7.js +65 -0
- package/mcp-server/dist/discover-schema-3T52ORPB.js +446 -0
- package/mcp-server/dist/get-agent-E3QSTVKG.js +28 -0
- package/mcp-server/dist/get-analytics-2OHV763I.js +72 -0
- package/mcp-server/dist/get-dashboard-PC7JDHH6.js +29 -0
- package/mcp-server/dist/get-dataset-H5IK5FVU.js +48 -0
- package/mcp-server/dist/get-evaluator-UWVUPYTM.js +47 -0
- package/mcp-server/dist/get-prompt-WZUOLLQC.js +45 -0
- package/mcp-server/dist/get-scenario-Q6LCNUYN.js +33 -0
- package/mcp-server/dist/get-simulation-run-Z2XKO256.js +56 -0
- package/mcp-server/dist/get-suite-BXK5TN7P.js +44 -0
- package/mcp-server/dist/get-trace-4EJAYVBG.js +50 -0
- package/mcp-server/dist/get-workflow-O34QJLHD.js +25 -0
- package/mcp-server/dist/http-server-RSTXN4CN.js +224 -0
- package/mcp-server/dist/index.d.ts +2 -0
- package/mcp-server/dist/index.js +67774 -0
- package/mcp-server/dist/langwatch-api-annotations-ERBG27RF.js +17 -0
- package/mcp-server/dist/langwatch-api-dashboards-G6TR7VVO.js +17 -0
- package/mcp-server/dist/langwatch-api-monitors-WSXZLS2B.js +52 -0
- package/mcp-server/dist/langwatch-api-secrets-RR5DKG2X.js +40 -0
- package/mcp-server/dist/langwatch-api-triggers-2RTNSWQY.js +30 -0
- package/mcp-server/dist/langwatch-api-workflows-VJRIIDZ7.js +15 -0
- package/mcp-server/dist/list-agents-AW3P6FJV.js +32 -0
- package/mcp-server/dist/list-annotations-QNCGWPQ3.js +33 -0
- package/mcp-server/dist/list-dashboards-R7RK2IXL.js +32 -0
- package/mcp-server/dist/list-dataset-records-WVCSQP7P.js +39 -0
- package/mcp-server/dist/list-datasets-KEXRLDEU.js +60 -0
- package/mcp-server/dist/list-evaluators-7R2LB4JH.js +34 -0
- package/mcp-server/dist/list-model-providers-OBYJCKBX.js +35 -0
- package/mcp-server/dist/list-prompt-tags-6LY3ZPYI.js +23 -0
- package/mcp-server/dist/list-prompts-VWEZ4CDE.js +32 -0
- package/mcp-server/dist/list-scenarios-TXD4W2ZJ.js +40 -0
- package/mcp-server/dist/list-simulation-runs-RHPOLMFI.js +43 -0
- package/mcp-server/dist/list-suites-FSGBX27Z.js +42 -0
- package/mcp-server/dist/list-workflows-VRGEZ3EN.js +35 -0
- package/mcp-server/dist/rename-prompt-tag-VOJJLX4M.js +18 -0
- package/mcp-server/dist/run-agent-KTCC7TB7.js +36 -0
- package/mcp-server/dist/run-evaluation-2X3V3Q6L.js +64 -0
- package/mcp-server/dist/run-suite-BTMHGI2D.js +29 -0
- package/mcp-server/dist/run-workflow-IGAYGKJL.js +36 -0
- package/mcp-server/dist/search-traces-VYFUIMXH.js +72 -0
- package/mcp-server/dist/set-model-provider-W5IUI326.js +33 -0
- package/mcp-server/dist/update-agent-4BB7EYLR.js +20 -0
- package/mcp-server/dist/update-dataset-CXBKZ4W3.js +22 -0
- package/mcp-server/dist/update-dataset-record-HOHAMHXG.js +19 -0
- package/mcp-server/dist/update-evaluator-IVOR6FTR.js +24 -0
- package/mcp-server/dist/update-prompt-OWQAKE7K.js +24 -0
- package/mcp-server/dist/update-scenario-GDFVILPN.js +27 -0
- package/mcp-server/dist/update-suite-BXYUYSPT.js +39 -0
- package/mcp-server/package.json +79 -0
- package/mcp-server/pnpm-lock.yaml +6103 -0
- package/mcp-server/pnpm-workspace.yaml +2 -0
- package/mcp-server/pyproject.toml +17 -0
- package/mcp-server/src/__tests__/all-tools.integration.test.ts +1681 -0
- package/mcp-server/src/__tests__/config.unit.test.ts +169 -0
- package/mcp-server/src/__tests__/datasets.integration.test.ts +603 -0
- package/mcp-server/src/__tests__/datasets.unit.test.ts +240 -0
- package/mcp-server/src/__tests__/date-parsing.unit.test.ts +78 -0
- package/mcp-server/src/__tests__/discover-evaluator-schema.unit.test.ts +89 -0
- package/mcp-server/src/__tests__/discover-schema.unit.test.ts +118 -0
- package/mcp-server/src/__tests__/docker.integration.test.ts +234 -0
- package/mcp-server/src/__tests__/evaluator-tools.unit.test.ts +262 -0
- package/mcp-server/src/__tests__/http-transport.integration.test.ts +397 -0
- package/mcp-server/src/__tests__/integration.integration.test.ts +288 -0
- package/mcp-server/src/__tests__/langwatch-api.unit.test.ts +455 -0
- package/mcp-server/src/__tests__/model-provider-tools.unit.test.ts +190 -0
- package/mcp-server/src/__tests__/scenario-tools.integration.test.ts +286 -0
- package/mcp-server/src/__tests__/scenario-tools.unit.test.ts +185 -0
- package/mcp-server/src/__tests__/schemas.unit.test.ts +85 -0
- package/mcp-server/src/__tests__/tools.unit.test.ts +900 -0
- package/mcp-server/src/config.d.ts +15 -0
- package/mcp-server/src/config.ts +107 -0
- package/mcp-server/src/create-mcp-server.d.ts +6 -0
- package/mcp-server/src/create-mcp-server.ts +1799 -0
- package/mcp-server/src/http-server.ts +329 -0
- package/mcp-server/src/index.ts +46 -0
- package/mcp-server/src/langwatch-api-agents.ts +108 -0
- package/mcp-server/src/langwatch-api-annotations.ts +49 -0
- package/mcp-server/src/langwatch-api-dashboards.ts +48 -0
- package/mcp-server/src/langwatch-api-datasets.ts +191 -0
- package/mcp-server/src/langwatch-api-evaluators.ts +80 -0
- package/mcp-server/src/langwatch-api-model-providers.ts +41 -0
- package/mcp-server/src/langwatch-api-monitors.ts +82 -0
- package/mcp-server/src/langwatch-api-scenarios.ts +67 -0
- package/mcp-server/src/langwatch-api-secrets.ts +48 -0
- package/mcp-server/src/langwatch-api-simulation-runs.ts +51 -0
- package/mcp-server/src/langwatch-api-suites.ts +118 -0
- package/mcp-server/src/langwatch-api-triggers.ts +48 -0
- package/mcp-server/src/langwatch-api-workflows.ts +41 -0
- package/mcp-server/src/langwatch-api.ts +299 -0
- package/mcp-server/src/schemas/analytics-groups.ts +78 -0
- package/mcp-server/src/schemas/analytics-metrics.ts +179 -0
- package/mcp-server/src/schemas/create-dataset.ts +48 -0
- package/mcp-server/src/schemas/filter-fields.ts +119 -0
- package/mcp-server/src/schemas/index.ts +4 -0
- package/mcp-server/src/tools/archive-scenario.ts +19 -0
- package/mcp-server/src/tools/archive-suite.ts +12 -0
- package/mcp-server/src/tools/assign-prompt-tag.ts +16 -0
- package/mcp-server/src/tools/create-agent.ts +15 -0
- package/mcp-server/src/tools/create-annotation.ts +18 -0
- package/mcp-server/src/tools/create-dashboard.ts +7 -0
- package/mcp-server/src/tools/create-dataset-records.ts +23 -0
- package/mcp-server/src/tools/create-dataset.ts +22 -0
- package/mcp-server/src/tools/create-evaluator.ts +33 -0
- package/mcp-server/src/tools/create-prompt-tag.ts +12 -0
- package/mcp-server/src/tools/create-prompt.ts +58 -0
- package/mcp-server/src/tools/create-scenario.ts +30 -0
- package/mcp-server/src/tools/create-suite.ts +42 -0
- package/mcp-server/src/tools/delete-agent.ts +7 -0
- package/mcp-server/src/tools/delete-annotation.ts +7 -0
- package/mcp-server/src/tools/delete-dashboard.ts +7 -0
- package/mcp-server/src/tools/delete-dataset-records.ts +22 -0
- package/mcp-server/src/tools/delete-dataset.ts +20 -0
- package/mcp-server/src/tools/delete-evaluator.ts +12 -0
- package/mcp-server/src/tools/delete-prompt-tag.ts +12 -0
- package/mcp-server/src/tools/delete-workflow.ts +7 -0
- package/mcp-server/src/tools/discover-evaluator-schema.ts +143 -0
- package/mcp-server/src/tools/discover-scenario-schema.ts +71 -0
- package/mcp-server/src/tools/discover-schema.ts +106 -0
- package/mcp-server/src/tools/format-dataset-mutation.ts +25 -0
- package/mcp-server/src/tools/get-agent.ts +21 -0
- package/mcp-server/src/tools/get-analytics.ts +98 -0
- package/mcp-server/src/tools/get-dashboard.ts +22 -0
- package/mcp-server/src/tools/get-dataset.ts +63 -0
- package/mcp-server/src/tools/get-evaluator.ts +53 -0
- package/mcp-server/src/tools/get-prompt.ts +54 -0
- package/mcp-server/src/tools/get-scenario.ts +36 -0
- package/mcp-server/src/tools/get-simulation-run.ts +60 -0
- package/mcp-server/src/tools/get-suite.ts +47 -0
- package/mcp-server/src/tools/get-trace.ts +61 -0
- package/mcp-server/src/tools/get-workflow.ts +17 -0
- package/mcp-server/src/tools/list-agents.ts +27 -0
- package/mcp-server/src/tools/list-annotations.ts +33 -0
- package/mcp-server/src/tools/list-dashboards.ts +27 -0
- package/mcp-server/src/tools/list-dataset-records.ts +46 -0
- package/mcp-server/src/tools/list-datasets.ts +80 -0
- package/mcp-server/src/tools/list-evaluators.ts +37 -0
- package/mcp-server/src/tools/list-model-providers.ts +40 -0
- package/mcp-server/src/tools/list-prompt-tags.ts +21 -0
- package/mcp-server/src/tools/list-prompts.ts +34 -0
- package/mcp-server/src/tools/list-scenarios.ts +47 -0
- package/mcp-server/src/tools/list-simulation-runs.ts +49 -0
- package/mcp-server/src/tools/list-suites.ts +43 -0
- package/mcp-server/src/tools/list-workflows.ts +31 -0
- package/mcp-server/src/tools/rename-prompt-tag.ts +14 -0
- package/mcp-server/src/tools/run-agent.ts +36 -0
- package/mcp-server/src/tools/run-evaluation.ts +87 -0
- package/mcp-server/src/tools/run-suite.ts +28 -0
- package/mcp-server/src/tools/run-workflow.ts +36 -0
- package/mcp-server/src/tools/search-traces.ts +91 -0
- package/mcp-server/src/tools/set-model-provider.ts +46 -0
- package/mcp-server/src/tools/update-agent.ts +13 -0
- package/mcp-server/src/tools/update-dataset-record.ts +21 -0
- package/mcp-server/src/tools/update-dataset.ts +23 -0
- package/mcp-server/src/tools/update-evaluator.ts +30 -0
- package/mcp-server/src/tools/update-prompt.ts +31 -0
- package/mcp-server/src/tools/update-scenario.ts +32 -0
- package/mcp-server/src/tools/update-suite.ts +44 -0
- package/mcp-server/src/utils/date-parsing.ts +31 -0
- package/mcp-server/src/utils/escape-markdown.ts +12 -0
- package/mcp-server/tsconfig.json +27 -0
- package/mcp-server/uv.lock +2731 -0
- package/package.json +2 -1
- package/packages/server/dist/cli.cjs +1 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
|
|
4
|
+
const IMAGE_NAME = "langwatch-mcp-server-test";
|
|
5
|
+
const CONTAINER_NAME = "langwatch-mcp-server-test-container";
|
|
6
|
+
const HOST_PORT = 13099; // unlikely to conflict
|
|
7
|
+
const BEARER_TOKEN = "test-docker-api-key";
|
|
8
|
+
|
|
9
|
+
/** Standard headers required by the MCP Streamable HTTP protocol */
|
|
10
|
+
const MCP_POST_HEADERS = {
|
|
11
|
+
"Content-Type": "application/json",
|
|
12
|
+
Accept: "application/json, text/event-stream",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
describe("Docker container", () => {
|
|
16
|
+
let containerRunning = false;
|
|
17
|
+
|
|
18
|
+
beforeAll(async () => {
|
|
19
|
+
try {
|
|
20
|
+
// Build from repo root (mcp-server needs langevals/ for build)
|
|
21
|
+
const repoRoot = process.cwd().replace(/\/mcp-server.*$/, "");
|
|
22
|
+
execSync(
|
|
23
|
+
`docker build -t ${IMAGE_NAME} -f mcp-server/Dockerfile .`,
|
|
24
|
+
{
|
|
25
|
+
cwd: repoRoot,
|
|
26
|
+
stdio: "pipe",
|
|
27
|
+
timeout: 180_000,
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
// Stop any previous container
|
|
32
|
+
execSync(`docker rm -f ${CONTAINER_NAME} 2>/dev/null || true`, {
|
|
33
|
+
stdio: "pipe",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Start the container WITHOUT LANGWATCH_API_KEY -- clients bring their own
|
|
37
|
+
execSync(
|
|
38
|
+
`docker run -d --name ${CONTAINER_NAME} -p ${HOST_PORT}:3000 ${IMAGE_NAME}`,
|
|
39
|
+
{ stdio: "pipe" }
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Wait for the server to be ready
|
|
43
|
+
let retries = 0;
|
|
44
|
+
while (retries < 20) {
|
|
45
|
+
try {
|
|
46
|
+
const res = await fetch(`http://localhost:${HOST_PORT}/health`);
|
|
47
|
+
if (res.ok) {
|
|
48
|
+
containerRunning = true;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
// not ready yet
|
|
53
|
+
}
|
|
54
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
55
|
+
retries++;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!containerRunning) {
|
|
59
|
+
const logs = execSync(`docker logs ${CONTAINER_NAME}`, {
|
|
60
|
+
encoding: "utf8",
|
|
61
|
+
});
|
|
62
|
+
throw new Error(`Container failed to start. Logs:\n${logs}`);
|
|
63
|
+
}
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error("Docker setup failed:", error);
|
|
66
|
+
// Clean up on failure
|
|
67
|
+
execSync(`docker rm -f ${CONTAINER_NAME} 2>/dev/null || true`, {
|
|
68
|
+
stdio: "pipe",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, 180_000); // 3 min for build + start
|
|
72
|
+
|
|
73
|
+
afterAll(() => {
|
|
74
|
+
execSync(`docker rm -f ${CONTAINER_NAME} 2>/dev/null || true`, {
|
|
75
|
+
stdio: "pipe",
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("health endpoint responds without authentication", async () => {
|
|
80
|
+
if (!containerRunning) return;
|
|
81
|
+
|
|
82
|
+
const res = await fetch(`http://localhost:${HOST_PORT}/health`);
|
|
83
|
+
expect(res.status).toBe(200);
|
|
84
|
+
const body = await res.json();
|
|
85
|
+
expect(body.status).toBe("ok");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("CORS headers are present", async () => {
|
|
89
|
+
if (!containerRunning) return;
|
|
90
|
+
|
|
91
|
+
const res = await fetch(`http://localhost:${HOST_PORT}/health`);
|
|
92
|
+
expect(res.headers.get("access-control-allow-origin")).toBe("*");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("returns 401 on initialize without Bearer token", async () => {
|
|
96
|
+
if (!containerRunning) return;
|
|
97
|
+
|
|
98
|
+
const res = await fetch(`http://localhost:${HOST_PORT}/mcp`, {
|
|
99
|
+
method: "POST",
|
|
100
|
+
headers: MCP_POST_HEADERS,
|
|
101
|
+
body: JSON.stringify({
|
|
102
|
+
jsonrpc: "2.0",
|
|
103
|
+
id: 1,
|
|
104
|
+
method: "initialize",
|
|
105
|
+
params: {
|
|
106
|
+
protocolVersion: "2025-03-26",
|
|
107
|
+
capabilities: {},
|
|
108
|
+
clientInfo: { name: "docker-test", version: "1.0.0" },
|
|
109
|
+
},
|
|
110
|
+
}),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
expect(res.status).toBe(401);
|
|
114
|
+
const body = await res.json();
|
|
115
|
+
expect(body.error).toContain("Authorization");
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("MCP initialize works with Bearer token", async () => {
|
|
119
|
+
if (!containerRunning) return;
|
|
120
|
+
|
|
121
|
+
const res = await fetch(`http://localhost:${HOST_PORT}/mcp`, {
|
|
122
|
+
method: "POST",
|
|
123
|
+
headers: {
|
|
124
|
+
...MCP_POST_HEADERS,
|
|
125
|
+
Authorization: `Bearer ${BEARER_TOKEN}`,
|
|
126
|
+
},
|
|
127
|
+
body: JSON.stringify({
|
|
128
|
+
jsonrpc: "2.0",
|
|
129
|
+
id: 1,
|
|
130
|
+
method: "initialize",
|
|
131
|
+
params: {
|
|
132
|
+
protocolVersion: "2025-03-26",
|
|
133
|
+
capabilities: {},
|
|
134
|
+
clientInfo: { name: "docker-test", version: "1.0.0" },
|
|
135
|
+
},
|
|
136
|
+
}),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
expect(res.status).toBe(200);
|
|
140
|
+
const sessionId = res.headers.get("mcp-session-id");
|
|
141
|
+
expect(sessionId).toBeTruthy();
|
|
142
|
+
|
|
143
|
+
// Parse SSE response for the initialize result
|
|
144
|
+
const text = await res.text();
|
|
145
|
+
expect(text).toContain("serverInfo");
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("lists tools after initialization with Bearer token", async () => {
|
|
149
|
+
if (!containerRunning) return;
|
|
150
|
+
|
|
151
|
+
// Initialize a session
|
|
152
|
+
const initRes = await fetch(`http://localhost:${HOST_PORT}/mcp`, {
|
|
153
|
+
method: "POST",
|
|
154
|
+
headers: {
|
|
155
|
+
...MCP_POST_HEADERS,
|
|
156
|
+
Authorization: `Bearer ${BEARER_TOKEN}`,
|
|
157
|
+
},
|
|
158
|
+
body: JSON.stringify({
|
|
159
|
+
jsonrpc: "2.0",
|
|
160
|
+
id: 1,
|
|
161
|
+
method: "initialize",
|
|
162
|
+
params: {
|
|
163
|
+
protocolVersion: "2025-03-26",
|
|
164
|
+
capabilities: {},
|
|
165
|
+
clientInfo: { name: "docker-test", version: "1.0.0" },
|
|
166
|
+
},
|
|
167
|
+
}),
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const sessionId = initRes.headers.get("mcp-session-id");
|
|
171
|
+
|
|
172
|
+
// Send initialized notification
|
|
173
|
+
await fetch(`http://localhost:${HOST_PORT}/mcp`, {
|
|
174
|
+
method: "POST",
|
|
175
|
+
headers: {
|
|
176
|
+
...MCP_POST_HEADERS,
|
|
177
|
+
"mcp-session-id": sessionId!,
|
|
178
|
+
Authorization: `Bearer ${BEARER_TOKEN}`,
|
|
179
|
+
},
|
|
180
|
+
body: JSON.stringify({
|
|
181
|
+
jsonrpc: "2.0",
|
|
182
|
+
method: "notifications/initialized",
|
|
183
|
+
}),
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// List tools
|
|
187
|
+
const toolsRes = await fetch(`http://localhost:${HOST_PORT}/mcp`, {
|
|
188
|
+
method: "POST",
|
|
189
|
+
headers: {
|
|
190
|
+
...MCP_POST_HEADERS,
|
|
191
|
+
"mcp-session-id": sessionId!,
|
|
192
|
+
Authorization: `Bearer ${BEARER_TOKEN}`,
|
|
193
|
+
},
|
|
194
|
+
body: JSON.stringify({
|
|
195
|
+
jsonrpc: "2.0",
|
|
196
|
+
id: 2,
|
|
197
|
+
method: "tools/list",
|
|
198
|
+
}),
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
expect(toolsRes.status).toBe(200);
|
|
202
|
+
const toolsText = await toolsRes.text();
|
|
203
|
+
expect(toolsText).toContain("fetch_langwatch_docs");
|
|
204
|
+
expect(toolsText).toContain("search_traces");
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("legacy SSE endpoint responds with Bearer token", async () => {
|
|
208
|
+
if (!containerRunning) return;
|
|
209
|
+
|
|
210
|
+
const controller = new AbortController();
|
|
211
|
+
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
212
|
+
|
|
213
|
+
try {
|
|
214
|
+
const res = await fetch(`http://localhost:${HOST_PORT}/sse`, {
|
|
215
|
+
signal: controller.signal,
|
|
216
|
+
headers: { Authorization: `Bearer ${BEARER_TOKEN}` },
|
|
217
|
+
});
|
|
218
|
+
expect(res.status).toBe(200);
|
|
219
|
+
expect(res.headers.get("content-type")).toContain("text/event-stream");
|
|
220
|
+
} catch (error: any) {
|
|
221
|
+
if (error.name !== "AbortError") throw error;
|
|
222
|
+
// AbortError is expected -- SSE stays open
|
|
223
|
+
} finally {
|
|
224
|
+
clearTimeout(timeout);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it("legacy SSE endpoint returns 401 without token", async () => {
|
|
229
|
+
if (!containerRunning) return;
|
|
230
|
+
|
|
231
|
+
const res = await fetch(`http://localhost:${HOST_PORT}/sse`);
|
|
232
|
+
expect(res.status).toBe(401);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
+
|
|
3
|
+
vi.mock("../langwatch-api-evaluators.js", async (importOriginal) => {
|
|
4
|
+
const actual = await importOriginal() as Record<string, unknown>;
|
|
5
|
+
return {
|
|
6
|
+
...actual,
|
|
7
|
+
listEvaluators: vi.fn(),
|
|
8
|
+
getEvaluator: vi.fn(),
|
|
9
|
+
createEvaluator: vi.fn(),
|
|
10
|
+
updateEvaluator: vi.fn(),
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
listEvaluators,
|
|
16
|
+
getEvaluator,
|
|
17
|
+
createEvaluator,
|
|
18
|
+
updateEvaluator,
|
|
19
|
+
} from "../langwatch-api-evaluators.js";
|
|
20
|
+
|
|
21
|
+
import { handleListEvaluators } from "../tools/list-evaluators.js";
|
|
22
|
+
import { handleGetEvaluator } from "../tools/get-evaluator.js";
|
|
23
|
+
import { handleCreateEvaluator } from "../tools/create-evaluator.js";
|
|
24
|
+
import { handleUpdateEvaluator } from "../tools/update-evaluator.js";
|
|
25
|
+
|
|
26
|
+
const mockListEvaluators = vi.mocked(listEvaluators);
|
|
27
|
+
const mockGetEvaluator = vi.mocked(getEvaluator);
|
|
28
|
+
const mockCreateEvaluator = vi.mocked(createEvaluator);
|
|
29
|
+
const mockUpdateEvaluator = vi.mocked(updateEvaluator);
|
|
30
|
+
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
vi.clearAllMocks();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe("handleListEvaluators()", () => {
|
|
36
|
+
const sampleEvaluators = [
|
|
37
|
+
{
|
|
38
|
+
id: "evaluator_abc123",
|
|
39
|
+
projectId: "proj_1",
|
|
40
|
+
name: "Toxicity Check",
|
|
41
|
+
slug: "toxicity-check",
|
|
42
|
+
type: "evaluator",
|
|
43
|
+
config: { evaluatorType: "openai/moderation" },
|
|
44
|
+
workflowId: null,
|
|
45
|
+
copiedFromEvaluatorId: null,
|
|
46
|
+
createdAt: "2024-01-01T00:00:00.000Z",
|
|
47
|
+
updatedAt: "2024-01-01T00:00:00.000Z",
|
|
48
|
+
fields: [{ identifier: "input", type: "str" }],
|
|
49
|
+
outputFields: [{ identifier: "passed", type: "bool" }],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "evaluator_def456",
|
|
53
|
+
projectId: "proj_1",
|
|
54
|
+
name: "Exact Match",
|
|
55
|
+
slug: "exact-match",
|
|
56
|
+
type: "evaluator",
|
|
57
|
+
config: { evaluatorType: "langevals/exact_match" },
|
|
58
|
+
workflowId: null,
|
|
59
|
+
copiedFromEvaluatorId: null,
|
|
60
|
+
createdAt: "2024-01-02T00:00:00.000Z",
|
|
61
|
+
updatedAt: "2024-01-02T00:00:00.000Z",
|
|
62
|
+
fields: [
|
|
63
|
+
{ identifier: "output", type: "str" },
|
|
64
|
+
{ identifier: "expected_output", type: "str" },
|
|
65
|
+
],
|
|
66
|
+
outputFields: [{ identifier: "passed", type: "bool" }],
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
describe("when evaluators exist", () => {
|
|
71
|
+
let result: string;
|
|
72
|
+
|
|
73
|
+
beforeEach(async () => {
|
|
74
|
+
mockListEvaluators.mockResolvedValue(sampleEvaluators);
|
|
75
|
+
result = await handleListEvaluators();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("includes evaluator id", () => {
|
|
79
|
+
expect(result).toContain("evaluator_abc123");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("includes evaluator name", () => {
|
|
83
|
+
expect(result).toContain("Toxicity Check");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("includes evaluator type", () => {
|
|
87
|
+
expect(result).toContain("openai/moderation");
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("includes slug", () => {
|
|
91
|
+
expect(result).toContain("toxicity-check");
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("includes all evaluators in the list", () => {
|
|
95
|
+
expect(result).toContain("evaluator_def456");
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("includes the total count header", () => {
|
|
99
|
+
expect(result).toContain("# Evaluators (2 total)");
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe("when no evaluators exist", () => {
|
|
104
|
+
let result: string;
|
|
105
|
+
|
|
106
|
+
beforeEach(async () => {
|
|
107
|
+
mockListEvaluators.mockResolvedValue([]);
|
|
108
|
+
result = await handleListEvaluators();
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("returns a no-evaluators message", () => {
|
|
112
|
+
expect(result).toContain("No evaluators found");
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("includes a tip to use platform_create_evaluator", () => {
|
|
116
|
+
expect(result).toContain("platform_create_evaluator");
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("handleGetEvaluator()", () => {
|
|
122
|
+
const sampleEvaluator = {
|
|
123
|
+
id: "evaluator_abc123",
|
|
124
|
+
projectId: "proj_1",
|
|
125
|
+
name: "Toxicity Check",
|
|
126
|
+
slug: "toxicity-check",
|
|
127
|
+
type: "evaluator",
|
|
128
|
+
config: {
|
|
129
|
+
evaluatorType: "openai/moderation",
|
|
130
|
+
settings: { model: "text-moderation-stable" },
|
|
131
|
+
},
|
|
132
|
+
workflowId: null,
|
|
133
|
+
copiedFromEvaluatorId: null,
|
|
134
|
+
createdAt: "2024-01-01T00:00:00.000Z",
|
|
135
|
+
updatedAt: "2024-01-01T00:00:00.000Z",
|
|
136
|
+
fields: [
|
|
137
|
+
{ identifier: "input", type: "str" },
|
|
138
|
+
{ identifier: "output", type: "str", optional: true },
|
|
139
|
+
],
|
|
140
|
+
outputFields: [
|
|
141
|
+
{ identifier: "passed", type: "bool" },
|
|
142
|
+
{ identifier: "score", type: "float" },
|
|
143
|
+
],
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
describe("when evaluator is found", () => {
|
|
147
|
+
let result: string;
|
|
148
|
+
|
|
149
|
+
beforeEach(async () => {
|
|
150
|
+
mockGetEvaluator.mockResolvedValue(sampleEvaluator);
|
|
151
|
+
result = await handleGetEvaluator({ idOrSlug: "evaluator_abc123" });
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("includes the evaluator name in the heading", () => {
|
|
155
|
+
expect(result).toContain("# Evaluator: Toxicity Check");
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it("includes the evaluator type", () => {
|
|
159
|
+
expect(result).toContain("openai/moderation");
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it("includes the config as JSON", () => {
|
|
163
|
+
expect(result).toContain("text-moderation-stable");
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("includes input fields", () => {
|
|
167
|
+
expect(result).toContain("## Input Fields");
|
|
168
|
+
expect(result).toContain("**input** (str)");
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it("marks optional fields", () => {
|
|
172
|
+
expect(result).toContain("(optional)");
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it("includes output fields", () => {
|
|
176
|
+
expect(result).toContain("## Output Fields");
|
|
177
|
+
expect(result).toContain("**passed** (bool)");
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
describe("handleCreateEvaluator()", () => {
|
|
183
|
+
describe("when creation succeeds", () => {
|
|
184
|
+
let result: string;
|
|
185
|
+
|
|
186
|
+
beforeEach(async () => {
|
|
187
|
+
mockCreateEvaluator.mockResolvedValue({
|
|
188
|
+
id: "evaluator_new123",
|
|
189
|
+
projectId: "proj_1",
|
|
190
|
+
name: "My LLM Judge",
|
|
191
|
+
slug: "my-llm-judge",
|
|
192
|
+
type: "evaluator",
|
|
193
|
+
config: { evaluatorType: "langevals/llm_boolean" },
|
|
194
|
+
workflowId: null,
|
|
195
|
+
copiedFromEvaluatorId: null,
|
|
196
|
+
createdAt: "2024-01-01T00:00:00.000Z",
|
|
197
|
+
updatedAt: "2024-01-01T00:00:00.000Z",
|
|
198
|
+
fields: [{ identifier: "input", type: "str" }],
|
|
199
|
+
outputFields: [{ identifier: "passed", type: "bool" }],
|
|
200
|
+
});
|
|
201
|
+
result = await handleCreateEvaluator({
|
|
202
|
+
name: "My LLM Judge",
|
|
203
|
+
config: { evaluatorType: "langevals/llm_boolean" },
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("confirms creation", () => {
|
|
208
|
+
expect(result).toContain("Evaluator created successfully!");
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it("includes the generated ID", () => {
|
|
212
|
+
expect(result).toContain("evaluator_new123");
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it("includes the slug", () => {
|
|
216
|
+
expect(result).toContain("my-llm-judge");
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it("includes the evaluator type", () => {
|
|
220
|
+
expect(result).toContain("langevals/llm_boolean");
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
describe("handleUpdateEvaluator()", () => {
|
|
226
|
+
describe("when update succeeds", () => {
|
|
227
|
+
let result: string;
|
|
228
|
+
|
|
229
|
+
beforeEach(async () => {
|
|
230
|
+
mockUpdateEvaluator.mockResolvedValue({
|
|
231
|
+
id: "evaluator_abc123",
|
|
232
|
+
projectId: "proj_1",
|
|
233
|
+
name: "Updated Name",
|
|
234
|
+
slug: "toxicity-check",
|
|
235
|
+
type: "evaluator",
|
|
236
|
+
config: { evaluatorType: "openai/moderation" },
|
|
237
|
+
workflowId: null,
|
|
238
|
+
copiedFromEvaluatorId: null,
|
|
239
|
+
createdAt: "2024-01-01T00:00:00.000Z",
|
|
240
|
+
updatedAt: "2024-01-02T00:00:00.000Z",
|
|
241
|
+
fields: [],
|
|
242
|
+
outputFields: [],
|
|
243
|
+
});
|
|
244
|
+
result = await handleUpdateEvaluator({
|
|
245
|
+
evaluatorId: "evaluator_abc123",
|
|
246
|
+
name: "Updated Name",
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it("confirms update", () => {
|
|
251
|
+
expect(result).toContain("Evaluator updated successfully!");
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it("includes the evaluator ID", () => {
|
|
255
|
+
expect(result).toContain("evaluator_abc123");
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it("includes the updated name", () => {
|
|
259
|
+
expect(result).toContain("Updated Name");
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
});
|