@librechat/agents 3.5.0 → 3.5.1
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/types/agents/AgentContext.d.ts +3 -3
- package/dist/types/agents/projection.d.ts +1 -1
- package/dist/types/events.d.ts +2 -2
- package/dist/types/graphs/Graph.d.ts +11 -11
- package/dist/types/graphs/MultiAgentGraph.d.ts +2 -2
- package/dist/types/graphs/createGraph.d.ts +4 -4
- package/dist/types/graphs/graphFactory.d.ts +1 -1
- package/dist/types/hitl/askUserQuestion.d.ts +1 -1
- package/dist/types/hitl/askUserQuestions.d.ts +1 -1
- package/dist/types/hitl/askUserQuestionsInterrupt.d.ts +1 -1
- package/dist/types/hooks/types.d.ts +1 -1
- package/dist/types/instrumentation.d.ts +1 -1
- package/dist/types/langfuse.d.ts +3 -3
- package/dist/types/langfuseConfig.d.ts +2 -2
- package/dist/types/langfuseRuntimeContext.d.ts +1 -1
- package/dist/types/langfuseRuntimeScope.d.ts +2 -2
- package/dist/types/langfuseSpanRegistry.d.ts +1 -1
- package/dist/types/langfuseToolOutputTracing.d.ts +3 -3
- package/dist/types/llm/anthropic/index.d.ts +1 -1
- package/dist/types/llm/bedrock/index.d.ts +1 -1
- package/dist/types/llm/bedrock/toolCache.d.ts +2 -2
- package/dist/types/llm/contextOverflowRecovery.d.ts +2 -2
- package/dist/types/llm/google/index.d.ts +1 -1
- package/dist/types/llm/init.d.ts +2 -2
- package/dist/types/llm/invoke.d.ts +6 -6
- package/dist/types/llm/mistral/index.d.ts +1 -1
- package/dist/types/llm/openai/index.d.ts +2 -2
- package/dist/types/llm/openrouter/index.d.ts +2 -2
- package/dist/types/llm/openrouter/toolCache.d.ts +2 -2
- package/dist/types/llm/providers.d.ts +2 -2
- package/dist/types/llm/request.d.ts +2 -2
- package/dist/types/llm/stream/chunkAdapters.d.ts +1 -1
- package/dist/types/llm/streamLimits.d.ts +1 -1
- package/dist/types/llm/truncation.d.ts +1 -1
- package/dist/types/llm/vertexai/index.d.ts +1 -1
- package/dist/types/messages/alternation.d.ts +1 -1
- package/dist/types/messages/anthropicToolCache.d.ts +2 -2
- package/dist/types/messages/assistantPhase.d.ts +3 -3
- package/dist/types/messages/budget.d.ts +1 -1
- package/dist/types/messages/cache.d.ts +1 -1
- package/dist/types/messages/contextPruning.d.ts +2 -2
- package/dist/types/messages/core.d.ts +2 -2
- package/dist/types/messages/format.d.ts +2 -2
- package/dist/types/messages/ids.d.ts +2 -2
- package/dist/types/messages/injected.d.ts +1 -1
- package/dist/types/messages/langchain.d.ts +1 -1
- package/dist/types/messages/prune.d.ts +3 -3
- package/dist/types/openai/index.d.ts +1 -1
- package/dist/types/prompts/activityLabel.d.ts +2 -2
- package/dist/types/responses/index.d.ts +1 -1
- package/dist/types/run.d.ts +3 -3
- package/dist/types/session/handlers.d.ts +1 -1
- package/dist/types/session/types.d.ts +1 -1
- package/dist/types/stream.d.ts +4 -4
- package/dist/types/summarization/index.d.ts +1 -1
- package/dist/types/summarization/node.d.ts +6 -6
- package/dist/types/tools/BashExecutor.d.ts +2 -2
- package/dist/types/tools/BashProgrammaticToolCalling.d.ts +2 -2
- package/dist/types/tools/CodeExecutor.d.ts +3 -3
- package/dist/types/tools/CodeSessionFileSummary.d.ts +1 -1
- package/dist/types/tools/ProgrammaticToolCalling.d.ts +2 -2
- package/dist/types/tools/ReadFile.d.ts +1 -1
- package/dist/types/tools/SkillTool.d.ts +1 -1
- package/dist/types/tools/SubagentTool.d.ts +3 -3
- package/dist/types/tools/ToolNode.d.ts +5 -5
- package/dist/types/tools/ToolSearch.d.ts +2 -2
- package/dist/types/tools/cloudflare/CloudflareBridgeRuntime.d.ts +1 -1
- package/dist/types/tools/cloudflare/CloudflareProgrammaticToolCalling.d.ts +1 -1
- package/dist/types/tools/cloudflare/CloudflareSandboxExecutionEngine.d.ts +2 -2
- package/dist/types/tools/cloudflare/CloudflareSandboxTools.d.ts +1 -1
- package/dist/types/tools/eagerEventExecution.d.ts +1 -1
- package/dist/types/tools/handlers.d.ts +3 -3
- package/dist/types/tools/intentArg.d.ts +1 -1
- package/dist/types/tools/local/CompileCheckTool.d.ts +2 -2
- package/dist/types/tools/local/FileCheckpointer.d.ts +1 -1
- package/dist/types/tools/local/LocalCodingTools.d.ts +2 -2
- package/dist/types/tools/local/LocalExecutionEngine.d.ts +1 -1
- package/dist/types/tools/local/LocalExecutionTools.d.ts +1 -1
- package/dist/types/tools/local/LocalProgrammaticToolCalling.d.ts +1 -1
- package/dist/types/tools/local/bashAst.d.ts +1 -1
- package/dist/types/tools/local/resolveLocalExecutionTools.d.ts +1 -1
- package/dist/types/tools/local/syntaxCheck.d.ts +1 -1
- package/dist/types/tools/ptcTimeout.d.ts +1 -1
- package/dist/types/tools/schema.d.ts +1 -1
- package/dist/types/tools/search/anthropic.d.ts +1 -1
- package/dist/types/tools/skillCatalog.d.ts +1 -1
- package/dist/types/tools/subagent/SubagentExecutor.d.ts +5 -5
- package/dist/types/tools/subagent/SubagentReplay.d.ts +3 -3
- package/dist/types/tools/subagent/childGraphConfig.d.ts +2 -2
- package/dist/types/types/activityLabel.d.ts +3 -3
- package/dist/types/types/graph.d.ts +7 -7
- package/dist/types/types/llm.d.ts +9 -9
- package/dist/types/types/run.d.ts +7 -7
- package/dist/types/types/stream.d.ts +5 -5
- package/dist/types/types/summarize.d.ts +2 -2
- package/dist/types/types/tools.d.ts +5 -5
- package/dist/types/utils/errors.d.ts +1 -1
- package/dist/types/utils/events.d.ts +1 -1
- package/dist/types/utils/handlers.d.ts +3 -3
- package/dist/types/utils/llm.d.ts +1 -1
- package/dist/types/utils/llmConfig.d.ts +1 -1
- package/dist/types/utils/title.d.ts +1 -1
- package/package.json +28 -32
- package/dist/types/agents/__tests__/promptCacheLiveHelpers.d.ts +0 -52
- package/dist/types/test/mockTools.d.ts +0 -28
- package/dist/types/utils/__tests__/fixtures/contextOverflowSignatures.d.ts +0 -40
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SystemMessage } from '@langchain/core/messages';
|
|
2
2
|
import type { UsageMetadata, BaseMessage } from '@langchain/core/messages';
|
|
3
3
|
import type { RunnableConfig, Runnable } from '@langchain/core/runnables';
|
|
4
|
-
import type * as t from '
|
|
5
|
-
import { createPruneMessages } from '
|
|
6
|
-
import { ContentTypes, Providers } from '
|
|
4
|
+
import type * as t from '@/types';
|
|
5
|
+
import { createPruneMessages } from '@/messages';
|
|
6
|
+
import { ContentTypes, Providers } from '@/common';
|
|
7
7
|
/**
|
|
8
8
|
* Encapsulates agent-specific state that can vary between agents in a multi-agent system
|
|
9
9
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import type * as t from '
|
|
2
|
+
import type * as t from '@/types';
|
|
3
3
|
export interface ProjectAgentContextUsageParams {
|
|
4
4
|
/** Same `AgentInputs` a run is built from (instructions, tools, model, window). */
|
|
5
5
|
agent: t.AgentInputs;
|
package/dist/types/events.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseMessageFields, UsageMetadata } from '@langchain/core/messages';
|
|
2
2
|
import type { Logger } from 'winston';
|
|
3
|
-
import type { MultiAgentGraph, StandardGraph } from '
|
|
4
|
-
import type * as t from '
|
|
3
|
+
import type { MultiAgentGraph, StandardGraph } from '@/graphs';
|
|
4
|
+
import type * as t from '@/types';
|
|
5
5
|
export declare class HandlerRegistry {
|
|
6
6
|
private handlers;
|
|
7
7
|
register(eventType: string, handler: t.EventHandler): void;
|
|
@@ -2,17 +2,17 @@ import { ToolNode } from '@langchain/langgraph/prebuilt';
|
|
|
2
2
|
import { RunnableConfig } from '@langchain/core/runnables';
|
|
3
3
|
import type { UsageMetadata, BaseMessage } from '@langchain/core/messages';
|
|
4
4
|
import type { ToolCall } from '@langchain/core/messages/tool';
|
|
5
|
-
import type { SubagentGraphResumeState, SubagentToolNodeResumeState } from '
|
|
6
|
-
import type { ResolvedStreamLimits, RunBreakerScope, StreamedToolCallArgTally, StreamDeltaEventTally } from '
|
|
7
|
-
import type { GraphFactoryDependencies } from '
|
|
8
|
-
import type { HookRegistry } from '
|
|
9
|
-
import type * as t from '
|
|
10
|
-
import { StreamLimitExceededError } from '
|
|
11
|
-
import { SubagentExecutor } from '
|
|
12
|
-
import { ToolOutputReferenceRegistry } from '
|
|
13
|
-
import { ToolNode as CustomToolNode } from '
|
|
14
|
-
import { AgentContext } from '
|
|
15
|
-
import { HandlerRegistry } from '
|
|
5
|
+
import type { SubagentGraphResumeState, SubagentToolNodeResumeState } from '@/tools/subagent/SubagentReplay';
|
|
6
|
+
import type { ResolvedStreamLimits, RunBreakerScope, StreamedToolCallArgTally, StreamDeltaEventTally } from '@/llm/streamLimits';
|
|
7
|
+
import type { GraphFactoryDependencies } from '@/graphs/graphFactory';
|
|
8
|
+
import type { HookRegistry } from '@/hooks';
|
|
9
|
+
import type * as t from '@/types';
|
|
10
|
+
import { StreamLimitExceededError } from '@/llm/streamLimits';
|
|
11
|
+
import { SubagentExecutor } from '@/tools/subagent';
|
|
12
|
+
import { ToolOutputReferenceRegistry } from '@/tools/toolOutputReferences';
|
|
13
|
+
import { ToolNode as CustomToolNode } from '@/tools/ToolNode';
|
|
14
|
+
import { AgentContext } from '@/agents/AgentContext';
|
|
15
|
+
import { HandlerRegistry } from '@/events';
|
|
16
16
|
export declare abstract class Graph<T extends t.BaseGraphState = t.BaseGraphState, _TNodeName extends string = string> {
|
|
17
17
|
abstract resetValues(keepContent?: boolean, checkpointScope?: string): void;
|
|
18
18
|
restoreCheckpointMessages(_messages: BaseMessage[], _pendingMessages?: BaseMessage[]): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GraphFactoryDependencies } from '
|
|
2
|
-
import type * as t from '
|
|
1
|
+
import type { GraphFactoryDependencies } from '@/graphs/graphFactory';
|
|
2
|
+
import type * as t from '@/types';
|
|
3
3
|
import { StandardGraph } from './Graph';
|
|
4
4
|
/**
|
|
5
5
|
* MultiAgentGraph extends StandardGraph to support dynamic multi-agent workflows
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { GraphFactoryRequest } from '
|
|
2
|
-
import type { MultiAgentGraphInput, StandardGraphInput } from '
|
|
3
|
-
import { MultiAgentGraph } from '
|
|
4
|
-
import { StandardGraph } from '
|
|
1
|
+
import type { GraphFactoryRequest } from '@/graphs/graphFactory';
|
|
2
|
+
import type { MultiAgentGraphInput, StandardGraphInput } from '@/types';
|
|
3
|
+
import { MultiAgentGraph } from '@/graphs/MultiAgentGraph';
|
|
4
|
+
import { StandardGraph } from '@/graphs/Graph';
|
|
5
5
|
export declare function createGraph(request: {
|
|
6
6
|
kind: 'standard';
|
|
7
7
|
input: StandardGraphInput;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* nodes (RunnableLambda, addNode callbacks) do not have that
|
|
17
17
|
* constraint.
|
|
18
18
|
*/
|
|
19
|
-
import type { AskUserQuestionRequest, AskUserQuestionResolution } from '
|
|
19
|
+
import type { AskUserQuestionRequest, AskUserQuestionResolution } from '@/types/hitl';
|
|
20
20
|
/**
|
|
21
21
|
* Suspend the current graph node to ask the human a question. Returns
|
|
22
22
|
* the host-supplied resolution after `Run.resume(resolution)` is
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AskUserQuestionsRequest, AskUserQuestionsResolution } from '
|
|
1
|
+
import type { AskUserQuestionsRequest, AskUserQuestionsResolution } from '@/types/hitl';
|
|
2
2
|
/**
|
|
3
3
|
* Suspend once to collect answers to several related questions. The first
|
|
4
4
|
* question is also included in the legacy `question` field so existing hosts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AskUserQuestionRequest, AskUserQuestionsInterruptPayload } from '
|
|
1
|
+
import type { AskUserQuestionRequest, AskUserQuestionsInterruptPayload } from '@/types/hitl';
|
|
2
2
|
/** Maximum questions supported by one batched clarification interaction. */
|
|
3
3
|
export declare const MAX_ASK_USER_QUESTIONS = 4;
|
|
4
4
|
/** Safe identifier format for answer-map keys in a batched question. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';
|
|
2
|
-
import type * as t from '
|
|
2
|
+
import type * as t from '@/types';
|
|
3
3
|
export declare function ensureOpenTelemetryContextManager(): void;
|
|
4
4
|
export declare function initializeLangfuseTracing(langfuse?: t.LangfuseConfig): BasicTracerProvider | undefined;
|
|
5
5
|
export declare function initializeLangfuseTracingFromEnv(): BasicTracerProvider | undefined;
|
package/dist/types/langfuse.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CallbackHandler } from '@langfuse/langchain';
|
|
2
|
-
import type { ResolvedLangfuseToolOutputTracingConfig } from '
|
|
3
|
-
import type * as t from '
|
|
4
|
-
import { hasLangfuseConfigCredentials, hasLangfuseEnvCredentials, hasLangfuseEnvConfig } from '
|
|
2
|
+
import type { ResolvedLangfuseToolOutputTracingConfig } from '@/langfuseRuntimeContext';
|
|
3
|
+
import type * as t from '@/types';
|
|
4
|
+
import { hasLangfuseConfigCredentials, hasLangfuseEnvCredentials, hasLangfuseEnvConfig } from '@/langfuseConfig';
|
|
5
5
|
export { hasLangfuseConfigCredentials, hasLangfuseEnvCredentials, hasLangfuseEnvConfig, };
|
|
6
6
|
export type LangfuseTraceMetadata = Record<string, string>;
|
|
7
7
|
export type LangfuseTraceAttributes = Record<string, string | number | boolean>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ResolvedLangfuseToolOutputTracingConfig } from '
|
|
2
|
-
import type * as t from '
|
|
1
|
+
import type { ResolvedLangfuseToolOutputTracingConfig } from '@/langfuseRuntimeContext';
|
|
2
|
+
import type * as t from '@/types';
|
|
3
3
|
export declare const LANGFUSE_TOOL_OUTPUT_REDACTION_TEXT = "[tool output redacted]";
|
|
4
4
|
export declare function normalizeToolName(name: string): string;
|
|
5
5
|
export declare function hasLangfuseConfigCredentials(langfuse?: t.LangfuseConfig): langfuse is t.LangfuseConfig & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from '@opentelemetry/api';
|
|
2
|
-
import type { LangfuseRuntimeContext, ResolvedLangfuseToolOutputTracingConfig } from '
|
|
3
|
-
import type * as t from '
|
|
2
|
+
import type { LangfuseRuntimeContext, ResolvedLangfuseToolOutputTracingConfig } from '@/langfuseRuntimeContext';
|
|
3
|
+
import type * as t from '@/types';
|
|
4
4
|
export type LangfuseRuntimeScope = LangfuseRuntimeContext;
|
|
5
5
|
export type ResolveLangfuseRuntimeScopeParams = {
|
|
6
6
|
runLangfuse?: t.LangfuseConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LangfuseSpanProcessorParams } from '@langfuse/otel';
|
|
2
2
|
import type { Span } from '@opentelemetry/api';
|
|
3
|
-
import type * as t from '
|
|
3
|
+
import type * as t from '@/types';
|
|
4
4
|
export declare function registerLangfuseManagedSpan(span: Span, destinationKey: string): void;
|
|
5
5
|
export declare function getLangfuseManagedSpanDestination(span: Span): string | undefined;
|
|
6
6
|
export declare function getLangfuseSpanProcessorParams(langfuse?: t.LangfuseConfig): LangfuseSpanProcessorParams | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ReadableSpan, SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
2
2
|
import type { LangfuseSpanProcessorParams } from '@langfuse/otel';
|
|
3
|
-
import type { ResolvedLangfuseToolOutputTracingConfig } from '
|
|
4
|
-
import type * as t from '
|
|
5
|
-
import { LANGFUSE_TOOL_OUTPUT_REDACTION_TEXT, resolveLangfuseConfig } from '
|
|
3
|
+
import type { ResolvedLangfuseToolOutputTracingConfig } from '@/langfuseRuntimeContext';
|
|
4
|
+
import type * as t from '@/types';
|
|
5
|
+
import { LANGFUSE_TOOL_OUTPUT_REDACTION_TEXT, resolveLangfuseConfig } from '@/langfuseConfig';
|
|
6
6
|
export { LANGFUSE_TOOL_OUTPUT_REDACTION_TEXT, resolveLangfuseConfig };
|
|
7
7
|
/** Whether a tool's outputs are excluded from tracing (global disable or
|
|
8
8
|
* `redactedToolNames` match). Exported for the activity-label prompt
|
|
@@ -6,7 +6,7 @@ import type { ChatModelStreamEvent } from '@langchain/core/language_models/event
|
|
|
6
6
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
7
7
|
import type { AnthropicInput } from '@langchain/anthropic';
|
|
8
8
|
import type { Anthropic } from '@anthropic-ai/sdk';
|
|
9
|
-
import type { AnthropicMessageCreateParams, AnthropicStreamingMessageCreateParams, AnthropicOutputConfig, AnthropicBeta, AnthropicMCPServerURLDefinition, AnthropicContextManagementConfigParam, AnthropicRequestOptions } from '
|
|
9
|
+
import type { AnthropicMessageCreateParams, AnthropicStreamingMessageCreateParams, AnthropicOutputConfig, AnthropicBeta, AnthropicMCPServerURLDefinition, AnthropicContextManagementConfigParam, AnthropicRequestOptions } from '@/llm/anthropic/types';
|
|
10
10
|
export declare function _documentsInParams(params: AnthropicMessageCreateParams | AnthropicStreamingMessageCreateParams): boolean;
|
|
11
11
|
export type CustomAnthropicInput = AnthropicInput & {
|
|
12
12
|
_lc_stream_delay?: number;
|
|
@@ -26,7 +26,7 @@ import { type GuardrailConfiguration, type GuardrailStreamConfiguration } from '
|
|
|
26
26
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
27
27
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
28
28
|
import type { ChatBedrockConverseInput } from '@langchain/aws';
|
|
29
|
-
import { type PromptCacheTtl } from '
|
|
29
|
+
import { type PromptCacheTtl } from '@/messages/cache';
|
|
30
30
|
/**
|
|
31
31
|
* Service tier type for Bedrock invocations.
|
|
32
32
|
* Requires AWS SDK >= 3.966.0 to actually work.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ToolConfiguration } from '@aws-sdk/client-bedrock-runtime';
|
|
2
|
-
import type { GraphTools } from '
|
|
3
|
-
import { type PromptCacheTtl } from '
|
|
2
|
+
import type { GraphTools } from '@/types';
|
|
3
|
+
import { type PromptCacheTtl } from '@/messages/cache';
|
|
4
4
|
export declare function partitionAndMarkBedrockToolCache(tools: GraphTools | undefined, isDeferred: (toolName: string) => boolean): GraphTools | undefined;
|
|
5
5
|
export declare function insertBedrockToolCachePoint(toolConfig: ToolConfiguration | undefined, fallbackToEnd: boolean, ttl?: PromptCacheTtl): ToolConfiguration | undefined;
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* the pruner's conversion without folding the same correction into the
|
|
18
18
|
* provider-space budget.
|
|
19
19
|
*/
|
|
20
|
-
import type { ContextOverflowInfo } from '
|
|
21
|
-
import type { Providers } from '
|
|
20
|
+
import type { ContextOverflowInfo } from '@/utils/errors';
|
|
21
|
+
import type { Providers } from '@/common';
|
|
22
22
|
/** Bound on forced-compaction retries per agent, per run. */
|
|
23
23
|
export declare const DEFAULT_MAX_OVERFLOW_RECOVERIES = 2;
|
|
24
24
|
export interface OverflowRecoveryPlan {
|
|
@@ -3,7 +3,7 @@ import { ChatGoogleGenerativeAI } from '@langchain/google-genai';
|
|
|
3
3
|
import type { GenerateContentRequest } from '@google/generative-ai';
|
|
4
4
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
5
5
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
6
|
-
import type { GoogleClientOptions, GoogleThinkingConfig } from '
|
|
6
|
+
import type { GoogleClientOptions, GoogleThinkingConfig } from '@/types';
|
|
7
7
|
export declare class CustomChatGoogleGenerativeAI extends ChatGoogleGenerativeAI {
|
|
8
8
|
_lc_stream_delay: number;
|
|
9
9
|
thinkingConfig?: GoogleThinkingConfig;
|
package/dist/types/llm/init.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Runnable } from '@langchain/core/runnables';
|
|
2
|
-
import type * as t from '
|
|
3
|
-
import { Providers } from '
|
|
2
|
+
import type * as t from '@/types';
|
|
3
|
+
import { Providers } from '@/common';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a chat model instance for a given provider, applies provider-specific
|
|
6
6
|
* field assignments, and optionally binds tools.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AIMessageChunk } from '@langchain/core/messages';
|
|
2
2
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
3
3
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
4
|
-
import type { ToolOutputReferenceRegistry } from '
|
|
5
|
-
import type { StreamLimitState } from '
|
|
6
|
-
import type { ContextOverflowContext } from '
|
|
7
|
-
import type * as t from '
|
|
8
|
-
import { ChatModelStreamHandler } from '
|
|
9
|
-
import { Providers } from '
|
|
4
|
+
import type { ToolOutputReferenceRegistry } from '@/tools/toolOutputReferences';
|
|
5
|
+
import type { StreamLimitState } from '@/llm/streamLimits';
|
|
6
|
+
import type { ContextOverflowContext } from '@/utils/errors';
|
|
7
|
+
import type * as t from '@/types';
|
|
8
|
+
import { ChatModelStreamHandler } from '@/stream';
|
|
9
|
+
import { Providers } from '@/common';
|
|
10
10
|
/**
|
|
11
11
|
* Context passed to `attemptInvoke`. Matches the subset of Graph that
|
|
12
12
|
* `ChatModelStreamHandler.handle` needs *plus* the explicit
|
|
@@ -2,7 +2,7 @@ import { ChatMistralAI } from '@langchain/mistralai';
|
|
|
2
2
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
3
3
|
import type { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
4
4
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
5
|
-
import type { MistralAIClientOptions } from '
|
|
5
|
+
import type { MistralAIClientOptions } from '@/types';
|
|
6
6
|
export declare class CustomChatMistralAI extends ChatMistralAI {
|
|
7
7
|
_lc_stream_delay: number;
|
|
8
8
|
static lc_name(): 'LibreChatMistralAI';
|
|
@@ -10,9 +10,9 @@ import type { BindToolsInput } from '@langchain/core/language_models/chat_models
|
|
|
10
10
|
import type { ChatResult } from '@langchain/core/outputs';
|
|
11
11
|
import type { ChatXAIInput } from '@langchain/xai';
|
|
12
12
|
import type * as t from '@langchain/openai';
|
|
13
|
-
import type { SmoothItem } from '
|
|
13
|
+
import type { SmoothItem } from '@/llm/stream/smoother';
|
|
14
14
|
import type { HeaderValue, HeadersLike } from './types';
|
|
15
|
-
import type { PromptCacheTtl } from '
|
|
15
|
+
import type { PromptCacheTtl } from '@/messages/cache';
|
|
16
16
|
export declare function isHeaders(headers: unknown): headers is Headers;
|
|
17
17
|
export declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;
|
|
18
18
|
type OpenAICoreRequestOptions = OpenAIClient.RequestOptions;
|
|
@@ -2,8 +2,8 @@ import type { ChatOpenAICallOptions, OpenAIChatInput, OpenAIClient } from '@lang
|
|
|
2
2
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
3
3
|
import type { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
4
4
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
5
|
-
import type { PromptCacheTtl } from '
|
|
6
|
-
import { ChatOpenAI } from '
|
|
5
|
+
import type { PromptCacheTtl } from '@/messages/cache';
|
|
6
|
+
import { ChatOpenAI } from '@/llm/openai';
|
|
7
7
|
export type OpenRouterReasoningEffort = 'xhigh' | 'high' | 'medium' | 'low' | 'minimal' | 'none';
|
|
8
8
|
export interface OpenRouterReasoning {
|
|
9
9
|
effort?: OpenRouterReasoningEffort;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { GraphTools } from '
|
|
2
|
-
import { type PromptCacheTtl } from '
|
|
1
|
+
import type { GraphTools } from '@/types';
|
|
2
|
+
import { type PromptCacheTtl } from '@/messages/cache';
|
|
3
3
|
export declare function partitionAndMarkOpenRouterToolCache(tools: GraphTools | undefined, isDeferred: (toolName: string) => boolean, ttl?: PromptCacheTtl): GraphTools | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChatModelConstructorMap, ProviderOptionsMap, ChatModelMap } from '
|
|
2
|
-
import { Providers } from '
|
|
1
|
+
import type { ChatModelConstructorMap, ProviderOptionsMap, ChatModelMap } from '@/types';
|
|
2
|
+
import { Providers } from '@/common';
|
|
3
3
|
export declare const llmProviders: Partial<ChatModelConstructorMap>;
|
|
4
4
|
export declare const manualToolStreamProviders: Set<string>;
|
|
5
5
|
export declare const getChatModelClass: <P extends Providers>(provider: P) => new (config: ProviderOptionsMap[P]) => ChatModelMap[P];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type * as t from '
|
|
2
|
-
import { Providers } from '
|
|
1
|
+
import type * as t from '@/types';
|
|
2
|
+
import { Providers } from '@/common';
|
|
3
3
|
/**
|
|
4
4
|
* Returns true when the provider + clientOptions indicate extended thinking
|
|
5
5
|
* is enabled. Works across Anthropic (direct), Bedrock (additionalModelRequestFields),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AIMessageChunk } from '@langchain/core/messages';
|
|
2
2
|
import { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
3
3
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
4
|
-
import type { SmoothItem, SmoothPiece } from '
|
|
4
|
+
import type { SmoothItem, SmoothPiece } from '@/llm/stream/smoother';
|
|
5
5
|
/**
|
|
6
6
|
* Rebuilds a generation chunk carrying one piece of a split plain-text chunk.
|
|
7
7
|
* Unsplit pieces return the original chunk untouched, so disabled smoothing is
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AIMessageChunk, BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import { Providers } from '
|
|
2
|
+
import { Providers } from '@/common';
|
|
3
3
|
/**
|
|
4
4
|
* Normalized truncation reasons across providers. Providers disagree on the
|
|
5
5
|
* key and the value: Anthropic/Bedrock use `max_tokens`, OpenAI uses `length`,
|
|
@@ -4,7 +4,7 @@ import type { GeminiContent, GoogleAIModelRequestParams, GoogleAbstractedClient
|
|
|
4
4
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
5
5
|
import type { BaseMessage, UsageMetadata } from '@langchain/core/messages';
|
|
6
6
|
import type { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
7
|
-
import type { GoogleThinkingConfig, VertexAIClientOptions } from '
|
|
7
|
+
import type { GoogleThinkingConfig, VertexAIClientOptions } from '@/types';
|
|
8
8
|
/**
|
|
9
9
|
* `@langchain/google-common`'s `_streamResponseChunks` emits usage on TWO
|
|
10
10
|
* different paths within the same stream:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import { Providers } from '
|
|
2
|
+
import { Providers } from '@/common';
|
|
3
3
|
/**
|
|
4
4
|
* Providers whose APIs specify strict user/assistant alternation. Mistral
|
|
5
5
|
* rejects consecutive user turns outright. Bedrock's Converse API documents
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* never mutating the original tool instance, since callers may share them
|
|
25
25
|
* across runs.
|
|
26
26
|
*/
|
|
27
|
-
import type { GraphTools } from '
|
|
28
|
-
import { type PromptCacheTtl } from '
|
|
27
|
+
import type { GraphTools } from '@/types';
|
|
28
|
+
import { type PromptCacheTtl } from '@/messages/cache';
|
|
29
29
|
/**
|
|
30
30
|
* Returns a callable that reports whether a given tool *name* is deferred
|
|
31
31
|
* according to the supplied registry of tool definitions. Tools without
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AssistantTextPhase } from '
|
|
2
|
-
import type { MessageContentComplex } from '
|
|
3
|
-
import { ContentTypes } from '
|
|
1
|
+
import type { AssistantTextPhase } from '@/types/assistantPhase';
|
|
2
|
+
import type { MessageContentComplex } from '@/types/stream';
|
|
3
|
+
import { ContentTypes } from '@/common';
|
|
4
4
|
export type MessageCreationContentMetadata = {
|
|
5
5
|
content_type?: ContentTypes.TEXT | ContentTypes.THINK;
|
|
6
6
|
phase?: AssistantTextPhase;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseMessage, MessageContentComplex } from '@langchain/core/messages';
|
|
2
|
-
import type { AnthropicMessage } from '
|
|
2
|
+
import type { AnthropicMessage } from '@/types/messages';
|
|
3
3
|
type MessageWithContent = {
|
|
4
4
|
content?: string | MessageContentComplex[];
|
|
5
5
|
};
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { type BaseMessage } from '@langchain/core/messages';
|
|
16
16
|
import type { ContextPruningSettings } from './contextPruningSettings';
|
|
17
|
-
import type { ContextPruningConfig } from '
|
|
18
|
-
import type { TokenCounter } from '
|
|
17
|
+
import type { ContextPruningConfig } from '@/types/graph';
|
|
18
|
+
import type { TokenCounter } from '@/types/run';
|
|
19
19
|
export interface ContextPruningResult {
|
|
20
20
|
/** Number of messages that were soft-trimmed. */
|
|
21
21
|
softTrimmed: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AIMessage, BaseMessage, ToolMessage, HumanMessage, AIMessageChunk } from '@langchain/core/messages';
|
|
2
|
-
import type * as t from '
|
|
3
|
-
import { Providers } from '
|
|
2
|
+
import type * as t from '@/types';
|
|
3
|
+
import { Providers } from '@/common';
|
|
4
4
|
export declare function getConverseOverrideMessage({ userMessage, lastMessageX, lastMessageY, }: {
|
|
5
5
|
userMessage: string[];
|
|
6
6
|
lastMessageX: AIMessageChunk | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AIMessage, ToolMessage, BaseMessage, HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
2
2
|
import type { MessageContentImageUrl } from '@langchain/core/messages';
|
|
3
3
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
4
|
-
import type { MessageContentComplex, TPayload } from '
|
|
5
|
-
import { Providers } from '
|
|
4
|
+
import type { MessageContentComplex, TPayload } from '@/types';
|
|
5
|
+
import { Providers } from '@/common';
|
|
6
6
|
interface MediaMessageParams {
|
|
7
7
|
message: {
|
|
8
8
|
role: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Graph } from '
|
|
2
|
-
import type * as t from '
|
|
1
|
+
import type { Graph } from '@/graphs';
|
|
2
|
+
import type * as t from '@/types';
|
|
3
3
|
export declare const getMessageId: (stepKey: string, graph: Graph<t.BaseGraphState>, returnExistingId?: boolean) => string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MessageContent } from '@langchain/core/messages';
|
|
2
|
-
import type * as t from '
|
|
2
|
+
import type * as t from '@/types';
|
|
3
3
|
type LibreChatMessageContent = MessageContent | string | t.MessageContentComplex[] | t.ExtendedMessageContent[];
|
|
4
4
|
type WithLangChainContent<T extends {
|
|
5
5
|
content: LibreChatMessageContent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseMessage, UsageMetadata } from '@langchain/core/messages';
|
|
2
|
-
import type { ContextPruningConfig } from '
|
|
3
|
-
import type { TokenCounter } from '
|
|
4
|
-
import { ContentTypes, Providers } from '
|
|
2
|
+
import type { ContextPruningConfig } from '@/types/graph';
|
|
3
|
+
import type { TokenCounter } from '@/types/run';
|
|
4
|
+
import { ContentTypes, Providers } from '@/common';
|
|
5
5
|
/** Default fraction of the token budget reserved as headroom (5 %). */
|
|
6
6
|
export declare const DEFAULT_RESERVE_RATIO = 0.05;
|
|
7
7
|
/** Provider framing reserved for the assistant reply label. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ActivityLabelToolEntry, ActivityPhaseEntry } from '
|
|
2
|
-
import type { ResolvedLangfuseToolOutputTracingConfig } from '
|
|
1
|
+
import type { ActivityLabelToolEntry, ActivityPhaseEntry } from '@/types/activityLabel';
|
|
2
|
+
import type { ResolvedLangfuseToolOutputTracingConfig } from '@/langfuseRuntimeContext';
|
|
3
3
|
/**
|
|
4
4
|
* Default system prompt for fast-model activity labeling.
|
|
5
5
|
*
|
package/dist/types/run.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Command } from '@langchain/langgraph';
|
|
2
2
|
import { BaseMessage } from '@langchain/core/messages';
|
|
3
3
|
import type { MessageContentComplex } from '@langchain/core/messages';
|
|
4
|
-
import type { MultiAgentGraph } from '
|
|
5
|
-
import type { StandardGraph } from '
|
|
6
|
-
import type * as t from '
|
|
4
|
+
import type { MultiAgentGraph } from '@/graphs/MultiAgentGraph';
|
|
5
|
+
import type { StandardGraph } from '@/graphs/Graph';
|
|
6
|
+
import type * as t from '@/types';
|
|
7
7
|
export declare const defaultOmitOptions: Set<string>;
|
|
8
8
|
export declare class Run<_T extends t.BaseGraphState> {
|
|
9
9
|
id: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
2
|
import type { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
3
3
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
4
|
-
import type * as t from '
|
|
4
|
+
import type * as t from '@/types';
|
|
5
5
|
export type JsonPrimitive = string | number | boolean | null;
|
|
6
6
|
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
7
7
|
[key: string]: JsonValue;
|
package/dist/types/stream.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AIMessageChunk } from '@langchain/core/messages';
|
|
2
|
-
import type { AgentContext } from '
|
|
3
|
-
import type { StandardGraph } from '
|
|
4
|
-
import type * as t from '
|
|
5
|
-
import { Providers } from '
|
|
2
|
+
import type { AgentContext } from '@/agents/AgentContext';
|
|
3
|
+
import type { StandardGraph } from '@/graphs';
|
|
4
|
+
import type * as t from '@/types';
|
|
5
|
+
import { Providers } from '@/common';
|
|
6
6
|
export declare function getChunkContent({ chunk, provider, reasoningKey, }: {
|
|
7
7
|
chunk?: Partial<AIMessageChunk>;
|
|
8
8
|
provider?: Providers;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
2
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
3
|
-
import type { StreamLimitState } from '
|
|
4
|
-
import type { AgentContext } from '
|
|
5
|
-
import type { HookRegistry } from '
|
|
6
|
-
import type { OnChunk } from '
|
|
7
|
-
import type * as t from '
|
|
8
|
-
import { Providers } from '
|
|
3
|
+
import type { StreamLimitState } from '@/llm/streamLimits';
|
|
4
|
+
import type { AgentContext } from '@/agents/AgentContext';
|
|
5
|
+
import type { HookRegistry } from '@/hooks';
|
|
6
|
+
import type { OnChunk } from '@/llm/invoke';
|
|
7
|
+
import type * as t from '@/types';
|
|
8
|
+
import { Providers } from '@/common';
|
|
9
9
|
/** Structured checkpoint prompt for fresh summarization (no prior summary). */
|
|
10
10
|
export declare const DEFAULT_SUMMARIZATION_PROMPT = "Hold on, before you continue I need you to write me a checkpoint of everything so far. Your context window is filling up and this checkpoint replaces the messages above, so capture everything you need to pick right back up.\n\nDon't second-guess or fact-check anything you did, your tool results reflect exactly what happened. If a tool result appears truncated, that's just a display artifact from context management: the tool executed fully. Just record what you did and what you observed. Only the checkpoint, don't respond to me or continue the conversation.\n\n## Checkpoint\n\n## Goal\nWhat I asked you to do and any sub-goals you identified.\n\n## Constraints & Preferences\nAny rules, preferences, or configuration I established.\n\n## Progress\n### Done\n- What you completed and the outcomes\n\n### In Progress\n- What you're currently working on\n\n## Key Decisions\nDecisions you made and why.\n\n## Next Steps\nConcrete task actions remaining, in priority order.\n\n## Critical Context\nExact identifiers, names, error messages, URLs, and details you need to preserve verbatim.\n\nRules:\n- Record what you did and observed, don't judge or re-evaluate it\n- For each tool call: the tool name, key inputs, and the outcome\n- Preserve exact identifiers, names, errors, and references verbatim\n- Short declarative sentences\n- Skip empty sections";
|
|
11
11
|
/** Prompt for re-compaction when a prior summary exists. */
|