@flutchai/flutch-sdk 0.7.3 → 0.7.5

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
@@ -1051,6 +1051,7 @@ declare class ToolSearchCatalog {
1051
1051
  get size(): number;
1052
1052
  has(name: string): boolean;
1053
1053
  search(query: string, limit: number): ToolSearchHit[];
1054
+ index(): string;
1054
1055
  summary(maxGroups?: number): string;
1055
1056
  }
1056
1057
 
@@ -1065,6 +1066,7 @@ interface ToolSearchOptions {
1065
1066
  alwaysLoaded?: string[] | string;
1066
1067
  maxResults?: number;
1067
1068
  minTools?: number;
1069
+ index?: boolean;
1068
1070
  }
1069
1071
  declare const DEFAULT_TOOL_SEARCH_RESULTS = 5;
1070
1072
  declare const DEFAULT_TOOL_SEARCH_MIN_TOOLS = 15;
@@ -1074,7 +1076,7 @@ declare function splitTools(tools: StructuredTool[], options: ToolSearchOptions,
1074
1076
  core: StructuredTool[];
1075
1077
  deferred: StructuredTool[];
1076
1078
  };
1077
- declare function createToolSearchTool(catalog: ToolSearchCatalog, maxResults?: number): DynamicStructuredTool;
1079
+ declare function createToolSearchTool(catalog: ToolSearchCatalog, maxResults?: number, index?: boolean): DynamicStructuredTool;
1078
1080
  type BindOptions = Parameters<BaseChatModel["bindTools"]>[1];
1079
1081
  declare function bindToolsWithSearch(params: {
1080
1082
  model: BaseChatModel;
@@ -1156,7 +1158,8 @@ declare function normalizeToolConfigs(tools?: ToolConfig[]): IAgentToolConfig[]
1156
1158
  declare const DEFAULT_ROUTER_URL = "https://router.flutch.ai";
1157
1159
  declare function resolveRouterURL(baseURL?: string): string | undefined;
1158
1160
  declare function generateModelCacheKey(modelId: string, temperature?: number, maxTokens?: number, toolsConfig?: IAgentToolConfig[], baseURL?: string): string;
1159
- declare function buildOpenAIModelConfig(modelName: string, temperature: number | undefined, maxTokens: number | undefined, apiToken: string): Record<string, any>;
1161
+ declare function toOpenAIEffort(effort: ReasoningEffort): "low" | "medium" | "high" | "xhigh";
1162
+ declare function buildOpenAIModelConfig(modelName: string, temperature: number | undefined, maxTokens: number | undefined, apiToken: string, effort?: ReasoningEffort): Record<string, any>;
1160
1163
 
1161
1164
  type ToolConfig = string | {
1162
1165
  name: string;
@@ -1953,4 +1956,4 @@ declare class MongoTokenStore implements IOAuthTokenStore {
1953
1956
  private ensureIndex;
1954
1957
  }
1955
1958
 
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 };
1959
+ 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, toOpenAIEffort, toOptionalNumber, toolSearchApplies, toolSearchTerms, traceApiCall, withFlutchContext, withToolReferences, wrapCohereFetcher };
package/dist/index.d.ts CHANGED
@@ -1051,6 +1051,7 @@ declare class ToolSearchCatalog {
1051
1051
  get size(): number;
1052
1052
  has(name: string): boolean;
1053
1053
  search(query: string, limit: number): ToolSearchHit[];
1054
+ index(): string;
1054
1055
  summary(maxGroups?: number): string;
1055
1056
  }
1056
1057
 
@@ -1065,6 +1066,7 @@ interface ToolSearchOptions {
1065
1066
  alwaysLoaded?: string[] | string;
1066
1067
  maxResults?: number;
1067
1068
  minTools?: number;
1069
+ index?: boolean;
1068
1070
  }
1069
1071
  declare const DEFAULT_TOOL_SEARCH_RESULTS = 5;
1070
1072
  declare const DEFAULT_TOOL_SEARCH_MIN_TOOLS = 15;
@@ -1074,7 +1076,7 @@ declare function splitTools(tools: StructuredTool[], options: ToolSearchOptions,
1074
1076
  core: StructuredTool[];
1075
1077
  deferred: StructuredTool[];
1076
1078
  };
1077
- declare function createToolSearchTool(catalog: ToolSearchCatalog, maxResults?: number): DynamicStructuredTool;
1079
+ declare function createToolSearchTool(catalog: ToolSearchCatalog, maxResults?: number, index?: boolean): DynamicStructuredTool;
1078
1080
  type BindOptions = Parameters<BaseChatModel["bindTools"]>[1];
1079
1081
  declare function bindToolsWithSearch(params: {
1080
1082
  model: BaseChatModel;
@@ -1156,7 +1158,8 @@ declare function normalizeToolConfigs(tools?: ToolConfig[]): IAgentToolConfig[]
1156
1158
  declare const DEFAULT_ROUTER_URL = "https://router.flutch.ai";
1157
1159
  declare function resolveRouterURL(baseURL?: string): string | undefined;
1158
1160
  declare function generateModelCacheKey(modelId: string, temperature?: number, maxTokens?: number, toolsConfig?: IAgentToolConfig[], baseURL?: string): string;
1159
- declare function buildOpenAIModelConfig(modelName: string, temperature: number | undefined, maxTokens: number | undefined, apiToken: string): Record<string, any>;
1161
+ declare function toOpenAIEffort(effort: ReasoningEffort): "low" | "medium" | "high" | "xhigh";
1162
+ declare function buildOpenAIModelConfig(modelName: string, temperature: number | undefined, maxTokens: number | undefined, apiToken: string, effort?: ReasoningEffort): Record<string, any>;
1160
1163
 
1161
1164
  type ToolConfig = string | {
1162
1165
  name: string;
@@ -1953,4 +1956,4 @@ declare class MongoTokenStore implements IOAuthTokenStore {
1953
1956
  private ensureIndex;
1954
1957
  }
1955
1958
 
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 };
1959
+ 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, toOpenAIEffort, toOptionalNumber, toolSearchApplies, toolSearchTerms, traceApiCall, withFlutchContext, withToolReferences, wrapCohereFetcher };
package/dist/index.js CHANGED
@@ -5960,6 +5960,10 @@ var LangGraphEngine = class _LangGraphEngine {
5960
5960
  traceEvents: trace?.events?.length || 0,
5961
5961
  hadError: !!streamError
5962
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
+ }
5963
5967
  if (streamError) {
5964
5968
  throw streamError;
5965
5969
  }
@@ -6168,6 +6172,10 @@ LangGraphEngine = _ts_decorate22([
6168
6172
  typeof ConfigService === "undefined" ? Object : ConfigService
6169
6173
  ])
6170
6174
  ], LangGraphEngine);
6175
+ function isRecursionLimit(error) {
6176
+ return error.name === "GraphRecursionError" || /Recursion limit of \d+ reached/.test(error.message);
6177
+ }
6178
+ __name(isRecursionLimit, "isRecursionLimit");
6171
6179
 
6172
6180
  // src/engines/graph-engine.factory.ts
6173
6181
  function _ts_decorate23(decorators, target, key, desc) {
@@ -7131,6 +7139,14 @@ function shortDescription(description) {
7131
7139
  return sentenceEnd > HIT_DESCRIPTION_CHARS / 2 ? cut.slice(0, sentenceEnd + 1) : `${cut.trimEnd()}\u2026`;
7132
7140
  }
7133
7141
  __name(shortDescription, "shortDescription");
7142
+ var INDEX_DESCRIPTION_CHARS = 100;
7143
+ function indexDescription(description) {
7144
+ const flat = description.replace(/\s+/g, " ").trim();
7145
+ const sentenceEnd = flat.search(/[.!?](\s|$)/);
7146
+ const sentence = sentenceEnd >= 0 ? flat.slice(0, sentenceEnd) : flat;
7147
+ return sentence.length <= INDEX_DESCRIPTION_CHARS ? sentence : `${sentence.slice(0, INDEX_DESCRIPTION_CHARS).trimEnd()}\u2026`;
7148
+ }
7149
+ __name(indexDescription, "indexDescription");
7134
7150
  var ToolSearchCatalog = class {
7135
7151
  static {
7136
7152
  __name(this, "ToolSearchCatalog");
@@ -7205,6 +7221,17 @@ var ToolSearchCatalog = class {
7205
7221
  }));
7206
7222
  }
7207
7223
  /**
7224
+ * Every tool of the catalog on its own line: its name and the start of its
7225
+ * description. Costs a few tokens per tool instead of a full schema, and
7226
+ * lets the model ask for a tool by its exact name.
7227
+ */
7228
+ index() {
7229
+ return this.entries.map((entry) => {
7230
+ const brief = indexDescription(entry.description);
7231
+ return brief ? `- ${entry.name}: ${brief}` : `- ${entry.name}`;
7232
+ }).join("\n");
7233
+ }
7234
+ /**
7208
7235
  * What the catalog covers, as name prefixes with counts:
7209
7236
  * "funnel_* (4), recipe_* (5), rl_* (41)". Goes into the search tool's
7210
7237
  * description so the model knows a search is worth making. Sorted, so the
@@ -7299,10 +7326,13 @@ function splitTools(tools, options, extraCore = []) {
7299
7326
  };
7300
7327
  }
7301
7328
  __name(splitTools, "splitTools");
7302
- function createToolSearchTool(catalog, maxResults = DEFAULT_TOOL_SEARCH_RESULTS) {
7329
+ function createToolSearchTool(catalog, maxResults = DEFAULT_TOOL_SEARCH_RESULTS, index = false) {
7330
+ const covered = index ? `${catalog.size} more are found by search:
7331
+ ${catalog.index()}
7332
+ ` : `${catalog.size} more are found by search: ${catalog.summary()}. `;
7303
7333
  return new DynamicStructuredTool({
7304
7334
  name: TOOL_SEARCH_NAME,
7305
- description: `Find more tools. You see only some of your tools; ${catalog.size} more are found by search: ${catalog.summary()}. Describe the task in a few words (what to do and with what, e.g. "customer review quotes by theme"), or give exact tool names. Found tools become callable right away and stay available for the rest of the conversation. Search before saying you cannot do something.`,
7335
+ description: `Find more tools. You see only some of your tools; ${covered}` + (index ? "Give the exact names of the tools you need, separated by commas, or describe the task in a few words. " : 'Describe the task in a few words (what to do and with what, e.g. "customer review quotes by theme"), or give exact tool names. ') + "Found tools become callable right away and stay available for the rest of the conversation. Search before saying you cannot do something.",
7306
7336
  schema: z.object({
7307
7337
  query: z.string().describe("What the tool should do, in a few words, or tool names separated by commas"),
7308
7338
  limit: z.number().int().min(1).max(20).optional().describe(`How many tools to return (default ${maxResults})`)
@@ -7584,7 +7614,11 @@ function generateModelCacheKey(modelId, temperature, maxTokens, toolsConfig, bas
7584
7614
  return parts.join(":");
7585
7615
  }
7586
7616
  __name(generateModelCacheKey, "generateModelCacheKey");
7587
- function buildOpenAIModelConfig(modelName, temperature, maxTokens, apiToken) {
7617
+ function toOpenAIEffort(effort) {
7618
+ return effort === "max" ? "xhigh" : effort;
7619
+ }
7620
+ __name(toOpenAIEffort, "toOpenAIEffort");
7621
+ function buildOpenAIModelConfig(modelName, temperature, maxTokens, apiToken, effort) {
7588
7622
  if (isReasoningModel(modelName)) {
7589
7623
  return {
7590
7624
  modelName,
@@ -7592,7 +7626,14 @@ function buildOpenAIModelConfig(modelName, temperature, maxTokens, apiToken) {
7592
7626
  maxCompletionTokens: maxTokens,
7593
7627
  streaming: true,
7594
7628
  useResponsesApi: true,
7595
- apiKey: apiToken
7629
+ apiKey: apiToken,
7630
+ // Responses API `reasoning.effort`. Omitted when unset, so the request
7631
+ // stays what it was and the model keeps its own default.
7632
+ ...effort && {
7633
+ reasoning: {
7634
+ effort: toOpenAIEffort(effort)
7635
+ }
7636
+ }
7596
7637
  };
7597
7638
  }
7598
7639
  return {
@@ -7859,8 +7900,8 @@ var ModelInitializer = class _ModelInitializer {
7859
7900
  }
7860
7901
  // Chat model creators
7861
7902
  chatModelCreators = {
7862
- [ModelProvider.OPENAI]: ({ modelName, defaultTemperature, defaultMaxTokens, apiToken, baseURL }) => {
7863
- const config = buildOpenAIModelConfig(modelName, defaultTemperature, defaultMaxTokens, apiToken || this.resolveApiKey(ModelProvider.OPENAI) || "");
7903
+ [ModelProvider.OPENAI]: ({ modelName, defaultTemperature, defaultMaxTokens, apiToken, baseURL, defaultEffort }) => {
7904
+ const config = buildOpenAIModelConfig(modelName, defaultTemperature, defaultMaxTokens, apiToken || this.resolveApiKey(ModelProvider.OPENAI) || "", defaultEffort);
7864
7905
  const routerURL = resolveRouterURL(baseURL);
7865
7906
  if (routerURL) {
7866
7907
  config.configuration = {
@@ -8092,7 +8133,8 @@ var ModelInitializer = class _ModelInitializer {
8092
8133
  ...modelConfig,
8093
8134
  defaultTemperature: sampling.temperature,
8094
8135
  defaultMaxTokens: toOptionalNumber(config.maxTokens) ?? toOptionalNumber(modelConfig.defaultMaxTokens),
8095
- baseURL: config.baseURL ?? modelConfig.baseURL
8136
+ baseURL: config.baseURL ?? modelConfig.baseURL,
8137
+ defaultEffort: config.effort ?? modelConfig.defaultEffort
8096
8138
  };
8097
8139
  const promptCacheControl = resolvePromptCacheControl([
8098
8140
  finalConfig.bedrockModelId,
@@ -8213,7 +8255,7 @@ var ModelInitializer = class _ModelInitializer {
8213
8255
  ...customTools ?? []
8214
8256
  ],
8215
8257
  deferred,
8216
- searchTool: createToolSearchTool(catalog, maxResults),
8258
+ searchTool: createToolSearchTool(catalog, maxResults, toolSearch.options.index === true),
8217
8259
  mode,
8218
8260
  bindOptions: promptCacheControl ? boundOptions : void 0
8219
8261
  });
@@ -9063,6 +9105,6 @@ var MongoTokenStore = class {
9063
9105
  }
9064
9106
  };
9065
9107
 
9066
- 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 };
9108
+ 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, toOpenAIEffort, toOptionalNumber, toolSearchApplies, toolSearchTerms, traceApiCall, withFlutchContext, withToolReferences, wrapCohereFetcher };
9067
9109
  //# sourceMappingURL=index.js.map
9068
9110
  //# sourceMappingURL=index.js.map