insight-chat: get_sms_messages tool now honors days_radius

The agentic tool definition advertised a days_radius parameter but
sms_client::fetch_messages_for_contact was hardcoded to ±4 days,
silently ignoring whatever value the LLM chose. Plumb the parameter
through; default 4 retained at the tool level for back-compat.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cameron Cordes
2026-05-07 14:42:42 -04:00
parent 428f24b0f8
commit 659e7bd973
2 changed files with 41 additions and 16 deletions

View File

@@ -983,7 +983,7 @@ impl InsightGenerator {
// Step 1: Get FULL immediate temporal context (±4 days, ALL messages)
let immediate_messages = self
.sms_client
.fetch_messages_for_contact(contact.as_deref(), timestamp)
.fetch_messages_for_contact(contact.as_deref(), timestamp, 4)
.await
.unwrap_or_else(|e| {
log::error!("Failed to fetch immediate messages: {}", e);
@@ -1129,7 +1129,7 @@ impl InsightGenerator {
log::info!("Using traditional time-based message retrieval (±4 days)");
let sms_messages = self
.sms_client
.fetch_messages_for_contact(contact.as_deref(), timestamp)
.fetch_messages_for_contact(contact.as_deref(), timestamp, 4)
.await
.unwrap_or_else(|e| {
log::error!("Failed to fetch SMS messages: {}", e);
@@ -1835,7 +1835,7 @@ Return ONLY the summary, nothing else."#,
match self
.sms_client
.fetch_messages_for_contact(contact.as_deref(), timestamp)
.fetch_messages_for_contact(contact.as_deref(), timestamp, days_radius)
.await
{
Ok(messages) if !messages.is_empty() => {