@librechat/agents 3.7.10 → 3.7.12
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/graphs/Graph.cjs +11 -1
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs +36 -3
- package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
- package/dist/cjs/langfuse.cjs +6 -2
- package/dist/cjs/langfuse.cjs.map +1 -1
- package/dist/cjs/main.cjs +2 -0
- package/dist/cjs/messages/format.cjs +6 -34
- package/dist/cjs/messages/format.cjs.map +1 -1
- package/dist/cjs/run.cjs +5 -1
- package/dist/cjs/run.cjs.map +1 -1
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs +22 -6
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticCallerPolicy.cjs +10 -0
- package/dist/cjs/tools/ProgrammaticCallerPolicy.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs +43 -6
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +12 -2
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs +5 -3
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +11 -1
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs +36 -3
- package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
- package/dist/esm/langfuse.mjs +6 -2
- package/dist/esm/langfuse.mjs.map +1 -1
- package/dist/esm/main.mjs +2 -2
- package/dist/esm/messages/format.mjs +6 -34
- package/dist/esm/messages/format.mjs.map +1 -1
- package/dist/esm/run.mjs +5 -1
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs +23 -7
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticCallerPolicy.mjs +10 -1
- package/dist/esm/tools/ProgrammaticCallerPolicy.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticToolCalling.mjs +42 -7
- package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +12 -2
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs +5 -3
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs.map +1 -1
- package/dist/types/langfuse.d.ts +5 -1
- package/dist/types/messages/format.d.ts +2 -1
- package/dist/types/tools/ProgrammaticCallerPolicy.d.ts +12 -0
- package/dist/types/tools/ProgrammaticToolCalling.d.ts +35 -0
- package/dist/types/tools/ToolNode.d.ts +4 -1
- package/dist/types/types/tools.d.ts +5 -0
- package/package.json +1 -1
- package/src/graphs/Graph.ts +10 -0
- package/src/graphs/MultiAgentGraph.ts +71 -2
- package/src/langfuse.ts +12 -0
- package/src/messages/format.ts +23 -70
- package/src/run.ts +4 -0
- package/src/tools/BashProgrammaticToolCalling.ts +57 -19
- package/src/tools/ProgrammaticCallerPolicy.ts +31 -0
- package/src/tools/ProgrammaticToolCalling.ts +132 -19
- package/src/tools/ToolNode.ts +19 -0
- package/src/tools/local/LocalProgrammaticToolCalling.ts +19 -8
- package/src/types/tools.ts +5 -0
package/src/tools/ToolNode.ts
CHANGED
|
@@ -738,6 +738,9 @@ export class ToolNode<T = any> extends RunnableCallable<T, T> {
|
|
|
738
738
|
* even where `agentId` (the subagent-scope marker) is undefined.
|
|
739
739
|
*/
|
|
740
740
|
private executingAgentId?: string;
|
|
741
|
+
private executingAgentName?: string;
|
|
742
|
+
private rootAgentId?: string;
|
|
743
|
+
private rootAgentName?: string;
|
|
741
744
|
/** Tool names that bypass event dispatch and execute directly (e.g., graph-managed handoff tools) */
|
|
742
745
|
private directToolNames?: Set<string>;
|
|
743
746
|
/**
|
|
@@ -823,6 +826,9 @@ export class ToolNode<T = any> extends RunnableCallable<T, T> {
|
|
|
823
826
|
eagerEventToolSuppressions,
|
|
824
827
|
agentId,
|
|
825
828
|
executingAgentId,
|
|
829
|
+
executingAgentName,
|
|
830
|
+
rootAgentId,
|
|
831
|
+
rootAgentName,
|
|
826
832
|
directToolNames,
|
|
827
833
|
interruptingToolNames,
|
|
828
834
|
codeSessionToolNames,
|
|
@@ -902,6 +908,9 @@ export class ToolNode<T = any> extends RunnableCallable<T, T> {
|
|
|
902
908
|
// Default to agentId so callers constructing ToolNode directly (who pass the
|
|
903
909
|
// existing agentId option) still get attribution without knowing the new option.
|
|
904
910
|
this.executingAgentId = executingAgentId ?? agentId;
|
|
911
|
+
this.executingAgentName = executingAgentName;
|
|
912
|
+
this.rootAgentId = rootAgentId;
|
|
913
|
+
this.rootAgentName = rootAgentName;
|
|
905
914
|
this.directToolNames = directToolNames;
|
|
906
915
|
this.interruptingToolNames =
|
|
907
916
|
interruptingToolNames != null && interruptingToolNames.size > 0
|
|
@@ -963,6 +972,16 @@ export class ToolNode<T = any> extends RunnableCallable<T, T> {
|
|
|
963
972
|
metadata: {
|
|
964
973
|
...options?.metadata,
|
|
965
974
|
agentId: this.executingAgentId,
|
|
975
|
+
activeAgentId: this.executingAgentId,
|
|
976
|
+
...(this.executingAgentName == null
|
|
977
|
+
? {}
|
|
978
|
+
: { activeAgentName: this.executingAgentName }),
|
|
979
|
+
...(this.rootAgentId == null
|
|
980
|
+
? {}
|
|
981
|
+
: { rootAgentId: this.rootAgentId }),
|
|
982
|
+
...(this.rootAgentName == null
|
|
983
|
+
? {}
|
|
984
|
+
: { rootAgentName: this.rootAgentName }),
|
|
966
985
|
},
|
|
967
986
|
};
|
|
968
987
|
return withLangfuseRuntimeScope(
|
|
@@ -589,17 +589,28 @@ async function runLocalProgrammaticTool(args: {
|
|
|
589
589
|
programmaticToolName: runnerName,
|
|
590
590
|
});
|
|
591
591
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
592
|
+
/* The local program builder supports zero stubs, so a call that selected no
|
|
593
|
+
* tools needs neither a toolMap nor toolDefs. Injected context is still
|
|
594
|
+
* required to conclude that. */
|
|
595
|
+
const needsNoTools =
|
|
596
|
+
selectedTools.length === 0 &&
|
|
597
|
+
(args.params.tool_manifest?.length === 0 ||
|
|
598
|
+
toolDefs != null ||
|
|
599
|
+
disallowedToolDefs != null);
|
|
600
|
+
|
|
601
|
+
if (!needsNoTools) {
|
|
602
|
+
if (toolMap == null || toolMap.size === 0) {
|
|
603
|
+
throw new Error('No toolMap provided for local programmatic execution.');
|
|
604
|
+
}
|
|
605
|
+
if (toolDefs == null || toolDefs.length === 0) {
|
|
606
|
+
throw new Error(
|
|
607
|
+
'No tool definitions provided for local programmatic execution.'
|
|
608
|
+
);
|
|
609
|
+
}
|
|
599
610
|
}
|
|
600
611
|
|
|
601
612
|
const { effectiveTools, effectiveMap } = createEffectiveToolMap(
|
|
602
|
-
toolMap,
|
|
613
|
+
toolMap ?? new Map(),
|
|
603
614
|
selectedTools
|
|
604
615
|
);
|
|
605
616
|
const bridge = await createToolBridge(effectiveMap, hookContext);
|
package/src/types/tools.ts
CHANGED
|
@@ -148,6 +148,11 @@ export type ToolNodeOptions = {
|
|
|
148
148
|
/** ID of the agent that owns this tool node, surfaced to hooks as `executingAgentId`
|
|
149
149
|
* so a batch can be attributed to a specific agent even where `agentId` is undefined. */
|
|
150
150
|
executingAgentId?: string;
|
|
151
|
+
/** Name of the agent that owns this tool node, used for active Langfuse attribution. */
|
|
152
|
+
executingAgentName?: string;
|
|
153
|
+
/** Root graph-agent identity retained alongside the currently executing tool owner. */
|
|
154
|
+
rootAgentId?: string;
|
|
155
|
+
rootAgentName?: string;
|
|
151
156
|
/** Tool names that must be executed directly (via runTool) even in event-driven mode (e.g., graph-managed handoff tools) */
|
|
152
157
|
directToolNames?: Set<string>;
|
|
153
158
|
/**
|