illuma-agents 1.0.49 → 1.0.51
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 +62 -14
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/common/enum.cjs +2 -0
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +48 -2
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs +26 -17
- package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
- package/dist/cjs/llm/openai/index.cjs +1 -0
- package/dist/cjs/llm/openai/index.cjs.map +1 -1
- package/dist/cjs/main.cjs +9 -17
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/stream.cjs +0 -14
- package/dist/cjs/stream.cjs.map +1 -1
- package/dist/cjs/tools/CodeExecutor.cjs +37 -27
- package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs +22 -18
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +100 -5
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/ToolSearch.cjs +38 -31
- package/dist/cjs/tools/ToolSearch.cjs.map +1 -1
- package/dist/cjs/tools/schema.cjs +31 -0
- package/dist/cjs/tools/schema.cjs.map +1 -0
- package/dist/cjs/tools/search/schema.cjs +25 -23
- package/dist/cjs/tools/search/schema.cjs.map +1 -1
- package/dist/cjs/tools/search/tool.cjs +9 -33
- package/dist/cjs/tools/search/tool.cjs.map +1 -1
- package/dist/cjs/utils/schema.cjs +27 -0
- package/dist/cjs/utils/schema.cjs.map +1 -0
- package/dist/cjs/utils/title.cjs +28 -14
- package/dist/cjs/utils/title.cjs.map +1 -1
- package/dist/esm/agents/AgentContext.mjs +62 -14
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/common/enum.mjs +2 -0
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +48 -2
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs +26 -17
- package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
- package/dist/esm/llm/openai/index.mjs +1 -0
- package/dist/esm/llm/openai/index.mjs.map +1 -1
- package/dist/esm/main.mjs +3 -4
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/stream.mjs +0 -14
- package/dist/esm/stream.mjs.map +1 -1
- package/dist/esm/tools/CodeExecutor.mjs +37 -27
- package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticToolCalling.mjs +22 -18
- package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +101 -6
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/ToolSearch.mjs +38 -31
- package/dist/esm/tools/ToolSearch.mjs.map +1 -1
- package/dist/esm/tools/schema.mjs +28 -0
- package/dist/esm/tools/schema.mjs.map +1 -0
- package/dist/esm/tools/search/schema.mjs +25 -23
- package/dist/esm/tools/search/schema.mjs.map +1 -1
- package/dist/esm/tools/search/tool.mjs +10 -34
- package/dist/esm/tools/search/tool.mjs.map +1 -1
- package/dist/esm/utils/schema.mjs +24 -0
- package/dist/esm/utils/schema.mjs.map +1 -0
- package/dist/esm/utils/title.mjs +28 -14
- package/dist/esm/utils/title.mjs.map +1 -1
- package/dist/types/agents/AgentContext.d.ts +13 -2
- package/dist/types/common/enum.d.ts +2 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/tools/CodeExecutor.d.ts +1 -15
- package/dist/types/tools/ProgrammaticToolCalling.d.ts +1 -13
- package/dist/types/tools/ToolNode.d.ts +12 -1
- package/dist/types/tools/ToolSearch.d.ts +1 -15
- package/dist/types/tools/schema.d.ts +12 -0
- package/dist/types/tools/search/schema.d.ts +25 -7
- package/dist/types/tools/search/tool.d.ts +1 -52
- package/dist/types/tools/search/types.d.ts +5 -23
- package/dist/types/types/graph.d.ts +32 -1
- package/dist/types/types/tools.d.ts +55 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/schema.d.ts +8 -0
- package/package.json +2 -4
- package/src/agents/AgentContext.test.ts +99 -0
- package/src/agents/AgentContext.ts +74 -20
- package/src/common/enum.ts +2 -0
- package/src/graphs/Graph.ts +56 -4
- package/src/graphs/MultiAgentGraph.ts +26 -17
- package/src/index.ts +2 -3
- package/src/scripts/test_code_api.ts +4 -4
- package/src/specs/agent-handoffs.test.ts +1 -2
- package/src/specs/azure.simple.test.ts +214 -175
- package/src/specs/thinking-prune.test.ts +6 -6
- package/src/specs/tool-error.test.ts +7 -2
- package/src/stream.ts +0 -17
- package/src/test/mockTools.ts +34 -14
- package/src/tools/CodeExecutor.ts +48 -31
- package/src/tools/ProgrammaticToolCalling.ts +25 -24
- package/src/tools/ToolNode.ts +137 -15
- package/src/tools/ToolSearch.ts +55 -44
- package/src/tools/__tests__/ProgrammaticToolCalling.integration.test.ts +10 -9
- package/src/tools/__tests__/ToolSearch.integration.test.ts +10 -9
- package/src/tools/schema.ts +37 -0
- package/src/tools/search/schema.ts +30 -25
- package/src/tools/search/tool.ts +23 -16
- package/src/tools/search/types.ts +5 -29
- package/src/types/graph.ts +33 -1
- package/src/types/tools.ts +58 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/schema.ts +35 -0
- package/src/utils/title.ts +31 -19
- package/LICENSE +0 -21
- package/dist/cjs/deepagents/DeepAgentBackend.cjs +0 -170
- package/dist/cjs/deepagents/DeepAgentBackend.cjs.map +0 -1
- package/dist/cjs/deepagents/DeepAgentRuntime.cjs +0 -135
- package/dist/cjs/deepagents/DeepAgentRuntime.cjs.map +0 -1
- package/dist/cjs/deepagents/types.cjs +0 -29
- package/dist/cjs/deepagents/types.cjs.map +0 -1
- package/dist/esm/deepagents/DeepAgentBackend.mjs +0 -168
- package/dist/esm/deepagents/DeepAgentBackend.mjs.map +0 -1
- package/dist/esm/deepagents/DeepAgentRuntime.mjs +0 -132
- package/dist/esm/deepagents/DeepAgentRuntime.mjs.map +0 -1
- package/dist/esm/deepagents/types.mjs +0 -26
- package/dist/esm/deepagents/types.mjs.map +0 -1
- package/dist/types/deepagents/DeepAgentBackend.d.ts +0 -82
- package/dist/types/deepagents/DeepAgentRuntime.d.ts +0 -46
- package/dist/types/deepagents/index.d.ts +0 -16
- package/dist/types/deepagents/types.d.ts +0 -105
- package/src/deepagents/DeepAgentBackend.ts +0 -214
- package/src/deepagents/DeepAgentRuntime.ts +0 -187
- package/src/deepagents/index.ts +0 -25
- package/src/deepagents/types.ts +0 -118
- package/src/specs/deepagents.test.ts +0 -286
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
1
|
export enum DATE_RANGE {
|
|
4
2
|
PAST_HOUR = 'h',
|
|
5
3
|
PAST_24_HOURS = 'd',
|
|
@@ -38,26 +36,33 @@ Examples:
|
|
|
38
36
|
- "in" for India
|
|
39
37
|
`.trim();
|
|
40
38
|
|
|
41
|
-
export const querySchema =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export const
|
|
47
|
-
|
|
48
|
-
.
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
39
|
+
export const querySchema = {
|
|
40
|
+
type: 'string',
|
|
41
|
+
description: DEFAULT_QUERY_DESCRIPTION,
|
|
42
|
+
} as const;
|
|
43
|
+
|
|
44
|
+
export const dateSchema = {
|
|
45
|
+
type: 'string',
|
|
46
|
+
enum: Object.values(DATE_RANGE),
|
|
47
|
+
description: 'Date range for search results.',
|
|
48
|
+
} as const;
|
|
49
|
+
|
|
50
|
+
export const countrySchema = {
|
|
51
|
+
type: 'string',
|
|
52
|
+
description: DEFAULT_COUNTRY_DESCRIPTION,
|
|
53
|
+
} as const;
|
|
54
|
+
|
|
55
|
+
export const imagesSchema = {
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
description: 'Whether to also run an image search.',
|
|
58
|
+
} as const;
|
|
59
|
+
|
|
60
|
+
export const videosSchema = {
|
|
61
|
+
type: 'boolean',
|
|
62
|
+
description: 'Whether to also run a video search.',
|
|
63
|
+
} as const;
|
|
64
|
+
|
|
65
|
+
export const newsSchema = {
|
|
66
|
+
type: 'boolean',
|
|
67
|
+
description: 'Whether to also run a news search.',
|
|
68
|
+
} as const;
|
package/src/tools/search/tool.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { tool, DynamicStructuredTool } from '@langchain/core/tools';
|
|
3
2
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
4
3
|
import type * as t from './types';
|
|
@@ -422,12 +421,13 @@ function createTool({
|
|
|
422
421
|
search,
|
|
423
422
|
onSearchResults: _onSearchResults,
|
|
424
423
|
}: {
|
|
425
|
-
schema:
|
|
424
|
+
schema: Record<string, unknown>;
|
|
426
425
|
search: ReturnType<typeof createSearchProcessor>;
|
|
427
426
|
onSearchResults: t.SearchToolConfig['onSearchResults'];
|
|
428
|
-
}): DynamicStructuredTool
|
|
429
|
-
return tool
|
|
430
|
-
async (
|
|
427
|
+
}): DynamicStructuredTool {
|
|
428
|
+
return tool(
|
|
429
|
+
async (rawParams, runnableConfig) => {
|
|
430
|
+
const params = rawParams as SearchToolParams;
|
|
431
431
|
const { query, date, country: _c, images, videos, news } = params;
|
|
432
432
|
const country = typeof _c === 'string' && _c ? _c : undefined;
|
|
433
433
|
|
|
@@ -531,9 +531,19 @@ Use anchor marker(s) immediately after the statement:
|
|
|
531
531
|
* @param config - The search tool configuration
|
|
532
532
|
* @returns A DynamicStructuredTool with a schema that depends on the searchProvider
|
|
533
533
|
*/
|
|
534
|
+
/** Input params type for search tool */
|
|
535
|
+
interface SearchToolParams {
|
|
536
|
+
query: string;
|
|
537
|
+
date?: DATE_RANGE;
|
|
538
|
+
country?: string;
|
|
539
|
+
images?: boolean;
|
|
540
|
+
videos?: boolean;
|
|
541
|
+
news?: boolean;
|
|
542
|
+
}
|
|
543
|
+
|
|
534
544
|
export const createSearchTool = (
|
|
535
545
|
config: t.SearchToolConfig = {}
|
|
536
|
-
): DynamicStructuredTool
|
|
546
|
+
): DynamicStructuredTool => {
|
|
537
547
|
const {
|
|
538
548
|
searchProvider = 'serper',
|
|
539
549
|
serperApiKey,
|
|
@@ -560,14 +570,7 @@ export const createSearchTool = (
|
|
|
560
570
|
|
|
561
571
|
const logger = config.logger || createDefaultLogger();
|
|
562
572
|
|
|
563
|
-
const
|
|
564
|
-
query: z.ZodString;
|
|
565
|
-
date: z.ZodOptional<z.ZodNativeEnum<typeof DATE_RANGE>>;
|
|
566
|
-
country?: z.ZodOptional<z.ZodString>;
|
|
567
|
-
images: z.ZodOptional<z.ZodBoolean>;
|
|
568
|
-
videos: z.ZodOptional<z.ZodBoolean>;
|
|
569
|
-
news: z.ZodOptional<z.ZodBoolean>;
|
|
570
|
-
} = {
|
|
573
|
+
const schemaProperties: Record<string, unknown> = {
|
|
571
574
|
query: querySchema,
|
|
572
575
|
date: dateSchema,
|
|
573
576
|
images: imagesSchema,
|
|
@@ -576,10 +579,14 @@ export const createSearchTool = (
|
|
|
576
579
|
};
|
|
577
580
|
|
|
578
581
|
if (searchProvider === 'serper') {
|
|
579
|
-
|
|
582
|
+
schemaProperties.country = countrySchema;
|
|
580
583
|
}
|
|
581
584
|
|
|
582
|
-
const toolSchema =
|
|
585
|
+
const toolSchema = {
|
|
586
|
+
type: 'object',
|
|
587
|
+
properties: schemaProperties,
|
|
588
|
+
required: ['query'],
|
|
589
|
+
};
|
|
583
590
|
|
|
584
591
|
const searchAPI = createSearchAPI({
|
|
585
592
|
searchProvider,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import type { Logger as WinstonLogger } from 'winston';
|
|
3
2
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
4
3
|
import type { BaseReranker } from './rerankers';
|
|
@@ -659,31 +658,8 @@ export type ProcessSourcesFields = {
|
|
|
659
658
|
skipScraping?: boolean;
|
|
660
659
|
};
|
|
661
660
|
|
|
662
|
-
export
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
images: z.ZodOptional<z.ZodBoolean>;
|
|
668
|
-
videos: z.ZodOptional<z.ZodBoolean>;
|
|
669
|
-
news: z.ZodOptional<z.ZodBoolean>;
|
|
670
|
-
},
|
|
671
|
-
'strip',
|
|
672
|
-
z.ZodTypeAny,
|
|
673
|
-
{
|
|
674
|
-
query: string;
|
|
675
|
-
date?: DATE_RANGE;
|
|
676
|
-
country?: unknown;
|
|
677
|
-
images?: boolean;
|
|
678
|
-
videos?: boolean;
|
|
679
|
-
news?: boolean;
|
|
680
|
-
},
|
|
681
|
-
{
|
|
682
|
-
query: string;
|
|
683
|
-
date?: DATE_RANGE;
|
|
684
|
-
country?: unknown;
|
|
685
|
-
images?: boolean;
|
|
686
|
-
videos?: boolean;
|
|
687
|
-
news?: boolean;
|
|
688
|
-
}
|
|
689
|
-
>;
|
|
661
|
+
export interface SearchToolSchema {
|
|
662
|
+
type: 'object';
|
|
663
|
+
properties: Record<string, unknown>;
|
|
664
|
+
required: string[];
|
|
665
|
+
}
|
package/src/types/graph.ts
CHANGED
|
@@ -420,6 +420,25 @@ export interface StructuredOutputConfig {
|
|
|
420
420
|
includeRaw?: boolean;
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
+
/**
|
|
424
|
+
* Database/API structured output format (snake_case with enabled flag).
|
|
425
|
+
* This matches the format stored in MongoDB and sent from frontends.
|
|
426
|
+
*/
|
|
427
|
+
export interface StructuredOutputInput {
|
|
428
|
+
/** Whether structured output is enabled */
|
|
429
|
+
enabled?: boolean;
|
|
430
|
+
/** JSON Schema defining the expected response structure */
|
|
431
|
+
schema?: Record<string, unknown>;
|
|
432
|
+
/** Name identifier for the structured output */
|
|
433
|
+
name?: string;
|
|
434
|
+
/** Description of what the structured output represents */
|
|
435
|
+
description?: string;
|
|
436
|
+
/** Mode for structured output: 'tool' | 'provider' | 'auto' */
|
|
437
|
+
mode?: StructuredOutputMode;
|
|
438
|
+
/** Whether to enforce strict schema validation */
|
|
439
|
+
strict?: boolean;
|
|
440
|
+
}
|
|
441
|
+
|
|
423
442
|
export interface AgentInputs {
|
|
424
443
|
agentId: string;
|
|
425
444
|
/** Human-readable name for the agent (used in handoff context). Defaults to agentId if not provided. */
|
|
@@ -450,9 +469,22 @@ export interface AgentInputs {
|
|
|
450
469
|
*/
|
|
451
470
|
dynamicContext?: string;
|
|
452
471
|
/**
|
|
453
|
-
* Structured output configuration.
|
|
472
|
+
* Structured output configuration (camelCase).
|
|
454
473
|
* When set, disables streaming and returns a validated JSON response
|
|
455
474
|
* conforming to the specified schema.
|
|
456
475
|
*/
|
|
457
476
|
structuredOutput?: StructuredOutputConfig;
|
|
477
|
+
/**
|
|
478
|
+
* Structured output configuration (snake_case - database/API format).
|
|
479
|
+
* Alternative to structuredOutput for compatibility with MongoDB/frontend.
|
|
480
|
+
* Uses an `enabled` flag to control activation.
|
|
481
|
+
* @deprecated Use structuredOutput instead when possible
|
|
482
|
+
*/
|
|
483
|
+
structured_output?: StructuredOutputInput;
|
|
484
|
+
/**
|
|
485
|
+
* Serializable tool definitions for event-driven execution.
|
|
486
|
+
* When provided, ToolNode operates in event-driven mode, dispatching
|
|
487
|
+
* ON_TOOL_EXECUTE events instead of invoking tools directly.
|
|
488
|
+
*/
|
|
489
|
+
toolDefinitions?: LCTool[];
|
|
458
490
|
}
|
package/src/types/tools.ts
CHANGED
|
@@ -41,6 +41,12 @@ export type ToolNodeOptions = {
|
|
|
41
41
|
toolRegistry?: LCToolRegistry;
|
|
42
42
|
/** Reference to Graph's sessions map for automatic session injection */
|
|
43
43
|
sessions?: ToolSessionMap;
|
|
44
|
+
/** When true, dispatches ON_TOOL_EXECUTE events instead of invoking tools directly */
|
|
45
|
+
eventDrivenMode?: boolean;
|
|
46
|
+
/** Tool definitions for event-driven mode (used for context, not invocation) */
|
|
47
|
+
toolDefinitions?: Map<string, LCTool>;
|
|
48
|
+
/** Agent ID for event-driven mode (used to identify which agent's context to use) */
|
|
49
|
+
agentId?: string;
|
|
44
50
|
};
|
|
45
51
|
|
|
46
52
|
export type ToolNodeConstructorParams = ToolRefs & ToolNodeOptions;
|
|
@@ -125,6 +131,58 @@ export type LCTool = {
|
|
|
125
131
|
* Options: 'direct', 'code_execution'
|
|
126
132
|
*/
|
|
127
133
|
allowed_callers?: AllowedCaller[];
|
|
134
|
+
/** Response format for the tool output */
|
|
135
|
+
responseFormat?: 'content' | 'content_and_artifact';
|
|
136
|
+
/** Server name for MCP tools */
|
|
137
|
+
serverName?: string;
|
|
138
|
+
/** Tool type classification */
|
|
139
|
+
toolType?: 'builtin' | 'mcp' | 'action';
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** Single tool call within a batch request for event-driven execution */
|
|
143
|
+
export type ToolCallRequest = {
|
|
144
|
+
/** Tool call ID from the LLM */
|
|
145
|
+
id: string;
|
|
146
|
+
/** Tool name */
|
|
147
|
+
name: string;
|
|
148
|
+
/** Tool arguments */
|
|
149
|
+
args: Record<string, unknown>;
|
|
150
|
+
/** Step ID for tracking */
|
|
151
|
+
stepId?: string;
|
|
152
|
+
/** Usage turn count for this tool */
|
|
153
|
+
turn?: number;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/** Batch request containing ALL tool calls for a graph step */
|
|
157
|
+
export type ToolExecuteBatchRequest = {
|
|
158
|
+
/** All tool calls from the AIMessage */
|
|
159
|
+
toolCalls: ToolCallRequest[];
|
|
160
|
+
/** User ID for context */
|
|
161
|
+
userId?: string;
|
|
162
|
+
/** Agent ID for context */
|
|
163
|
+
agentId?: string;
|
|
164
|
+
/** Runtime configurable from RunnableConfig (includes user, userMCPAuthMap, etc.) */
|
|
165
|
+
configurable?: Record<string, unknown>;
|
|
166
|
+
/** Runtime metadata from RunnableConfig (includes thread_id, run_id, provider, etc.) */
|
|
167
|
+
metadata?: Record<string, unknown>;
|
|
168
|
+
/** Promise resolver - handler calls this with ALL results */
|
|
169
|
+
resolve: (results: ToolExecuteResult[]) => void;
|
|
170
|
+
/** Promise rejector - handler calls this on fatal error */
|
|
171
|
+
reject: (error: Error) => void;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/** Result for a single tool call in event-driven execution */
|
|
175
|
+
export type ToolExecuteResult = {
|
|
176
|
+
/** Matches ToolCallRequest.id */
|
|
177
|
+
toolCallId: string;
|
|
178
|
+
/** Tool output content */
|
|
179
|
+
content: string | unknown[];
|
|
180
|
+
/** Optional artifact (for content_and_artifact format) */
|
|
181
|
+
artifact?: unknown;
|
|
182
|
+
/** Execution status */
|
|
183
|
+
status: 'success' | 'error';
|
|
184
|
+
/** Error message if status is 'error' */
|
|
185
|
+
errorMessage?: string;
|
|
128
186
|
};
|
|
129
187
|
|
|
130
188
|
/** Map of tool names to tool definitions */
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/utils/schema.ts
|
|
2
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
|
+
import type { ZodTypeAny } from 'zod';
|
|
4
|
+
|
|
5
|
+
/** Checks if a schema is a Zod schema by looking for the _def property */
|
|
6
|
+
export function isZodSchema(schema: unknown): schema is ZodTypeAny {
|
|
7
|
+
return (
|
|
8
|
+
schema != null && typeof schema === 'object' && '_def' in (schema as object)
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Converts a schema to JSON schema format.
|
|
14
|
+
* Handles both Zod schemas (converts) and JSON schemas (passthrough).
|
|
15
|
+
*/
|
|
16
|
+
export function toJsonSchema(
|
|
17
|
+
schema: unknown,
|
|
18
|
+
name?: string,
|
|
19
|
+
description?: string
|
|
20
|
+
): Record<string, unknown> {
|
|
21
|
+
if (isZodSchema(schema)) {
|
|
22
|
+
const zodSchema = schema as ZodTypeAny & {
|
|
23
|
+
describe: (desc: string) => ZodTypeAny;
|
|
24
|
+
};
|
|
25
|
+
const described =
|
|
26
|
+
description != null && description !== ''
|
|
27
|
+
? zodSchema.describe(description)
|
|
28
|
+
: schema;
|
|
29
|
+
return zodToJsonSchema(
|
|
30
|
+
described as Parameters<typeof zodToJsonSchema>[0],
|
|
31
|
+
name ?? ''
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return schema as Record<string, unknown>;
|
|
35
|
+
}
|
package/src/utils/title.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
|
3
2
|
import { RunnableLambda, RunnableSequence } from '@langchain/core/runnables';
|
|
4
3
|
import type { Runnable, RunnableConfig } from '@langchain/core/runnables';
|
|
@@ -12,22 +11,33 @@ const defaultTitlePrompt = `Analyze this conversation and provide:
|
|
|
12
11
|
|
|
13
12
|
{convo}`;
|
|
14
13
|
|
|
15
|
-
const titleSchema =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
const titleSchema = {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
title: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description:
|
|
20
|
+
'A concise title for the conversation in 5 words or less, without punctuation or quotation',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ['title'],
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
const combinedSchema = {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
language: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'The detected language of the conversation',
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description:
|
|
36
|
+
'A concise title for the conversation in 5 words or less, without punctuation or quotation',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
required: ['language', 'title'],
|
|
40
|
+
} as const;
|
|
31
41
|
|
|
32
42
|
export const createTitleRunnable = async (
|
|
33
43
|
model: t.ChatModelInstance,
|
|
@@ -54,7 +64,8 @@ export const createTitleRunnable = async (
|
|
|
54
64
|
input: { convo: string },
|
|
55
65
|
config?: Partial<RunnableConfig>
|
|
56
66
|
): Promise<{ title: string }> => {
|
|
57
|
-
|
|
67
|
+
const result = await titleOnlyInnerChain.invoke(input, config);
|
|
68
|
+
return result as { title: string };
|
|
58
69
|
},
|
|
59
70
|
}).withConfig({ runName: 'TitleOnlyChain' });
|
|
60
71
|
|
|
@@ -64,7 +75,8 @@ export const createTitleRunnable = async (
|
|
|
64
75
|
input: { convo: string },
|
|
65
76
|
config?: Partial<RunnableConfig>
|
|
66
77
|
): Promise<{ language: string; title: string }> => {
|
|
67
|
-
|
|
78
|
+
const result = await combinedInnerChain.invoke(input, config);
|
|
79
|
+
return result as { language: string; title: string };
|
|
68
80
|
},
|
|
69
81
|
}).withConfig({ runName: 'TitleLanguageChain' });
|
|
70
82
|
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 LibreChat
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var deepagents = require('deepagents');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Deep Agent Backend
|
|
7
|
-
*
|
|
8
|
-
* A backend implementation that extends deepagents' FilesystemBackend
|
|
9
|
-
* with SSE streaming for real-time updates and integration with
|
|
10
|
-
* external code execution services.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Deep Agent Backend
|
|
14
|
-
*
|
|
15
|
-
* Extends FilesystemBackend with:
|
|
16
|
-
* - SSE streaming for real-time updates
|
|
17
|
-
* - Integration with external code executor services
|
|
18
|
-
* - Event emission for todos and subagents
|
|
19
|
-
*/
|
|
20
|
-
class DeepAgentBackend extends deepagents.FilesystemBackend {
|
|
21
|
-
id;
|
|
22
|
-
timeout;
|
|
23
|
-
maxOutputBytes;
|
|
24
|
-
conversationId;
|
|
25
|
-
sseResponse;
|
|
26
|
-
codeExecutorUrl;
|
|
27
|
-
onTodoUpdate;
|
|
28
|
-
onSubagentUpdate;
|
|
29
|
-
constructor(options = {}) {
|
|
30
|
-
super({
|
|
31
|
-
rootDir: options.rootDir ?? process.cwd(),
|
|
32
|
-
virtualMode: options.virtualMode ?? true,
|
|
33
|
-
maxFileSizeMb: 10,
|
|
34
|
-
});
|
|
35
|
-
this.id = `deep-agent-backend-${Date.now().toString(36)}`;
|
|
36
|
-
this.timeout = options.timeout ?? 120_000;
|
|
37
|
-
this.maxOutputBytes = options.maxOutputBytes ?? 100_000;
|
|
38
|
-
this.conversationId = options.conversationId;
|
|
39
|
-
this.sseResponse = options.sseResponse;
|
|
40
|
-
this.codeExecutorUrl = options.codeExecutorUrl;
|
|
41
|
-
this.onTodoUpdate = options.onTodoUpdate;
|
|
42
|
-
this.onSubagentUpdate = options.onSubagentUpdate;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Execute a command
|
|
46
|
-
*
|
|
47
|
-
* If codeExecutorUrl is configured, uses the external sandboxed executor.
|
|
48
|
-
* Otherwise, logs a warning (shell execution may not be available).
|
|
49
|
-
*/
|
|
50
|
-
async execute(command) {
|
|
51
|
-
if (!command || typeof command !== 'string') {
|
|
52
|
-
return {
|
|
53
|
-
output: 'Error: Command must be a non-empty string.',
|
|
54
|
-
exitCode: 1,
|
|
55
|
-
truncated: false,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
// If we have a code executor URL, use that for sandboxed execution
|
|
59
|
-
if (this.codeExecutorUrl) {
|
|
60
|
-
return this.executeViaCodeExecutor(command);
|
|
61
|
-
}
|
|
62
|
-
// Log warning - direct shell execution may not be available
|
|
63
|
-
console.warn('[DeepAgentBackend] Shell execution requested but no code executor configured');
|
|
64
|
-
return {
|
|
65
|
-
output: 'Shell execution is not available in this environment. Consider using the code executor tool instead.',
|
|
66
|
-
exitCode: 1,
|
|
67
|
-
truncated: false,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Execute command via external code executor service
|
|
72
|
-
*/
|
|
73
|
-
async executeViaCodeExecutor(command) {
|
|
74
|
-
try {
|
|
75
|
-
const response = await fetch(`${this.codeExecutorUrl}/execute`, {
|
|
76
|
-
method: 'POST',
|
|
77
|
-
headers: { 'Content-Type': 'application/json' },
|
|
78
|
-
body: JSON.stringify({
|
|
79
|
-
code: command,
|
|
80
|
-
language: 'shell',
|
|
81
|
-
timeout: this.timeout,
|
|
82
|
-
}),
|
|
83
|
-
signal: AbortSignal.timeout(this.timeout + 5000),
|
|
84
|
-
});
|
|
85
|
-
if (!response.ok) {
|
|
86
|
-
return {
|
|
87
|
-
output: `Execution error: ${response.statusText}`,
|
|
88
|
-
exitCode: 1,
|
|
89
|
-
truncated: false,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
const result = await response.json();
|
|
93
|
-
let output = result.output ?? result.error ?? '';
|
|
94
|
-
let truncated = false;
|
|
95
|
-
if (output.length > this.maxOutputBytes) {
|
|
96
|
-
output = output.slice(0, this.maxOutputBytes) + '\n... (output truncated)';
|
|
97
|
-
truncated = true;
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
output,
|
|
101
|
-
exitCode: result.exitCode ?? (result.error ? 1 : 0),
|
|
102
|
-
truncated,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
return {
|
|
107
|
-
output: `Execution failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
108
|
-
exitCode: 1,
|
|
109
|
-
truncated: false,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Send an SSE event to the client
|
|
115
|
-
*/
|
|
116
|
-
sendEvent(event, data) {
|
|
117
|
-
if (this.sseResponse && !this.sseResponse.headersSent) {
|
|
118
|
-
try {
|
|
119
|
-
this.sseResponse.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
|
|
120
|
-
}
|
|
121
|
-
catch (e) {
|
|
122
|
-
console.warn('[DeepAgentBackend] Failed to send SSE event:', e);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Emit todo update event
|
|
128
|
-
*/
|
|
129
|
-
emitTodoUpdate(todos) {
|
|
130
|
-
// Call callback if provided
|
|
131
|
-
if (this.onTodoUpdate) {
|
|
132
|
-
this.onTodoUpdate(todos);
|
|
133
|
-
}
|
|
134
|
-
// Send SSE event
|
|
135
|
-
this.sendEvent('deep_research', {
|
|
136
|
-
type: 'todo_update',
|
|
137
|
-
conversationId: this.conversationId,
|
|
138
|
-
todos,
|
|
139
|
-
progress: this.calculateProgress(todos),
|
|
140
|
-
isRunning: todos.some(t => t.status === 'in_progress'),
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Emit subagent update event
|
|
145
|
-
*/
|
|
146
|
-
emitSubagentUpdate(subagents) {
|
|
147
|
-
// Call callback if provided
|
|
148
|
-
if (this.onSubagentUpdate) {
|
|
149
|
-
this.onSubagentUpdate(subagents);
|
|
150
|
-
}
|
|
151
|
-
// Send SSE event
|
|
152
|
-
this.sendEvent('deep_research', {
|
|
153
|
-
type: 'subagent_update',
|
|
154
|
-
conversationId: this.conversationId,
|
|
155
|
-
subagents,
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Calculate progress from todos
|
|
160
|
-
*/
|
|
161
|
-
calculateProgress(todos) {
|
|
162
|
-
if (todos.length === 0)
|
|
163
|
-
return 0;
|
|
164
|
-
const completed = todos.filter(t => t.status === 'completed').length;
|
|
165
|
-
return Math.round((completed / todos.length) * 100);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
exports.DeepAgentBackend = DeepAgentBackend;
|
|
170
|
-
//# sourceMappingURL=DeepAgentBackend.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeepAgentBackend.cjs","sources":["../../../src/deepagents/DeepAgentBackend.ts"],"sourcesContent":["/**\r\n * Deep Agent Backend\r\n * \r\n * A backend implementation that extends deepagents' FilesystemBackend\r\n * with SSE streaming for real-time updates and integration with\r\n * external code execution services.\r\n */\r\n\r\nimport { FilesystemBackend } from 'deepagents';\r\nimport type { ExecuteResponse, SandboxBackendProtocol } from 'deepagents';\r\nimport type { DeepAgentTodo, DeepAgentSubagent } from './types';\r\n\r\n/** SSE Response interface for streaming */\r\nexport interface SSEResponse {\r\n write: (data: string) => void;\r\n headersSent?: boolean;\r\n}\r\n\r\n/** Options for Deep Agent Backend */\r\nexport interface DeepAgentBackendOptions {\r\n /** Root directory for file operations (default: process.cwd()) */\r\n rootDir?: string;\r\n /** Whether to use virtual paths (default: true) */\r\n virtualMode?: boolean;\r\n /** Timeout for command execution in ms (default: 120000) */\r\n timeout?: number;\r\n /** Max output size in bytes (default: 100000) */\r\n maxOutputBytes?: number;\r\n /** SSE response for streaming updates */\r\n sseResponse?: SSEResponse;\r\n /** Conversation ID for event tracking */\r\n conversationId?: string;\r\n /** Code executor API URL (optional - for sandboxed execution) */\r\n codeExecutorUrl?: string;\r\n /** Callback for todo changes */\r\n onTodoUpdate?: (todos: DeepAgentTodo[]) => void;\r\n /** Callback for subagent changes */\r\n onSubagentUpdate?: (subagents: DeepAgentSubagent[]) => void;\r\n}\r\n\r\n/**\r\n * Deep Agent Backend\r\n * \r\n * Extends FilesystemBackend with:\r\n * - SSE streaming for real-time updates\r\n * - Integration with external code executor services\r\n * - Event emission for todos and subagents\r\n */\r\nexport class DeepAgentBackend extends FilesystemBackend implements SandboxBackendProtocol {\r\n readonly id: string;\r\n private readonly timeout: number;\r\n private readonly maxOutputBytes: number;\r\n private readonly conversationId?: string;\r\n private readonly sseResponse?: SSEResponse;\r\n private readonly codeExecutorUrl?: string;\r\n private readonly onTodoUpdate?: (todos: DeepAgentTodo[]) => void;\r\n private readonly onSubagentUpdate?: (subagents: DeepAgentSubagent[]) => void;\r\n\r\n constructor(options: DeepAgentBackendOptions = {}) {\r\n super({\r\n rootDir: options.rootDir ?? process.cwd(),\r\n virtualMode: options.virtualMode ?? true,\r\n maxFileSizeMb: 10,\r\n });\r\n\r\n this.id = `deep-agent-backend-${Date.now().toString(36)}`;\r\n this.timeout = options.timeout ?? 120_000;\r\n this.maxOutputBytes = options.maxOutputBytes ?? 100_000;\r\n this.conversationId = options.conversationId;\r\n this.sseResponse = options.sseResponse;\r\n this.codeExecutorUrl = options.codeExecutorUrl;\r\n this.onTodoUpdate = options.onTodoUpdate;\r\n this.onSubagentUpdate = options.onSubagentUpdate;\r\n }\r\n\r\n /**\r\n * Execute a command\r\n * \r\n * If codeExecutorUrl is configured, uses the external sandboxed executor.\r\n * Otherwise, logs a warning (shell execution may not be available).\r\n */\r\n async execute(command: string): Promise<ExecuteResponse> {\r\n if (!command || typeof command !== 'string') {\r\n return {\r\n output: 'Error: Command must be a non-empty string.',\r\n exitCode: 1,\r\n truncated: false,\r\n };\r\n }\r\n\r\n // If we have a code executor URL, use that for sandboxed execution\r\n if (this.codeExecutorUrl) {\r\n return this.executeViaCodeExecutor(command);\r\n }\r\n\r\n // Log warning - direct shell execution may not be available\r\n console.warn('[DeepAgentBackend] Shell execution requested but no code executor configured');\r\n return {\r\n output: 'Shell execution is not available in this environment. Consider using the code executor tool instead.',\r\n exitCode: 1,\r\n truncated: false,\r\n };\r\n }\r\n\r\n /**\r\n * Execute command via external code executor service\r\n */\r\n private async executeViaCodeExecutor(command: string): Promise<ExecuteResponse> {\r\n try {\r\n const response = await fetch(`${this.codeExecutorUrl}/execute`, {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n body: JSON.stringify({\r\n code: command,\r\n language: 'shell',\r\n timeout: this.timeout,\r\n }),\r\n signal: AbortSignal.timeout(this.timeout + 5000),\r\n });\r\n\r\n if (!response.ok) {\r\n return {\r\n output: `Execution error: ${response.statusText}`,\r\n exitCode: 1,\r\n truncated: false,\r\n };\r\n }\r\n\r\n const result = await response.json() as {\r\n output?: string;\r\n exitCode?: number;\r\n error?: string;\r\n };\r\n\r\n let output = result.output ?? result.error ?? '';\r\n let truncated = false;\r\n\r\n if (output.length > this.maxOutputBytes) {\r\n output = output.slice(0, this.maxOutputBytes) + '\\n... (output truncated)';\r\n truncated = true;\r\n }\r\n\r\n return {\r\n output,\r\n exitCode: result.exitCode ?? (result.error ? 1 : 0),\r\n truncated,\r\n };\r\n } catch (error) {\r\n return {\r\n output: `Execution failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\r\n exitCode: 1,\r\n truncated: false,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Send an SSE event to the client\r\n */\r\n sendEvent(event: string, data: unknown): void {\r\n if (this.sseResponse && !this.sseResponse.headersSent) {\r\n try {\r\n this.sseResponse.write(`event: ${event}\\ndata: ${JSON.stringify(data)}\\n\\n`);\r\n } catch (e) {\r\n console.warn('[DeepAgentBackend] Failed to send SSE event:', e);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Emit todo update event\r\n */\r\n emitTodoUpdate(todos: DeepAgentTodo[]): void {\r\n // Call callback if provided\r\n if (this.onTodoUpdate) {\r\n this.onTodoUpdate(todos);\r\n }\r\n\r\n // Send SSE event\r\n this.sendEvent('deep_research', {\r\n type: 'todo_update',\r\n conversationId: this.conversationId,\r\n todos,\r\n progress: this.calculateProgress(todos),\r\n isRunning: todos.some(t => t.status === 'in_progress'),\r\n });\r\n }\r\n\r\n /**\r\n * Emit subagent update event\r\n */\r\n emitSubagentUpdate(subagents: DeepAgentSubagent[]): void {\r\n // Call callback if provided\r\n if (this.onSubagentUpdate) {\r\n this.onSubagentUpdate(subagents);\r\n }\r\n\r\n // Send SSE event\r\n this.sendEvent('deep_research', {\r\n type: 'subagent_update',\r\n conversationId: this.conversationId,\r\n subagents,\r\n });\r\n }\r\n\r\n /**\r\n * Calculate progress from todos\r\n */\r\n private calculateProgress(todos: DeepAgentTodo[]): number {\r\n if (todos.length === 0) return 0;\r\n const completed = todos.filter(t => t.status === 'completed').length;\r\n return Math.round((completed / todos.length) * 100);\r\n }\r\n}\r\n"],"names":["FilesystemBackend"],"mappings":";;;;AAAA;;;;;;AAMG;AAkCH;;;;;;;AAOG;AACG,MAAO,gBAAiB,SAAQA,4BAAiB,CAAA;AAC5C,IAAA,EAAE;AACM,IAAA,OAAO;AACP,IAAA,cAAc;AACd,IAAA,cAAc;AACd,IAAA,WAAW;AACX,IAAA,eAAe;AACf,IAAA,YAAY;AACZ,IAAA,gBAAgB;AAEjC,IAAA,WAAA,CAAY,UAAmC,EAAE,EAAA;AAC/C,QAAA,KAAK,CAAC;YACJ,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE;AACzC,YAAA,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;AACxC,YAAA,aAAa,EAAE,EAAE;AAClB,SAAA,CAAC;AAEF,QAAA,IAAI,CAAC,EAAE,GAAG,CAAA,mBAAA,EAAsB,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;QACzD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO;QACzC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,OAAO;AACvD,QAAA,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc;AAC5C,QAAA,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW;AACtC,QAAA,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe;AAC9C,QAAA,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY;AACxC,QAAA,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB;;AAGlD;;;;;AAKG;IACH,MAAM,OAAO,CAAC,OAAe,EAAA;QAC3B,IAA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