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

@@ -200,6 +200,7 @@ which carry Discord's own time.
-> {"type": "chat_edit", "channel": "...", "message_id": "...", "text": "..."}
-> {"type": "chat_delete", "channel": "...", "message_id": "..."}
-> {"type": "reply", "id": "r1", "user": "<id>", "text": "...", "via": "voice", "speak": true}
// via chat: optional "channel" it was written in
<- {"type": "reply_text", "id": "r1", "text": "...", "failed": false}
-> {"type": "reply_delivered", "id": "c1", "ok": true} // a chat answer was posted (ok: false: it was not)
-> {"type": "prepare", "user": "<id>", "text": "..."} // a call still being said; nothing comes back
@@ -318,6 +319,33 @@ which carry Discord's own time.
`budget_tokens` (4000).
- Logs carry IDs, counts and timings only, never record, question or answer text.
### Schedules
The brain's schedule tool (`src/jarvis/tools/builtin/schedule.spec.md`) asks the app, which keeps
the schedules (`app/src/admin.spec.md`, "Schedules"):
```
<- {"type": "schedule_action", "id": "s1", "action": "add|list|delete", "user": "<id>",
"via": "voice|chat", "channel": "<chat channel id>", // channel: only for via chat, when given
"kind": "remind|task", "text": "...", "at": 1762830000.0, "repeat": "none|daily|weekdays|weekly",
"schedule": "<id>"} // add: kind..repeat; delete: schedule
-> {"type": "schedule_action_result", "id": "s1", "ok": true, "item": {...}} // add, delete
-> {"type": "schedule_action_result", "id": "s1", "ok": true, "items": [...]} // list
-> {"type": "schedule_action_result", "id": "s1", "ok": false, "error": "..."}
-> {"type": "reply", "id": "t1", "user": "<id>", "text": "<the task>", "via": "task"}
<- {"type": "reply_text", "id": "t1", "text": "...", "failed": false}
```
- Every voice and chat reply gets a schedule backend for its asker, the reply's `via` and, for
chat, the `channel` the `reply` named. Ids and waiting are those of chat actions (unique across
connections and runs, 15 s, a closed session fails what waits).
- `via: "task"` runs a scheduled task the app fires: in the chat lane and one at a time with the
person's other replies, with their history scope, but its own short-term memory, no chat or
schedule backend and the read-only tools only (`brain.TASK_TOOLS`, no MCP tools). It is not a turn
of the person's conversation (their turn count and delete confirmations stay), is never spoken
(`speak: true` is `bad_message`), and its answer is not stored; the app delivers it. It waits for
LLM switches like any reply.
### Background collection (M6)
With `JARVIS_COLLECT_PATH` set, the worker collects on its own thread, apart from the voice and the