@librechat/agents 3.8.4 → 3.8.6
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/cjs/agents/AgentContext.cjs +1 -1
- package/dist/cjs/common/constants.cjs +2 -0
- package/dist/cjs/common/constants.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +18 -9
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/hitl/approvalReview.cjs +1 -1
- package/dist/cjs/hooks/types.cjs.map +1 -1
- package/dist/cjs/main.cjs +7 -6
- package/dist/cjs/messages/index.cjs +1 -1
- package/dist/cjs/messages/prune.cjs +1 -1
- package/dist/cjs/run.cjs +7 -3
- package/dist/cjs/run.cjs.map +1 -1
- package/dist/cjs/stream.cjs +13 -3
- package/dist/cjs/stream.cjs.map +1 -1
- package/dist/cjs/summarization/node.cjs +3 -1
- package/dist/cjs/summarization/node.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +134 -32
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs +1 -0
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutionRegistry.cjs +0 -1
- package/dist/cjs/tools/subagent/SubagentExecutionRegistry.cjs.map +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs +123 -29
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
- package/dist/cjs/tools/toolBatchReplay.cjs +65 -13
- package/dist/cjs/tools/toolBatchReplay.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/esm/agents/AgentContext.mjs +1 -1
- package/dist/esm/common/constants.mjs +2 -1
- package/dist/esm/common/constants.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +17 -8
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/hitl/approvalReview.mjs +1 -1
- package/dist/esm/hooks/types.mjs.map +1 -1
- package/dist/esm/main.mjs +6 -6
- package/dist/esm/messages/index.mjs +1 -1
- package/dist/esm/messages/prune.mjs +1 -1
- package/dist/esm/run.mjs +7 -3
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/stream.mjs +13 -3
- package/dist/esm/stream.mjs.map +1 -1
- package/dist/esm/summarization/node.mjs +3 -1
- package/dist/esm/summarization/node.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +135 -33
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs +1 -0
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/subagent/SubagentExecutionRegistry.mjs +0 -1
- package/dist/esm/tools/subagent/SubagentExecutionRegistry.mjs.map +1 -1
- package/dist/esm/tools/subagent/SubagentExecutor.mjs +123 -29
- package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
- package/dist/esm/tools/toolBatchReplay.mjs +64 -13
- package/dist/esm/tools/toolBatchReplay.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/graphs/Graph.d.ts +3 -2
- package/dist/types/hooks/types.d.ts +3 -0
- package/dist/types/run.d.ts +1 -0
- package/dist/types/summarization/node.d.ts +1 -0
- package/dist/types/tools/ToolNode.d.ts +4 -2
- package/dist/types/tools/subagent/SubagentExecutor.d.ts +7 -4
- package/dist/types/tools/toolBatchReplay.d.ts +6 -3
- package/dist/types/types/graph.d.ts +28 -0
- package/dist/types/types/run.d.ts +2 -0
- package/dist/types/types/tools.d.ts +11 -1
- package/package.json +1 -1
- package/src/common/constants.ts +3 -0
- package/src/graphs/Graph.ts +32 -18
- package/src/hooks/types.ts +3 -0
- package/src/run.ts +30 -15
- package/src/stream.ts +27 -5
- package/src/summarization/node.ts +3 -0
- package/src/tools/ToolNode.ts +528 -149
- package/src/tools/local/LocalProgrammaticToolCalling.ts +1 -0
- package/src/tools/subagent/SubagentExecutionRegistry.ts +0 -1
- package/src/tools/subagent/SubagentExecutor.ts +216 -48
- package/src/tools/toolBatchReplay.ts +121 -20
- package/src/types/graph.ts +37 -0
- package/src/types/run.ts +2 -0
- package/src/types/tools.ts +11 -1
- package/src/utils/llmConfig.ts +0 -1
package/src/types/graph.ts
CHANGED
|
@@ -395,6 +395,8 @@ export type StandardGraphInput = {
|
|
|
395
395
|
* do not inherit it, keeping background nesting disabled for the MVP.
|
|
396
396
|
*/
|
|
397
397
|
subagentTasks?: SubagentTaskConfig;
|
|
398
|
+
/** Host-owned context and result projection for each isolated child execution. */
|
|
399
|
+
subagentContext?: SubagentContextAdapter;
|
|
398
400
|
/**
|
|
399
401
|
* True when this graph IS a subagent child run (set by `SubagentExecutor`
|
|
400
402
|
* when it constructs the child graph). Drives the hook-input `agentId`
|
|
@@ -669,6 +671,41 @@ export interface SubagentExecutionContext {
|
|
|
669
671
|
readonly ancestry: readonly SubagentAncestryEntry[];
|
|
670
672
|
}
|
|
671
673
|
|
|
674
|
+
/** Trusted identity supplied before a child can access host-owned resources. */
|
|
675
|
+
export interface SubagentContextInput {
|
|
676
|
+
executionContext: SubagentExecutionContext;
|
|
677
|
+
parentThreadId?: string;
|
|
678
|
+
memberAgentIds: readonly string[];
|
|
679
|
+
signal: AbortSignal;
|
|
680
|
+
resumed: boolean;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
export interface PreparedSubagentContext {
|
|
684
|
+
/** Added to the initial child input; checkpoint recovery does not add them again. */
|
|
685
|
+
messages?: BaseMessage[];
|
|
686
|
+
/** Host configuration; SDK execution and checkpoint identities remain authoritative. */
|
|
687
|
+
configurable?: RunnableConfig['configurable'];
|
|
688
|
+
/** Each entry replaces that member's inherited code partition and initial sessions. */
|
|
689
|
+
agentSessions?: Readonly<
|
|
690
|
+
Record<string, Pick<AgentInputs, 'codeSessionKey' | 'initialSessions'>>
|
|
691
|
+
>;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
export interface SubagentContextResult {
|
|
695
|
+
content: string;
|
|
696
|
+
messages: BaseMessage[];
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
export interface SubagentContextAdapter {
|
|
700
|
+
/** Reauthorizes reconstructed executions; durable work must be idempotent by child run ID. */
|
|
701
|
+
prepare(input: SubagentContextInput): Promise<PreparedSubagentContext>;
|
|
702
|
+
/** Projects durable references into the result returned to the parent. */
|
|
703
|
+
complete?(
|
|
704
|
+
input: SubagentContextInput,
|
|
705
|
+
result: SubagentContextResult
|
|
706
|
+
): Promise<Pick<SubagentContextResult, 'content'>>;
|
|
707
|
+
}
|
|
708
|
+
|
|
672
709
|
/**
|
|
673
710
|
* Wrapper event emitted when a subagent's child graph dispatches activity.
|
|
674
711
|
* Lets hosts show subagent progress in a UI surface separate from the parent
|
package/src/types/run.ts
CHANGED
|
@@ -291,6 +291,8 @@ export type RunConfig = {
|
|
|
291
291
|
* Omit to preserve foreground-only subagent behavior.
|
|
292
292
|
*/
|
|
293
293
|
subagentTasks?: SubagentTaskConfig;
|
|
294
|
+
/** Authorizes and supplies host-owned context to isolated child runs. */
|
|
295
|
+
subagentContext?: g.SubagentContextAdapter;
|
|
294
296
|
/**
|
|
295
297
|
* Pre-constructed hook registry for this run. Hooks fire at lifecycle
|
|
296
298
|
* points in `processStream` (RunStart, UserPromptSubmit, Stop,
|
package/src/types/tools.ts
CHANGED
|
@@ -11,10 +11,10 @@ import type {
|
|
|
11
11
|
ToolErrorData,
|
|
12
12
|
} from './stream';
|
|
13
13
|
import type { ToolOutputReferenceRegistry } from '@/tools/toolOutputReferences';
|
|
14
|
+
import type { LangfuseConfig, SubagentExecutionContext } from './graph';
|
|
14
15
|
import type { PreparedSubagents } from '@/tools/preparedSubagents';
|
|
15
16
|
import type { RunBreakerScope } from '@/llm/streamLimits';
|
|
16
17
|
import type { HumanInTheLoopConfig } from './hitl';
|
|
17
|
-
import type { LangfuseConfig } from './graph';
|
|
18
18
|
import type { HookRegistry } from '@/hooks';
|
|
19
19
|
|
|
20
20
|
/** Replacement type for `import type { ToolCall } from '@langchain/core/messages/tool'` in order to have stringified args typed */
|
|
@@ -75,6 +75,7 @@ export type EagerEventToolExecution = {
|
|
|
75
75
|
toolName: string;
|
|
76
76
|
args: Record<string, unknown>;
|
|
77
77
|
request: ToolCallRequest;
|
|
78
|
+
codeSessionBaselineByName?: ReadonlyMap<string, string>;
|
|
78
79
|
promise: Promise<EagerEventToolExecutionOutcome>;
|
|
79
80
|
/**
|
|
80
81
|
* True when the streaming eager path already emitted the user-visible
|
|
@@ -156,6 +157,8 @@ export type ToolNodeOptions = {
|
|
|
156
157
|
/** ID of the agent that owns this tool node, surfaced to hooks as `executingAgentId`
|
|
157
158
|
* so a batch can be attributed to a specific agent even where `agentId` is undefined. */
|
|
158
159
|
executingAgentId?: string;
|
|
160
|
+
/** SDK-owned identity of the child execution, independent of reusable agent IDs. */
|
|
161
|
+
executionContext?: SubagentExecutionContext;
|
|
159
162
|
/** Name of the agent that owns this tool node, used for active Langfuse attribution. */
|
|
160
163
|
executingAgentName?: string;
|
|
161
164
|
/** Root graph-agent identity retained alongside the currently executing tool owner. */
|
|
@@ -573,6 +576,10 @@ export type ToolCallRequest = {
|
|
|
573
576
|
session_id: string;
|
|
574
577
|
files?: CodeEnvFile[];
|
|
575
578
|
};
|
|
579
|
+
/** Request-time execution session used to detect host session refreshes. */
|
|
580
|
+
codeSessionBaselineId?: string;
|
|
581
|
+
/** Preserve request-provisioned code inputs after an eager identity mismatch. */
|
|
582
|
+
retainCodeSessionInputs?: true;
|
|
576
583
|
/**
|
|
577
584
|
* Stable runtime session hint for stateful sandbox sessions. Orthogonal to
|
|
578
585
|
* `codeSessionContext` (which threads the transient exec-session for file
|
|
@@ -596,6 +603,8 @@ export type CallerCapabilityProjectionSnapshot = {
|
|
|
596
603
|
|
|
597
604
|
/** Batch request containing ALL tool calls for a graph step */
|
|
598
605
|
export type ToolExecuteBatchRequest = {
|
|
606
|
+
/** SDK-owned child lineage. Unset for tools in the root graph. */
|
|
607
|
+
executionContext?: SubagentExecutionContext;
|
|
599
608
|
/** All tool calls from the AIMessage */
|
|
600
609
|
toolCalls: ToolCallRequest[];
|
|
601
610
|
/** User ID for context */
|
|
@@ -1227,6 +1236,7 @@ export type ProgrammaticHookContext = {
|
|
|
1227
1236
|
runId: string;
|
|
1228
1237
|
threadId?: string;
|
|
1229
1238
|
agentId?: string;
|
|
1239
|
+
executionContext?: SubagentExecutionContext;
|
|
1230
1240
|
executingAgentId?: string;
|
|
1231
1241
|
};
|
|
1232
1242
|
|
package/src/utils/llmConfig.ts
CHANGED
|
@@ -71,7 +71,6 @@ export const llmConfigs: Record<string, t.BuiltInLLMConfig | undefined> = {
|
|
|
71
71
|
} as or.ChatOpenRouterCallOptions & t.BuiltInLLMConfig,
|
|
72
72
|
[Providers.AZURE]: {
|
|
73
73
|
provider: Providers.AZURE,
|
|
74
|
-
temperature: 0.7,
|
|
75
74
|
streaming: true,
|
|
76
75
|
streamUsage: true,
|
|
77
76
|
azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY,
|