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.
- package/dist/cjs/agents/AgentContext.cjs +112 -14
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/common/enum.cjs +5 -1
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +148 -8
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs +277 -11
- package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/index.cjs +128 -61
- package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
- package/dist/cjs/main.cjs +22 -7
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/messages/cache.cjs +140 -46
- package/dist/cjs/messages/cache.cjs.map +1 -1
- package/dist/cjs/messages/core.cjs +1 -1
- package/dist/cjs/messages/core.cjs.map +1 -1
- package/dist/cjs/messages/tools.cjs +2 -2
- package/dist/cjs/messages/tools.cjs.map +1 -1
- package/dist/cjs/schemas/validate.cjs +173 -0
- package/dist/cjs/schemas/validate.cjs.map +1 -0
- package/dist/cjs/stream.cjs +4 -2
- package/dist/cjs/stream.cjs.map +1 -1
- package/dist/cjs/tools/BrowserTools.cjs.map +1 -1
- package/dist/cjs/tools/CodeExecutor.cjs +22 -21
- package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs +14 -11
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +101 -2
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/ToolSearch.cjs +862 -0
- package/dist/cjs/tools/ToolSearch.cjs.map +1 -0
- package/dist/esm/agents/AgentContext.mjs +112 -14
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/common/enum.mjs +5 -1
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +149 -9
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs +278 -12
- package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
- package/dist/esm/llm/bedrock/index.mjs +127 -60
- package/dist/esm/llm/bedrock/index.mjs.map +1 -1
- package/dist/esm/main.mjs +2 -1
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/messages/cache.mjs +140 -46
- package/dist/esm/messages/cache.mjs.map +1 -1
- package/dist/esm/messages/core.mjs +1 -1
- package/dist/esm/messages/core.mjs.map +1 -1
- package/dist/esm/messages/tools.mjs +2 -2
- package/dist/esm/messages/tools.mjs.map +1 -1
- package/dist/esm/schemas/validate.mjs +167 -0
- package/dist/esm/schemas/validate.mjs.map +1 -0
- package/dist/esm/stream.mjs +4 -2
- package/dist/esm/stream.mjs.map +1 -1
- package/dist/esm/tools/BrowserTools.mjs.map +1 -1
- package/dist/esm/tools/CodeExecutor.mjs +22 -21
- package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticToolCalling.mjs +14 -11
- package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +102 -3
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/ToolSearch.mjs +827 -0
- package/dist/esm/tools/ToolSearch.mjs.map +1 -0
- package/dist/types/agents/AgentContext.d.ts +51 -1
- package/dist/types/common/enum.d.ts +6 -2
- package/dist/types/graphs/Graph.d.ts +12 -0
- package/dist/types/graphs/MultiAgentGraph.d.ts +16 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/llm/bedrock/index.d.ts +89 -11
- package/dist/types/llm/bedrock/types.d.ts +27 -0
- package/dist/types/llm/bedrock/utils/index.d.ts +5 -0
- package/dist/types/llm/bedrock/utils/message_inputs.d.ts +31 -0
- package/dist/types/llm/bedrock/utils/message_outputs.d.ts +33 -0
- package/dist/types/messages/cache.d.ts +4 -1
- package/dist/types/schemas/index.d.ts +1 -0
- package/dist/types/schemas/validate.d.ts +36 -0
- package/dist/types/tools/CodeExecutor.d.ts +0 -3
- package/dist/types/tools/ProgrammaticToolCalling.d.ts +0 -3
- package/dist/types/tools/ToolNode.d.ts +3 -1
- package/dist/types/tools/ToolSearch.d.ts +148 -0
- package/dist/types/types/graph.d.ts +71 -0
- package/dist/types/types/llm.d.ts +3 -1
- package/dist/types/types/tools.d.ts +42 -2
- package/package.json +13 -6
- package/src/agents/AgentContext.test.ts +312 -0
- package/src/agents/AgentContext.ts +144 -16
- package/src/common/enum.ts +5 -1
- package/src/graphs/Graph.ts +214 -13
- package/src/graphs/MultiAgentGraph.ts +350 -13
- package/src/index.ts +4 -1
- package/src/llm/bedrock/index.ts +221 -99
- package/src/llm/bedrock/llm.spec.ts +616 -0
- package/src/llm/bedrock/types.ts +51 -0
- package/src/llm/bedrock/utils/index.ts +18 -0
- package/src/llm/bedrock/utils/message_inputs.ts +563 -0
- package/src/llm/bedrock/utils/message_outputs.ts +310 -0
- package/src/messages/__tests__/tools.test.ts +21 -21
- package/src/messages/cache.test.ts +304 -0
- package/src/messages/cache.ts +183 -53
- package/src/messages/core.ts +1 -1
- package/src/messages/tools.ts +2 -2
- package/src/schemas/index.ts +2 -0
- package/src/schemas/validate.test.ts +358 -0
- package/src/schemas/validate.ts +238 -0
- package/src/scripts/caching.ts +27 -19
- package/src/scripts/code_exec_files.ts +58 -15
- package/src/scripts/code_exec_multi_session.ts +241 -0
- package/src/scripts/code_exec_session.ts +282 -0
- package/src/scripts/multi-agent-conditional.ts +1 -0
- package/src/scripts/multi-agent-supervisor.ts +1 -0
- package/src/scripts/programmatic_exec_agent.ts +4 -4
- package/src/scripts/test-handoff-preamble.ts +277 -0
- package/src/scripts/test-parallel-handoffs.ts +291 -0
- package/src/scripts/test-tools-before-handoff.ts +8 -4
- package/src/scripts/test_code_api.ts +361 -0
- package/src/scripts/thinking-bedrock.ts +159 -0
- package/src/scripts/thinking.ts +39 -18
- package/src/scripts/{tool_search_regex.ts → tool_search.ts} +5 -5
- package/src/scripts/tools.ts +7 -3
- package/src/specs/cache.simple.test.ts +396 -0
- package/src/stream.ts +4 -2
- package/src/tools/BrowserTools.ts +39 -17
- package/src/tools/CodeExecutor.ts +26 -23
- package/src/tools/ProgrammaticToolCalling.ts +18 -14
- package/src/tools/ToolNode.ts +114 -1
- package/src/tools/ToolSearch.ts +1041 -0
- package/src/tools/__tests__/ProgrammaticToolCalling.test.ts +0 -2
- package/src/tools/__tests__/{ToolSearchRegex.integration.test.ts → ToolSearch.integration.test.ts} +6 -6
- package/src/tools/__tests__/ToolSearch.test.ts +1003 -0
- package/src/types/graph.test.ts +183 -0
- package/src/types/graph.ts +73 -0
- package/src/types/llm.ts +3 -1
- package/src/types/tools.ts +51 -2
- package/dist/cjs/tools/ToolSearchRegex.cjs +0 -455
- package/dist/cjs/tools/ToolSearchRegex.cjs.map +0 -1
- package/dist/esm/tools/ToolSearchRegex.mjs +0 -448
- package/dist/esm/tools/ToolSearchRegex.mjs.map +0 -1
- package/dist/types/tools/ToolSearchRegex.d.ts +0 -80
- package/src/tools/ToolSearchRegex.ts +0 -535
- package/src/tools/__tests__/ToolSearchRegex.test.ts +0 -232
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// src/types/graph.test.ts
|
|
2
|
+
import type {
|
|
3
|
+
StructuredOutputConfig,
|
|
4
|
+
StructuredOutputMode,
|
|
5
|
+
AgentInputs,
|
|
6
|
+
BaseGraphState,
|
|
7
|
+
} from './graph';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Type-level tests to ensure StructuredOutputConfig interface is correctly defined.
|
|
11
|
+
* These tests don't run at runtime but will fail at compile time if types are wrong.
|
|
12
|
+
*/
|
|
13
|
+
describe('StructuredOutputConfig type', () => {
|
|
14
|
+
describe('type compatibility', () => {
|
|
15
|
+
it('should accept minimal configuration', () => {
|
|
16
|
+
const config: StructuredOutputConfig = {
|
|
17
|
+
schema: { type: 'object' },
|
|
18
|
+
};
|
|
19
|
+
expect(config.schema).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should accept full configuration', () => {
|
|
23
|
+
const config: StructuredOutputConfig = {
|
|
24
|
+
schema: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
name: { type: 'string' },
|
|
28
|
+
value: { type: 'number' },
|
|
29
|
+
},
|
|
30
|
+
required: ['name'],
|
|
31
|
+
},
|
|
32
|
+
name: 'TestSchema',
|
|
33
|
+
description: 'A test schema for structured output',
|
|
34
|
+
mode: 'auto',
|
|
35
|
+
strict: true,
|
|
36
|
+
handleErrors: true,
|
|
37
|
+
maxRetries: 3,
|
|
38
|
+
includeRaw: false,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
expect(config.schema).toBeDefined();
|
|
42
|
+
expect(config.name).toBe('TestSchema');
|
|
43
|
+
expect(config.description).toBe('A test schema for structured output');
|
|
44
|
+
expect(config.mode).toBe('auto');
|
|
45
|
+
expect(config.strict).toBe(true);
|
|
46
|
+
expect(config.handleErrors).toBe(true);
|
|
47
|
+
expect(config.maxRetries).toBe(3);
|
|
48
|
+
expect(config.includeRaw).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should accept all valid mode values', () => {
|
|
52
|
+
const modes: StructuredOutputMode[] = ['auto', 'tool', 'provider'];
|
|
53
|
+
|
|
54
|
+
for (const mode of modes) {
|
|
55
|
+
const config: StructuredOutputConfig = {
|
|
56
|
+
schema: { type: 'string' },
|
|
57
|
+
mode,
|
|
58
|
+
};
|
|
59
|
+
expect(config.mode).toBe(mode);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should make all fields except schema optional', () => {
|
|
64
|
+
const minimalConfig: StructuredOutputConfig = {
|
|
65
|
+
schema: { type: 'boolean' },
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// These should all be undefined for minimal config
|
|
69
|
+
expect(minimalConfig.name).toBeUndefined();
|
|
70
|
+
expect(minimalConfig.description).toBeUndefined();
|
|
71
|
+
expect(minimalConfig.mode).toBeUndefined();
|
|
72
|
+
expect(minimalConfig.strict).toBeUndefined();
|
|
73
|
+
expect(minimalConfig.handleErrors).toBeUndefined();
|
|
74
|
+
expect(minimalConfig.maxRetries).toBeUndefined();
|
|
75
|
+
expect(minimalConfig.includeRaw).toBeUndefined();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('schema property types', () => {
|
|
80
|
+
it('should accept object schema', () => {
|
|
81
|
+
const config: StructuredOutputConfig = {
|
|
82
|
+
schema: {
|
|
83
|
+
type: 'object',
|
|
84
|
+
properties: {
|
|
85
|
+
nested: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
properties: {
|
|
88
|
+
value: { type: 'string' },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
expect(config.schema.type).toBe('object');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should accept array schema', () => {
|
|
98
|
+
const config: StructuredOutputConfig = {
|
|
99
|
+
schema: {
|
|
100
|
+
type: 'array',
|
|
101
|
+
items: {
|
|
102
|
+
type: 'object',
|
|
103
|
+
properties: {
|
|
104
|
+
id: { type: 'number' },
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
expect(config.schema.type).toBe('array');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('should accept schema with enum', () => {
|
|
113
|
+
const config: StructuredOutputConfig = {
|
|
114
|
+
schema: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
enum: ['option1', 'option2', 'option3'],
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
expect(config.schema.enum).toEqual(['option1', 'option2', 'option3']);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should accept schema with $ref', () => {
|
|
123
|
+
const config: StructuredOutputConfig = {
|
|
124
|
+
schema: {
|
|
125
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
126
|
+
definitions: {
|
|
127
|
+
Address: {
|
|
128
|
+
type: 'object',
|
|
129
|
+
properties: {
|
|
130
|
+
street: { type: 'string' },
|
|
131
|
+
city: { type: 'string' },
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
type: 'object',
|
|
136
|
+
properties: {
|
|
137
|
+
address: { $ref: '#/definitions/Address' },
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
expect(config.schema.$schema).toBeDefined();
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe('AgentInputs with structuredOutput', () => {
|
|
147
|
+
it('should accept structuredOutput as optional field', () => {
|
|
148
|
+
const inputsWithout: Partial<AgentInputs> = {
|
|
149
|
+
agentId: 'agent-1',
|
|
150
|
+
provider: 'openai' as AgentInputs['provider'],
|
|
151
|
+
};
|
|
152
|
+
expect(inputsWithout.structuredOutput).toBeUndefined();
|
|
153
|
+
|
|
154
|
+
const inputsWith: Partial<AgentInputs> = {
|
|
155
|
+
agentId: 'agent-2',
|
|
156
|
+
provider: 'anthropic' as AgentInputs['provider'],
|
|
157
|
+
structuredOutput: {
|
|
158
|
+
schema: { type: 'object' },
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
expect(inputsWith.structuredOutput).toBeDefined();
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
describe('BaseGraphState with structuredResponse', () => {
|
|
166
|
+
it('should support structuredResponse field', () => {
|
|
167
|
+
const state: Partial<BaseGraphState> = {
|
|
168
|
+
messages: [],
|
|
169
|
+
structuredResponse: { result: 'success', data: [1, 2, 3] },
|
|
170
|
+
};
|
|
171
|
+
expect(state.structuredResponse).toEqual({
|
|
172
|
+
result: 'success',
|
|
173
|
+
data: [1, 2, 3],
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('should allow structuredResponse to be undefined', () => {
|
|
178
|
+
const state: Partial<BaseGraphState> = {
|
|
179
|
+
messages: [],
|
|
180
|
+
};
|
|
181
|
+
expect(state.structuredResponse).toBeUndefined();
|
|
182
|
+
});
|
|
183
|
+
});
|
package/src/types/graph.ts
CHANGED
|
@@ -64,6 +64,11 @@ export type SystemCallbacks = {
|
|
|
64
64
|
|
|
65
65
|
export type BaseGraphState = {
|
|
66
66
|
messages: BaseMessage[];
|
|
67
|
+
/**
|
|
68
|
+
* Structured response when using structured output mode.
|
|
69
|
+
* Contains the validated JSON response conforming to the configured schema.
|
|
70
|
+
*/
|
|
71
|
+
structuredResponse?: Record<string, unknown>;
|
|
67
72
|
};
|
|
68
73
|
|
|
69
74
|
export type MultiAgentGraphState = BaseGraphState & {
|
|
@@ -355,8 +360,70 @@ export type MultiAgentGraphInput = StandardGraphInput & {
|
|
|
355
360
|
edges: GraphEdge[];
|
|
356
361
|
};
|
|
357
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Structured output mode determines how the agent returns structured data.
|
|
365
|
+
* - 'tool': Uses tool calling to return structured output (works with all tool-calling models)
|
|
366
|
+
* - 'provider': Uses provider-native structured output (OpenAI, Anthropic, etc.)
|
|
367
|
+
* - 'auto': Automatically selects the best strategy based on model capabilities
|
|
368
|
+
*/
|
|
369
|
+
export type StructuredOutputMode = 'tool' | 'provider' | 'auto';
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Configuration for structured JSON output from agents.
|
|
373
|
+
* When configured, the agent will return a validated JSON response
|
|
374
|
+
* instead of streaming text.
|
|
375
|
+
*/
|
|
376
|
+
export interface StructuredOutputConfig {
|
|
377
|
+
/**
|
|
378
|
+
* JSON Schema defining the output structure.
|
|
379
|
+
* The model will be forced to return data conforming to this schema.
|
|
380
|
+
*/
|
|
381
|
+
schema: Record<string, unknown>;
|
|
382
|
+
/**
|
|
383
|
+
* Name for the structured output format (used in tool mode).
|
|
384
|
+
* @default 'StructuredResponse'
|
|
385
|
+
*/
|
|
386
|
+
name?: string;
|
|
387
|
+
/**
|
|
388
|
+
* Description of what the structured output represents.
|
|
389
|
+
* Helps the model understand the expected format.
|
|
390
|
+
*/
|
|
391
|
+
description?: string;
|
|
392
|
+
/**
|
|
393
|
+
* Output mode strategy.
|
|
394
|
+
* @default 'auto'
|
|
395
|
+
*/
|
|
396
|
+
mode?: StructuredOutputMode;
|
|
397
|
+
/**
|
|
398
|
+
* Enable strict schema validation.
|
|
399
|
+
* When true, the response must exactly match the schema.
|
|
400
|
+
* @default true
|
|
401
|
+
*/
|
|
402
|
+
strict?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Error handling configuration.
|
|
405
|
+
* - true: Auto-retry on validation errors (default)
|
|
406
|
+
* - false: Throw error on validation failure
|
|
407
|
+
* - string: Custom error message for retry
|
|
408
|
+
*/
|
|
409
|
+
handleErrors?: boolean | string;
|
|
410
|
+
/**
|
|
411
|
+
* Maximum number of retry attempts on validation failure.
|
|
412
|
+
* @default 2
|
|
413
|
+
*/
|
|
414
|
+
maxRetries?: number;
|
|
415
|
+
/**
|
|
416
|
+
* Include the raw AI message along with structured response.
|
|
417
|
+
* Useful for debugging.
|
|
418
|
+
* @default false
|
|
419
|
+
*/
|
|
420
|
+
includeRaw?: boolean;
|
|
421
|
+
}
|
|
422
|
+
|
|
358
423
|
export interface AgentInputs {
|
|
359
424
|
agentId: string;
|
|
425
|
+
/** Human-readable name for the agent (used in handoff context). Defaults to agentId if not provided. */
|
|
426
|
+
name?: string;
|
|
360
427
|
toolEnd?: boolean;
|
|
361
428
|
toolMap?: ToolMap;
|
|
362
429
|
tools?: GraphTools;
|
|
@@ -382,4 +449,10 @@ export interface AgentInputs {
|
|
|
382
449
|
* and can be cached by Bedrock/Anthropic prompt caching.
|
|
383
450
|
*/
|
|
384
451
|
dynamicContext?: string;
|
|
452
|
+
/**
|
|
453
|
+
* Structured output configuration.
|
|
454
|
+
* When set, disables streaming and returns a validated JSON response
|
|
455
|
+
* conforming to the specified schema.
|
|
456
|
+
*/
|
|
457
|
+
structuredOutput?: StructuredOutputConfig;
|
|
385
458
|
}
|
package/src/types/llm.ts
CHANGED
|
@@ -55,7 +55,9 @@ export type AnthropicReasoning = {
|
|
|
55
55
|
thinkingBudget?: number;
|
|
56
56
|
};
|
|
57
57
|
export type OpenAIClientOptions = ChatOpenAIFields;
|
|
58
|
-
export type AnthropicClientOptions = AnthropicInput
|
|
58
|
+
export type AnthropicClientOptions = AnthropicInput & {
|
|
59
|
+
promptCache?: boolean;
|
|
60
|
+
};
|
|
59
61
|
export type MistralAIClientOptions = ChatMistralAIInput;
|
|
60
62
|
export type VertexAIClientOptions = ChatVertexAIInput & {
|
|
61
63
|
includeThoughts?: boolean;
|
package/src/types/tools.ts
CHANGED
|
@@ -39,6 +39,8 @@ export type ToolNodeOptions = {
|
|
|
39
39
|
) => Promise<void>;
|
|
40
40
|
/** Tool registry for lazy computation of programmatic tools and tool search */
|
|
41
41
|
toolRegistry?: LCToolRegistry;
|
|
42
|
+
/** Reference to Graph's sessions map for automatic session injection */
|
|
43
|
+
sessions?: ToolSessionMap;
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
export type ToolNodeConstructorParams = ToolRefs & ToolNodeOptions;
|
|
@@ -72,6 +74,8 @@ export type FileRef = {
|
|
|
72
74
|
id: string;
|
|
73
75
|
name: string;
|
|
74
76
|
path?: string;
|
|
77
|
+
/** Session ID this file belongs to (for multi-session file tracking) */
|
|
78
|
+
session_id?: string;
|
|
75
79
|
};
|
|
76
80
|
|
|
77
81
|
export type FileRefs = FileRef[];
|
|
@@ -128,12 +132,19 @@ export type LCToolRegistry = Map<string, LCTool>;
|
|
|
128
132
|
|
|
129
133
|
export type ProgrammaticCache = { toolMap: ToolMap; toolDefs: LCTool[] };
|
|
130
134
|
|
|
131
|
-
/**
|
|
132
|
-
export type
|
|
135
|
+
/** Search mode: code_interpreter uses external sandbox, local uses safe substring matching */
|
|
136
|
+
export type ToolSearchMode = 'code_interpreter' | 'local';
|
|
137
|
+
|
|
138
|
+
/** Parameters for creating a Tool Search tool */
|
|
139
|
+
export type ToolSearchParams = {
|
|
133
140
|
apiKey?: string;
|
|
134
141
|
toolRegistry?: LCToolRegistry;
|
|
135
142
|
onlyDeferred?: boolean;
|
|
136
143
|
baseUrl?: string;
|
|
144
|
+
/** Search mode: 'code_interpreter' (default) uses sandbox for regex, 'local' uses safe substring matching */
|
|
145
|
+
mode?: ToolSearchMode;
|
|
146
|
+
/** Filter tools to only those from specific MCP server(s). Can be a single name or array of names. */
|
|
147
|
+
mcpServer?: string | string[];
|
|
137
148
|
[key: string]: unknown;
|
|
138
149
|
};
|
|
139
150
|
|
|
@@ -246,3 +257,41 @@ export type ProgrammaticToolCallingParams = {
|
|
|
246
257
|
/** Environment variable key for API key */
|
|
247
258
|
[key: string]: unknown;
|
|
248
259
|
};
|
|
260
|
+
|
|
261
|
+
// ============================================================================
|
|
262
|
+
// Tool Session Context Types
|
|
263
|
+
// ============================================================================
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Tracks code execution session state for automatic file persistence.
|
|
267
|
+
* Stored in Graph.sessions and injected into subsequent tool invocations.
|
|
268
|
+
*/
|
|
269
|
+
export type CodeSessionContext = {
|
|
270
|
+
/** Session ID from the code execution environment */
|
|
271
|
+
session_id: string;
|
|
272
|
+
/** Files generated in this session (for context/tracking) */
|
|
273
|
+
files: FileRefs;
|
|
274
|
+
/** Timestamp of last update */
|
|
275
|
+
lastUpdated: number;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Artifact structure returned by code execution tools (CodeExecutor, PTC).
|
|
280
|
+
* Used to extract session context after tool completion.
|
|
281
|
+
*/
|
|
282
|
+
export type CodeExecutionArtifact = {
|
|
283
|
+
session_id?: string;
|
|
284
|
+
files?: FileRefs;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Generic session context union type for different tool types.
|
|
289
|
+
* Extend this as new tool session types are added.
|
|
290
|
+
*/
|
|
291
|
+
export type ToolSessionContext = CodeSessionContext;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Map of tool names to their session contexts.
|
|
295
|
+
* Keys are tool constants (e.g., Constants.EXECUTE_CODE, Constants.PROGRAMMATIC_TOOL_CALLING).
|
|
296
|
+
*/
|
|
297
|
+
export type ToolSessionMap = Map<string, ToolSessionContext>;
|