@librechat/agents 3.1.66-dev.0 → 3.1.67-dev.0
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 +47 -18
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/common/enum.cjs +1 -0
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +69 -0
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/hooks/types.cjs.map +1 -1
- package/dist/cjs/main.cjs +12 -0
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/summarization/node.cjs +44 -0
- package/dist/cjs/summarization/node.cjs.map +1 -1
- package/dist/cjs/tools/SubagentTool.cjs +92 -0
- package/dist/cjs/tools/SubagentTool.cjs.map +1 -0
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs +261 -0
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -0
- package/dist/esm/agents/AgentContext.mjs +47 -18
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/common/enum.mjs +1 -0
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +69 -0
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/hooks/types.mjs.map +1 -1
- package/dist/esm/main.mjs +2 -0
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/summarization/node.mjs +44 -0
- package/dist/esm/summarization/node.mjs.map +1 -1
- package/dist/esm/tools/SubagentTool.mjs +85 -0
- package/dist/esm/tools/SubagentTool.mjs.map +1 -0
- package/dist/esm/tools/subagent/SubagentExecutor.mjs +256 -0
- package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -0
- package/dist/types/agents/AgentContext.d.ts +12 -0
- package/dist/types/common/enum.d.ts +2 -1
- package/dist/types/hooks/types.d.ts +12 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/summarization/node.d.ts +2 -0
- package/dist/types/tools/SubagentTool.d.ts +36 -0
- package/dist/types/tools/subagent/SubagentExecutor.d.ts +83 -0
- package/dist/types/tools/subagent/index.d.ts +2 -0
- package/dist/types/types/graph.d.ts +25 -0
- package/dist/types/types/llm.d.ts +14 -2
- package/package.json +2 -1
- package/src/agents/AgentContext.ts +54 -17
- package/src/agents/__tests__/AgentContext.test.ts +110 -0
- package/src/common/enum.ts +1 -0
- package/src/graphs/Graph.ts +88 -0
- package/src/hooks/__tests__/compactHooks.test.ts +214 -0
- package/src/hooks/index.ts +4 -2
- package/src/hooks/types.ts +17 -1
- package/src/index.ts +2 -0
- package/src/scripts/multi-agent-subagent.ts +246 -0
- package/src/specs/subagent.test.ts +305 -0
- package/src/summarization/node.ts +53 -0
- package/src/tools/SubagentTool.ts +100 -0
- package/src/tools/__tests__/SubagentExecutor.test.ts +615 -0
- package/src/tools/__tests__/SubagentTool.test.ts +149 -0
- package/src/tools/__tests__/subagentHooks.test.ts +215 -0
- package/src/tools/subagent/SubagentExecutor.ts +344 -0
- package/src/tools/subagent/index.ts +12 -0
- package/src/types/graph.ts +27 -0
- package/src/types/llm.ts +16 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export {
|
|
2
|
+
SubagentExecutor,
|
|
3
|
+
filterSubagentResult,
|
|
4
|
+
resolveSubagentConfigs,
|
|
5
|
+
buildChildInputs,
|
|
6
|
+
} from './SubagentExecutor';
|
|
7
|
+
export type {
|
|
8
|
+
SubagentExecuteParams,
|
|
9
|
+
SubagentExecuteResult,
|
|
10
|
+
SubagentExecutorOptions,
|
|
11
|
+
ChildGraphFactory,
|
|
12
|
+
} from './SubagentExecutor';
|
package/src/types/graph.ts
CHANGED
|
@@ -388,6 +388,29 @@ export type MultiAgentGraphInput = StandardGraphInput & {
|
|
|
388
388
|
edges: GraphEdge[];
|
|
389
389
|
};
|
|
390
390
|
|
|
391
|
+
/** Configuration for a subagent type that can be spawned by a parent agent. */
|
|
392
|
+
export type SubagentConfig = {
|
|
393
|
+
/** Identifier used in the tool's `subagent_type` enum (e.g. 'researcher', 'coder'). */
|
|
394
|
+
type: string;
|
|
395
|
+
/** Human-readable display name. */
|
|
396
|
+
name: string;
|
|
397
|
+
/** What this subagent specializes in — shown to the LLM. */
|
|
398
|
+
description: string;
|
|
399
|
+
/** Full agent config for the child graph. Omit when `self` is true. */
|
|
400
|
+
agentInputs?: AgentInputs;
|
|
401
|
+
/** When true, reuse the parent's AgentInputs (context isolation without separate config). */
|
|
402
|
+
self?: boolean;
|
|
403
|
+
/** Max AGENT→TOOLS cycles before forced stop (default: 25). */
|
|
404
|
+
maxTurns?: number;
|
|
405
|
+
/** Allow this subagent to spawn its own subagents (default: false). */
|
|
406
|
+
allowNested?: boolean;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
/** SubagentConfig with agentInputs guaranteed present (self-spawn resolved). */
|
|
410
|
+
export type ResolvedSubagentConfig = SubagentConfig & {
|
|
411
|
+
agentInputs: AgentInputs;
|
|
412
|
+
};
|
|
413
|
+
|
|
391
414
|
export interface AgentInputs {
|
|
392
415
|
agentId: string;
|
|
393
416
|
/** Human-readable name for the agent (used in handoff context). Defaults to agentId if not provided. */
|
|
@@ -431,6 +454,10 @@ export interface AgentInputs {
|
|
|
431
454
|
maxToolResultChars?: number;
|
|
432
455
|
/** Pre-computed tool schema token count (from cache). Skips recalculation when provided. */
|
|
433
456
|
toolSchemaTokens?: number;
|
|
457
|
+
/** Subagent configurations for hierarchical delegation. Each defines a child agent type. */
|
|
458
|
+
subagentConfigs?: SubagentConfig[];
|
|
459
|
+
/** Maximum subagent nesting depth. Default 1 means top-level agents can spawn subagents but subagents cannot nest further. */
|
|
460
|
+
maxSubagentDepth?: number;
|
|
434
461
|
}
|
|
435
462
|
|
|
436
463
|
export interface ContextPruningConfig {
|
package/src/types/llm.ts
CHANGED
|
@@ -45,7 +45,20 @@ export type AzureClientOptions = Partial<OpenAIChatInput> &
|
|
|
45
45
|
} & BaseChatModelParams & {
|
|
46
46
|
configuration?: OAIClientOptions;
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Controls whether Claude's reasoning content is returned in adaptive
|
|
50
|
+
* thinking responses. Added for Claude Opus 4.7, which omits thinking by
|
|
51
|
+
* default unless the caller opts in with `'summarized'`.
|
|
52
|
+
* @see https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-7#thinking-content-omitted-by-default
|
|
53
|
+
*/
|
|
54
|
+
export type ThinkingDisplay = 'summarized' | 'omitted';
|
|
55
|
+
export type ThinkingConfigAdaptive = {
|
|
56
|
+
type: 'adaptive';
|
|
57
|
+
display?: ThinkingDisplay;
|
|
58
|
+
};
|
|
59
|
+
export type ThinkingConfig =
|
|
60
|
+
| NonNullable<AnthropicInput['thinking']>
|
|
61
|
+
| ThinkingConfigAdaptive;
|
|
49
62
|
export type ChatOpenAIToolType =
|
|
50
63
|
| BindToolsInput
|
|
51
64
|
| OpenAIClient.ChatCompletionTool;
|
|
@@ -60,7 +73,8 @@ export type GoogleThinkingConfig = {
|
|
|
60
73
|
thinkingLevel?: string;
|
|
61
74
|
};
|
|
62
75
|
export type OpenAIClientOptions = ChatOpenAIFields;
|
|
63
|
-
export type AnthropicClientOptions = AnthropicInput & {
|
|
76
|
+
export type AnthropicClientOptions = Omit<AnthropicInput, 'thinking'> & {
|
|
77
|
+
thinking?: ThinkingConfig;
|
|
64
78
|
promptCache?: boolean;
|
|
65
79
|
};
|
|
66
80
|
export type MistralAIClientOptions = ChatMistralAIInput;
|