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:
javis-bot
2026-11-14 16:27:42 +09:00
parent 3d75d74f92
commit ea2d3ba958
32 changed files with 1568 additions and 59 deletions

View File

@@ -25,9 +25,16 @@ class LevelTranscriber:
class FakeBrain:
"""Answers with two sentences, says only "켜" (on) requests were said to it, ranks in reverse."""
"""Answers with two sentences, says only "켜" (on) requests were said to it, ranks in reverse.
"예약" adds a reminder through the schedule backend and answers with its result; a task answers
"task: <text>"."""
def reply(self, user, text, history, chat=None):
def reply(self, user, text, history, chat=None, schedule=None, task=False):
if task:
return f"task: {text}"
if "예약" in text and schedule is not None:
got = schedule.act("add", kind="remind", text="물 마시기", at=4_000_000_000.0, repeat="daily")
return f"scheduled {got.get('item', {}).get('id')} {got.get('error', '')}".strip()
return "첫 문장입니다. 둘째 문장입니다."
def addressed(self, user, text, names):

View File

@@ -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;
}