illuma-agents 1.0.12 → 1.0.14
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 +77 -3
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +11 -0
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/index.cjs +0 -16
- package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
- package/dist/cjs/messages/cache.cjs +7 -10
- package/dist/cjs/messages/cache.cjs.map +1 -1
- package/dist/cjs/tools/CodeExecutor.cjs +16 -7
- package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
- package/dist/esm/agents/AgentContext.mjs +77 -3
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +11 -0
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/llm/bedrock/index.mjs +0 -16
- package/dist/esm/llm/bedrock/index.mjs.map +1 -1
- package/dist/esm/messages/cache.mjs +7 -10
- package/dist/esm/messages/cache.mjs.map +1 -1
- package/dist/esm/tools/CodeExecutor.mjs +16 -7
- package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
- package/dist/types/agents/AgentContext.d.ts +49 -0
- package/dist/types/graphs/Graph.d.ts +20 -0
- package/package.json +2 -2
- package/src/agents/AgentContext.ts +109 -3
- package/src/graphs/Graph.ts +21 -0
- package/src/llm/bedrock/index.ts +2 -8
- package/src/messages/cache.ts +7 -11
- package/src/tools/CodeExecutor.ts +16 -7
package/src/messages/cache.ts
CHANGED
|
@@ -7,14 +7,10 @@ type MessageWithContent = {
|
|
|
7
7
|
content?: string | MessageContentComplex[];
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
/** Always-on logger for cache operations */
|
|
11
|
-
const logCache = (message: string) => {
|
|
12
|
-
console.log(`[Cache] ${message}`);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
10
|
/** Debug logger for cache operations - set ILLUMA_DEBUG_CACHE=true to enable */
|
|
16
11
|
const debugCache = (message: string, data?: unknown) => {
|
|
17
12
|
if (process.env.ILLUMA_DEBUG_CACHE === 'true') {
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
18
14
|
console.log(`[Cache] ${message}`, data !== undefined ? JSON.stringify(data, null, 2) : '');
|
|
19
15
|
}
|
|
20
16
|
};
|
|
@@ -266,12 +262,12 @@ export function addBedrockCacheControl<
|
|
|
266
262
|
}
|
|
267
263
|
|
|
268
264
|
// Log message summary
|
|
269
|
-
|
|
265
|
+
debugCache(`📨 Messages | total=${updatedMessages.length} | ${Object.entries(messageTypes).map(([k,v]) => `${k}:${v}`).join(' ')} | skippedReasoning=${skippedWithReasoning}`);
|
|
270
266
|
|
|
271
267
|
// If no suitable assistant message found, skip conversation caching
|
|
272
268
|
// (System and Tools caching are still handled separately)
|
|
273
269
|
if (lastAssistantIndex === -1) {
|
|
274
|
-
|
|
270
|
+
debugCache('📨 Messages | No suitable assistant message for cachePoint (first turn or all have reasoning)');
|
|
275
271
|
return updatedMessages;
|
|
276
272
|
}
|
|
277
273
|
|
|
@@ -284,7 +280,7 @@ export function addBedrockCacheControl<
|
|
|
284
280
|
{ type: ContentTypes.TEXT, text: content },
|
|
285
281
|
{ cachePoint: { type: 'default' } },
|
|
286
282
|
] as MessageContentComplex[];
|
|
287
|
-
|
|
283
|
+
debugCache(`📍 Message cachePoint at index ${lastAssistantIndex} (string, ${content.length} chars)`);
|
|
288
284
|
debugCache('addBedrockCacheControl: Added cachePoint to assistant message (string content)', {
|
|
289
285
|
index: lastAssistantIndex,
|
|
290
286
|
contentLength: content.length,
|
|
@@ -293,7 +289,7 @@ export function addBedrockCacheControl<
|
|
|
293
289
|
// Double-check: If this message has reasoning blocks, skip adding cache point entirely
|
|
294
290
|
// This handles edge cases where the initial skip check might have missed it
|
|
295
291
|
if (hasReasoningBlock(assistantMessage)) {
|
|
296
|
-
|
|
292
|
+
debugCache(`⚠️ Message cachePoint SKIPPED at index ${lastAssistantIndex} (has reasoning blocks)`);
|
|
297
293
|
debugCache('addBedrockCacheControl: Skipping - assistant message has reasoning blocks (safety check)', {
|
|
298
294
|
index: lastAssistantIndex,
|
|
299
295
|
});
|
|
@@ -312,7 +308,7 @@ export function addBedrockCacheControl<
|
|
|
312
308
|
cachePoint: { type: 'default' },
|
|
313
309
|
} as MessageContentComplex);
|
|
314
310
|
inserted = true;
|
|
315
|
-
|
|
311
|
+
debugCache(`📍 Message cachePoint at index ${lastAssistantIndex} (array, block ${j}, ${text.length} chars)`);
|
|
316
312
|
debugCache('addBedrockCacheControl: Added cachePoint after text block in assistant message', {
|
|
317
313
|
index: lastAssistantIndex,
|
|
318
314
|
textBlockIndex: j,
|
|
@@ -326,7 +322,7 @@ export function addBedrockCacheControl<
|
|
|
326
322
|
// If no text block found, don't append cache point as the message structure is unexpected
|
|
327
323
|
if (!inserted) {
|
|
328
324
|
const contentTypes = assistantMessage.content.map((b) => (b as { type?: string }).type);
|
|
329
|
-
|
|
325
|
+
debugCache(`⚠️ Message cachePoint SKIPPED at index ${lastAssistantIndex} (no text block, types: ${contentTypes.join(',')})`);
|
|
330
326
|
debugCache('addBedrockCacheControl: No suitable text block found, skipping cache point', {
|
|
331
327
|
index: lastAssistantIndex,
|
|
332
328
|
contentTypes,
|
|
@@ -85,16 +85,25 @@ function createCodeExecutionTool(
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
const description = `
|
|
88
|
-
|
|
88
|
+
⛔ STOP! Before using this tool, ask: "Does user need a DOWNLOADABLE FILE?"
|
|
89
|
+
- If NO (dashboard, chart, visualization, UI) → DO NOT USE THIS TOOL. Use :::artifact instead.
|
|
90
|
+
- If YES (.pptx, .docx, .pdf, .xlsx) → Use this tool.
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
Runs code in a stateless execution environment. Each execution is isolated.
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
🚫 NEVER USE FOR:
|
|
95
|
+
- Dashboards, charts, visualizations → Use :::artifact with React/Chart.js
|
|
96
|
+
- "Mock data" or "sample data" for display → Hardcode data in artifact
|
|
97
|
+
- UI components, HTML pages, React apps → Use :::artifact
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
99
|
+
✅ ONLY USE FOR:
|
|
100
|
+
- File generation: PowerPoint (.pptx), Word (.docx), PDF (.pdf), Excel (.xlsx)
|
|
101
|
+
- Processing uploaded files (CSV, Excel analysis)
|
|
102
|
+
- Heavy computation requiring Python
|
|
103
|
+
|
|
104
|
+
Rules:
|
|
105
|
+
- No network access available
|
|
106
|
+
- Generated files auto-delivered (no download links needed)
|
|
98
107
|
`.trim();
|
|
99
108
|
|
|
100
109
|
return tool<typeof CodeExecutionToolSchema>(
|