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

@@ -366,6 +366,28 @@ impl AdminApi {
v
}).collect::<Vec<_>>()}))
}
// Personal notes (admin.spec.md, "Personal notes"): everyone's, editable on the screen.
"notes_list" => {
let items = crate::notes::Notes::new(self.dir()?.path()).all()?;
Ok(json!({"items": items.iter().map(|n| {
let mut v = json!(n);
v["id"] = json!(n.id.to_string());
v["user"] = json!(n.user.to_string());
v
}).collect::<Vec<_>>()}))
}
"note_update" => {
let id: u64 = arg_str(&args, "id")?.parse().map_err(|_| "지침 ID가 올바르지 않습니다")?;
crate::notes::Notes::new(self.dir()?.path()).update(id, arg_str(&args, "text")?)?;
crate::info_log!("admin", "note {id} changed");
Ok(json!({"updated": id.to_string()}))
}
"note_delete" => {
let id: u64 = arg_str(&args, "id")?.parse().map_err(|_| "지침 ID가 올바르지 않습니다")?;
crate::notes::Notes::new(self.dir()?.path()).delete(id, None)?;
crate::info_log!("admin", "note {id} deleted");
Ok(json!({"deleted": id.to_string()}))
}
"activity_list" => {
let limit = args.get("limit").and_then(Value::as_u64).unwrap_or(200).clamp(1, 1000) as usize;
Ok(json!({"items": crate::activity::Activity::new(self.dir()?.path()).recent(limit)}))
@@ -495,6 +517,22 @@ mod tests {
assert!(a.call("nope", json!({})).await.is_err());
}
#[tokio::test]
async fn the_notes_screen_lists_edits_and_deletes_anyones_notes() {
let (a, base) = api("api-notes");
let data = base.join("d");
a.call("folder_choose", json!({"path": data.to_string_lossy()})).await.unwrap();
let store = crate::notes::Notes::new(&data);
let n = store.add(123456789012345678, "가", "반말로 해", 0).unwrap();
let items = a.call("notes_list", json!({})).await.unwrap()["items"].clone();
assert_eq!(items[0]["user"], "123456789012345678");
a.call("note_update", json!({"id": n.id.to_string(), "text": "존댓말로 해"})).await.unwrap();
assert_eq!(store.texts_of(123456789012345678), vec!["존댓말로 해".to_string()]);
assert!(a.call("note_update", json!({"id": n.id.to_string(), "text": " "})).await.is_err());
a.call("note_delete", json!({"id": n.id.to_string()})).await.unwrap();
assert!(store.all().unwrap().is_empty());
}
#[tokio::test]
async fn the_activity_screen_reads_the_newest_entries() {
let (a, base) = api("api-activity");