feat(app): 대화 screen to read what people said, Jarvis's answers and how each answer was made

The management app reads the worker's history store (read only) and shows
people's words, Jarvis's answers and the answer traces in time order, with
filters for kind, place, person, channel, day and text, live follow, older
items on demand and expandable traces (records given, tools offered, plan,
model thinking, tool calls and results).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-16 03:08:38 +09:00
parent a20ebe4eae
commit 46f71e7f03
15 changed files with 724 additions and 4 deletions

View File

@@ -68,6 +68,30 @@ Setting `since` (default none, meaning the whole history) drops records older th
A record that is a match is not repeated in the recent block. Returns the two blocks separately
so the prompt can label them.
## Traces
How each answer was made, for the management app's 대화 screen (`app/src/admin.spec.md`,
"Conversations"). A trace is never a record: no read above returns it and it never reaches a prompt.
- `add_trace(via, channel_id, user_id, question, answer, steps, ms, ts)`: one per `reply` the brain
ran (`via` `voice`, `chat` or `task`; `channel_id` where it was asked, none for a task; `answer`
empty when the brain gave none; `ts` when it was ready; `ms` how long it took). `steps` is a JSON
list in the order they happened:
- `{"kind": "records", "recent": [...], "matches": [...], "notes": n}`: the history lines and the
number of personal notes the brain was given (the voice worker adds it first),
- `{"kind": "tools", "names": [...]}`: the tools the turn was offered after routing,
- `{"kind": "plan", "steps": [...]}`: the planner's steps, when it ran,
- `{"kind": "think", "text": "..."}`: the model's thinking in one round, when thinking is on
(at most 8,000 characters),
- `{"kind": "tool", "name", "args", "ok", "result"}`: a tool call and the start of its result or
error (at most 2,000 characters), or `"skipped": "not_allowed" | "duplicate"` with `ok` false
for a call the engine refused.
The engine writes them through `turn_state.trace` (`reply/turn_state.py`), which does nothing when
no trace list was set (v1, evals).
- `traces_of(person)`: the person's traces, oldest first. `forget_person` deletes them too.
- `purge_traces_older_than(ts)`: the voice worker keeps traces 30 days (`TRACE_KEEP_DAYS`) and
removes older ones when it starts. `purge_older_than` removes old traces with the records.
## Writes and maintenance
- `add_voice`, `add_reply`, `add_chat`, `edit_chat`, `delete_chat`.

View File

@@ -246,7 +246,10 @@ which carry Discord's own time.
`speak: true` the answer is also spoken through the TTS path under the same id (audio frames and
`tts_done`), and `tts_cancel` with that id stops it. A `tts_cancel` that arrives while the brain is
still answering means the answer is not spoken: `reply_text` still comes, then `tts_done` with
`cancelled: true` and no audio. Each user keeps their own short-term dialogue
`cancelled: true` and no audio. Every reply, a task's too and one that failed, leaves a trace of
how it was made (`history.spec.md`, "Traces"): the history lines and number of notes it was given,
then what the engine wrote down; a trace that cannot be stored never stops the answer. Traces older
than 30 days are removed when the worker starts. Each user keeps their own short-term dialogue
memory (tool carry-over) across replies. The brain runs the reply engine with v1's single-user
memory off (`legacy_memory=False`: no warm profile, diary or graph), because several people share
this assistant and only the asker's scoped history may reach the prompt. It answers in Korean