@flutchai/flutch-sdk 0.2.8 → 0.2.10

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/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@ import * as _nestjs_common from '@nestjs/common';
3
3
  import { OnModuleInit, Logger, CanActivate, ExecutionContext, Type, DynamicModule } from '@nestjs/common';
4
4
  import { ConfigService } from '@nestjs/config';
5
5
  import { BaseChannel, OverwriteValue, CompiledStateGraph, LangGraphRunnableConfig } from '@langchain/langgraph';
6
- import { MongoClient } from 'mongodb';
6
+ import { MongoClient, Db } from 'mongodb';
7
7
  import Redis from 'ioredis';
8
8
  import { Registry } from 'prom-client';
9
9
  import { Response, Request } from 'express';
@@ -11,10 +11,6 @@ import { DiscoveryService, MetadataScanner, ModuleRef } from '@nestjs/core';
11
11
  import { AIMessageChunk, ToolMessage, AIMessage } from '@langchain/core/messages';
12
12
  import { Runnable, RunnableConfig } from '@langchain/core/runnables';
13
13
  import { DynamicStructuredTool, StructuredTool } from '@langchain/core/tools';
14
- import { ChatAnthropic } from '@langchain/anthropic';
15
- import { ChatCohere } from '@langchain/cohere';
16
- import { ChatMistralAI } from '@langchain/mistralai';
17
- import { ChatOpenAI } from '@langchain/openai';
18
14
  import { BaseChatModel, BaseChatModelCallOptions } from '@langchain/core/language_models/chat_models';
19
15
  import { BaseDocumentCompressor } from '@langchain/core/retrievers/document_compressors';
20
16
  import { Embeddings } from '@langchain/core/embeddings';
@@ -993,10 +989,6 @@ interface IBaseEntity {
993
989
  }
994
990
 
995
991
  declare enum ModelProvider {
996
- FLUTCH = "flutch",
997
- FLUTCH_MISTRAL = "flutch-mistral",
998
- FLUTCH_OPENAI = "flutch-openai",
999
- FLUTCH_ANTHROPIC = "flutch-anthropic",
1000
992
  MISTRAL = "mistral",
1001
993
  OPENAI = "openai",
1002
994
  ANTHROPIC = "anthropic",
@@ -1019,12 +1011,6 @@ declare enum ChatFeature {
1019
1011
  JSON_MODE = "json_mode"
1020
1012
  }
1021
1013
 
1022
- interface ModelConfig {
1023
- name: string;
1024
- modelProvider: ModelProvider;
1025
- temperature?: number;
1026
- maxTokens?: number;
1027
- }
1028
1014
  interface ModelByIdConfig {
1029
1015
  modelId: string;
1030
1016
  temperature?: number;
@@ -1041,12 +1027,11 @@ interface ModelConfigWithToken {
1041
1027
  defaultMaxTokens: number;
1042
1028
  apiToken?: string;
1043
1029
  requiresApiKey: boolean;
1030
+ useBedrock?: boolean;
1031
+ bedrockModelId?: string;
1044
1032
  }
1033
+ type ApiKeyResolver = (provider: ModelProvider) => string | undefined;
1045
1034
  type LLModel = BaseChatModel;
1046
- type ConcreteModels = ChatOpenAI | ChatAnthropic | ChatCohere | ChatMistralAI;
1047
- type ModelCreator = (config: ModelConfig & {
1048
- customApiToken?: string;
1049
- }) => LLModel;
1050
1035
 
1051
1036
  type ChatModelWithTools = Runnable<BaseLanguageModelInput, AIMessageChunk, BaseChatModelCallOptions>;
1052
1037
  type ChatModelOrRunnable = BaseChatModel | ChatModelWithTools;
@@ -1086,13 +1071,16 @@ interface ModelCreators {
1086
1071
 
1087
1072
  declare class ModelInitializer implements IModelInitializer {
1088
1073
  private configFetcher?;
1074
+ private apiKeyResolver?;
1089
1075
  private logger;
1090
1076
  private modelConfigCache;
1091
1077
  private modelInstanceCache;
1092
- constructor(configFetcher?: ModelConfigFetcher, logger?: Logger);
1078
+ private static readonly DEFAULT_ENV_MAP;
1079
+ constructor(configFetcher?: ModelConfigFetcher, logger?: Logger, apiKeyResolver?: ApiKeyResolver);
1080
+ private resolveApiKey;
1081
+ private resolveBedrockRegion;
1093
1082
  private hashToolsConfig;
1094
1083
  private generateModelCacheKey;
1095
- private requiresMaxCompletionTokens;
1096
1084
  private readonly chatModelCreators;
1097
1085
  private readonly rerankModelCreators;
1098
1086
  private readonly embeddingModelCreators;
@@ -1676,4 +1664,63 @@ declare class StaticDiscovery implements ServiceDiscoveryProvider {
1676
1664
  }>>;
1677
1665
  }
1678
1666
 
1679
- export { type ACLValidationResult, AbstractGraphBuilder, type ApiCallTracerOptions, AttachmentType, type AuditEntry, type BaseGraphConfig, type BaseGraphContext, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, type BaseGraphState, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, type CallbackContext, CallbackController, type CallbackEntry, type CallbackHandler, type CallbackMetadata, CallbackMetrics, type CallbackPatch, type CallbackPatchHandler, CallbackPatchService, CallbackRateLimiter, type CallbackRecord, CallbackRegistry, type CallbackRequest, type CallbackResult, CallbackStore, CallbackTokenGuard, type CallbackUser, type ChannelState, type ChartType, ChatFeature, type ChatModelCreator, type ChatModelOrRunnable, type ChatModelWithTools, type CitationValue, type CompiledGraphFor, type ConcreteModels, type CustomDocument, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_TRACER_OPTIONS, type DataEnvelope, ENDPOINT_METADATA_KEY, type EmbeddingModelCreator, Endpoint, type EndpointDescriptor, type EndpointHandler, type EndpointMetadata, type EndpointOptions, EndpointRegistry, EventProcessor, type ExecuteToolWithAttachmentsParams, type ExecuteToolWithAttachmentsResult, type ExtendedCallbackContext, type ExtendedCallbackHandler, ExternalGraphBuilder, FileBasedDiscovery, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, type IAgentToolConfig, type IAgentToolConfiguration, type IAttachment, type IBaseEntity, type IChartDataPoint, type IChartDataset, type IChartValue, type IContentBlock, type IContentChain, type IDeletionInfo, type IGenericGraphType, type IGraphAttachment, type IGraphBuilder, type IGraphCompiler, type IGraphConfigurable, type IGraphEngine, type IGraphLogger, type IGraphManifest, type IGraphMetadata, type IGraphMetadataRegistry, type IGraphRequestPayload, type IGraphResponsePayload, type IGraphRunnableConfig, type IGraphService, type IGraphServiceRegistry, type IGraphSettingsRepository, type IGraphTraceEvent, type IGraphTracer, type IGraphTypeMetadata, type IGraphTypeRegistry, type ILangGraphConfig, type IModelInitializer, type IReasoningChain, type IReasoningStep, type IStoredMessageContent, type ISystemToolCredentials, type IToolCall, type IToolCatalog, type IToolConfigOption, type IToolExecutionContext, type ITracingEvent, type IUsageMetrics, type IUsageRecorder, type IdempotencyConfig, type IdempotencyEntry, IdempotencyManager, IdempotencyStatus, type KnowledgeBaseInfo, type LLMCallRecord, type LLMConfig, type LLModel, LangGraphEngine, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreator, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, type RateLimitConfig, type RateLimitResult, type RequestContext, type RerankModelCreator, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TelegramPatchHandler, type ToolExecutionResult, type TraceApiCallResult, type TracingLevel, UIDispatchController, type UIDispatchDto, UIEndpoint, type UIEndpointClassMetadata, type UIEndpointMethodMetadata, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, type UniversalGraphModuleOptions, UniversalGraphService, type VersionResolution, type VersionResolutionOptions, type VersionRoute, VersionedGraphService, type VersioningConfig, VoyageAIRerank, type VoyageAIRerankConfig, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bootstrap, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, dispatchAttachments, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, generateAttachmentSummary, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, registerFinanceExampleCallback, registerUIEndpointsFromClass, sanitizeTraceData, storeAttachmentData, traceApiCall };
1667
+ interface OAuthTokens {
1668
+ accessToken: string;
1669
+ refreshToken: string;
1670
+ expiresAt: number;
1671
+ }
1672
+ interface OAuthProviderConfig {
1673
+ provider: string;
1674
+ tokenUrl: string;
1675
+ clientId: string;
1676
+ clientSecret: string;
1677
+ }
1678
+ interface IOAuthTokenStore {
1679
+ get(provider: string): Promise<string | null>;
1680
+ save(provider: string, encrypted: string): Promise<void>;
1681
+ delete(provider: string): Promise<void>;
1682
+ }
1683
+ interface OAuthTokenManagerOptions {
1684
+ store: IOAuthTokenStore;
1685
+ encryptionKey: string;
1686
+ }
1687
+
1688
+ declare class OAuthTokenManager {
1689
+ private readonly store;
1690
+ private readonly encryptionKey;
1691
+ private readonly cache;
1692
+ constructor(options: OAuthTokenManagerOptions);
1693
+ getAccessToken(config: OAuthProviderConfig): Promise<string>;
1694
+ saveTokens(provider: string, tokens: OAuthTokens): Promise<void>;
1695
+ revokeTokens(provider: string): Promise<void>;
1696
+ hasTokens(provider: string): Promise<boolean>;
1697
+ private refreshAccessToken;
1698
+ private persistTokens;
1699
+ private setCache;
1700
+ }
1701
+
1702
+ declare function encryptTokens(tokens: OAuthTokens, key: string): string;
1703
+ declare function decryptTokens(encrypted: string, key: string): OAuthTokens;
1704
+
1705
+ declare class FileTokenStore implements IOAuthTokenStore {
1706
+ private readonly filePath;
1707
+ constructor(filePath: string);
1708
+ get(provider: string): Promise<string | null>;
1709
+ save(provider: string, encrypted: string): Promise<void>;
1710
+ delete(provider: string): Promise<void>;
1711
+ private readFile;
1712
+ private writeFile;
1713
+ }
1714
+
1715
+ declare class MongoTokenStore implements IOAuthTokenStore {
1716
+ private readonly db;
1717
+ private readonly collectionName;
1718
+ private initialized;
1719
+ constructor(db: Db, collectionName?: string);
1720
+ get(provider: string): Promise<string | null>;
1721
+ save(provider: string, encrypted: string): Promise<void>;
1722
+ delete(provider: string): Promise<void>;
1723
+ private ensureIndex;
1724
+ }
1725
+
1726
+ export { type ACLValidationResult, AbstractGraphBuilder, type ApiCallTracerOptions, type ApiKeyResolver, AttachmentType, type AuditEntry, type BaseGraphConfig, type BaseGraphContext, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, type BaseGraphState, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, type CallbackContext, CallbackController, type CallbackEntry, type CallbackHandler, type CallbackMetadata, CallbackMetrics, type CallbackPatch, type CallbackPatchHandler, CallbackPatchService, CallbackRateLimiter, type CallbackRecord, CallbackRegistry, type CallbackRequest, type CallbackResult, CallbackStore, CallbackTokenGuard, type CallbackUser, type ChannelState, type ChartType, ChatFeature, type ChatModelCreator, type ChatModelOrRunnable, type ChatModelWithTools, type CitationValue, type CompiledGraphFor, type CustomDocument, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_TRACER_OPTIONS, type DataEnvelope, ENDPOINT_METADATA_KEY, type EmbeddingModelCreator, Endpoint, type EndpointDescriptor, type EndpointHandler, type EndpointMetadata, type EndpointOptions, EndpointRegistry, EventProcessor, type ExecuteToolWithAttachmentsParams, type ExecuteToolWithAttachmentsResult, type ExtendedCallbackContext, type ExtendedCallbackHandler, ExternalGraphBuilder, FileBasedDiscovery, FileTokenStore, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, type IAgentToolConfig, type IAgentToolConfiguration, type IAttachment, type IBaseEntity, type IChartDataPoint, type IChartDataset, type IChartValue, type IContentBlock, type IContentChain, type IDeletionInfo, type IGenericGraphType, type IGraphAttachment, type IGraphBuilder, type IGraphCompiler, type IGraphConfigurable, type IGraphEngine, type IGraphLogger, type IGraphManifest, type IGraphMetadata, type IGraphMetadataRegistry, type IGraphRequestPayload, type IGraphResponsePayload, type IGraphRunnableConfig, type IGraphService, type IGraphServiceRegistry, type IGraphSettingsRepository, type IGraphTraceEvent, type IGraphTracer, type IGraphTypeMetadata, type IGraphTypeRegistry, type ILangGraphConfig, type IModelInitializer, type IOAuthTokenStore, type IReasoningChain, type IReasoningStep, type IStoredMessageContent, type ISystemToolCredentials, type IToolCall, type IToolCatalog, type IToolConfigOption, type IToolExecutionContext, type ITracingEvent, type IUsageMetrics, type IUsageRecorder, type IdempotencyConfig, type IdempotencyEntry, IdempotencyManager, IdempotencyStatus, type KnowledgeBaseInfo, type LLMCallRecord, type LLMConfig, type LLModel, LangGraphEngine, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, type RateLimitConfig, type RateLimitResult, type RequestContext, type RerankModelCreator, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TelegramPatchHandler, type ToolExecutionResult, type TraceApiCallResult, type TracingLevel, UIDispatchController, type UIDispatchDto, UIEndpoint, type UIEndpointClassMetadata, type UIEndpointMethodMetadata, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, type UniversalGraphModuleOptions, UniversalGraphService, type VersionResolution, type VersionResolutionOptions, type VersionRoute, VersionedGraphService, type VersioningConfig, VoyageAIRerank, type VoyageAIRerankConfig, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bootstrap, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, decryptTokens, dispatchAttachments, encryptTokens, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, generateAttachmentSummary, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, registerFinanceExampleCallback, registerUIEndpointsFromClass, sanitizeTraceData, storeAttachmentData, traceApiCall };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import * as _nestjs_common from '@nestjs/common';
3
3
  import { OnModuleInit, Logger, CanActivate, ExecutionContext, Type, DynamicModule } from '@nestjs/common';
4
4
  import { ConfigService } from '@nestjs/config';
5
5
  import { BaseChannel, OverwriteValue, CompiledStateGraph, LangGraphRunnableConfig } from '@langchain/langgraph';
6
- import { MongoClient } from 'mongodb';
6
+ import { MongoClient, Db } from 'mongodb';
7
7
  import Redis from 'ioredis';
8
8
  import { Registry } from 'prom-client';
9
9
  import { Response, Request } from 'express';
@@ -11,10 +11,6 @@ import { DiscoveryService, MetadataScanner, ModuleRef } from '@nestjs/core';
11
11
  import { AIMessageChunk, ToolMessage, AIMessage } from '@langchain/core/messages';
12
12
  import { Runnable, RunnableConfig } from '@langchain/core/runnables';
13
13
  import { DynamicStructuredTool, StructuredTool } from '@langchain/core/tools';
14
- import { ChatAnthropic } from '@langchain/anthropic';
15
- import { ChatCohere } from '@langchain/cohere';
16
- import { ChatMistralAI } from '@langchain/mistralai';
17
- import { ChatOpenAI } from '@langchain/openai';
18
14
  import { BaseChatModel, BaseChatModelCallOptions } from '@langchain/core/language_models/chat_models';
19
15
  import { BaseDocumentCompressor } from '@langchain/core/retrievers/document_compressors';
20
16
  import { Embeddings } from '@langchain/core/embeddings';
@@ -993,10 +989,6 @@ interface IBaseEntity {
993
989
  }
994
990
 
995
991
  declare enum ModelProvider {
996
- FLUTCH = "flutch",
997
- FLUTCH_MISTRAL = "flutch-mistral",
998
- FLUTCH_OPENAI = "flutch-openai",
999
- FLUTCH_ANTHROPIC = "flutch-anthropic",
1000
992
  MISTRAL = "mistral",
1001
993
  OPENAI = "openai",
1002
994
  ANTHROPIC = "anthropic",
@@ -1019,12 +1011,6 @@ declare enum ChatFeature {
1019
1011
  JSON_MODE = "json_mode"
1020
1012
  }
1021
1013
 
1022
- interface ModelConfig {
1023
- name: string;
1024
- modelProvider: ModelProvider;
1025
- temperature?: number;
1026
- maxTokens?: number;
1027
- }
1028
1014
  interface ModelByIdConfig {
1029
1015
  modelId: string;
1030
1016
  temperature?: number;
@@ -1041,12 +1027,11 @@ interface ModelConfigWithToken {
1041
1027
  defaultMaxTokens: number;
1042
1028
  apiToken?: string;
1043
1029
  requiresApiKey: boolean;
1030
+ useBedrock?: boolean;
1031
+ bedrockModelId?: string;
1044
1032
  }
1033
+ type ApiKeyResolver = (provider: ModelProvider) => string | undefined;
1045
1034
  type LLModel = BaseChatModel;
1046
- type ConcreteModels = ChatOpenAI | ChatAnthropic | ChatCohere | ChatMistralAI;
1047
- type ModelCreator = (config: ModelConfig & {
1048
- customApiToken?: string;
1049
- }) => LLModel;
1050
1035
 
1051
1036
  type ChatModelWithTools = Runnable<BaseLanguageModelInput, AIMessageChunk, BaseChatModelCallOptions>;
1052
1037
  type ChatModelOrRunnable = BaseChatModel | ChatModelWithTools;
@@ -1086,13 +1071,16 @@ interface ModelCreators {
1086
1071
 
1087
1072
  declare class ModelInitializer implements IModelInitializer {
1088
1073
  private configFetcher?;
1074
+ private apiKeyResolver?;
1089
1075
  private logger;
1090
1076
  private modelConfigCache;
1091
1077
  private modelInstanceCache;
1092
- constructor(configFetcher?: ModelConfigFetcher, logger?: Logger);
1078
+ private static readonly DEFAULT_ENV_MAP;
1079
+ constructor(configFetcher?: ModelConfigFetcher, logger?: Logger, apiKeyResolver?: ApiKeyResolver);
1080
+ private resolveApiKey;
1081
+ private resolveBedrockRegion;
1093
1082
  private hashToolsConfig;
1094
1083
  private generateModelCacheKey;
1095
- private requiresMaxCompletionTokens;
1096
1084
  private readonly chatModelCreators;
1097
1085
  private readonly rerankModelCreators;
1098
1086
  private readonly embeddingModelCreators;
@@ -1676,4 +1664,63 @@ declare class StaticDiscovery implements ServiceDiscoveryProvider {
1676
1664
  }>>;
1677
1665
  }
1678
1666
 
1679
- export { type ACLValidationResult, AbstractGraphBuilder, type ApiCallTracerOptions, AttachmentType, type AuditEntry, type BaseGraphConfig, type BaseGraphContext, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, type BaseGraphState, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, type CallbackContext, CallbackController, type CallbackEntry, type CallbackHandler, type CallbackMetadata, CallbackMetrics, type CallbackPatch, type CallbackPatchHandler, CallbackPatchService, CallbackRateLimiter, type CallbackRecord, CallbackRegistry, type CallbackRequest, type CallbackResult, CallbackStore, CallbackTokenGuard, type CallbackUser, type ChannelState, type ChartType, ChatFeature, type ChatModelCreator, type ChatModelOrRunnable, type ChatModelWithTools, type CitationValue, type CompiledGraphFor, type ConcreteModels, type CustomDocument, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_TRACER_OPTIONS, type DataEnvelope, ENDPOINT_METADATA_KEY, type EmbeddingModelCreator, Endpoint, type EndpointDescriptor, type EndpointHandler, type EndpointMetadata, type EndpointOptions, EndpointRegistry, EventProcessor, type ExecuteToolWithAttachmentsParams, type ExecuteToolWithAttachmentsResult, type ExtendedCallbackContext, type ExtendedCallbackHandler, ExternalGraphBuilder, FileBasedDiscovery, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, type IAgentToolConfig, type IAgentToolConfiguration, type IAttachment, type IBaseEntity, type IChartDataPoint, type IChartDataset, type IChartValue, type IContentBlock, type IContentChain, type IDeletionInfo, type IGenericGraphType, type IGraphAttachment, type IGraphBuilder, type IGraphCompiler, type IGraphConfigurable, type IGraphEngine, type IGraphLogger, type IGraphManifest, type IGraphMetadata, type IGraphMetadataRegistry, type IGraphRequestPayload, type IGraphResponsePayload, type IGraphRunnableConfig, type IGraphService, type IGraphServiceRegistry, type IGraphSettingsRepository, type IGraphTraceEvent, type IGraphTracer, type IGraphTypeMetadata, type IGraphTypeRegistry, type ILangGraphConfig, type IModelInitializer, type IReasoningChain, type IReasoningStep, type IStoredMessageContent, type ISystemToolCredentials, type IToolCall, type IToolCatalog, type IToolConfigOption, type IToolExecutionContext, type ITracingEvent, type IUsageMetrics, type IUsageRecorder, type IdempotencyConfig, type IdempotencyEntry, IdempotencyManager, IdempotencyStatus, type KnowledgeBaseInfo, type LLMCallRecord, type LLMConfig, type LLModel, LangGraphEngine, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreator, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, type RateLimitConfig, type RateLimitResult, type RequestContext, type RerankModelCreator, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TelegramPatchHandler, type ToolExecutionResult, type TraceApiCallResult, type TracingLevel, UIDispatchController, type UIDispatchDto, UIEndpoint, type UIEndpointClassMetadata, type UIEndpointMethodMetadata, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, type UniversalGraphModuleOptions, UniversalGraphService, type VersionResolution, type VersionResolutionOptions, type VersionRoute, VersionedGraphService, type VersioningConfig, VoyageAIRerank, type VoyageAIRerankConfig, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bootstrap, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, dispatchAttachments, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, generateAttachmentSummary, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, registerFinanceExampleCallback, registerUIEndpointsFromClass, sanitizeTraceData, storeAttachmentData, traceApiCall };
1667
+ interface OAuthTokens {
1668
+ accessToken: string;
1669
+ refreshToken: string;
1670
+ expiresAt: number;
1671
+ }
1672
+ interface OAuthProviderConfig {
1673
+ provider: string;
1674
+ tokenUrl: string;
1675
+ clientId: string;
1676
+ clientSecret: string;
1677
+ }
1678
+ interface IOAuthTokenStore {
1679
+ get(provider: string): Promise<string | null>;
1680
+ save(provider: string, encrypted: string): Promise<void>;
1681
+ delete(provider: string): Promise<void>;
1682
+ }
1683
+ interface OAuthTokenManagerOptions {
1684
+ store: IOAuthTokenStore;
1685
+ encryptionKey: string;
1686
+ }
1687
+
1688
+ declare class OAuthTokenManager {
1689
+ private readonly store;
1690
+ private readonly encryptionKey;
1691
+ private readonly cache;
1692
+ constructor(options: OAuthTokenManagerOptions);
1693
+ getAccessToken(config: OAuthProviderConfig): Promise<string>;
1694
+ saveTokens(provider: string, tokens: OAuthTokens): Promise<void>;
1695
+ revokeTokens(provider: string): Promise<void>;
1696
+ hasTokens(provider: string): Promise<boolean>;
1697
+ private refreshAccessToken;
1698
+ private persistTokens;
1699
+ private setCache;
1700
+ }
1701
+
1702
+ declare function encryptTokens(tokens: OAuthTokens, key: string): string;
1703
+ declare function decryptTokens(encrypted: string, key: string): OAuthTokens;
1704
+
1705
+ declare class FileTokenStore implements IOAuthTokenStore {
1706
+ private readonly filePath;
1707
+ constructor(filePath: string);
1708
+ get(provider: string): Promise<string | null>;
1709
+ save(provider: string, encrypted: string): Promise<void>;
1710
+ delete(provider: string): Promise<void>;
1711
+ private readFile;
1712
+ private writeFile;
1713
+ }
1714
+
1715
+ declare class MongoTokenStore implements IOAuthTokenStore {
1716
+ private readonly db;
1717
+ private readonly collectionName;
1718
+ private initialized;
1719
+ constructor(db: Db, collectionName?: string);
1720
+ get(provider: string): Promise<string | null>;
1721
+ save(provider: string, encrypted: string): Promise<void>;
1722
+ delete(provider: string): Promise<void>;
1723
+ private ensureIndex;
1724
+ }
1725
+
1726
+ export { type ACLValidationResult, AbstractGraphBuilder, type ApiCallTracerOptions, type ApiKeyResolver, AttachmentType, type AuditEntry, type BaseGraphConfig, type BaseGraphContext, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, type BaseGraphState, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, type CallbackContext, CallbackController, type CallbackEntry, type CallbackHandler, type CallbackMetadata, CallbackMetrics, type CallbackPatch, type CallbackPatchHandler, CallbackPatchService, CallbackRateLimiter, type CallbackRecord, CallbackRegistry, type CallbackRequest, type CallbackResult, CallbackStore, CallbackTokenGuard, type CallbackUser, type ChannelState, type ChartType, ChatFeature, type ChatModelCreator, type ChatModelOrRunnable, type ChatModelWithTools, type CitationValue, type CompiledGraphFor, type CustomDocument, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_TRACER_OPTIONS, type DataEnvelope, ENDPOINT_METADATA_KEY, type EmbeddingModelCreator, Endpoint, type EndpointDescriptor, type EndpointHandler, type EndpointMetadata, type EndpointOptions, EndpointRegistry, EventProcessor, type ExecuteToolWithAttachmentsParams, type ExecuteToolWithAttachmentsResult, type ExtendedCallbackContext, type ExtendedCallbackHandler, ExternalGraphBuilder, FileBasedDiscovery, FileTokenStore, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, type IAgentToolConfig, type IAgentToolConfiguration, type IAttachment, type IBaseEntity, type IChartDataPoint, type IChartDataset, type IChartValue, type IContentBlock, type IContentChain, type IDeletionInfo, type IGenericGraphType, type IGraphAttachment, type IGraphBuilder, type IGraphCompiler, type IGraphConfigurable, type IGraphEngine, type IGraphLogger, type IGraphManifest, type IGraphMetadata, type IGraphMetadataRegistry, type IGraphRequestPayload, type IGraphResponsePayload, type IGraphRunnableConfig, type IGraphService, type IGraphServiceRegistry, type IGraphSettingsRepository, type IGraphTraceEvent, type IGraphTracer, type IGraphTypeMetadata, type IGraphTypeRegistry, type ILangGraphConfig, type IModelInitializer, type IOAuthTokenStore, type IReasoningChain, type IReasoningStep, type IStoredMessageContent, type ISystemToolCredentials, type IToolCall, type IToolCatalog, type IToolConfigOption, type IToolExecutionContext, type ITracingEvent, type IUsageMetrics, type IUsageRecorder, type IdempotencyConfig, type IdempotencyEntry, IdempotencyManager, IdempotencyStatus, type KnowledgeBaseInfo, type LLMCallRecord, type LLMConfig, type LLModel, LangGraphEngine, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, type RateLimitConfig, type RateLimitResult, type RequestContext, type RerankModelCreator, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TelegramPatchHandler, type ToolExecutionResult, type TraceApiCallResult, type TracingLevel, UIDispatchController, type UIDispatchDto, UIEndpoint, type UIEndpointClassMetadata, type UIEndpointMethodMetadata, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, type UniversalGraphModuleOptions, UniversalGraphService, type VersionResolution, type VersionResolutionOptions, type VersionRoute, VersionedGraphService, type VersioningConfig, VoyageAIRerank, type VoyageAIRerankConfig, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bootstrap, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, decryptTokens, dispatchAttachments, encryptTokens, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, generateAttachmentSummary, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, registerFinanceExampleCallback, registerUIEndpointsFromClass, sanitizeTraceData, storeAttachmentData, traceApiCall };