feat: reminders and scheduled tasks (schedule tool, app store and delivery)
The brain gets a schedule tool (add, list, delete the asker's own reminders, timers and tasks) offered only with a schedule backend. The voice worker asks the app through schedule_action and runs fired tasks as reply via task with read-only tools, no MCP and a fresh short-term memory. The app keeps the schedules in config/schedules.json, fires them every 5 s, speaks them when the person is in Jarvis's voice channel and otherwise posts in the chat channel they asked in (or schedule.chatChannel for voice). A feature switch and a 예약 screen list and delete everyone's schedules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -145,6 +145,44 @@ async fn audio_and_tts_round_trip_through_the_python_server() {
|
||||
.expect("judgements");
|
||||
assert_eq!(addressed, Some(("q1".to_string(), true)));
|
||||
assert_eq!(ranked, Some(("k1".to_string(), vec!["2".to_string(), "1".to_string()])));
|
||||
|
||||
// The brain's schedule tool asks the app for the person and the channel they asked in; the
|
||||
// app's store answers; a scheduled task comes back as text.
|
||||
let data = std::env::temp_dir().join(format!("jarvis-proto-schedule-{}", std::process::id()));
|
||||
let store = jarvis_app::schedule::Store::new(&data);
|
||||
assert!(c.reply_in("c1", 42, "예약해 줘", "chat", false, Some(77)));
|
||||
let text = tokio::time::timeout(Duration::from_secs(5), async {
|
||||
loop {
|
||||
match rx.recv().await.unwrap() {
|
||||
WorkerEvent::ScheduleAction(a) => {
|
||||
assert_eq!((a.action.as_str(), a.user.as_str(), a.via.as_str(), a.channel.as_deref()),
|
||||
("add", "42", "chat", Some("77")));
|
||||
c.schedule_action_result(&a.id, jarvis_app::schedule::act(&store, &a, "가", 1000));
|
||||
}
|
||||
WorkerEvent::ReplyText { id, text, .. } if id == "c1" => return text,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
})
|
||||
.await
|
||||
.expect("schedule round trip");
|
||||
assert_eq!(text, "scheduled 1");
|
||||
let kept = store.all().unwrap();
|
||||
assert_eq!((kept[0].user, kept[0].channel, kept[0].repeat.as_str()), (42, Some(77), "daily"));
|
||||
assert!(c.reply("t1", 42, "날씨", "task", false));
|
||||
let task = tokio::time::timeout(Duration::from_secs(5), async {
|
||||
loop {
|
||||
if let WorkerEvent::ReplyText { id, text, failed } = rx.recv().await.unwrap() {
|
||||
if id == "t1" {
|
||||
return (text, failed);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.await
|
||||
.expect("task answer");
|
||||
assert_eq!(task, ("task: 날씨".to_string(), false));
|
||||
let _ = std::fs::remove_dir_all(&data);
|
||||
c.close();
|
||||
let _ = child.kill().await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user