@flutchai/flutch-sdk 0.7.2 → 0.7.4
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.cjs +41 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +41 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1667,6 +1667,7 @@ interface StreamAccumulator {
|
|
|
1667
1667
|
attachments: IAttachment[];
|
|
1668
1668
|
metadata: Record<string, any>;
|
|
1669
1669
|
traceEvents: IGraphTraceEvent[];
|
|
1670
|
+
traceMessages: TraceMessageStore;
|
|
1670
1671
|
traceStartedAt: number | null;
|
|
1671
1672
|
traceCompletedAt: number | null;
|
|
1672
1673
|
}
|
|
@@ -1685,6 +1686,7 @@ declare class EventProcessor {
|
|
|
1685
1686
|
content: IStoredMessageContent;
|
|
1686
1687
|
trace: {
|
|
1687
1688
|
events: IGraphTraceEvent[];
|
|
1689
|
+
messages: Record<string, unknown>;
|
|
1688
1690
|
startedAt: number;
|
|
1689
1691
|
completedAt: number;
|
|
1690
1692
|
durationMs: number;
|
|
@@ -1694,7 +1696,11 @@ declare class EventProcessor {
|
|
|
1694
1696
|
private captureTraceEvent;
|
|
1695
1697
|
private normalizeTraceEvent;
|
|
1696
1698
|
}
|
|
1697
|
-
|
|
1699
|
+
interface TraceMessageStore {
|
|
1700
|
+
messages: Record<string, unknown>;
|
|
1701
|
+
keys: WeakMap<object, string>;
|
|
1702
|
+
}
|
|
1703
|
+
declare function refTraceMessages(value: unknown, store: TraceMessageStore, depth?: number): unknown;
|
|
1698
1704
|
|
|
1699
1705
|
declare class LangGraphEngine implements IGraphEngine {
|
|
1700
1706
|
private readonly eventProcessor;
|
|
@@ -1947,4 +1953,4 @@ declare class MongoTokenStore implements IOAuthTokenStore {
|
|
|
1947
1953
|
private ensureIndex;
|
|
1948
1954
|
}
|
|
1949
1955
|
|
|
1950
|
-
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_ROUTER_URL, DEFAULT_TOOL_SEARCH_MIN_TOOLS, DEFAULT_TOOL_SEARCH_RESULTS, 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, FlutchChatBedrockConverse, type FlutchContext, 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 LangchainReasoningBlock, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, type OAuthProviderDef, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, PROMPT_CACHE_MIN_VERSIONS, type PostgresConfig, type PromptCacheControl, type PromptCacheTtl, type RateLimitConfig, type RateLimitResult, type ReasoningEffort, type RequestContext, type RerankModelCreator, type ResolvedSamplingParams, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, SAMPLING_PARAM_FREE_THRESHOLDS, type SamplingParams, type SanitizedHistory, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TOOL_SEARCH_NAME, TelegramPatchHandler, type ToolConfig, type ToolExecutionResult, ToolSearchCatalog, type ToolSearchEntry, type ToolSearchHit, type ToolSearchMode, type ToolSearchOptions, 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, bindToolsWithSearch, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore,
|
|
1956
|
+
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_ROUTER_URL, DEFAULT_TOOL_SEARCH_MIN_TOOLS, DEFAULT_TOOL_SEARCH_RESULTS, 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, FlutchChatBedrockConverse, type FlutchContext, 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 LangchainReasoningBlock, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, type OAuthProviderDef, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, PROMPT_CACHE_MIN_VERSIONS, type PostgresConfig, type PromptCacheControl, type PromptCacheTtl, type RateLimitConfig, type RateLimitResult, type ReasoningEffort, type RequestContext, type RerankModelCreator, type ResolvedSamplingParams, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, SAMPLING_PARAM_FREE_THRESHOLDS, type SamplingParams, type SanitizedHistory, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TOOL_SEARCH_NAME, TelegramPatchHandler, type ToolConfig, type ToolExecutionResult, ToolSearchCatalog, type ToolSearchEntry, type ToolSearchHit, type ToolSearchMode, type ToolSearchOptions, type TraceApiCallResult, type TraceMessageStore, 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, bindToolsWithSearch, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, createToolSearchTool, decryptTokens, dispatchAttachments, encryptTokens, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, flutchFetch, flutchHeaders, flutchMistralHook, formatToolSearchResult, generateAttachmentSummary, generateModelCacheKey, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getFlutchContext, getOAuthProvider, getOAuthProviderNames, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, hashToolsConfig, isInternalMode, isReasoningBlock, isReasoningModel, isSendableReasoningBlock, isToolSearchCall, joinTextSteps, loadOAuthProviders, loadedToolNames, modelAcceptsSamplingParams, modelSupportsPromptCache, normalizeToolConfigs, parseToolSearchResult, redactConnectionString, refTraceMessages, registerFinanceExampleCallback, registerUIEndpointsFromClass, resolveOAuthProviderConfig, resolvePromptCacheControl, resolveRouterURL, resolveSamplingParams, rewriteToolReferences, sanitizeMessageReasoning, sanitizeReasoningForBedrock, sanitizeTraceData, splitTools, storeAttachmentData, toOptionalNumber, toolSearchApplies, toolSearchTerms, traceApiCall, withFlutchContext, withToolReferences, wrapCohereFetcher };
|
package/dist/index.d.ts
CHANGED
|
@@ -1667,6 +1667,7 @@ interface StreamAccumulator {
|
|
|
1667
1667
|
attachments: IAttachment[];
|
|
1668
1668
|
metadata: Record<string, any>;
|
|
1669
1669
|
traceEvents: IGraphTraceEvent[];
|
|
1670
|
+
traceMessages: TraceMessageStore;
|
|
1670
1671
|
traceStartedAt: number | null;
|
|
1671
1672
|
traceCompletedAt: number | null;
|
|
1672
1673
|
}
|
|
@@ -1685,6 +1686,7 @@ declare class EventProcessor {
|
|
|
1685
1686
|
content: IStoredMessageContent;
|
|
1686
1687
|
trace: {
|
|
1687
1688
|
events: IGraphTraceEvent[];
|
|
1689
|
+
messages: Record<string, unknown>;
|
|
1688
1690
|
startedAt: number;
|
|
1689
1691
|
completedAt: number;
|
|
1690
1692
|
durationMs: number;
|
|
@@ -1694,7 +1696,11 @@ declare class EventProcessor {
|
|
|
1694
1696
|
private captureTraceEvent;
|
|
1695
1697
|
private normalizeTraceEvent;
|
|
1696
1698
|
}
|
|
1697
|
-
|
|
1699
|
+
interface TraceMessageStore {
|
|
1700
|
+
messages: Record<string, unknown>;
|
|
1701
|
+
keys: WeakMap<object, string>;
|
|
1702
|
+
}
|
|
1703
|
+
declare function refTraceMessages(value: unknown, store: TraceMessageStore, depth?: number): unknown;
|
|
1698
1704
|
|
|
1699
1705
|
declare class LangGraphEngine implements IGraphEngine {
|
|
1700
1706
|
private readonly eventProcessor;
|
|
@@ -1947,4 +1953,4 @@ declare class MongoTokenStore implements IOAuthTokenStore {
|
|
|
1947
1953
|
private ensureIndex;
|
|
1948
1954
|
}
|
|
1949
1955
|
|
|
1950
|
-
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_ROUTER_URL, DEFAULT_TOOL_SEARCH_MIN_TOOLS, DEFAULT_TOOL_SEARCH_RESULTS, 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, FlutchChatBedrockConverse, type FlutchContext, 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 LangchainReasoningBlock, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, type OAuthProviderDef, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, PROMPT_CACHE_MIN_VERSIONS, type PostgresConfig, type PromptCacheControl, type PromptCacheTtl, type RateLimitConfig, type RateLimitResult, type ReasoningEffort, type RequestContext, type RerankModelCreator, type ResolvedSamplingParams, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, SAMPLING_PARAM_FREE_THRESHOLDS, type SamplingParams, type SanitizedHistory, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TOOL_SEARCH_NAME, TelegramPatchHandler, type ToolConfig, type ToolExecutionResult, ToolSearchCatalog, type ToolSearchEntry, type ToolSearchHit, type ToolSearchMode, type ToolSearchOptions, 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, bindToolsWithSearch, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore,
|
|
1956
|
+
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_ROUTER_URL, DEFAULT_TOOL_SEARCH_MIN_TOOLS, DEFAULT_TOOL_SEARCH_RESULTS, 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, FlutchChatBedrockConverse, type FlutchContext, 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 LangchainReasoningBlock, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, type OAuthProviderDef, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, PROMPT_CACHE_MIN_VERSIONS, type PostgresConfig, type PromptCacheControl, type PromptCacheTtl, type RateLimitConfig, type RateLimitResult, type ReasoningEffort, type RequestContext, type RerankModelCreator, type ResolvedSamplingParams, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, SAMPLING_PARAM_FREE_THRESHOLDS, type SamplingParams, type SanitizedHistory, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TOOL_SEARCH_NAME, TelegramPatchHandler, type ToolConfig, type ToolExecutionResult, ToolSearchCatalog, type ToolSearchEntry, type ToolSearchHit, type ToolSearchMode, type ToolSearchOptions, type TraceApiCallResult, type TraceMessageStore, 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, bindToolsWithSearch, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, createToolSearchTool, decryptTokens, dispatchAttachments, encryptTokens, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, flutchFetch, flutchHeaders, flutchMistralHook, formatToolSearchResult, generateAttachmentSummary, generateModelCacheKey, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getFlutchContext, getOAuthProvider, getOAuthProviderNames, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, hashToolsConfig, isInternalMode, isReasoningBlock, isReasoningModel, isSendableReasoningBlock, isToolSearchCall, joinTextSteps, loadOAuthProviders, loadedToolNames, modelAcceptsSamplingParams, modelSupportsPromptCache, normalizeToolConfigs, parseToolSearchResult, redactConnectionString, refTraceMessages, registerFinanceExampleCallback, registerUIEndpointsFromClass, resolveOAuthProviderConfig, resolvePromptCacheControl, resolveRouterURL, resolveSamplingParams, rewriteToolReferences, sanitizeMessageReasoning, sanitizeReasoningForBedrock, sanitizeTraceData, splitTools, storeAttachmentData, toOptionalNumber, toolSearchApplies, toolSearchTerms, traceApiCall, withFlutchContext, withToolReferences, wrapCohereFetcher };
|
package/dist/index.js
CHANGED
|
@@ -5182,6 +5182,10 @@ var EventProcessor = class _EventProcessor {
|
|
|
5182
5182
|
attachments: [],
|
|
5183
5183
|
metadata: {},
|
|
5184
5184
|
traceEvents: [],
|
|
5185
|
+
traceMessages: {
|
|
5186
|
+
messages: {},
|
|
5187
|
+
keys: /* @__PURE__ */ new WeakMap()
|
|
5188
|
+
},
|
|
5185
5189
|
traceStartedAt: null,
|
|
5186
5190
|
traceCompletedAt: null
|
|
5187
5191
|
};
|
|
@@ -5583,6 +5587,7 @@ var EventProcessor = class _EventProcessor {
|
|
|
5583
5587
|
const completedAt = acc.traceCompletedAt ?? startedAt;
|
|
5584
5588
|
const trace = acc.traceEvents.length > 0 ? {
|
|
5585
5589
|
events: acc.traceEvents,
|
|
5590
|
+
messages: acc.traceMessages.messages,
|
|
5586
5591
|
startedAt,
|
|
5587
5592
|
completedAt,
|
|
5588
5593
|
durationMs: Math.max(0, completedAt - startedAt),
|
|
@@ -5610,14 +5615,14 @@ var EventProcessor = class _EventProcessor {
|
|
|
5610
5615
|
};
|
|
5611
5616
|
}
|
|
5612
5617
|
captureTraceEvent(acc, event) {
|
|
5613
|
-
const normalized = this.normalizeTraceEvent(event);
|
|
5618
|
+
const normalized = this.normalizeTraceEvent(event, acc.traceMessages);
|
|
5614
5619
|
if (!normalized) {
|
|
5615
5620
|
return;
|
|
5616
5621
|
}
|
|
5617
5622
|
acc.traceEvents.push(normalized);
|
|
5618
5623
|
this.logger.debug(`[TRACE] Captured trace event ${normalized.type} for node ${normalized.nodeName} (${acc.traceEvents.length} total)`);
|
|
5619
5624
|
}
|
|
5620
|
-
normalizeTraceEvent(event) {
|
|
5625
|
+
normalizeTraceEvent(event, traceMessages) {
|
|
5621
5626
|
const type = event?.event ?? event?.type;
|
|
5622
5627
|
if (!type) {
|
|
5623
5628
|
return null;
|
|
@@ -5656,7 +5661,7 @@ var EventProcessor = class _EventProcessor {
|
|
|
5656
5661
|
const metadata = sanitizeTraceData(event?.metadata, 0, /* @__PURE__ */ new WeakSet(), {
|
|
5657
5662
|
maxStringLength: TRACE_MAX_STRING
|
|
5658
5663
|
});
|
|
5659
|
-
const data = sanitizeTraceData(
|
|
5664
|
+
const data = sanitizeTraceData(refTraceMessages(event?.data, traceMessages), 0, /* @__PURE__ */ new WeakSet(), {
|
|
5660
5665
|
maxStringLength: TRACE_MAX_STRING
|
|
5661
5666
|
});
|
|
5662
5667
|
const timestampSource = event?.timestamp ?? event?.time ?? event?.data?.timestamp ?? event?.data?.ts ?? Date.now();
|
|
@@ -5678,39 +5683,39 @@ var EventProcessor = class _EventProcessor {
|
|
|
5678
5683
|
EventProcessor = _ts_decorate21([
|
|
5679
5684
|
Injectable()
|
|
5680
5685
|
], EventProcessor);
|
|
5681
|
-
var TRACE_MAX_STRING =
|
|
5682
|
-
|
|
5683
|
-
function compactTraceMessages(value, depth = 0) {
|
|
5686
|
+
var TRACE_MAX_STRING = 1e5;
|
|
5687
|
+
function refTraceMessages(value, store, depth = 0) {
|
|
5684
5688
|
if (depth > 6 || value === null || typeof value !== "object") return value;
|
|
5685
5689
|
if (Array.isArray(value)) {
|
|
5686
|
-
|
|
5687
|
-
|
|
5690
|
+
if (isHistory(value)) {
|
|
5691
|
+
return value.map((message) => ({
|
|
5692
|
+
_traceMsg: messageKey(message, store)
|
|
5693
|
+
}));
|
|
5694
|
+
}
|
|
5695
|
+
return value.map((item) => refTraceMessages(item, store, depth + 1));
|
|
5688
5696
|
}
|
|
5689
5697
|
const out = {};
|
|
5690
5698
|
for (const [key, item] of Object.entries(value)) {
|
|
5691
|
-
out[key] =
|
|
5699
|
+
out[key] = refTraceMessages(item, store, depth + 1);
|
|
5692
5700
|
}
|
|
5693
5701
|
return out;
|
|
5694
5702
|
}
|
|
5695
|
-
__name(
|
|
5703
|
+
__name(refTraceMessages, "refTraceMessages");
|
|
5704
|
+
function messageKey(message, store) {
|
|
5705
|
+
const known = store.keys.get(message);
|
|
5706
|
+
if (known) return known;
|
|
5707
|
+
const key = `m${Object.keys(store.messages).length + 1}`;
|
|
5708
|
+
store.keys.set(message, key);
|
|
5709
|
+
store.messages[key] = sanitizeTraceData(message, 0, /* @__PURE__ */ new WeakSet(), {
|
|
5710
|
+
maxStringLength: TRACE_MAX_STRING
|
|
5711
|
+
});
|
|
5712
|
+
return key;
|
|
5713
|
+
}
|
|
5714
|
+
__name(messageKey, "messageKey");
|
|
5696
5715
|
function isHistory(items) {
|
|
5697
|
-
return items.length >
|
|
5716
|
+
return items.length > 0 && items.every((item) => item !== null && typeof item === "object" && !Array.isArray(item) && ("lc_kwargs" in item || "content" in item && ("type" in item || "role" in item)));
|
|
5698
5717
|
}
|
|
5699
5718
|
__name(isHistory, "isHistory");
|
|
5700
|
-
function compactHistory(messages) {
|
|
5701
|
-
const keep = TRACE_KEEP_LAST_MESSAGES + 1;
|
|
5702
|
-
if (messages.length <= keep + 1) return messages;
|
|
5703
|
-
const omitted = messages.length - keep;
|
|
5704
|
-
return [
|
|
5705
|
-
messages[0],
|
|
5706
|
-
{
|
|
5707
|
-
type: "trace_omitted",
|
|
5708
|
-
omittedMessages: omitted
|
|
5709
|
-
},
|
|
5710
|
-
...messages.slice(-TRACE_KEEP_LAST_MESSAGES)
|
|
5711
|
-
];
|
|
5712
|
-
}
|
|
5713
|
-
__name(compactHistory, "compactHistory");
|
|
5714
5719
|
var als = new AsyncLocalStorage();
|
|
5715
5720
|
function withFlutchContext(ctx, fn) {
|
|
5716
5721
|
return als.run(ctx, fn);
|
|
@@ -5955,6 +5960,10 @@ var LangGraphEngine = class _LangGraphEngine {
|
|
|
5955
5960
|
traceEvents: trace?.events?.length || 0,
|
|
5956
5961
|
hadError: !!streamError
|
|
5957
5962
|
});
|
|
5963
|
+
if (streamError && isRecursionLimit(streamError) && content?.text?.trim()) {
|
|
5964
|
+
this.logger.warn(`[STREAM-ERROR] Recursion limit reached after the answer was written; returning the answer`);
|
|
5965
|
+
return content;
|
|
5966
|
+
}
|
|
5958
5967
|
if (streamError) {
|
|
5959
5968
|
throw streamError;
|
|
5960
5969
|
}
|
|
@@ -5984,6 +5993,7 @@ var LangGraphEngine = class _LangGraphEngine {
|
|
|
5984
5993
|
agentId: context.agentId || "unknown",
|
|
5985
5994
|
companyId: context.companyId || "unknown",
|
|
5986
5995
|
events: trace.events,
|
|
5996
|
+
messages: trace.messages,
|
|
5987
5997
|
totalEvents: trace.totalEvents,
|
|
5988
5998
|
startedAt: trace.startedAt,
|
|
5989
5999
|
completedAt: trace.completedAt || Date.now(),
|
|
@@ -6070,6 +6080,7 @@ var LangGraphEngine = class _LangGraphEngine {
|
|
|
6070
6080
|
durationMs: payload.durationMs,
|
|
6071
6081
|
status: payload.status || "success",
|
|
6072
6082
|
error: payload.error,
|
|
6083
|
+
messages: payload.messages,
|
|
6073
6084
|
events: payload.events.map((event) => ({
|
|
6074
6085
|
timestamp: event.timestamp ? new Date(event.timestamp).toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
|
|
6075
6086
|
meta: {
|
|
@@ -6161,6 +6172,10 @@ LangGraphEngine = _ts_decorate22([
|
|
|
6161
6172
|
typeof ConfigService === "undefined" ? Object : ConfigService
|
|
6162
6173
|
])
|
|
6163
6174
|
], LangGraphEngine);
|
|
6175
|
+
function isRecursionLimit(error) {
|
|
6176
|
+
return error.name === "GraphRecursionError" || /Recursion limit of \d+ reached/.test(error.message);
|
|
6177
|
+
}
|
|
6178
|
+
__name(isRecursionLimit, "isRecursionLimit");
|
|
6164
6179
|
|
|
6165
6180
|
// src/engines/graph-engine.factory.ts
|
|
6166
6181
|
function _ts_decorate23(decorators, target, key, desc) {
|
|
@@ -9056,6 +9071,6 @@ var MongoTokenStore = class {
|
|
|
9056
9071
|
}
|
|
9057
9072
|
};
|
|
9058
9073
|
|
|
9059
|
-
export { AbstractGraphBuilder, AttachmentType, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, CallbackController, CallbackMetrics, CallbackPatchService, CallbackRateLimiter, CallbackRegistry, CallbackStore, CallbackTokenGuard, ChatFeature, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_ROUTER_URL, DEFAULT_TOOL_SEARCH_MIN_TOOLS, DEFAULT_TOOL_SEARCH_RESULTS, DEFAULT_TRACER_OPTIONS, ENDPOINT_METADATA_KEY, Endpoint, EndpointRegistry, EventProcessor, ExternalGraphBuilder, FileBasedDiscovery, FileTokenStore, FlutchChatBedrockConverse, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, IdempotencyManager, IdempotencyStatus, LangGraphEngine, McpConverter, McpRuntimeHttpClient, McpToolFilter, ModelInitializer, ModelProvider, ModelType, MongoTokenStore, OAuthTokenManager, PROMPT_CACHE_MIN_VERSIONS, RetrieverSearchType, RetrieverService, SAMPLING_PARAM_FREE_THRESHOLDS, SmartCallbackRouter, StaticDiscovery, StreamChannel, TOOL_SEARCH_NAME, TelegramPatchHandler, ToolSearchCatalog, UIDispatchController, UIEndpoint, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, UniversalGraphService, VersionedGraphService, VoyageAIRerank, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bindToolsWithSearch, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore,
|
|
9074
|
+
export { AbstractGraphBuilder, AttachmentType, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, CallbackController, CallbackMetrics, CallbackPatchService, CallbackRateLimiter, CallbackRegistry, CallbackStore, CallbackTokenGuard, ChatFeature, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_ROUTER_URL, DEFAULT_TOOL_SEARCH_MIN_TOOLS, DEFAULT_TOOL_SEARCH_RESULTS, DEFAULT_TRACER_OPTIONS, ENDPOINT_METADATA_KEY, Endpoint, EndpointRegistry, EventProcessor, ExternalGraphBuilder, FileBasedDiscovery, FileTokenStore, FlutchChatBedrockConverse, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, IdempotencyManager, IdempotencyStatus, LangGraphEngine, McpConverter, McpRuntimeHttpClient, McpToolFilter, ModelInitializer, ModelProvider, ModelType, MongoTokenStore, OAuthTokenManager, PROMPT_CACHE_MIN_VERSIONS, RetrieverSearchType, RetrieverService, SAMPLING_PARAM_FREE_THRESHOLDS, SmartCallbackRouter, StaticDiscovery, StreamChannel, TOOL_SEARCH_NAME, TelegramPatchHandler, ToolSearchCatalog, UIDispatchController, UIEndpoint, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, UniversalGraphService, VersionedGraphService, VoyageAIRerank, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bindToolsWithSearch, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, createToolSearchTool, decryptTokens, dispatchAttachments, encryptTokens, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, flutchFetch, flutchHeaders, flutchMistralHook, formatToolSearchResult, generateAttachmentSummary, generateModelCacheKey, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getFlutchContext, getOAuthProvider, getOAuthProviderNames, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, hashToolsConfig, isInternalMode, isReasoningBlock, isReasoningModel, isSendableReasoningBlock, isToolSearchCall, joinTextSteps, loadOAuthProviders, loadedToolNames, modelAcceptsSamplingParams, modelSupportsPromptCache, normalizeToolConfigs, parseToolSearchResult, redactConnectionString, refTraceMessages, registerFinanceExampleCallback, registerUIEndpointsFromClass, resolveOAuthProviderConfig, resolvePromptCacheControl, resolveRouterURL, resolveSamplingParams, rewriteToolReferences, sanitizeMessageReasoning, sanitizeReasoningForBedrock, sanitizeTraceData, splitTools, storeAttachmentData, toOptionalNumber, toolSearchApplies, toolSearchTerms, traceApiCall, withFlutchContext, withToolReferences, wrapCohereFetcher };
|
|
9060
9075
|
//# sourceMappingURL=index.js.map
|
|
9061
9076
|
//# sourceMappingURL=index.js.map
|