illuma-agents 1.0.37 → 1.0.39

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.
Files changed (139) hide show
  1. package/dist/cjs/agents/AgentContext.cjs +112 -14
  2. package/dist/cjs/agents/AgentContext.cjs.map +1 -1
  3. package/dist/cjs/common/enum.cjs +5 -1
  4. package/dist/cjs/common/enum.cjs.map +1 -1
  5. package/dist/cjs/graphs/Graph.cjs +148 -8
  6. package/dist/cjs/graphs/Graph.cjs.map +1 -1
  7. package/dist/cjs/graphs/MultiAgentGraph.cjs +277 -11
  8. package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
  9. package/dist/cjs/llm/bedrock/index.cjs +128 -61
  10. package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
  11. package/dist/cjs/main.cjs +22 -7
  12. package/dist/cjs/main.cjs.map +1 -1
  13. package/dist/cjs/messages/cache.cjs +140 -46
  14. package/dist/cjs/messages/cache.cjs.map +1 -1
  15. package/dist/cjs/messages/core.cjs +1 -1
  16. package/dist/cjs/messages/core.cjs.map +1 -1
  17. package/dist/cjs/messages/tools.cjs +2 -2
  18. package/dist/cjs/messages/tools.cjs.map +1 -1
  19. package/dist/cjs/schemas/validate.cjs +173 -0
  20. package/dist/cjs/schemas/validate.cjs.map +1 -0
  21. package/dist/cjs/stream.cjs +4 -2
  22. package/dist/cjs/stream.cjs.map +1 -1
  23. package/dist/cjs/tools/BrowserTools.cjs.map +1 -1
  24. package/dist/cjs/tools/CodeExecutor.cjs +22 -21
  25. package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
  26. package/dist/cjs/tools/ProgrammaticToolCalling.cjs +14 -11
  27. package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
  28. package/dist/cjs/tools/ToolNode.cjs +101 -2
  29. package/dist/cjs/tools/ToolNode.cjs.map +1 -1
  30. package/dist/cjs/tools/ToolSearch.cjs +862 -0
  31. package/dist/cjs/tools/ToolSearch.cjs.map +1 -0
  32. package/dist/esm/agents/AgentContext.mjs +112 -14
  33. package/dist/esm/agents/AgentContext.mjs.map +1 -1
  34. package/dist/esm/common/enum.mjs +5 -1
  35. package/dist/esm/common/enum.mjs.map +1 -1
  36. package/dist/esm/graphs/Graph.mjs +149 -9
  37. package/dist/esm/graphs/Graph.mjs.map +1 -1
  38. package/dist/esm/graphs/MultiAgentGraph.mjs +278 -12
  39. package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
  40. package/dist/esm/llm/bedrock/index.mjs +127 -60
  41. package/dist/esm/llm/bedrock/index.mjs.map +1 -1
  42. package/dist/esm/main.mjs +2 -1
  43. package/dist/esm/main.mjs.map +1 -1
  44. package/dist/esm/messages/cache.mjs +140 -46
  45. package/dist/esm/messages/cache.mjs.map +1 -1
  46. package/dist/esm/messages/core.mjs +1 -1
  47. package/dist/esm/messages/core.mjs.map +1 -1
  48. package/dist/esm/messages/tools.mjs +2 -2
  49. package/dist/esm/messages/tools.mjs.map +1 -1
  50. package/dist/esm/schemas/validate.mjs +167 -0
  51. package/dist/esm/schemas/validate.mjs.map +1 -0
  52. package/dist/esm/stream.mjs +4 -2
  53. package/dist/esm/stream.mjs.map +1 -1
  54. package/dist/esm/tools/BrowserTools.mjs.map +1 -1
  55. package/dist/esm/tools/CodeExecutor.mjs +22 -21
  56. package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
  57. package/dist/esm/tools/ProgrammaticToolCalling.mjs +14 -11
  58. package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
  59. package/dist/esm/tools/ToolNode.mjs +102 -3
  60. package/dist/esm/tools/ToolNode.mjs.map +1 -1
  61. package/dist/esm/tools/ToolSearch.mjs +827 -0
  62. package/dist/esm/tools/ToolSearch.mjs.map +1 -0
  63. package/dist/types/agents/AgentContext.d.ts +51 -1
  64. package/dist/types/common/enum.d.ts +6 -2
  65. package/dist/types/graphs/Graph.d.ts +12 -0
  66. package/dist/types/graphs/MultiAgentGraph.d.ts +16 -0
  67. package/dist/types/index.d.ts +2 -1
  68. package/dist/types/llm/bedrock/index.d.ts +89 -11
  69. package/dist/types/llm/bedrock/types.d.ts +27 -0
  70. package/dist/types/llm/bedrock/utils/index.d.ts +5 -0
  71. package/dist/types/llm/bedrock/utils/message_inputs.d.ts +31 -0
  72. package/dist/types/llm/bedrock/utils/message_outputs.d.ts +33 -0
  73. package/dist/types/messages/cache.d.ts +4 -1
  74. package/dist/types/schemas/index.d.ts +1 -0
  75. package/dist/types/schemas/validate.d.ts +36 -0
  76. package/dist/types/tools/CodeExecutor.d.ts +0 -3
  77. package/dist/types/tools/ProgrammaticToolCalling.d.ts +0 -3
  78. package/dist/types/tools/ToolNode.d.ts +3 -1
  79. package/dist/types/tools/ToolSearch.d.ts +148 -0
  80. package/dist/types/types/graph.d.ts +71 -0
  81. package/dist/types/types/llm.d.ts +3 -1
  82. package/dist/types/types/tools.d.ts +42 -2
  83. package/package.json +13 -6
  84. package/src/agents/AgentContext.test.ts +312 -0
  85. package/src/agents/AgentContext.ts +144 -16
  86. package/src/common/enum.ts +5 -1
  87. package/src/graphs/Graph.ts +214 -13
  88. package/src/graphs/MultiAgentGraph.ts +350 -13
  89. package/src/index.ts +4 -1
  90. package/src/llm/bedrock/index.ts +221 -99
  91. package/src/llm/bedrock/llm.spec.ts +616 -0
  92. package/src/llm/bedrock/types.ts +51 -0
  93. package/src/llm/bedrock/utils/index.ts +18 -0
  94. package/src/llm/bedrock/utils/message_inputs.ts +563 -0
  95. package/src/llm/bedrock/utils/message_outputs.ts +310 -0
  96. package/src/messages/__tests__/tools.test.ts +21 -21
  97. package/src/messages/cache.test.ts +304 -0
  98. package/src/messages/cache.ts +183 -53
  99. package/src/messages/core.ts +1 -1
  100. package/src/messages/tools.ts +2 -2
  101. package/src/schemas/index.ts +2 -0
  102. package/src/schemas/validate.test.ts +358 -0
  103. package/src/schemas/validate.ts +238 -0
  104. package/src/scripts/caching.ts +27 -19
  105. package/src/scripts/code_exec_files.ts +58 -15
  106. package/src/scripts/code_exec_multi_session.ts +241 -0
  107. package/src/scripts/code_exec_session.ts +282 -0
  108. package/src/scripts/multi-agent-conditional.ts +1 -0
  109. package/src/scripts/multi-agent-supervisor.ts +1 -0
  110. package/src/scripts/programmatic_exec_agent.ts +4 -4
  111. package/src/scripts/test-handoff-preamble.ts +277 -0
  112. package/src/scripts/test-parallel-handoffs.ts +291 -0
  113. package/src/scripts/test-tools-before-handoff.ts +8 -4
  114. package/src/scripts/test_code_api.ts +361 -0
  115. package/src/scripts/thinking-bedrock.ts +159 -0
  116. package/src/scripts/thinking.ts +39 -18
  117. package/src/scripts/{tool_search_regex.ts → tool_search.ts} +5 -5
  118. package/src/scripts/tools.ts +7 -3
  119. package/src/specs/cache.simple.test.ts +396 -0
  120. package/src/stream.ts +4 -2
  121. package/src/tools/BrowserTools.ts +39 -17
  122. package/src/tools/CodeExecutor.ts +26 -23
  123. package/src/tools/ProgrammaticToolCalling.ts +18 -14
  124. package/src/tools/ToolNode.ts +114 -1
  125. package/src/tools/ToolSearch.ts +1041 -0
  126. package/src/tools/__tests__/ProgrammaticToolCalling.test.ts +0 -2
  127. package/src/tools/__tests__/{ToolSearchRegex.integration.test.ts → ToolSearch.integration.test.ts} +6 -6
  128. package/src/tools/__tests__/ToolSearch.test.ts +1003 -0
  129. package/src/types/graph.test.ts +183 -0
  130. package/src/types/graph.ts +73 -0
  131. package/src/types/llm.ts +3 -1
  132. package/src/types/tools.ts +51 -2
  133. package/dist/cjs/tools/ToolSearchRegex.cjs +0 -455
  134. package/dist/cjs/tools/ToolSearchRegex.cjs.map +0 -1
  135. package/dist/esm/tools/ToolSearchRegex.mjs +0 -448
  136. package/dist/esm/tools/ToolSearchRegex.mjs.map +0 -1
  137. package/dist/types/tools/ToolSearchRegex.d.ts +0 -80
  138. package/src/tools/ToolSearchRegex.ts +0 -535
  139. package/src/tools/__tests__/ToolSearchRegex.test.ts +0 -232
@@ -3,16 +3,13 @@ import { DynamicStructuredTool } from '@langchain/core/tools';
3
3
  import type * as t from '@/types';
4
4
  declare const ProgrammaticToolCallingSchema: z.ZodObject<{
5
5
  code: z.ZodString;
6
- session_id: z.ZodOptional<z.ZodString>;
7
6
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
8
7
  }, "strip", z.ZodTypeAny, {
9
8
  code: string;
10
9
  timeout: number;
11
- session_id?: string | undefined;
12
10
  }, {
13
11
  code: string;
14
12
  timeout?: number | undefined;
15
- session_id?: string | undefined;
16
13
  }>;
17
14
  /**
18
15
  * Normalizes a tool name to Python identifier format.
@@ -16,7 +16,9 @@ export declare class ToolNode<T = any> extends RunnableCallable<T, T> {
16
16
  private toolRegistry?;
17
17
  /** Cached programmatic tools (computed once on first PTC call) */
18
18
  private programmaticCache?;
19
- constructor({ tools, toolMap, name, tags, errorHandler, toolCallStepIds, handleToolErrors, loadRuntimeTools, toolRegistry, }: t.ToolNodeConstructorParams);
19
+ /** Reference to Graph's sessions map for automatic session injection */
20
+ private sessions?;
21
+ constructor({ tools, toolMap, name, tags, errorHandler, toolCallStepIds, handleToolErrors, loadRuntimeTools, toolRegistry, sessions, }: t.ToolNodeConstructorParams);
20
22
  /**
21
23
  * Returns cached programmatic tools, computing once on first access.
22
24
  * Single iteration builds both toolMap and toolDefs simultaneously.
@@ -0,0 +1,148 @@
1
+ import { z } from 'zod';
2
+ import { DynamicStructuredTool } from '@langchain/core/tools';
3
+ import type * as t from '@/types';
4
+ /** Zod schema type for tool search parameters */
5
+ type ToolSearchSchema = z.ZodObject<{
6
+ query: z.ZodDefault<z.ZodOptional<z.ZodString>>;
7
+ fields: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<['name', 'description', 'parameters']>>>>;
8
+ max_results: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
9
+ mcp_server: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>>;
10
+ }>;
11
+ /**
12
+ * Creates the Zod schema with dynamic query description based on mode.
13
+ * @param mode - The search mode determining query interpretation
14
+ * @returns Zod schema for tool search parameters
15
+ */
16
+ declare function createToolSearchSchema(mode: t.ToolSearchMode): ToolSearchSchema;
17
+ /**
18
+ * Extracts the MCP server name from a tool name.
19
+ * MCP tools follow the pattern: toolName_mcp_serverName
20
+ * @param toolName - The full tool name
21
+ * @returns The server name if it's an MCP tool, undefined otherwise
22
+ */
23
+ declare function extractMcpServerName(toolName: string): string | undefined;
24
+ /**
25
+ * Checks if a tool belongs to a specific MCP server.
26
+ * @param toolName - The full tool name
27
+ * @param serverName - The server name to match
28
+ * @returns True if the tool belongs to the specified server
29
+ */
30
+ declare function isFromMcpServer(toolName: string, serverName: string): boolean;
31
+ /**
32
+ * Checks if a tool belongs to any of the specified MCP servers.
33
+ * @param toolName - The full tool name
34
+ * @param serverNames - Array of server names to match
35
+ * @returns True if the tool belongs to any of the specified servers
36
+ */
37
+ declare function isFromAnyMcpServer(toolName: string, serverNames: string[]): boolean;
38
+ /**
39
+ * Normalizes server filter input to always be an array.
40
+ * @param serverFilter - String, array of strings, or undefined
41
+ * @returns Array of server names (empty if none specified)
42
+ */
43
+ declare function normalizeServerFilter(serverFilter: string | string[] | undefined): string[];
44
+ /**
45
+ * Extracts all unique MCP server names from a tool registry.
46
+ * @param toolRegistry - The tool registry to scan
47
+ * @param onlyDeferred - If true, only considers deferred tools
48
+ * @returns Array of unique server names, sorted alphabetically
49
+ */
50
+ declare function getAvailableMcpServers(toolRegistry: t.LCToolRegistry | undefined, onlyDeferred?: boolean): string[];
51
+ /**
52
+ * Escapes special regex characters in a string to use as a literal pattern.
53
+ * @param pattern - The string to escape
54
+ * @returns The escaped string safe for use in a RegExp
55
+ */
56
+ declare function escapeRegexSpecialChars(pattern: string): string;
57
+ /**
58
+ * Counts the maximum nesting depth of groups in a regex pattern.
59
+ * @param pattern - The regex pattern to analyze
60
+ * @returns The maximum nesting depth
61
+ */
62
+ declare function countNestedGroups(pattern: string): number;
63
+ /**
64
+ * Detects nested quantifiers that can cause catastrophic backtracking.
65
+ * Patterns like (a+)+, (a*)*, (a+)*, etc.
66
+ * @param pattern - The regex pattern to check
67
+ * @returns True if nested quantifiers are detected
68
+ */
69
+ declare function hasNestedQuantifiers(pattern: string): boolean;
70
+ /**
71
+ * Checks if a regex pattern contains potentially dangerous constructs.
72
+ * @param pattern - The regex pattern to validate
73
+ * @returns True if the pattern is dangerous
74
+ */
75
+ declare function isDangerousPattern(pattern: string): boolean;
76
+ /**
77
+ * Sanitizes a regex pattern for safe execution.
78
+ * If the pattern is dangerous, it will be escaped to a literal string search.
79
+ * @param pattern - The regex pattern to sanitize
80
+ * @returns Object containing the safe pattern and whether it was escaped
81
+ */
82
+ declare function sanitizeRegex(pattern: string): {
83
+ safe: string;
84
+ wasEscaped: boolean;
85
+ };
86
+ /**
87
+ * Performs BM25-based search for better relevance ranking.
88
+ * Uses Okapi BM25 algorithm for term frequency and document length normalization.
89
+ * @param tools - Array of tool metadata to search
90
+ * @param query - The search query
91
+ * @param fields - Which fields to search
92
+ * @param maxResults - Maximum results to return
93
+ * @returns Search response with matching tools ranked by BM25 score
94
+ */
95
+ declare function performLocalSearch(tools: t.ToolMetadata[], query: string, fields: string[], maxResults: number): t.ToolSearchResponse;
96
+ /**
97
+ * Extracts the base tool name (without MCP server suffix) from a full tool name.
98
+ * @param toolName - The full tool name
99
+ * @returns The base tool name without server suffix
100
+ */
101
+ declare function getBaseToolName(toolName: string): string;
102
+ /**
103
+ * Generates a compact listing of deferred tools grouped by server.
104
+ * Format: "server: tool1, tool2, tool3"
105
+ * Non-MCP tools are grouped under "other".
106
+ * @param toolRegistry - The tool registry
107
+ * @param onlyDeferred - Whether to only include deferred tools
108
+ * @returns Formatted string with tools grouped by server
109
+ */
110
+ declare function getDeferredToolsListing(toolRegistry: t.LCToolRegistry | undefined, onlyDeferred: boolean): string;
111
+ /**
112
+ * Formats a server listing response as structured JSON.
113
+ * NOTE: This is a PREVIEW only - tools are NOT discovered/loaded.
114
+ * @param tools - Array of tool metadata from the server(s)
115
+ * @param serverNames - The MCP server name(s)
116
+ * @returns JSON string showing all tools grouped by server
117
+ */
118
+ declare function formatServerListing(tools: t.ToolMetadata[], serverNames: string | string[]): string;
119
+ /**
120
+ * Creates a Tool Search tool for discovering tools from a large registry.
121
+ *
122
+ * This tool enables AI agents to dynamically discover tools from a large library
123
+ * without loading all tool definitions into the LLM context window. The agent
124
+ * can search for relevant tools on-demand.
125
+ *
126
+ * **Modes:**
127
+ * - `code_interpreter` (default): Uses external sandbox for regex search. Safer for complex patterns.
128
+ * - `local`: Uses safe substring matching locally. No network call, faster, completely safe from ReDoS.
129
+ *
130
+ * The tool registry can be provided either:
131
+ * 1. At initialization time via params.toolRegistry
132
+ * 2. At runtime via config.configurable.toolRegistry when invoking
133
+ *
134
+ * @param params - Configuration parameters for the tool (toolRegistry is optional)
135
+ * @returns A LangChain DynamicStructuredTool for tool searching
136
+ *
137
+ * @example
138
+ * // Option 1: Code interpreter mode (regex via sandbox)
139
+ * const tool = createToolSearch({ apiKey, toolRegistry });
140
+ * await tool.invoke({ query: 'expense.*report' });
141
+ *
142
+ * @example
143
+ * // Option 2: Local mode (safe substring search, no API key needed)
144
+ * const tool = createToolSearch({ mode: 'local', toolRegistry });
145
+ * await tool.invoke({ query: 'expense' });
146
+ */
147
+ declare function createToolSearch(initParams?: t.ToolSearchParams): DynamicStructuredTool<ReturnType<typeof createToolSearchSchema>>;
148
+ export { createToolSearch, performLocalSearch, extractMcpServerName, isFromMcpServer, isFromAnyMcpServer, normalizeServerFilter, getAvailableMcpServers, getDeferredToolsListing, getBaseToolName, formatServerListing, sanitizeRegex, escapeRegexSpecialChars, isDangerousPattern, countNestedGroups, hasNestedQuantifiers, };
@@ -27,6 +27,11 @@ export type SystemCallbacks = {
27
27
  };
28
28
  export type BaseGraphState = {
29
29
  messages: BaseMessage[];
30
+ /**
31
+ * Structured response when using structured output mode.
32
+ * Contains the validated JSON response conforming to the configured schema.
33
+ */
34
+ structuredResponse?: Record<string, unknown>;
30
35
  };
31
36
  export type MultiAgentGraphState = BaseGraphState & {
32
37
  agentMessages?: BaseMessage[];
@@ -234,8 +239,68 @@ export type GraphEdge = {
234
239
  export type MultiAgentGraphInput = StandardGraphInput & {
235
240
  edges: GraphEdge[];
236
241
  };
242
+ /**
243
+ * Structured output mode determines how the agent returns structured data.
244
+ * - 'tool': Uses tool calling to return structured output (works with all tool-calling models)
245
+ * - 'provider': Uses provider-native structured output (OpenAI, Anthropic, etc.)
246
+ * - 'auto': Automatically selects the best strategy based on model capabilities
247
+ */
248
+ export type StructuredOutputMode = 'tool' | 'provider' | 'auto';
249
+ /**
250
+ * Configuration for structured JSON output from agents.
251
+ * When configured, the agent will return a validated JSON response
252
+ * instead of streaming text.
253
+ */
254
+ export interface StructuredOutputConfig {
255
+ /**
256
+ * JSON Schema defining the output structure.
257
+ * The model will be forced to return data conforming to this schema.
258
+ */
259
+ schema: Record<string, unknown>;
260
+ /**
261
+ * Name for the structured output format (used in tool mode).
262
+ * @default 'StructuredResponse'
263
+ */
264
+ name?: string;
265
+ /**
266
+ * Description of what the structured output represents.
267
+ * Helps the model understand the expected format.
268
+ */
269
+ description?: string;
270
+ /**
271
+ * Output mode strategy.
272
+ * @default 'auto'
273
+ */
274
+ mode?: StructuredOutputMode;
275
+ /**
276
+ * Enable strict schema validation.
277
+ * When true, the response must exactly match the schema.
278
+ * @default true
279
+ */
280
+ strict?: boolean;
281
+ /**
282
+ * Error handling configuration.
283
+ * - true: Auto-retry on validation errors (default)
284
+ * - false: Throw error on validation failure
285
+ * - string: Custom error message for retry
286
+ */
287
+ handleErrors?: boolean | string;
288
+ /**
289
+ * Maximum number of retry attempts on validation failure.
290
+ * @default 2
291
+ */
292
+ maxRetries?: number;
293
+ /**
294
+ * Include the raw AI message along with structured response.
295
+ * Useful for debugging.
296
+ * @default false
297
+ */
298
+ includeRaw?: boolean;
299
+ }
237
300
  export interface AgentInputs {
238
301
  agentId: string;
302
+ /** Human-readable name for the agent (used in handoff context). Defaults to agentId if not provided. */
303
+ name?: string;
239
304
  toolEnd?: boolean;
240
305
  toolMap?: ToolMap;
241
306
  tools?: GraphTools;
@@ -261,4 +326,10 @@ export interface AgentInputs {
261
326
  * and can be cached by Bedrock/Anthropic prompt caching.
262
327
  */
263
328
  dynamicContext?: string;
329
+ /**
330
+ * Structured output configuration.
331
+ * When set, disables streaming and returns a validated JSON response
332
+ * conforming to the specified schema.
333
+ */
334
+ structuredOutput?: StructuredOutputConfig;
264
335
  }
@@ -37,7 +37,9 @@ export type AnthropicReasoning = {
37
37
  thinkingBudget?: number;
38
38
  };
39
39
  export type OpenAIClientOptions = ChatOpenAIFields;
40
- export type AnthropicClientOptions = AnthropicInput;
40
+ export type AnthropicClientOptions = AnthropicInput & {
41
+ promptCache?: boolean;
42
+ };
41
43
  export type MistralAIClientOptions = ChatMistralAIInput;
42
44
  export type VertexAIClientOptions = ChatVertexAIInput & {
43
45
  includeThoughts?: boolean;
@@ -29,6 +29,8 @@ export type ToolNodeOptions = {
29
29
  errorHandler?: (data: ToolErrorData, metadata?: Record<string, unknown>) => Promise<void>;
30
30
  /** Tool registry for lazy computation of programmatic tools and tool search */
31
31
  toolRegistry?: LCToolRegistry;
32
+ /** Reference to Graph's sessions map for automatic session injection */
33
+ sessions?: ToolSessionMap;
32
34
  };
33
35
  export type ToolNodeConstructorParams = ToolRefs & ToolNodeOptions;
34
36
  export type ToolEndEvent = {
@@ -55,6 +57,8 @@ export type FileRef = {
55
57
  id: string;
56
58
  name: string;
57
59
  path?: string;
60
+ /** Session ID this file belongs to (for multi-session file tracking) */
61
+ session_id?: string;
58
62
  };
59
63
  export type FileRefs = FileRef[];
60
64
  export type ExecuteResult = {
@@ -99,12 +103,18 @@ export type ProgrammaticCache = {
99
103
  toolMap: ToolMap;
100
104
  toolDefs: LCTool[];
101
105
  };
102
- /** Parameters for creating a Tool Search Regex tool */
103
- export type ToolSearchRegexParams = {
106
+ /** Search mode: code_interpreter uses external sandbox, local uses safe substring matching */
107
+ export type ToolSearchMode = 'code_interpreter' | 'local';
108
+ /** Parameters for creating a Tool Search tool */
109
+ export type ToolSearchParams = {
104
110
  apiKey?: string;
105
111
  toolRegistry?: LCToolRegistry;
106
112
  onlyDeferred?: boolean;
107
113
  baseUrl?: string;
114
+ /** Search mode: 'code_interpreter' (default) uses sandbox for regex, 'local' uses safe substring matching */
115
+ mode?: ToolSearchMode;
116
+ /** Filter tools to only those from specific MCP server(s). Can be a single name or array of names. */
117
+ mcpServer?: string | string[];
108
118
  [key: string]: unknown;
109
119
  };
110
120
  /** Simplified tool metadata for search purposes */
@@ -199,3 +209,33 @@ export type ProgrammaticToolCallingParams = {
199
209
  /** Environment variable key for API key */
200
210
  [key: string]: unknown;
201
211
  };
212
+ /**
213
+ * Tracks code execution session state for automatic file persistence.
214
+ * Stored in Graph.sessions and injected into subsequent tool invocations.
215
+ */
216
+ export type CodeSessionContext = {
217
+ /** Session ID from the code execution environment */
218
+ session_id: string;
219
+ /** Files generated in this session (for context/tracking) */
220
+ files: FileRefs;
221
+ /** Timestamp of last update */
222
+ lastUpdated: number;
223
+ };
224
+ /**
225
+ * Artifact structure returned by code execution tools (CodeExecutor, PTC).
226
+ * Used to extract session context after tool completion.
227
+ */
228
+ export type CodeExecutionArtifact = {
229
+ session_id?: string;
230
+ files?: FileRefs;
231
+ };
232
+ /**
233
+ * Generic session context union type for different tool types.
234
+ * Extend this as new tool session types are added.
235
+ */
236
+ export type ToolSessionContext = CodeSessionContext;
237
+ /**
238
+ * Map of tool names to their session contexts.
239
+ * Keys are tool constants (e.g., Constants.EXECUTE_CODE, Constants.PROGRAMMATIC_TOOL_CALLING).
240
+ */
241
+ export type ToolSessionMap = Map<string, ToolSessionContext>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "illuma-agents",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "main": "./dist/cjs/main.cjs",
5
5
  "module": "./dist/esm/main.mjs",
6
6
  "types": "./dist/types/index.d.ts",
@@ -44,14 +44,17 @@
44
44
  "code_exec": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/code_exec.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
45
45
  "image": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/image.ts --provider 'google' --name 'Jo' --location 'New York, NY'",
46
46
  "code_exec_files": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/code_exec_files.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
47
- "code_exec_simple": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/code_exec_simple.ts --provider 'google' --name 'Jo' --location 'New York, NY'",
48
- "simple": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/simple.ts --provider 'openrouter' --name 'Jo' --location 'New York, NY'",
47
+ "code_exec_session": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/code_exec_session.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
48
+ "code_exec_multi_session": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/code_exec_multi_session.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
49
+ "code_exec_simple": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/code_exec_simple.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
50
+ "simple": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/simple.ts --provider 'bedrock' --name 'Jo' --location 'New York, NY'",
49
51
  "caching": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/caching.ts --name 'Jo' --location 'New York, NY'",
50
52
  "thinking": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/thinking.ts --name 'Jo' --location 'New York, NY'",
53
+ "thinking:bedrock": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/thinking-bedrock.ts --name 'Jo' --location 'New York, NY'",
51
54
  "memory": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/memory.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
52
- "tool": "node --trace-warnings -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/tools.ts --provider 'openrouter' --name 'Jo' --location 'New York, NY'",
55
+ "tool": "node --trace-warnings -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/tools.ts --provider 'bedrock' --name 'Jo' --location 'New York, NY'",
53
56
  "search": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/search.ts --provider 'bedrock' --name 'Jo' --location 'New York, NY'",
54
- "tool_search_regex": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/tool_search_regex.ts",
57
+ "tool_search": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/tool_search.ts",
55
58
  "programmatic_exec": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/programmatic_exec.ts",
56
59
  "code_exec_ptc": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/code_exec_ptc.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
57
60
  "programmatic_exec_agent": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/programmatic_exec_agent.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
@@ -69,6 +72,7 @@
69
72
  "multi-agent-sequence": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/multi-agent-sequence.ts",
70
73
  "multi-agent-conditional": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/multi-agent-conditional.ts",
71
74
  "multi-agent-supervisor": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/multi-agent-supervisor.ts",
75
+ "test-handoff-preamble": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/test-handoff-preamble.ts",
72
76
  "multi-agent-list-handoff": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/test-multi-agent-list-handoff.ts",
73
77
  "test-parallel-agent-labeling": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/test-parallel-agent-labeling.ts",
74
78
  "test-thinking-handoff": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/test-thinking-handoff.ts",
@@ -87,7 +91,7 @@
87
91
  "start:collab5": "node --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/collab_design_v5.ts",
88
92
  "start:dev": "node --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/main.ts",
89
93
  "supervised": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/supervised.ts --provider anthropic --name Jo --location \"New York, NY\"",
90
- "test": "jest",
94
+ "test": "NODE_OPTIONS='--experimental-vm-modules' jest",
91
95
  "test:memory": "NODE_OPTIONS='--expose-gc' npx jest src/specs/title.memory-leak.test.ts",
92
96
  "test:all": "npm test -- --testPathIgnorePatterns=title.memory-leak.test.ts && npm run test:memory",
93
97
  "reinstall": "npm run clean && npm ci && rm -rf ./dist && npm run build",
@@ -102,6 +106,7 @@
102
106
  }
103
107
  },
104
108
  "dependencies": {
109
+ "@aws-sdk/client-bedrock-runtime": "^3.970.0",
105
110
  "@langchain/anthropic": "^0.3.26",
106
111
  "@langchain/aws": "^0.1.15",
107
112
  "@langchain/core": "^0.3.80",
@@ -124,6 +129,7 @@
124
129
  "https-proxy-agent": "^7.0.6",
125
130
  "mathjs": "^15.1.0",
126
131
  "nanoid": "^3.3.7",
132
+ "okapibm25": "^1.4.1",
127
133
  "openai": "5.8.2"
128
134
  },
129
135
  "imports": {
@@ -151,6 +157,7 @@
151
157
  "eslint-plugin-import": "^2.31.0",
152
158
  "husky": "^9.1.7",
153
159
  "jest": "^30.2.0",
160
+ "jest-util": "^30.2.0",
154
161
  "lint-staged": "^15.2.7",
155
162
  "prettier": "^3.6.2",
156
163
  "rollup": "^4.34.6",