deepagents 1.8.2 → 1.8.4
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.cjs +18 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -18
- package/dist/index.d.ts +44 -18
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/package.json +4 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zod_v30 from "zod/v3";
|
|
2
2
|
import * as langchain from "langchain";
|
|
3
|
-
import { AgentMiddleware, AgentMiddleware as AgentMiddleware$1, AgentTypeConfig, HumanMessage, InferMiddlewareStates, InterruptOnConfig, ProviderStrategy, ReactAgent, ResponseFormat, ResponseFormatUndefined, StructuredTool, SystemMessage, ToolMessage, ToolStrategy } from "langchain";
|
|
3
|
+
import { AgentMiddleware, AgentMiddleware as AgentMiddleware$1, AgentTypeConfig, CreateAgentParams, HumanMessage, InferMiddlewareStates, InterruptOnConfig, ProviderStrategy, ReactAgent, ResponseFormat, ResponseFormatUndefined, StructuredTool, SystemMessage, ToolMessage, ToolStrategy } from "langchain";
|
|
4
4
|
import * as _langchain_langgraph0 from "@langchain/langgraph";
|
|
5
5
|
import { AnnotationRoot, Command, ReducedValue, StateSchema } from "@langchain/langgraph";
|
|
6
6
|
import { z } from "zod/v4";
|
|
@@ -469,7 +469,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
469
469
|
path: string;
|
|
470
470
|
}, {
|
|
471
471
|
path?: string | undefined;
|
|
472
|
-
}, string, "ls"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
472
|
+
}, string, unknown, "ls"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
473
473
|
file_path: z.ZodString;
|
|
474
474
|
offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
475
475
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
@@ -481,7 +481,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
481
481
|
file_path: string;
|
|
482
482
|
offset?: unknown;
|
|
483
483
|
limit?: unknown;
|
|
484
|
-
}, string, "read_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
484
|
+
}, string, unknown, "read_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
485
485
|
file_path: z.ZodString;
|
|
486
486
|
content: z.ZodDefault<z.ZodString>;
|
|
487
487
|
}, z.core.$strip>, {
|
|
@@ -493,7 +493,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
493
493
|
}, string | ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>> | Command<unknown, {
|
|
494
494
|
files: Record<string, FileData>;
|
|
495
495
|
messages: ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
496
|
-
}, string>, "write_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
496
|
+
}, string>, unknown, "write_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
497
497
|
file_path: z.ZodString;
|
|
498
498
|
old_string: z.ZodString;
|
|
499
499
|
new_string: z.ZodString;
|
|
@@ -511,7 +511,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
511
511
|
}, string | ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>> | Command<unknown, {
|
|
512
512
|
files: Record<string, FileData>;
|
|
513
513
|
messages: ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
514
|
-
}, string>, "edit_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
514
|
+
}, string>, unknown, "edit_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
515
515
|
pattern: z.ZodString;
|
|
516
516
|
path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
517
517
|
}, z.core.$strip>, {
|
|
@@ -520,7 +520,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
520
520
|
}, {
|
|
521
521
|
pattern: string;
|
|
522
522
|
path?: string | undefined;
|
|
523
|
-
}, string, "glob"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
523
|
+
}, string, unknown, "glob"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
524
524
|
pattern: z.ZodString;
|
|
525
525
|
path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
526
526
|
glob: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -532,13 +532,13 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
532
532
|
pattern: string;
|
|
533
533
|
path?: string | undefined;
|
|
534
534
|
glob?: string | null | undefined;
|
|
535
|
-
}, string, "grep"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
535
|
+
}, string, unknown, "grep"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
536
536
|
command: z.ZodString;
|
|
537
537
|
}, z.core.$strip>, {
|
|
538
538
|
command: string;
|
|
539
539
|
}, {
|
|
540
540
|
command: string;
|
|
541
|
-
}, string, "execute">)[]>;
|
|
541
|
+
}, string, unknown, "execute">)[]>;
|
|
542
542
|
//#endregion
|
|
543
543
|
//#region src/middleware/subagents.d.ts
|
|
544
544
|
/**
|
|
@@ -647,6 +647,32 @@ interface SubAgent {
|
|
|
647
647
|
* ```
|
|
648
648
|
*/
|
|
649
649
|
skills?: string[];
|
|
650
|
+
/**
|
|
651
|
+
* Structured output response format for the subagent.
|
|
652
|
+
*
|
|
653
|
+
* When specified, the subagent will produce a `structuredResponse` conforming to the
|
|
654
|
+
* given schema. The structured response is JSON-serialized and returned as the
|
|
655
|
+
* ToolMessage content to the parent agent, replacing the default last-message extraction.
|
|
656
|
+
*
|
|
657
|
+
* Accepts any format supported by `createAgent`: Zod schemas, JSON schema objects,
|
|
658
|
+
* `toolStrategy(schema)`, `providerStrategy(schema)`, etc.
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* ```typescript
|
|
662
|
+
* import { z } from "zod"
|
|
663
|
+
*
|
|
664
|
+
* const analyzer: SubAgent = {
|
|
665
|
+
* name: "analyzer",
|
|
666
|
+
* description: "Analyzes data and returns structured findings",
|
|
667
|
+
* systemPrompt: "Analyze the data and return your findings.",
|
|
668
|
+
* responseFormat: z.object({
|
|
669
|
+
* findings: z.string(),
|
|
670
|
+
* confidence: z.number(),
|
|
671
|
+
* }),
|
|
672
|
+
* };
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
responseFormat?: CreateAgentParams["responseFormat"];
|
|
650
676
|
}
|
|
651
677
|
/**
|
|
652
678
|
* Base specification for the general-purpose subagent.
|
|
@@ -724,7 +750,7 @@ declare function createSubAgentMiddleware(options: SubAgentMiddlewareOptions): A
|
|
|
724
750
|
}, {
|
|
725
751
|
description: string;
|
|
726
752
|
subagent_type: string;
|
|
727
|
-
}, string | Command<unknown, Record<string, unknown>, string>, "task">]>;
|
|
753
|
+
}, string | Command<unknown, Record<string, unknown>, string>, unknown, "task">]>;
|
|
728
754
|
//#endregion
|
|
729
755
|
//#region src/middleware/patch_tool_calls.d.ts
|
|
730
756
|
/**
|
|
@@ -2118,7 +2144,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2118
2144
|
status: "completed" | "in_progress" | "pending";
|
|
2119
2145
|
}[];
|
|
2120
2146
|
messages: _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
2121
|
-
}, string>, "write_todos">]>, AgentMiddleware<_langchain_langgraph0.StateSchema<{
|
|
2147
|
+
}, string>, unknown, "write_todos">]>, AgentMiddleware<_langchain_langgraph0.StateSchema<{
|
|
2122
2148
|
files: _langchain_langgraph0.ReducedValue<FilesRecord | undefined, FilesRecordUpdate | undefined>;
|
|
2123
2149
|
}>, undefined, unknown, (langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2124
2150
|
path: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
@@ -2126,7 +2152,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2126
2152
|
path: string;
|
|
2127
2153
|
}, {
|
|
2128
2154
|
path?: string | undefined;
|
|
2129
|
-
}, string, "ls"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2155
|
+
}, string, unknown, "ls"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2130
2156
|
file_path: zod.ZodString;
|
|
2131
2157
|
offset: zod.ZodDefault<zod.ZodOptional<zod.ZodCoercedNumber<unknown>>>;
|
|
2132
2158
|
limit: zod.ZodDefault<zod.ZodOptional<zod.ZodCoercedNumber<unknown>>>;
|
|
@@ -2138,7 +2164,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2138
2164
|
file_path: string;
|
|
2139
2165
|
offset?: unknown;
|
|
2140
2166
|
limit?: unknown;
|
|
2141
|
-
}, string, "read_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2167
|
+
}, string, unknown, "read_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2142
2168
|
file_path: zod.ZodString;
|
|
2143
2169
|
content: zod.ZodDefault<zod.ZodString>;
|
|
2144
2170
|
}, zod_v4_core0.$strip>, {
|
|
@@ -2150,7 +2176,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2150
2176
|
}, string | _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>> | _langchain_langgraph0.Command<unknown, {
|
|
2151
2177
|
files: Record<string, FileData>;
|
|
2152
2178
|
messages: _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
2153
|
-
}, string>, "write_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2179
|
+
}, string>, unknown, "write_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2154
2180
|
file_path: zod.ZodString;
|
|
2155
2181
|
old_string: zod.ZodString;
|
|
2156
2182
|
new_string: zod.ZodString;
|
|
@@ -2168,7 +2194,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2168
2194
|
}, string | _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>> | _langchain_langgraph0.Command<unknown, {
|
|
2169
2195
|
files: Record<string, FileData>;
|
|
2170
2196
|
messages: _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
2171
|
-
}, string>, "edit_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2197
|
+
}, string>, unknown, "edit_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2172
2198
|
pattern: zod.ZodString;
|
|
2173
2199
|
path: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
2174
2200
|
}, zod_v4_core0.$strip>, {
|
|
@@ -2177,7 +2203,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2177
2203
|
}, {
|
|
2178
2204
|
pattern: string;
|
|
2179
2205
|
path?: string | undefined;
|
|
2180
|
-
}, string, "glob"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2206
|
+
}, string, unknown, "glob"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2181
2207
|
pattern: zod.ZodString;
|
|
2182
2208
|
path: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
2183
2209
|
glob: zod.ZodNullable<zod.ZodOptional<zod.ZodString>>;
|
|
@@ -2189,13 +2215,13 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2189
2215
|
pattern: string;
|
|
2190
2216
|
path?: string | undefined;
|
|
2191
2217
|
glob?: string | null | undefined;
|
|
2192
|
-
}, string, "grep"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2218
|
+
}, string, unknown, "grep"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2193
2219
|
command: zod.ZodString;
|
|
2194
2220
|
}, zod_v4_core0.$strip>, {
|
|
2195
2221
|
command: string;
|
|
2196
2222
|
}, {
|
|
2197
2223
|
command: string;
|
|
2198
|
-
}, string, "execute">)[]>, AgentMiddleware<undefined, undefined, unknown, readonly [langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2224
|
+
}, string, unknown, "execute">)[]>, AgentMiddleware<undefined, undefined, unknown, readonly [langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2199
2225
|
description: zod.ZodString;
|
|
2200
2226
|
subagent_type: zod.ZodString;
|
|
2201
2227
|
}, zod_v4_core0.$strip>, {
|
|
@@ -2204,7 +2230,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2204
2230
|
}, {
|
|
2205
2231
|
description: string;
|
|
2206
2232
|
subagent_type: string;
|
|
2207
|
-
}, string | _langchain_langgraph0.Command<unknown, Record<string, unknown>, string>, "task">]>, AgentMiddleware<zod.ZodObject<{
|
|
2233
|
+
}, string | _langchain_langgraph0.Command<unknown, Record<string, unknown>, string>, unknown, "task">]>, AgentMiddleware<zod.ZodObject<{
|
|
2208
2234
|
_summarizationSessionId: zod.ZodOptional<zod.ZodString>;
|
|
2209
2235
|
_summarizationEvent: zod.ZodOptional<zod.ZodObject<{
|
|
2210
2236
|
cutoffIndex: zod.ZodNumber;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as langchain from "langchain";
|
|
2
|
-
import { AgentMiddleware, AgentMiddleware as AgentMiddleware$1, AgentTypeConfig, HumanMessage, InferMiddlewareStates, InterruptOnConfig, ProviderStrategy, ReactAgent, ResponseFormat, ResponseFormatUndefined, StructuredTool, SystemMessage, ToolMessage, ToolStrategy } from "langchain";
|
|
2
|
+
import { AgentMiddleware, AgentMiddleware as AgentMiddleware$1, AgentTypeConfig, CreateAgentParams, HumanMessage, InferMiddlewareStates, InterruptOnConfig, ProviderStrategy, ReactAgent, ResponseFormat, ResponseFormatUndefined, StructuredTool, SystemMessage, ToolMessage, ToolStrategy } from "langchain";
|
|
3
3
|
import { Runnable } from "@langchain/core/runnables";
|
|
4
4
|
import * as _langchain_langgraph0 from "@langchain/langgraph";
|
|
5
5
|
import { AnnotationRoot, Command, ReducedValue, StateSchema } from "@langchain/langgraph";
|
|
@@ -469,7 +469,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
469
469
|
path: string;
|
|
470
470
|
}, {
|
|
471
471
|
path?: string | undefined;
|
|
472
|
-
}, string, "ls"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
472
|
+
}, string, unknown, "ls"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
473
473
|
file_path: z.ZodString;
|
|
474
474
|
offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
475
475
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
@@ -481,7 +481,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
481
481
|
file_path: string;
|
|
482
482
|
offset?: unknown;
|
|
483
483
|
limit?: unknown;
|
|
484
|
-
}, string, "read_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
484
|
+
}, string, unknown, "read_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
485
485
|
file_path: z.ZodString;
|
|
486
486
|
content: z.ZodDefault<z.ZodString>;
|
|
487
487
|
}, z.core.$strip>, {
|
|
@@ -493,7 +493,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
493
493
|
}, string | ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>> | Command<unknown, {
|
|
494
494
|
files: Record<string, FileData>;
|
|
495
495
|
messages: ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
496
|
-
}, string>, "write_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
496
|
+
}, string>, unknown, "write_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
497
497
|
file_path: z.ZodString;
|
|
498
498
|
old_string: z.ZodString;
|
|
499
499
|
new_string: z.ZodString;
|
|
@@ -511,7 +511,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
511
511
|
}, string | ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>> | Command<unknown, {
|
|
512
512
|
files: Record<string, FileData>;
|
|
513
513
|
messages: ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
514
|
-
}, string>, "edit_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
514
|
+
}, string>, unknown, "edit_file"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
515
515
|
pattern: z.ZodString;
|
|
516
516
|
path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
517
517
|
}, z.core.$strip>, {
|
|
@@ -520,7 +520,7 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
520
520
|
}, {
|
|
521
521
|
pattern: string;
|
|
522
522
|
path?: string | undefined;
|
|
523
|
-
}, string, "glob"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
523
|
+
}, string, unknown, "glob"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
524
524
|
pattern: z.ZodString;
|
|
525
525
|
path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
526
526
|
glob: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -532,13 +532,13 @@ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOption
|
|
|
532
532
|
pattern: string;
|
|
533
533
|
path?: string | undefined;
|
|
534
534
|
glob?: string | null | undefined;
|
|
535
|
-
}, string, "grep"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
535
|
+
}, string, unknown, "grep"> | langchain.DynamicStructuredTool<z.ZodObject<{
|
|
536
536
|
command: z.ZodString;
|
|
537
537
|
}, z.core.$strip>, {
|
|
538
538
|
command: string;
|
|
539
539
|
}, {
|
|
540
540
|
command: string;
|
|
541
|
-
}, string, "execute">)[]>;
|
|
541
|
+
}, string, unknown, "execute">)[]>;
|
|
542
542
|
//#endregion
|
|
543
543
|
//#region src/middleware/subagents.d.ts
|
|
544
544
|
/**
|
|
@@ -647,6 +647,32 @@ interface SubAgent {
|
|
|
647
647
|
* ```
|
|
648
648
|
*/
|
|
649
649
|
skills?: string[];
|
|
650
|
+
/**
|
|
651
|
+
* Structured output response format for the subagent.
|
|
652
|
+
*
|
|
653
|
+
* When specified, the subagent will produce a `structuredResponse` conforming to the
|
|
654
|
+
* given schema. The structured response is JSON-serialized and returned as the
|
|
655
|
+
* ToolMessage content to the parent agent, replacing the default last-message extraction.
|
|
656
|
+
*
|
|
657
|
+
* Accepts any format supported by `createAgent`: Zod schemas, JSON schema objects,
|
|
658
|
+
* `toolStrategy(schema)`, `providerStrategy(schema)`, etc.
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* ```typescript
|
|
662
|
+
* import { z } from "zod"
|
|
663
|
+
*
|
|
664
|
+
* const analyzer: SubAgent = {
|
|
665
|
+
* name: "analyzer",
|
|
666
|
+
* description: "Analyzes data and returns structured findings",
|
|
667
|
+
* systemPrompt: "Analyze the data and return your findings.",
|
|
668
|
+
* responseFormat: z.object({
|
|
669
|
+
* findings: z.string(),
|
|
670
|
+
* confidence: z.number(),
|
|
671
|
+
* }),
|
|
672
|
+
* };
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
responseFormat?: CreateAgentParams["responseFormat"];
|
|
650
676
|
}
|
|
651
677
|
/**
|
|
652
678
|
* Base specification for the general-purpose subagent.
|
|
@@ -724,7 +750,7 @@ declare function createSubAgentMiddleware(options: SubAgentMiddlewareOptions): A
|
|
|
724
750
|
}, {
|
|
725
751
|
description: string;
|
|
726
752
|
subagent_type: string;
|
|
727
|
-
}, string | Command<unknown, Record<string, unknown>, string>, "task">]>;
|
|
753
|
+
}, string | Command<unknown, Record<string, unknown>, string>, unknown, "task">]>;
|
|
728
754
|
//#endregion
|
|
729
755
|
//#region src/middleware/patch_tool_calls.d.ts
|
|
730
756
|
/**
|
|
@@ -2118,7 +2144,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2118
2144
|
status: "completed" | "in_progress" | "pending";
|
|
2119
2145
|
}[];
|
|
2120
2146
|
messages: _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
2121
|
-
}, string>, "write_todos">]>, AgentMiddleware<_langchain_langgraph0.StateSchema<{
|
|
2147
|
+
}, string>, unknown, "write_todos">]>, AgentMiddleware<_langchain_langgraph0.StateSchema<{
|
|
2122
2148
|
files: _langchain_langgraph0.ReducedValue<FilesRecord | undefined, FilesRecordUpdate | undefined>;
|
|
2123
2149
|
}>, undefined, unknown, (langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2124
2150
|
path: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
@@ -2126,7 +2152,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2126
2152
|
path: string;
|
|
2127
2153
|
}, {
|
|
2128
2154
|
path?: string | undefined;
|
|
2129
|
-
}, string, "ls"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2155
|
+
}, string, unknown, "ls"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2130
2156
|
file_path: zod.ZodString;
|
|
2131
2157
|
offset: zod.ZodDefault<zod.ZodOptional<zod.ZodCoercedNumber<unknown>>>;
|
|
2132
2158
|
limit: zod.ZodDefault<zod.ZodOptional<zod.ZodCoercedNumber<unknown>>>;
|
|
@@ -2138,7 +2164,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2138
2164
|
file_path: string;
|
|
2139
2165
|
offset?: unknown;
|
|
2140
2166
|
limit?: unknown;
|
|
2141
|
-
}, string, "read_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2167
|
+
}, string, unknown, "read_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2142
2168
|
file_path: zod.ZodString;
|
|
2143
2169
|
content: zod.ZodDefault<zod.ZodString>;
|
|
2144
2170
|
}, zod_v4_core0.$strip>, {
|
|
@@ -2150,7 +2176,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2150
2176
|
}, string | _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>> | _langchain_langgraph0.Command<unknown, {
|
|
2151
2177
|
files: Record<string, FileData>;
|
|
2152
2178
|
messages: _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
2153
|
-
}, string>, "write_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2179
|
+
}, string>, unknown, "write_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2154
2180
|
file_path: zod.ZodString;
|
|
2155
2181
|
old_string: zod.ZodString;
|
|
2156
2182
|
new_string: zod.ZodString;
|
|
@@ -2168,7 +2194,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2168
2194
|
}, string | _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>> | _langchain_langgraph0.Command<unknown, {
|
|
2169
2195
|
files: Record<string, FileData>;
|
|
2170
2196
|
messages: _messages.ToolMessage<_messages.MessageStructure<_messages.MessageToolSet>>[];
|
|
2171
|
-
}, string>, "edit_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2197
|
+
}, string>, unknown, "edit_file"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2172
2198
|
pattern: zod.ZodString;
|
|
2173
2199
|
path: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
2174
2200
|
}, zod_v4_core0.$strip>, {
|
|
@@ -2177,7 +2203,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2177
2203
|
}, {
|
|
2178
2204
|
pattern: string;
|
|
2179
2205
|
path?: string | undefined;
|
|
2180
|
-
}, string, "glob"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2206
|
+
}, string, unknown, "glob"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2181
2207
|
pattern: zod.ZodString;
|
|
2182
2208
|
path: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
2183
2209
|
glob: zod.ZodNullable<zod.ZodOptional<zod.ZodString>>;
|
|
@@ -2189,13 +2215,13 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2189
2215
|
pattern: string;
|
|
2190
2216
|
path?: string | undefined;
|
|
2191
2217
|
glob?: string | null | undefined;
|
|
2192
|
-
}, string, "grep"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2218
|
+
}, string, unknown, "grep"> | langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2193
2219
|
command: zod.ZodString;
|
|
2194
2220
|
}, zod_v4_core0.$strip>, {
|
|
2195
2221
|
command: string;
|
|
2196
2222
|
}, {
|
|
2197
2223
|
command: string;
|
|
2198
|
-
}, string, "execute">)[]>, AgentMiddleware<undefined, undefined, unknown, readonly [langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2224
|
+
}, string, unknown, "execute">)[]>, AgentMiddleware<undefined, undefined, unknown, readonly [langchain.DynamicStructuredTool<zod.ZodObject<{
|
|
2199
2225
|
description: zod.ZodString;
|
|
2200
2226
|
subagent_type: zod.ZodString;
|
|
2201
2227
|
}, zod_v4_core0.$strip>, {
|
|
@@ -2204,7 +2230,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
|
|
|
2204
2230
|
}, {
|
|
2205
2231
|
description: string;
|
|
2206
2232
|
subagent_type: string;
|
|
2207
|
-
}, string | _langchain_langgraph0.Command<unknown, Record<string, unknown>, string>, "task">]>, AgentMiddleware<zod.ZodObject<{
|
|
2233
|
+
}, string | _langchain_langgraph0.Command<unknown, Record<string, unknown>, string>, unknown, "task">]>, AgentMiddleware<zod.ZodObject<{
|
|
2208
2234
|
_summarizationSessionId: zod.ZodOptional<zod.ZodString>;
|
|
2209
2235
|
_summarizationEvent: zod.ZodOptional<zod.ZodObject<{
|
|
2210
2236
|
cutoffIndex: zod.ZodNumber;
|
package/dist/index.js
CHANGED
|
@@ -1037,7 +1037,7 @@ function createFilesystemMiddleware(options = {}) {
|
|
|
1037
1037
|
wrapModelCall: async (request, handler) => {
|
|
1038
1038
|
const supportsExecution = isSandboxBackend(getBackend(backend, {
|
|
1039
1039
|
state: request.state || {},
|
|
1040
|
-
store: request.
|
|
1040
|
+
store: request.runtime?.store
|
|
1041
1041
|
}));
|
|
1042
1042
|
let tools = request.tools;
|
|
1043
1043
|
if (!supportsExecution) tools = tools.filter((t) => t.name !== "execute");
|
|
@@ -1059,7 +1059,7 @@ function createFilesystemMiddleware(options = {}) {
|
|
|
1059
1059
|
if (typeof msg.content === "string" && msg.content.length > toolTokenLimitBeforeEvict * NUM_CHARS_PER_TOKEN) {
|
|
1060
1060
|
const resolvedBackend = getBackend(backend, {
|
|
1061
1061
|
state: request.state || {},
|
|
1062
|
-
store: request.
|
|
1062
|
+
store: request.runtime?.store
|
|
1063
1063
|
});
|
|
1064
1064
|
const evictPath = `/large_tool_results/${sanitizeToolCallId(request.toolCall?.id || msg.tool_call_id)}`;
|
|
1065
1065
|
const writeResult = await resolvedBackend.write(evictPath, msg.content);
|
|
@@ -1368,11 +1368,15 @@ const INVALID_TOOL_MESSAGE_BLOCK_TYPES = [
|
|
|
1368
1368
|
*/
|
|
1369
1369
|
function returnCommandWithStateUpdate(result, toolCallId) {
|
|
1370
1370
|
const stateUpdate = filterStateForSubagent(result);
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1371
|
+
let content;
|
|
1372
|
+
if (result.structuredResponse != null) content = JSON.stringify(result.structuredResponse);
|
|
1373
|
+
else {
|
|
1374
|
+
const messages = result.messages;
|
|
1375
|
+
content = (messages?.[messages.length - 1])?.content || "Task completed";
|
|
1376
|
+
if (Array.isArray(content)) {
|
|
1377
|
+
content = content.filter((block) => !INVALID_TOOL_MESSAGE_BLOCK_TYPES.includes(block.type));
|
|
1378
|
+
if (content.length === 0) content = "Task completed";
|
|
1379
|
+
}
|
|
1376
1380
|
}
|
|
1377
1381
|
return new Command({ update: {
|
|
1378
1382
|
...stateUpdate,
|
|
@@ -1416,7 +1420,8 @@ function getSubagents(options) {
|
|
|
1416
1420
|
systemPrompt: agentParams.systemPrompt,
|
|
1417
1421
|
tools: agentParams.tools ?? defaultTools,
|
|
1418
1422
|
middleware,
|
|
1419
|
-
name: agentParams.name
|
|
1423
|
+
name: agentParams.name,
|
|
1424
|
+
...agentParams.responseFormat != null && { responseFormat: agentParams.responseFormat }
|
|
1420
1425
|
});
|
|
1421
1426
|
}
|
|
1422
1427
|
}
|
|
@@ -1450,6 +1455,7 @@ function createTaskTool(options) {
|
|
|
1450
1455
|
subagentState.messages = [new HumanMessage$1({ content: description })];
|
|
1451
1456
|
const result = await subagent.invoke(subagentState, config);
|
|
1452
1457
|
if (!config.toolCall?.id) {
|
|
1458
|
+
if (result.structuredResponse != null) return JSON.stringify(result.structuredResponse);
|
|
1453
1459
|
const messages = result.messages;
|
|
1454
1460
|
let content = (messages?.[messages.length - 1])?.content || "Task completed";
|
|
1455
1461
|
if (Array.isArray(content)) {
|
|
@@ -4989,7 +4995,10 @@ function createDeepAgent(params = {}) {
|
|
|
4989
4995
|
checkpointer,
|
|
4990
4996
|
store,
|
|
4991
4997
|
name
|
|
4992
|
-
}).withConfig({
|
|
4998
|
+
}).withConfig({
|
|
4999
|
+
recursionLimit: 1e4,
|
|
5000
|
+
metadata: { ls_integration: "deepagents" }
|
|
5001
|
+
});
|
|
4993
5002
|
}
|
|
4994
5003
|
|
|
4995
5004
|
//#endregion
|