feat: personal notes, each person's standing instructions for how Jarvis answers them

A personalNotes tool (add, list, delete the asker's own notes) offered only
with a notes backend. The app keeps the notes in config/notes.json and sends
the asker's with every voice, chat and task reply; the reply engine puts them
in a <person_notes> fence as that person's preferences, which never permit an
action or a tool. The worker's schedule bridge becomes a shared app bridge
for schedule_action and note_action. A 사람별 지침 screen edits and deletes
any note; features.notes turns the tool and the notes off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-14 17:10:53 +09:00
parent e4b6327cf9
commit a5bd25b86f
32 changed files with 901 additions and 91 deletions

View File

@@ -29,9 +29,12 @@ class FakeBrain:
"예약" 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, schedule=None, task=False):
def reply(self, user, text, history, chat=None, schedule=None, task=False, notes=None, notes_backend=None):
if task:
return f"task: {text}"
return f"task: {text}" + (f" notes={'|'.join(notes)}" if notes else "")
if "지침" in text and notes_backend is not None:
got = notes_backend.act("add", text="반말로 해")
return f"noted {got.get('item', {}).get('id')} {got.get('error', '')}".strip()
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()

View File

@@ -150,7 +150,7 @@ async fn audio_and_tts_round_trip_through_the_python_server() {
// 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)));
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() {
@@ -169,7 +169,7 @@ async fn audio_and_tts_round_trip_through_the_python_server() {
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));
assert!(c.reply_in("t1", 42, "날씨", "task", false, None, &["섭씨로".to_string()]));
let task = tokio::time::timeout(Duration::from_secs(5), async {
loop {
if let WorkerEvent::ReplyText { id, text, failed } = rx.recv().await.unwrap() {
@@ -181,7 +181,26 @@ async fn audio_and_tts_round_trip_through_the_python_server() {
})
.await
.expect("task answer");
assert_eq!(task, ("task: 날씨".to_string(), false));
assert_eq!(task, ("task: 날씨 notes=섭씨로".to_string(), false));
// The personalNotes tool's actions come to the app's notes store for the asker.
let notes = jarvis_app::notes::Notes::new(&data);
assert!(c.reply("n1", 42, "지침 저장해 줘", "voice", false));
let noted = tokio::time::timeout(Duration::from_secs(5), async {
loop {
match rx.recv().await.unwrap() {
WorkerEvent::NoteAction(a) => {
assert_eq!((a.action.as_str(), a.user.as_str()), ("add", "42"));
c.note_action_result(&a.id, jarvis_app::notes::act(&notes, &a, "가", 1000));
}
WorkerEvent::ReplyText { id, text, .. } if id == "n1" => return text,
_ => {}
}
}
})
.await
.expect("note round trip");
assert_eq!(noted, "noted 1");
assert_eq!(notes.texts_of(42), vec!["반말로 해".to_string()]);
let _ = std::fs::remove_dir_all(&data);
c.close();
let _ = child.kill().await;