manifest 5.45.0 → 6.0.0
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/CONTRACT.md +50 -0
- package/README.md +69 -100
- package/dist/index.cjs +472 -0
- package/dist/index.d.cts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +443 -12
- package/docs/guide.md +77 -0
- package/package.json +36 -79
- package/dist/backend/analytics/analytics.module.js +0 -60
- package/dist/backend/analytics/controllers/agent-analytics.controller.js +0 -69
- package/dist/backend/analytics/controllers/agents.controller.js +0 -176
- package/dist/backend/analytics/controllers/costs.controller.js +0 -71
- package/dist/backend/analytics/controllers/messages.controller.js +0 -67
- package/dist/backend/analytics/controllers/overview.controller.js +0 -104
- package/dist/backend/analytics/controllers/tokens.controller.js +0 -74
- package/dist/backend/analytics/dto/messages-query.dto.js +0 -73
- package/dist/backend/analytics/services/agent-analytics.service.js +0 -125
- package/dist/backend/analytics/services/agent-lifecycle.service.js +0 -102
- package/dist/backend/analytics/services/aggregation.service.js +0 -205
- package/dist/backend/analytics/services/message-details.service.js +0 -146
- package/dist/backend/analytics/services/messages-query.service.js +0 -196
- package/dist/backend/analytics/services/query-helpers.js +0 -45
- package/dist/backend/analytics/services/timeseries-queries.service.js +0 -237
- package/dist/backend/app.module.js +0 -94
- package/dist/backend/auth/auth.instance.js +0 -121
- package/dist/backend/auth/auth.module.js +0 -17
- package/dist/backend/auth/current-user.decorator.js +0 -9
- package/dist/backend/auth/local-auth.guard.js +0 -51
- package/dist/backend/auth/session.guard.js +0 -57
- package/dist/backend/common/common.module.js +0 -41
- package/dist/backend/common/constants/api-key.constants.js +0 -6
- package/dist/backend/common/constants/cache.constants.js +0 -8
- package/dist/backend/common/constants/local-mode.constants.js +0 -102
- package/dist/backend/common/constants/ollama.js +0 -5
- package/dist/backend/common/constants/providers.js +0 -134
- package/dist/backend/common/decorators/public.decorator.js +0 -8
- package/dist/backend/common/dto/create-agent.dto.js +0 -26
- package/dist/backend/common/dto/range-query.dto.js +0 -29
- package/dist/backend/common/dto/rename-agent.dto.js +0 -26
- package/dist/backend/common/filters/spa-fallback.filter.js +0 -46
- package/dist/backend/common/guards/api-key.guard.js +0 -89
- package/dist/backend/common/interceptors/agent-cache.interceptor.js +0 -39
- package/dist/backend/common/interceptors/user-cache.interceptor.js +0 -39
- package/dist/backend/common/services/ingest-event-bus.service.js +0 -44
- package/dist/backend/common/services/manifest-runtime.service.js +0 -39
- package/dist/backend/common/services/tenant-cache.service.js +0 -56
- package/dist/backend/common/utils/anthropic-model-id.js +0 -36
- package/dist/backend/common/utils/cost-calculator.js +0 -19
- package/dist/backend/common/utils/crypto.util.js +0 -72
- package/dist/backend/common/utils/frontend-path.js +0 -21
- package/dist/backend/common/utils/hash.util.js +0 -32
- package/dist/backend/common/utils/local-ip.js +0 -33
- package/dist/backend/common/utils/period.util.js +0 -55
- package/dist/backend/common/utils/provider-aliases.js +0 -13
- package/dist/backend/common/utils/provider-inference.js +0 -7
- package/dist/backend/common/utils/range.util.js +0 -29
- package/dist/backend/common/utils/slugify.js +0 -13
- package/dist/backend/common/utils/sql-dialect.js +0 -71
- package/dist/backend/common/utils/subscription-support.js +0 -12
- package/dist/backend/common/utils/ttl-cache.js +0 -59
- package/dist/backend/common/utils/url-validation.js +0 -107
- package/dist/backend/config/app.config.js +0 -48
- package/dist/backend/database/database-seeder.service.js +0 -180
- package/dist/backend/database/database.module.js +0 -199
- package/dist/backend/database/datasource.js +0 -28
- package/dist/backend/database/local-bootstrap.service.js +0 -161
- package/dist/backend/database/migrations/1771464895790-InitialSchema.js +0 -91
- package/dist/backend/database/migrations/1771500000000-HashApiKeys.js +0 -67
- package/dist/backend/database/migrations/1771600000000-AddModelCapabilities.js +0 -27
- package/dist/backend/database/migrations/1771600000000-ModelPricingImprovements.js +0 -60
- package/dist/backend/database/migrations/1771700000000-AddRoutingTables.js +0 -50
- package/dist/backend/database/migrations/1771700000000-EmailProviderConfigs.js +0 -31
- package/dist/backend/database/migrations/1771800000000-AddNotificationEmailAndOptionalDomain.js +0 -16
- package/dist/backend/database/migrations/1771800000000-AddQualityScore.js +0 -50
- package/dist/backend/database/migrations/1771800100000-SeedQualityScores.js +0 -45
- package/dist/backend/database/migrations/1771900000000-EncryptApiKeys.js +0 -34
- package/dist/backend/database/migrations/1772000000000-MakeApiKeyNullable.js +0 -16
- package/dist/backend/database/migrations/1772100000000-AddRoutingTier.js +0 -17
- package/dist/backend/database/migrations/1772200000000-AddLimitAction.js +0 -17
- package/dist/backend/database/migrations/1772300000000-AddRoutingReason.js +0 -17
- package/dist/backend/database/migrations/1772400000000-AddAgentDisplayName.js +0 -13
- package/dist/backend/database/migrations/1772500000000-PerAgentRouting.js +0 -82
- package/dist/backend/database/migrations/1772668898071-AddCustomProviders.js +0 -31
- package/dist/backend/database/migrations/1772682112419-NullablePricing.js +0 -17
- package/dist/backend/database/migrations/1772843035514-AddPerformanceIndexes.js +0 -56
- package/dist/backend/database/migrations/1772900000000-AddProviderAuthType.js +0 -13
- package/dist/backend/database/migrations/1772905146384-AddDashboardIndexes.js +0 -24
- package/dist/backend/database/migrations/1772905260464-AddFallbacks.js +0 -18
- package/dist/backend/database/migrations/1772920000000-AddModelDisplayName.js +0 -14
- package/dist/backend/database/migrations/1772940000000-DropRedundantIndexes.js +0 -39
- package/dist/backend/database/migrations/1772948502780-BackfillTenantId.js +0 -20
- package/dist/backend/database/migrations/1772960000000-DropUnusedIndexes.js +0 -19
- package/dist/backend/database/migrations/1772960000000-PurgeNonCuratedModels.js +0 -86
- package/dist/backend/database/migrations/1773000000000-ExpandProviderUniqueKey.js +0 -19
- package/dist/backend/database/migrations/1773100000000-AddOverrideAuthType.js +0 -18
- package/dist/backend/database/migrations/1773200000000-AddMessageAuthType.js +0 -18
- package/dist/backend/database/migrations/1773202787708-AddModelsAgentIndex.js +0 -16
- package/dist/backend/database/migrations/1773300000000-AddEmailProviderKeyPrefix.js +0 -13
- package/dist/backend/database/migrations/1773400000000-AddProviderModelCache.js +0 -15
- package/dist/backend/database/migrations/1773500000000-DropModelPricingTables.js +0 -51
- package/dist/backend/database/migrations/1773600000000-AddOverrideProvider.js +0 -18
- package/dist/backend/database/migrations/1773650000000-AddProviderRegion.js +0 -13
- package/dist/backend/database/migrations/1773700000000-DropSecurityEventTable.js +0 -24
- package/dist/backend/database/migrations/1773800000000-FixNegativeCosts.js +0 -12
- package/dist/backend/database/migrations/1773900000000-AddKeyPrefixIndex.js +0 -15
- package/dist/backend/database/migrations/1774000000000-WidenKeyHashColumn.js +0 -15
- package/dist/backend/database/migrations/1774896789000-WidenApiKeyColumn.js +0 -14
- package/dist/backend/database/models-dev-sync.service.js +0 -238
- package/dist/backend/database/ollama-sync.service.js +0 -70
- package/dist/backend/database/pricing-sync.service.js +0 -116
- package/dist/backend/database/quality-score.util.js +0 -76
- package/dist/backend/database/seed-messages.js +0 -66
- package/dist/backend/entities/agent-api-key.entity.js +0 -91
- package/dist/backend/entities/agent-log.entity.js +0 -71
- package/dist/backend/entities/agent-message.entity.js +0 -158
- package/dist/backend/entities/agent.entity.js +0 -75
- package/dist/backend/entities/api-key.entity.js +0 -62
- package/dist/backend/entities/cost-snapshot.entity.js +0 -56
- package/dist/backend/entities/custom-provider.entity.js +0 -64
- package/dist/backend/entities/email-provider-config.entity.js +0 -72
- package/dist/backend/entities/llm-call.entity.js +0 -106
- package/dist/backend/entities/notification-log.entity.js +0 -67
- package/dist/backend/entities/notification-rule.entity.js +0 -84
- package/dist/backend/entities/tenant.entity.js +0 -62
- package/dist/backend/entities/tier-assignment.entity.js +0 -72
- package/dist/backend/entities/token-usage-snapshot.entity.js +0 -71
- package/dist/backend/entities/tool-execution.entity.js +0 -60
- package/dist/backend/entities/user-provider.entity.js +0 -87
- package/dist/backend/github/github.controller.js +0 -53
- package/dist/backend/github/github.module.js +0 -20
- package/dist/backend/health/health.controller.js +0 -51
- package/dist/backend/health/health.module.js +0 -22
- package/dist/backend/health/version-check.service.js +0 -95
- package/dist/backend/main.js +0 -153
- package/dist/backend/model-discovery/anthropic-subscription-probe.js +0 -87
- package/dist/backend/model-discovery/known-model-prices.js +0 -18
- package/dist/backend/model-discovery/model-discovery.module.js +0 -28
- package/dist/backend/model-discovery/model-discovery.service.js +0 -309
- package/dist/backend/model-discovery/model-fallback.js +0 -234
- package/dist/backend/model-discovery/model-fetcher.js +0 -3
- package/dist/backend/model-discovery/provider-model-fetcher.service.js +0 -376
- package/dist/backend/model-discovery/provider-model-registry.service.js +0 -84
- package/dist/backend/model-prices/model-name-normalizer.js +0 -129
- package/dist/backend/model-prices/model-prices.controller.js +0 -39
- package/dist/backend/model-prices/model-prices.module.js +0 -41
- package/dist/backend/model-prices/model-prices.service.js +0 -45
- package/dist/backend/model-prices/model-pricing-cache.service.js +0 -171
- package/dist/backend/notifications/dto/notification-rule.dto.js +0 -82
- package/dist/backend/notifications/dto/set-email-provider.dto.js +0 -86
- package/dist/backend/notifications/dto/set-notification-email.dto.js +0 -24
- package/dist/backend/notifications/emails/reset-password.js +0 -108
- package/dist/backend/notifications/emails/test-email.js +0 -91
- package/dist/backend/notifications/emails/threshold-alert.js +0 -187
- package/dist/backend/notifications/emails/verify-email.js +0 -108
- package/dist/backend/notifications/notifications.controller.js +0 -208
- package/dist/backend/notifications/notifications.module.js +0 -35
- package/dist/backend/notifications/services/email-provider-config.service.js +0 -184
- package/dist/backend/notifications/services/email-provider-validation.js +0 -47
- package/dist/backend/notifications/services/email-providers/email-provider.interface.js +0 -3
- package/dist/backend/notifications/services/email-providers/mailgun.provider.js +0 -62
- package/dist/backend/notifications/services/email-providers/resend.provider.js +0 -51
- package/dist/backend/notifications/services/email-providers/resolve-provider.js +0 -19
- package/dist/backend/notifications/services/email-providers/send-email.js +0 -34
- package/dist/backend/notifications/services/email-providers/sendgrid.provider.js +0 -59
- package/dist/backend/notifications/services/limit-check.service.js +0 -160
- package/dist/backend/notifications/services/notification-cron.service.js +0 -151
- package/dist/backend/notifications/services/notification-email.service.js +0 -65
- package/dist/backend/notifications/services/notification-log.service.js +0 -84
- package/dist/backend/notifications/services/notification-rules.service.js +0 -156
- package/dist/backend/otlp/guards/agent-key-auth.guard.js +0 -226
- package/dist/backend/otlp/interfaces/ingestion-context.interface.js +0 -3
- package/dist/backend/otlp/otlp-deprecated.controller.js +0 -61
- package/dist/backend/otlp/otlp.module.js +0 -30
- package/dist/backend/otlp/services/api-key.service.js +0 -143
- package/dist/backend/public-stats/public-stats.controller.js +0 -141
- package/dist/backend/public-stats/public-stats.module.js +0 -26
- package/dist/backend/public-stats/public-stats.service.js +0 -226
- package/dist/backend/routing/copilot.controller.js +0 -79
- package/dist/backend/routing/custom-provider/custom-provider.controller.js +0 -131
- package/dist/backend/routing/custom-provider/custom-provider.module.js +0 -27
- package/dist/backend/routing/custom-provider/custom-provider.service.js +0 -161
- package/dist/backend/routing/dto/custom-provider.dto.js +0 -124
- package/dist/backend/routing/dto/resolve-request.dto.js +0 -63
- package/dist/backend/routing/dto/resolve-response.js +0 -3
- package/dist/backend/routing/dto/routing.dto.js +0 -136
- package/dist/backend/routing/model.controller.js +0 -105
- package/dist/backend/routing/oauth/copilot-device-auth.service.js +0 -77
- package/dist/backend/routing/oauth/minimax-oauth-helpers.js +0 -70
- package/dist/backend/routing/oauth/minimax-oauth.controller.js +0 -80
- package/dist/backend/routing/oauth/minimax-oauth.service.js +0 -252
- package/dist/backend/routing/oauth/oauth.module.js +0 -29
- package/dist/backend/routing/oauth/openai-oauth.controller.js +0 -138
- package/dist/backend/routing/oauth/openai-oauth.service.js +0 -273
- package/dist/backend/routing/oauth/openai-oauth.types.js +0 -45
- package/dist/backend/routing/provider-base-url.js +0 -25
- package/dist/backend/routing/provider.controller.js +0 -152
- package/dist/backend/routing/proxy/anthropic-adapter.js +0 -295
- package/dist/backend/routing/proxy/cache-injection.js +0 -33
- package/dist/backend/routing/proxy/chatgpt-adapter.js +0 -272
- package/dist/backend/routing/proxy/chatgpt-helpers.js +0 -108
- package/dist/backend/routing/proxy/copilot-token.service.js +0 -63
- package/dist/backend/routing/proxy/fallback-status-codes.js +0 -7
- package/dist/backend/routing/proxy/google-adapter.js +0 -314
- package/dist/backend/routing/proxy/provider-client-converters.js +0 -190
- package/dist/backend/routing/proxy/provider-client.js +0 -130
- package/dist/backend/routing/proxy/provider-endpoints.js +0 -182
- package/dist/backend/routing/proxy/proxy-error-sanitizer.js +0 -40
- package/dist/backend/routing/proxy/proxy-exception.filter.js +0 -67
- package/dist/backend/routing/proxy/proxy-fallback.service.js +0 -227
- package/dist/backend/routing/proxy/proxy-friendly-response.js +0 -115
- package/dist/backend/routing/proxy/proxy-message-dedup.js +0 -121
- package/dist/backend/routing/proxy/proxy-message-recorder.js +0 -262
- package/dist/backend/routing/proxy/proxy-rate-limiter.js +0 -81
- package/dist/backend/routing/proxy/proxy-response-handler.js +0 -202
- package/dist/backend/routing/proxy/proxy-transport.js +0 -90
- package/dist/backend/routing/proxy/proxy-types.js +0 -3
- package/dist/backend/routing/proxy/proxy.controller.js +0 -174
- package/dist/backend/routing/proxy/proxy.module.js +0 -62
- package/dist/backend/routing/proxy/proxy.service.js +0 -227
- package/dist/backend/routing/proxy/session-momentum.service.js +0 -66
- package/dist/backend/routing/proxy/stream-writer.js +0 -147
- package/dist/backend/routing/proxy/thought-signature-cache.js +0 -45
- package/dist/backend/routing/qwen-region.js +0 -51
- package/dist/backend/routing/resolve/resolve.controller.js +0 -106
- package/dist/backend/routing/resolve/resolve.module.js +0 -28
- package/dist/backend/routing/resolve/resolve.service.js +0 -126
- package/dist/backend/routing/routing-core/provider-key.service.js +0 -190
- package/dist/backend/routing/routing-core/provider.service.js +0 -305
- package/dist/backend/routing/routing-core/resolve-agent.service.js +0 -62
- package/dist/backend/routing/routing-core/routing-cache.service.js +0 -73
- package/dist/backend/routing/routing-core/routing-core.module.js +0 -56
- package/dist/backend/routing/routing-core/routing-invalidation.service.js +0 -90
- package/dist/backend/routing/routing-core/tier-auto-assign.service.js +0 -138
- package/dist/backend/routing/routing-core/tier.service.js +0 -179
- package/dist/backend/routing/routing.module.js +0 -46
- package/dist/backend/routing/tier.controller.js +0 -129
- package/dist/backend/scoring/__tests__/fixtures.js +0 -191
- package/dist/backend/scoring/config.js +0 -383
- package/dist/backend/scoring/dimensions/contextual-dimensions.js +0 -85
- package/dist/backend/scoring/dimensions/index.js +0 -17
- package/dist/backend/scoring/dimensions/keyword-dimensions.js +0 -47
- package/dist/backend/scoring/dimensions/structural-dimensions.js +0 -118
- package/dist/backend/scoring/index.js +0 -186
- package/dist/backend/scoring/keyword-trie.js +0 -75
- package/dist/backend/scoring/momentum.js +0 -50
- package/dist/backend/scoring/overrides.js +0 -55
- package/dist/backend/scoring/sigmoid.js +0 -24
- package/dist/backend/scoring/text-extractor.js +0 -67
- package/dist/backend/scoring/types.js +0 -6
- package/dist/backend/sse/sse.controller.js +0 -45
- package/dist/backend/sse/sse.module.js +0 -20
- package/dist/node_modules/manifest-shared/dist/cjs/api-key.d.ts +0 -2
- package/dist/node_modules/manifest-shared/dist/cjs/api-key.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/api-key.js +0 -5
- package/dist/node_modules/manifest-shared/dist/cjs/api-key.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/auth-types.d.ts +0 -3
- package/dist/node_modules/manifest-shared/dist/cjs/auth-types.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/auth-types.js +0 -5
- package/dist/node_modules/manifest-shared/dist/cjs/auth-types.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/index.d.ts +0 -10
- package/dist/node_modules/manifest-shared/dist/cjs/index.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/index.js +0 -22
- package/dist/node_modules/manifest-shared/dist/cjs/index.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/provider-inference.d.ts +0 -8
- package/dist/node_modules/manifest-shared/dist/cjs/provider-inference.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/provider-inference.js +0 -37
- package/dist/node_modules/manifest-shared/dist/cjs/provider-inference.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/resolve-response.d.ts +0 -12
- package/dist/node_modules/manifest-shared/dist/cjs/resolve-response.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/resolve-response.js +0 -3
- package/dist/node_modules/manifest-shared/dist/cjs/resolve-response.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/configs.d.ts +0 -4
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/configs.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/configs.js +0 -80
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/configs.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/helpers.d.ts +0 -6
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/helpers.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/helpers.js +0 -25
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/helpers.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/index.d.ts +0 -4
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/index.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/index.js +0 -12
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/index.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/types.d.ts +0 -17
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/types.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/types.js +0 -3
- package/dist/node_modules/manifest-shared/dist/cjs/subscription/types.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/tiers.d.ts +0 -5
- package/dist/node_modules/manifest-shared/dist/cjs/tiers.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/cjs/tiers.js +0 -17
- package/dist/node_modules/manifest-shared/dist/cjs/tiers.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/api-key.d.ts +0 -2
- package/dist/node_modules/manifest-shared/dist/esm/api-key.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/api-key.js +0 -2
- package/dist/node_modules/manifest-shared/dist/esm/api-key.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/auth-types.d.ts +0 -3
- package/dist/node_modules/manifest-shared/dist/esm/auth-types.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/auth-types.js +0 -2
- package/dist/node_modules/manifest-shared/dist/esm/auth-types.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/index.d.ts +0 -10
- package/dist/node_modules/manifest-shared/dist/esm/index.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/index.js +0 -6
- package/dist/node_modules/manifest-shared/dist/esm/index.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/provider-inference.d.ts +0 -8
- package/dist/node_modules/manifest-shared/dist/esm/provider-inference.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/provider-inference.js +0 -33
- package/dist/node_modules/manifest-shared/dist/esm/provider-inference.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/resolve-response.d.ts +0 -12
- package/dist/node_modules/manifest-shared/dist/esm/resolve-response.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/resolve-response.js +0 -2
- package/dist/node_modules/manifest-shared/dist/esm/resolve-response.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/subscription/configs.d.ts +0 -4
- package/dist/node_modules/manifest-shared/dist/esm/subscription/configs.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/subscription/configs.js +0 -77
- package/dist/node_modules/manifest-shared/dist/esm/subscription/configs.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/subscription/helpers.d.ts +0 -6
- package/dist/node_modules/manifest-shared/dist/esm/subscription/helpers.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/subscription/helpers.js +0 -19
- package/dist/node_modules/manifest-shared/dist/esm/subscription/helpers.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/subscription/index.d.ts +0 -4
- package/dist/node_modules/manifest-shared/dist/esm/subscription/index.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/subscription/index.js +0 -3
- package/dist/node_modules/manifest-shared/dist/esm/subscription/index.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/subscription/types.d.ts +0 -17
- package/dist/node_modules/manifest-shared/dist/esm/subscription/types.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/subscription/types.js +0 -2
- package/dist/node_modules/manifest-shared/dist/esm/subscription/types.js.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/tiers.d.ts +0 -5
- package/dist/node_modules/manifest-shared/dist/esm/tiers.d.ts.map +0 -1
- package/dist/node_modules/manifest-shared/dist/esm/tiers.js +0 -14
- package/dist/node_modules/manifest-shared/dist/esm/tiers.js.map +0 -1
- package/dist/node_modules/manifest-shared/package.json +0 -26
- package/dist/openclaw.plugin.json +0 -37
- package/dist/package.json +0 -94
- package/dist/server.d.ts +0 -8
- package/dist/server.js +0 -69
- package/openclaw.plugin.json +0 -37
- package/public/assets/Account-B_3C4z7e.js +0 -1
- package/public/assets/AuthBadge-Dj2KkXRW.js +0 -1
- package/public/assets/ConnectProvider-DxPYovG2.js +0 -1
- package/public/assets/CopyButton-BWMVlK2w.js +0 -1
- package/public/assets/FreeModels-BzNWxfZl.js +0 -1
- package/public/assets/Help-ifWIlcDo.js +0 -1
- package/public/assets/Limits-BLW0fW8j.js +0 -1
- package/public/assets/Login-DvUR0ri0.js +0 -1
- package/public/assets/MessageLog-BsuwgHos.js +0 -1
- package/public/assets/ModelPrices-8EpyI4cZ.js +0 -1
- package/public/assets/Overview-B2DQeTd2.js +0 -1
- package/public/assets/Pagination-D8BOkffh.js +0 -1
- package/public/assets/ProviderTokens-nv6wk29Y.js +0 -1
- package/public/assets/Register-WBrQ1E73.js +0 -1
- package/public/assets/ResetPassword-CWdklAXJ.js +0 -1
- package/public/assets/Routing-BqfY1unJ.js +0 -6
- package/public/assets/Settings-na6aYffS.js +0 -1
- package/public/assets/SetupStepAddProvider-CSNkQmoC.js +0 -3
- package/public/assets/SocialButtons-DG2BtKEz.js +0 -1
- package/public/assets/auth-Bcnz6mJV.js +0 -1
- package/public/assets/chart-utils-DTt1NOye.js +0 -1
- package/public/assets/charts-Cty976qB.js +0 -3
- package/public/assets/charts-Saz_VHki.css +0 -1
- package/public/assets/index-ByYwCwOa.js +0 -2
- package/public/assets/index-DhaXpWfr.css +0 -1
- package/public/assets/model-display-Bd0Zg5Lp.js +0 -1
- package/public/assets/overview-B6Wy_RSw.js +0 -1
- package/public/assets/overview-vZEzTjBP.css +0 -1
- package/public/assets/provider-api-key-urls-1G6okUJ7.js +0 -1
- package/public/assets/routing-UGVXjYdE.js +0 -1
- package/public/assets/routing-utils-BVCa9TKk.js +0 -1
- package/public/assets/vendor-C-Y5oNOq.js +0 -1
- package/public/example-messages.svg +0 -1
- package/public/example-overview.svg +0 -1
- package/public/favicon.ico +0 -0
- package/public/fonts/boxicons/boxicons-duotone.min.css +0 -37
- package/public/fonts/boxicons/boxicons-duotone.woff2 +0 -0
- package/public/fonts/bricolage-grotesque-latin.woff2 +0 -0
- package/public/fonts/dm-sans-latin.woff2 +0 -0
- package/public/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/public/icons/caret-down.svg +0 -1
- package/public/icons/cohere.svg +0 -30
- package/public/icons/free.svg +0 -91
- package/public/icons/gemini.svg +0 -25
- package/public/icons/kilocode.jpg +0 -0
- package/public/icons/nvidia.svg +0 -1
- package/public/icons/providers/alibaba.svg +0 -1
- package/public/icons/providers/amazon.svg +0 -1
- package/public/icons/providers/anthropic.svg +0 -1
- package/public/icons/providers/cohere.svg +0 -1
- package/public/icons/providers/deepseek.svg +0 -1
- package/public/icons/providers/google.svg +0 -1
- package/public/icons/providers/meta.svg +0 -1
- package/public/icons/providers/mistral.svg +0 -1
- package/public/icons/providers/moonshot.svg +0 -1
- package/public/icons/providers/openai.svg +0 -1
- package/public/icons/providers/xai.svg +0 -1
- package/public/icons/providers/zhipu.svg +0 -1
- package/public/icons/qwen.svg +0 -1
- package/public/images/oauth-callback-example.mp4 +0 -0
- package/public/images/oauth-callback-example.png +0 -0
- package/public/index.html +0 -41
- package/public/logo-white.svg +0 -93
- package/public/logo.svg +0 -93
- package/public/logos/mailgun.svg +0 -13
- package/public/logos/resend.svg +0 -4
- package/public/logos/sendgrid.svg +0 -18
- package/public/manifest-logo.png +0 -0
- package/public/theme-init.js +0 -6
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MessagesQueryDto = void 0;
|
|
13
|
-
const class_transformer_1 = require("class-transformer");
|
|
14
|
-
const class_validator_1 = require("class-validator");
|
|
15
|
-
class MessagesQueryDto {
|
|
16
|
-
range;
|
|
17
|
-
provider;
|
|
18
|
-
service_type;
|
|
19
|
-
cost_min;
|
|
20
|
-
cost_max;
|
|
21
|
-
limit;
|
|
22
|
-
cursor;
|
|
23
|
-
agent_name;
|
|
24
|
-
}
|
|
25
|
-
exports.MessagesQueryDto = MessagesQueryDto;
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, class_validator_1.IsOptional)(),
|
|
28
|
-
(0, class_validator_1.IsString)(),
|
|
29
|
-
__metadata("design:type", String)
|
|
30
|
-
], MessagesQueryDto.prototype, "range", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, class_validator_1.IsOptional)(),
|
|
33
|
-
(0, class_validator_1.IsString)(),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], MessagesQueryDto.prototype, "provider", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, class_validator_1.IsOptional)(),
|
|
38
|
-
(0, class_validator_1.IsString)(),
|
|
39
|
-
__metadata("design:type", String)
|
|
40
|
-
], MessagesQueryDto.prototype, "service_type", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, class_validator_1.IsOptional)(),
|
|
43
|
-
(0, class_validator_1.IsNumber)(),
|
|
44
|
-
(0, class_validator_1.Min)(0),
|
|
45
|
-
(0, class_transformer_1.Type)(() => Number),
|
|
46
|
-
__metadata("design:type", Number)
|
|
47
|
-
], MessagesQueryDto.prototype, "cost_min", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, class_validator_1.IsOptional)(),
|
|
50
|
-
(0, class_validator_1.IsNumber)(),
|
|
51
|
-
(0, class_validator_1.Max)(999999),
|
|
52
|
-
(0, class_transformer_1.Type)(() => Number),
|
|
53
|
-
__metadata("design:type", Number)
|
|
54
|
-
], MessagesQueryDto.prototype, "cost_max", void 0);
|
|
55
|
-
__decorate([
|
|
56
|
-
(0, class_validator_1.IsOptional)(),
|
|
57
|
-
(0, class_validator_1.IsNumber)(),
|
|
58
|
-
(0, class_validator_1.Min)(1),
|
|
59
|
-
(0, class_validator_1.Max)(200),
|
|
60
|
-
(0, class_transformer_1.Type)(() => Number),
|
|
61
|
-
__metadata("design:type", Number)
|
|
62
|
-
], MessagesQueryDto.prototype, "limit", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
(0, class_validator_1.IsOptional)(),
|
|
65
|
-
(0, class_validator_1.IsString)(),
|
|
66
|
-
__metadata("design:type", String)
|
|
67
|
-
], MessagesQueryDto.prototype, "cursor", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, class_validator_1.IsOptional)(),
|
|
70
|
-
(0, class_validator_1.IsString)(),
|
|
71
|
-
__metadata("design:type", String)
|
|
72
|
-
], MessagesQueryDto.prototype, "agent_name", void 0);
|
|
73
|
-
//# sourceMappingURL=messages-query.dto.js.map
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AgentAnalyticsService = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
-
const typeorm_2 = require("typeorm");
|
|
19
|
-
const agent_message_entity_1 = require("../../entities/agent-message.entity");
|
|
20
|
-
const range_util_1 = require("../../common/utils/range.util");
|
|
21
|
-
const query_helpers_1 = require("./query-helpers");
|
|
22
|
-
const sql_dialect_1 = require("../../common/utils/sql-dialect");
|
|
23
|
-
let AgentAnalyticsService = class AgentAnalyticsService {
|
|
24
|
-
turnRepo;
|
|
25
|
-
constructor(turnRepo) {
|
|
26
|
-
this.turnRepo = turnRepo;
|
|
27
|
-
}
|
|
28
|
-
async getUsage(range, scope) {
|
|
29
|
-
const interval = (0, range_util_1.rangeToInterval)(range);
|
|
30
|
-
const prevInterval = (0, range_util_1.rangeToPreviousInterval)(range);
|
|
31
|
-
const cutoff = (0, sql_dialect_1.computeCutoff)(interval);
|
|
32
|
-
const prevCutoff = (0, sql_dialect_1.computeCutoff)(prevInterval);
|
|
33
|
-
const [currentRows, prevRows] = await Promise.all([
|
|
34
|
-
this.turnRepo
|
|
35
|
-
.createQueryBuilder('at')
|
|
36
|
-
.select('COALESCE(SUM(at.input_tokens), 0)', 'input')
|
|
37
|
-
.addSelect('COALESCE(SUM(at.output_tokens), 0)', 'output')
|
|
38
|
-
.addSelect('COALESCE(SUM(at.cache_read_tokens), 0)', 'cache_read')
|
|
39
|
-
.addSelect('COUNT(*)', 'messages')
|
|
40
|
-
.where('at.timestamp >= :cutoff', { cutoff })
|
|
41
|
-
.andWhere('at.tenant_id = :tenantId', { tenantId: scope.tenantId })
|
|
42
|
-
.andWhere('at.agent_id = :agentId', { agentId: scope.agentId })
|
|
43
|
-
.getRawOne(),
|
|
44
|
-
this.turnRepo
|
|
45
|
-
.createQueryBuilder('at')
|
|
46
|
-
.select('COALESCE(SUM(at.input_tokens + at.output_tokens), 0)', 'total')
|
|
47
|
-
.where('at.timestamp >= :prevCutoff', { prevCutoff })
|
|
48
|
-
.andWhere('at.timestamp < :cutoff', { cutoff })
|
|
49
|
-
.andWhere('at.tenant_id = :tenantId', { tenantId: scope.tenantId })
|
|
50
|
-
.andWhere('at.agent_id = :agentId', { agentId: scope.agentId })
|
|
51
|
-
.getRawOne(),
|
|
52
|
-
]);
|
|
53
|
-
const input = Number(currentRows?.input ?? 0);
|
|
54
|
-
const output = Number(currentRows?.output ?? 0);
|
|
55
|
-
const cacheRead = Number(currentRows?.cache_read ?? 0);
|
|
56
|
-
const messages = Number(currentRows?.messages ?? 0);
|
|
57
|
-
const currentTotal = input + output;
|
|
58
|
-
const previousTotal = Number(prevRows?.total ?? 0);
|
|
59
|
-
return {
|
|
60
|
-
range,
|
|
61
|
-
total_tokens: currentTotal,
|
|
62
|
-
input_tokens: input,
|
|
63
|
-
output_tokens: output,
|
|
64
|
-
cache_read_tokens: cacheRead,
|
|
65
|
-
message_count: messages,
|
|
66
|
-
trend_pct: (0, query_helpers_1.computeTrend)(currentTotal, previousTotal),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
async getCosts(range, scope) {
|
|
70
|
-
const interval = (0, range_util_1.rangeToInterval)(range);
|
|
71
|
-
const prevInterval = (0, range_util_1.rangeToPreviousInterval)(range);
|
|
72
|
-
const cutoff = (0, sql_dialect_1.computeCutoff)(interval);
|
|
73
|
-
const prevCutoff = (0, sql_dialect_1.computeCutoff)(prevInterval);
|
|
74
|
-
const [currentRows, prevRows, modelRows] = await Promise.all([
|
|
75
|
-
this.turnRepo
|
|
76
|
-
.createQueryBuilder('at')
|
|
77
|
-
.select('COALESCE(SUM(at.cost_usd), 0)', 'total')
|
|
78
|
-
.where('at.timestamp >= :cutoff', { cutoff })
|
|
79
|
-
.andWhere('at.tenant_id = :tenantId', { tenantId: scope.tenantId })
|
|
80
|
-
.andWhere('at.agent_id = :agentId', { agentId: scope.agentId })
|
|
81
|
-
.getRawOne(),
|
|
82
|
-
this.turnRepo
|
|
83
|
-
.createQueryBuilder('at')
|
|
84
|
-
.select('COALESCE(SUM(at.cost_usd), 0)', 'total')
|
|
85
|
-
.where('at.timestamp >= :prevCutoff', { prevCutoff })
|
|
86
|
-
.andWhere('at.timestamp < :cutoff', { cutoff })
|
|
87
|
-
.andWhere('at.tenant_id = :tenantId', { tenantId: scope.tenantId })
|
|
88
|
-
.andWhere('at.agent_id = :agentId', { agentId: scope.agentId })
|
|
89
|
-
.getRawOne(),
|
|
90
|
-
this.turnRepo
|
|
91
|
-
.createQueryBuilder('at')
|
|
92
|
-
.select('at.model', 'model')
|
|
93
|
-
.addSelect('COALESCE(SUM(at.cost_usd), 0)', 'cost_usd')
|
|
94
|
-
.addSelect('COALESCE(SUM(at.input_tokens), 0)', 'input_tokens')
|
|
95
|
-
.addSelect('COALESCE(SUM(at.output_tokens), 0)', 'output_tokens')
|
|
96
|
-
.where('at.timestamp >= :cutoff', { cutoff })
|
|
97
|
-
.andWhere('at.tenant_id = :tenantId', { tenantId: scope.tenantId })
|
|
98
|
-
.andWhere('at.agent_id = :agentId', { agentId: scope.agentId })
|
|
99
|
-
.andWhere('at.model IS NOT NULL')
|
|
100
|
-
.groupBy('at.model')
|
|
101
|
-
.orderBy('cost_usd', 'DESC')
|
|
102
|
-
.getRawMany(),
|
|
103
|
-
]);
|
|
104
|
-
const currentCost = Number(currentRows?.total ?? 0);
|
|
105
|
-
const previousCost = Number(prevRows?.total ?? 0);
|
|
106
|
-
return {
|
|
107
|
-
range,
|
|
108
|
-
total_cost_usd: currentCost,
|
|
109
|
-
trend_pct: (0, query_helpers_1.computeTrend)(currentCost, previousCost),
|
|
110
|
-
by_model: modelRows.map((r) => ({
|
|
111
|
-
model: String(r['model']),
|
|
112
|
-
cost_usd: Number(r['cost_usd']),
|
|
113
|
-
input_tokens: Number(r['input_tokens']),
|
|
114
|
-
output_tokens: Number(r['output_tokens']),
|
|
115
|
-
})),
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
exports.AgentAnalyticsService = AgentAnalyticsService;
|
|
120
|
-
exports.AgentAnalyticsService = AgentAnalyticsService = __decorate([
|
|
121
|
-
(0, common_1.Injectable)(),
|
|
122
|
-
__param(0, (0, typeorm_1.InjectRepository)(agent_message_entity_1.AgentMessage)),
|
|
123
|
-
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
124
|
-
], AgentAnalyticsService);
|
|
125
|
-
//# sourceMappingURL=agent-analytics.service.js.map
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AgentLifecycleService = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
-
const typeorm_2 = require("typeorm");
|
|
19
|
-
const agent_entity_1 = require("../../entities/agent.entity");
|
|
20
|
-
let AgentLifecycleService = class AgentLifecycleService {
|
|
21
|
-
agentRepo;
|
|
22
|
-
dataSource;
|
|
23
|
-
constructor(agentRepo, dataSource) {
|
|
24
|
-
this.agentRepo = agentRepo;
|
|
25
|
-
this.dataSource = dataSource;
|
|
26
|
-
}
|
|
27
|
-
async deleteAgent(userId, agentName) {
|
|
28
|
-
const agent = await this.agentRepo
|
|
29
|
-
.createQueryBuilder('a')
|
|
30
|
-
.leftJoin('a.tenant', 't')
|
|
31
|
-
.where('t.name = :userId', { userId })
|
|
32
|
-
.andWhere('a.name = :agentName', { agentName })
|
|
33
|
-
.getOne();
|
|
34
|
-
if (!agent) {
|
|
35
|
-
throw new common_1.NotFoundException(`Agent "${agentName}" not found`);
|
|
36
|
-
}
|
|
37
|
-
await this.agentRepo.delete(agent.id);
|
|
38
|
-
}
|
|
39
|
-
async renameAgent(userId, currentName, newName, displayName) {
|
|
40
|
-
const agent = await this.agentRepo
|
|
41
|
-
.createQueryBuilder('a')
|
|
42
|
-
.leftJoin('a.tenant', 't')
|
|
43
|
-
.where('t.name = :userId', { userId })
|
|
44
|
-
.andWhere('a.name = :currentName', { currentName })
|
|
45
|
-
.getOne();
|
|
46
|
-
if (!agent) {
|
|
47
|
-
throw new common_1.NotFoundException(`Agent "${currentName}" not found`);
|
|
48
|
-
}
|
|
49
|
-
if (newName === currentName) {
|
|
50
|
-
if (displayName !== undefined) {
|
|
51
|
-
await this.agentRepo
|
|
52
|
-
.createQueryBuilder()
|
|
53
|
-
.update('agents')
|
|
54
|
-
.set({ display_name: displayName })
|
|
55
|
-
.where('id = :id', { id: agent.id })
|
|
56
|
-
.execute();
|
|
57
|
-
}
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const duplicate = await this.agentRepo
|
|
61
|
-
.createQueryBuilder('a')
|
|
62
|
-
.leftJoin('a.tenant', 't')
|
|
63
|
-
.where('t.name = :userId', { userId })
|
|
64
|
-
.andWhere('a.name = :newName', { newName })
|
|
65
|
-
.getOne();
|
|
66
|
-
if (duplicate) {
|
|
67
|
-
throw new common_1.ConflictException(`Agent "${newName}" already exists`);
|
|
68
|
-
}
|
|
69
|
-
await this.dataSource.transaction(async (manager) => {
|
|
70
|
-
const agentUpdate = { name: newName };
|
|
71
|
-
if (displayName !== undefined)
|
|
72
|
-
agentUpdate['display_name'] = displayName;
|
|
73
|
-
await manager
|
|
74
|
-
.createQueryBuilder()
|
|
75
|
-
.update('agents')
|
|
76
|
-
.set(agentUpdate)
|
|
77
|
-
.where('id = :id', { id: agent.id })
|
|
78
|
-
.execute();
|
|
79
|
-
const tables = [
|
|
80
|
-
'agent_messages',
|
|
81
|
-
'notification_rules',
|
|
82
|
-
'notification_logs',
|
|
83
|
-
'token_usage_snapshots',
|
|
84
|
-
'cost_snapshots',
|
|
85
|
-
];
|
|
86
|
-
await Promise.all(tables.map((table) => manager
|
|
87
|
-
.createQueryBuilder()
|
|
88
|
-
.update(table)
|
|
89
|
-
.set({ agent_name: newName })
|
|
90
|
-
.where('agent_name = :currentName', { currentName })
|
|
91
|
-
.execute()));
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
exports.AgentLifecycleService = AgentLifecycleService;
|
|
96
|
-
exports.AgentLifecycleService = AgentLifecycleService = __decorate([
|
|
97
|
-
(0, common_1.Injectable)(),
|
|
98
|
-
__param(0, (0, typeorm_1.InjectRepository)(agent_entity_1.Agent)),
|
|
99
|
-
__metadata("design:paramtypes", [typeorm_2.Repository,
|
|
100
|
-
typeorm_2.DataSource])
|
|
101
|
-
], AgentLifecycleService);
|
|
102
|
-
//# sourceMappingURL=agent-lifecycle.service.js.map
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AggregationService = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
-
const typeorm_2 = require("typeorm");
|
|
19
|
-
const agent_message_entity_1 = require("../../entities/agent-message.entity");
|
|
20
|
-
const range_util_1 = require("../../common/utils/range.util");
|
|
21
|
-
const query_helpers_1 = require("./query-helpers");
|
|
22
|
-
const tenant_cache_service_1 = require("../../common/services/tenant-cache.service");
|
|
23
|
-
const sql_dialect_1 = require("../../common/utils/sql-dialect");
|
|
24
|
-
let AggregationService = class AggregationService {
|
|
25
|
-
turnRepo;
|
|
26
|
-
dataSource;
|
|
27
|
-
tenantCache;
|
|
28
|
-
dialect;
|
|
29
|
-
constructor(turnRepo, dataSource, tenantCache) {
|
|
30
|
-
this.turnRepo = turnRepo;
|
|
31
|
-
this.dataSource = dataSource;
|
|
32
|
-
this.tenantCache = tenantCache;
|
|
33
|
-
this.dialect = (0, sql_dialect_1.detectDialect)(this.dataSource.options.type);
|
|
34
|
-
}
|
|
35
|
-
async hasAnyData(userId, agentName, tenantId) {
|
|
36
|
-
const resolved = tenantId ?? (await this.tenantCache.resolve(userId)) ?? undefined;
|
|
37
|
-
const qb = this.turnRepo.createQueryBuilder('at').select('1').limit(1);
|
|
38
|
-
(0, query_helpers_1.addTenantFilter)(qb, userId, agentName, resolved);
|
|
39
|
-
const row = await qb.getRawOne();
|
|
40
|
-
return row != null;
|
|
41
|
-
}
|
|
42
|
-
async getTokenSummary(range, userId, agentName) {
|
|
43
|
-
const tenantId = (await this.tenantCache.resolve(userId)) ?? undefined;
|
|
44
|
-
const interval = (0, range_util_1.rangeToInterval)(range);
|
|
45
|
-
const prevInterval = (0, range_util_1.rangeToPreviousInterval)(range);
|
|
46
|
-
const cutoff = (0, sql_dialect_1.computeCutoff)(interval);
|
|
47
|
-
const prevCutoff = (0, sql_dialect_1.computeCutoff)(prevInterval);
|
|
48
|
-
const detailQb = this.turnRepo
|
|
49
|
-
.createQueryBuilder('at')
|
|
50
|
-
.select('COALESCE(SUM(at.input_tokens), 0)', 'inp')
|
|
51
|
-
.addSelect('COALESCE(SUM(at.output_tokens), 0)', 'out')
|
|
52
|
-
.where('at.timestamp >= :cutoff', { cutoff });
|
|
53
|
-
(0, query_helpers_1.addTenantFilter)(detailQb, userId, agentName, tenantId);
|
|
54
|
-
const prevQb = this.turnRepo
|
|
55
|
-
.createQueryBuilder('at')
|
|
56
|
-
.select('COALESCE(SUM(at.input_tokens + at.output_tokens), 0)', 'total')
|
|
57
|
-
.where('at.timestamp >= :prevCutoff', { prevCutoff })
|
|
58
|
-
.andWhere('at.timestamp < :cutoff', { cutoff });
|
|
59
|
-
(0, query_helpers_1.addTenantFilter)(prevQb, userId, agentName, tenantId);
|
|
60
|
-
const [detail, prevRow] = await Promise.all([detailQb.getRawOne(), prevQb.getRawOne()]);
|
|
61
|
-
const inputTotal = Number(detail?.inp ?? 0);
|
|
62
|
-
const outputTotal = Number(detail?.out ?? 0);
|
|
63
|
-
const current = inputTotal + outputTotal;
|
|
64
|
-
const previous = Number(prevRow?.total ?? 0);
|
|
65
|
-
return {
|
|
66
|
-
tokens_today: {
|
|
67
|
-
value: current,
|
|
68
|
-
trend_pct: (0, query_helpers_1.computeTrend)(current, previous),
|
|
69
|
-
sub_values: { input: inputTotal, output: outputTotal },
|
|
70
|
-
},
|
|
71
|
-
input_tokens: inputTotal,
|
|
72
|
-
output_tokens: outputTotal,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
async getCostSummary(range, userId, agentName) {
|
|
76
|
-
const tenantId = (await this.tenantCache.resolve(userId)) ?? undefined;
|
|
77
|
-
const interval = (0, range_util_1.rangeToInterval)(range);
|
|
78
|
-
const prevInterval = (0, range_util_1.rangeToPreviousInterval)(range);
|
|
79
|
-
const cutoff = (0, sql_dialect_1.computeCutoff)(interval);
|
|
80
|
-
const prevCutoff = (0, sql_dialect_1.computeCutoff)(prevInterval);
|
|
81
|
-
const safeCost = (0, sql_dialect_1.sqlSanitizeCost)('at.cost_usd');
|
|
82
|
-
const currentQb = this.turnRepo
|
|
83
|
-
.createQueryBuilder('at')
|
|
84
|
-
.select(`COALESCE(SUM(${safeCost}), 0)`, 'total')
|
|
85
|
-
.where('at.timestamp >= :cutoff', { cutoff });
|
|
86
|
-
(0, query_helpers_1.addTenantFilter)(currentQb, userId, agentName, tenantId);
|
|
87
|
-
const prevQb = this.turnRepo
|
|
88
|
-
.createQueryBuilder('at')
|
|
89
|
-
.select(`COALESCE(SUM(${safeCost}), 0)`, 'total')
|
|
90
|
-
.where('at.timestamp >= :prevCutoff', { prevCutoff })
|
|
91
|
-
.andWhere('at.timestamp < :cutoff', { cutoff });
|
|
92
|
-
(0, query_helpers_1.addTenantFilter)(prevQb, userId, agentName, tenantId);
|
|
93
|
-
const [currentRow, prevRow] = await Promise.all([currentQb.getRawOne(), prevQb.getRawOne()]);
|
|
94
|
-
const current = Number(currentRow?.total ?? 0);
|
|
95
|
-
const previous = Number(prevRow?.total ?? 0);
|
|
96
|
-
return { value: current, trend_pct: (0, query_helpers_1.computeTrend)(current, previous) };
|
|
97
|
-
}
|
|
98
|
-
async getMessageCount(range, userId, agentName) {
|
|
99
|
-
const tenantId = (await this.tenantCache.resolve(userId)) ?? undefined;
|
|
100
|
-
const interval = (0, range_util_1.rangeToInterval)(range);
|
|
101
|
-
const prevInterval = (0, range_util_1.rangeToPreviousInterval)(range);
|
|
102
|
-
const cutoff = (0, sql_dialect_1.computeCutoff)(interval);
|
|
103
|
-
const prevCutoff = (0, sql_dialect_1.computeCutoff)(prevInterval);
|
|
104
|
-
const currentQb = this.turnRepo
|
|
105
|
-
.createQueryBuilder('at')
|
|
106
|
-
.select('COUNT(*)', 'total')
|
|
107
|
-
.where('at.timestamp >= :cutoff', { cutoff });
|
|
108
|
-
(0, query_helpers_1.addTenantFilter)(currentQb, userId, agentName, tenantId);
|
|
109
|
-
const prevQb = this.turnRepo
|
|
110
|
-
.createQueryBuilder('at')
|
|
111
|
-
.select('COUNT(*)', 'total')
|
|
112
|
-
.where('at.timestamp >= :prevCutoff', { prevCutoff })
|
|
113
|
-
.andWhere('at.timestamp < :cutoff', { cutoff });
|
|
114
|
-
(0, query_helpers_1.addTenantFilter)(prevQb, userId, agentName, tenantId);
|
|
115
|
-
const [currentRow, prevRow] = await Promise.all([currentQb.getRawOne(), prevQb.getRawOne()]);
|
|
116
|
-
const current = Number(currentRow?.total ?? 0);
|
|
117
|
-
const previous = Number(prevRow?.total ?? 0);
|
|
118
|
-
return { value: current, trend_pct: (0, query_helpers_1.computeTrend)(current, previous) };
|
|
119
|
-
}
|
|
120
|
-
async getPreviousTokenTotal(range, userId, agentName) {
|
|
121
|
-
const tenantId = (await this.tenantCache.resolve(userId)) ?? undefined;
|
|
122
|
-
const interval = (0, range_util_1.rangeToInterval)(range);
|
|
123
|
-
const prevInterval = (0, range_util_1.rangeToPreviousInterval)(range);
|
|
124
|
-
const cutoff = (0, sql_dialect_1.computeCutoff)(interval);
|
|
125
|
-
const prevCutoff = (0, sql_dialect_1.computeCutoff)(prevInterval);
|
|
126
|
-
const prevQb = this.turnRepo
|
|
127
|
-
.createQueryBuilder('at')
|
|
128
|
-
.select('COALESCE(SUM(at.input_tokens + at.output_tokens), 0)', 'total')
|
|
129
|
-
.where('at.timestamp >= :prevCutoff', { prevCutoff })
|
|
130
|
-
.andWhere('at.timestamp < :cutoff', { cutoff });
|
|
131
|
-
(0, query_helpers_1.addTenantFilter)(prevQb, userId, agentName, tenantId);
|
|
132
|
-
const row = await prevQb.getRawOne();
|
|
133
|
-
return Number(row?.total ?? 0);
|
|
134
|
-
}
|
|
135
|
-
async getPreviousCostTotal(range, userId, agentName) {
|
|
136
|
-
const tenantId = (await this.tenantCache.resolve(userId)) ?? undefined;
|
|
137
|
-
const interval = (0, range_util_1.rangeToInterval)(range);
|
|
138
|
-
const prevInterval = (0, range_util_1.rangeToPreviousInterval)(range);
|
|
139
|
-
const cutoff = (0, sql_dialect_1.computeCutoff)(interval);
|
|
140
|
-
const prevCutoff = (0, sql_dialect_1.computeCutoff)(prevInterval);
|
|
141
|
-
const safeCost = (0, sql_dialect_1.sqlSanitizeCost)('at.cost_usd');
|
|
142
|
-
const prevQb = this.turnRepo
|
|
143
|
-
.createQueryBuilder('at')
|
|
144
|
-
.select(`COALESCE(SUM(${safeCost}), 0)`, 'total')
|
|
145
|
-
.where('at.timestamp >= :prevCutoff', { prevCutoff })
|
|
146
|
-
.andWhere('at.timestamp < :cutoff', { cutoff });
|
|
147
|
-
(0, query_helpers_1.addTenantFilter)(prevQb, userId, agentName, tenantId);
|
|
148
|
-
const row = await prevQb.getRawOne();
|
|
149
|
-
return Number(row?.total ?? 0);
|
|
150
|
-
}
|
|
151
|
-
async getSummaryMetrics(range, userId, tenantId, agentName) {
|
|
152
|
-
const interval = (0, range_util_1.rangeToInterval)(range);
|
|
153
|
-
const prevInterval = (0, range_util_1.rangeToPreviousInterval)(range);
|
|
154
|
-
const cutoff = (0, sql_dialect_1.computeCutoff)(interval);
|
|
155
|
-
const prevCutoff = (0, sql_dialect_1.computeCutoff)(prevInterval);
|
|
156
|
-
const safeCost = (0, sql_dialect_1.sqlSanitizeCost)('at.cost_usd');
|
|
157
|
-
const currentQb = this.turnRepo
|
|
158
|
-
.createQueryBuilder('at')
|
|
159
|
-
.select('COUNT(*)', 'msg_count')
|
|
160
|
-
.addSelect('COALESCE(SUM(at.input_tokens), 0)', 'inp')
|
|
161
|
-
.addSelect('COALESCE(SUM(at.output_tokens), 0)', 'out')
|
|
162
|
-
.addSelect(`COALESCE(SUM(${safeCost}), 0)`, 'cost')
|
|
163
|
-
.where('at.timestamp >= :cutoff', { cutoff });
|
|
164
|
-
(0, query_helpers_1.addTenantFilter)(currentQb, userId, agentName, tenantId);
|
|
165
|
-
const prevQb = this.turnRepo
|
|
166
|
-
.createQueryBuilder('at')
|
|
167
|
-
.select('COUNT(*)', 'msg_count')
|
|
168
|
-
.addSelect('COALESCE(SUM(at.input_tokens + at.output_tokens), 0)', 'tokens')
|
|
169
|
-
.addSelect(`COALESCE(SUM(${safeCost}), 0)`, 'cost')
|
|
170
|
-
.where('at.timestamp >= :prevCutoff', { prevCutoff })
|
|
171
|
-
.andWhere('at.timestamp < :cutoff', { cutoff });
|
|
172
|
-
(0, query_helpers_1.addTenantFilter)(prevQb, userId, agentName, tenantId);
|
|
173
|
-
const [cur, prev] = await Promise.all([currentQb.getRawOne(), prevQb.getRawOne()]);
|
|
174
|
-
const inputTotal = Number(cur?.inp ?? 0);
|
|
175
|
-
const outputTotal = Number(cur?.out ?? 0);
|
|
176
|
-
const curTokens = inputTotal + outputTotal;
|
|
177
|
-
const prevTokens = Number(prev?.tokens ?? 0);
|
|
178
|
-
const curCost = Number(cur?.cost ?? 0);
|
|
179
|
-
const prevCost = Number(prev?.cost ?? 0);
|
|
180
|
-
const curMsgs = Number(cur?.msg_count ?? 0);
|
|
181
|
-
const prevMsgs = Number(prev?.msg_count ?? 0);
|
|
182
|
-
return {
|
|
183
|
-
tokens: {
|
|
184
|
-
tokens_today: {
|
|
185
|
-
value: curTokens,
|
|
186
|
-
trend_pct: (0, query_helpers_1.computeTrend)(curTokens, prevTokens),
|
|
187
|
-
sub_values: { input: inputTotal, output: outputTotal },
|
|
188
|
-
},
|
|
189
|
-
input_tokens: inputTotal,
|
|
190
|
-
output_tokens: outputTotal,
|
|
191
|
-
},
|
|
192
|
-
cost: { value: curCost, trend_pct: (0, query_helpers_1.computeTrend)(curCost, prevCost) },
|
|
193
|
-
messages: { value: curMsgs, trend_pct: (0, query_helpers_1.computeTrend)(curMsgs, prevMsgs) },
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
exports.AggregationService = AggregationService;
|
|
198
|
-
exports.AggregationService = AggregationService = __decorate([
|
|
199
|
-
(0, common_1.Injectable)(),
|
|
200
|
-
__param(0, (0, typeorm_1.InjectRepository)(agent_message_entity_1.AgentMessage)),
|
|
201
|
-
__metadata("design:paramtypes", [typeorm_2.Repository,
|
|
202
|
-
typeorm_2.DataSource,
|
|
203
|
-
tenant_cache_service_1.TenantCacheService])
|
|
204
|
-
], AggregationService);
|
|
205
|
-
//# sourceMappingURL=aggregation.service.js.map
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.MessageDetailsService = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
-
const typeorm_2 = require("typeorm");
|
|
19
|
-
const agent_message_entity_1 = require("../../entities/agent-message.entity");
|
|
20
|
-
const llm_call_entity_1 = require("../../entities/llm-call.entity");
|
|
21
|
-
const tool_execution_entity_1 = require("../../entities/tool-execution.entity");
|
|
22
|
-
const agent_log_entity_1 = require("../../entities/agent-log.entity");
|
|
23
|
-
const tenant_cache_service_1 = require("../../common/services/tenant-cache.service");
|
|
24
|
-
let MessageDetailsService = class MessageDetailsService {
|
|
25
|
-
messageRepo;
|
|
26
|
-
llmCallRepo;
|
|
27
|
-
toolRepo;
|
|
28
|
-
logRepo;
|
|
29
|
-
tenantCache;
|
|
30
|
-
constructor(messageRepo, llmCallRepo, toolRepo, logRepo, tenantCache) {
|
|
31
|
-
this.messageRepo = messageRepo;
|
|
32
|
-
this.llmCallRepo = llmCallRepo;
|
|
33
|
-
this.toolRepo = toolRepo;
|
|
34
|
-
this.logRepo = logRepo;
|
|
35
|
-
this.tenantCache = tenantCache;
|
|
36
|
-
}
|
|
37
|
-
async getDetails(messageId, userId) {
|
|
38
|
-
const tenantId = await this.tenantCache.resolve(userId);
|
|
39
|
-
const messageQb = this.messageRepo
|
|
40
|
-
.createQueryBuilder('m')
|
|
41
|
-
.where('m.id = :id', { id: messageId });
|
|
42
|
-
if (tenantId) {
|
|
43
|
-
messageQb.andWhere('m.tenant_id = :tenantId', { tenantId });
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
messageQb.andWhere('m.user_id = :userId', { userId });
|
|
47
|
-
}
|
|
48
|
-
const message = await messageQb.getOne();
|
|
49
|
-
if (!message)
|
|
50
|
-
throw new common_1.NotFoundException('Message not found');
|
|
51
|
-
const llmCallsQb = this.llmCallRepo
|
|
52
|
-
.createQueryBuilder('lc')
|
|
53
|
-
.where('lc.turn_id = :turnId', { turnId: messageId })
|
|
54
|
-
.orderBy('lc.call_index', 'ASC')
|
|
55
|
-
.addOrderBy('lc.timestamp', 'ASC');
|
|
56
|
-
const logsQb = message.trace_id
|
|
57
|
-
? this.logRepo
|
|
58
|
-
.createQueryBuilder('al')
|
|
59
|
-
.where('al.trace_id = :traceId', { traceId: message.trace_id })
|
|
60
|
-
.orderBy('al.timestamp', 'ASC')
|
|
61
|
-
: null;
|
|
62
|
-
const [llmCalls, agentLogs] = await Promise.all([
|
|
63
|
-
llmCallsQb.getMany(),
|
|
64
|
-
logsQb ? logsQb.getMany() : Promise.resolve([]),
|
|
65
|
-
]);
|
|
66
|
-
const llmCallIds = llmCalls.map((lc) => lc.id);
|
|
67
|
-
const toolExecutions = llmCallIds.length > 0
|
|
68
|
-
? await this.toolRepo
|
|
69
|
-
.createQueryBuilder('te')
|
|
70
|
-
.where('te.llm_call_id IN (:...ids)', { ids: llmCallIds })
|
|
71
|
-
.orderBy('te.llm_call_id', 'ASC')
|
|
72
|
-
.getMany()
|
|
73
|
-
: [];
|
|
74
|
-
return {
|
|
75
|
-
message: {
|
|
76
|
-
id: message.id,
|
|
77
|
-
timestamp: message.timestamp,
|
|
78
|
-
agent_name: message.agent_name,
|
|
79
|
-
model: message.model,
|
|
80
|
-
status: message.status,
|
|
81
|
-
error_message: message.error_message,
|
|
82
|
-
description: message.description,
|
|
83
|
-
service_type: message.service_type,
|
|
84
|
-
input_tokens: message.input_tokens,
|
|
85
|
-
output_tokens: message.output_tokens,
|
|
86
|
-
cache_read_tokens: message.cache_read_tokens,
|
|
87
|
-
cache_creation_tokens: message.cache_creation_tokens,
|
|
88
|
-
cost_usd: message.cost_usd,
|
|
89
|
-
duration_ms: message.duration_ms,
|
|
90
|
-
trace_id: message.trace_id,
|
|
91
|
-
routing_tier: message.routing_tier,
|
|
92
|
-
routing_reason: message.routing_reason,
|
|
93
|
-
auth_type: message.auth_type,
|
|
94
|
-
skill_name: message.skill_name,
|
|
95
|
-
fallback_from_model: message.fallback_from_model,
|
|
96
|
-
fallback_index: message.fallback_index,
|
|
97
|
-
session_key: message.session_key,
|
|
98
|
-
},
|
|
99
|
-
llm_calls: llmCalls.map((lc) => ({
|
|
100
|
-
id: lc.id,
|
|
101
|
-
call_index: lc.call_index,
|
|
102
|
-
request_model: lc.request_model,
|
|
103
|
-
response_model: lc.response_model,
|
|
104
|
-
gen_ai_system: lc.gen_ai_system,
|
|
105
|
-
input_tokens: lc.input_tokens,
|
|
106
|
-
output_tokens: lc.output_tokens,
|
|
107
|
-
cache_read_tokens: lc.cache_read_tokens,
|
|
108
|
-
cache_creation_tokens: lc.cache_creation_tokens,
|
|
109
|
-
duration_ms: lc.duration_ms,
|
|
110
|
-
ttft_ms: lc.ttft_ms,
|
|
111
|
-
temperature: lc.temperature,
|
|
112
|
-
max_output_tokens: lc.max_output_tokens,
|
|
113
|
-
timestamp: lc.timestamp,
|
|
114
|
-
})),
|
|
115
|
-
tool_executions: toolExecutions.map((te) => ({
|
|
116
|
-
id: te.id,
|
|
117
|
-
llm_call_id: te.llm_call_id,
|
|
118
|
-
tool_name: te.tool_name,
|
|
119
|
-
duration_ms: te.duration_ms,
|
|
120
|
-
status: te.status,
|
|
121
|
-
error_message: te.error_message,
|
|
122
|
-
})),
|
|
123
|
-
agent_logs: agentLogs.map((al) => ({
|
|
124
|
-
id: al.id,
|
|
125
|
-
severity: al.severity,
|
|
126
|
-
body: al.body,
|
|
127
|
-
timestamp: al.timestamp,
|
|
128
|
-
span_id: al.span_id,
|
|
129
|
-
})),
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
exports.MessageDetailsService = MessageDetailsService;
|
|
134
|
-
exports.MessageDetailsService = MessageDetailsService = __decorate([
|
|
135
|
-
(0, common_1.Injectable)(),
|
|
136
|
-
__param(0, (0, typeorm_1.InjectRepository)(agent_message_entity_1.AgentMessage)),
|
|
137
|
-
__param(1, (0, typeorm_1.InjectRepository)(llm_call_entity_1.LlmCall)),
|
|
138
|
-
__param(2, (0, typeorm_1.InjectRepository)(tool_execution_entity_1.ToolExecution)),
|
|
139
|
-
__param(3, (0, typeorm_1.InjectRepository)(agent_log_entity_1.AgentLog)),
|
|
140
|
-
__metadata("design:paramtypes", [typeorm_2.Repository,
|
|
141
|
-
typeorm_2.Repository,
|
|
142
|
-
typeorm_2.Repository,
|
|
143
|
-
typeorm_2.Repository,
|
|
144
|
-
tenant_cache_service_1.TenantCacheService])
|
|
145
|
-
], MessageDetailsService);
|
|
146
|
-
//# sourceMappingURL=message-details.service.js.map
|