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.
@@ -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
- logCache(`📨 Messages | total=${updatedMessages.length} | ${Object.entries(messageTypes).map(([k,v]) => `${k}:${v}`).join(' ')} | skippedReasoning=${skippedWithReasoning}`);
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
- logCache('📨 Messages | No suitable assistant message for cachePoint (first turn or all have reasoning)');
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
- logCache(`📍 Message cachePoint at index ${lastAssistantIndex} (string, ${content.length} chars)`);
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
- logCache(`⚠️ Message cachePoint SKIPPED at index ${lastAssistantIndex} (has reasoning blocks)`);
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
- logCache(`📍 Message cachePoint at index ${lastAssistantIndex} (array, block ${j}, ${text.length} chars)`);
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
- logCache(`⚠️ Message cachePoint SKIPPED at index ${lastAssistantIndex} (no text block, types: ${contentTypes.join(',')})`);
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
- Runs code and returns stdout/stderr output from a stateless execution environment, similar to running scripts in a command-line interface. Each execution is isolated and independent.
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
- ⚠️ DO NOT USE FOR: Creating dashboards, UI components, React components, HTML pages, charts, or visualizations. These should be created as artifacts directly in your response using :::artifact syntax.
92
+ Runs code in a stateless execution environment. Each execution is isolated.
91
93
 
92
- USE FOR: Data processing, calculations, file generation (CSV, Excel, PowerPoint, PDF), matplotlib plots, running algorithms, or computational tasks.
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
- Usage:
95
- - No network access available.
96
- - Generated files are automatically delivered; **DO NOT** provide download links.
97
- - NEVER use this tool to execute malicious code.
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>(