loopd: a turn's speaker in the log, its number in SessionUpdated
Co-Authored-By: ornith-1.5-35b-a3b <agent@wntrmute.dev>
This commit is contained in:
+20
-13
@@ -178,25 +178,32 @@ pub fn handle(stream: UnixStream, ctx: Arc<Context>) {
|
||||
}
|
||||
};
|
||||
|
||||
let outcome = run_turn(&mut session, &runtime, &turn.content, &mut |event| {
|
||||
let _ = write_frame(
|
||||
&mut stream,
|
||||
&Envelope {
|
||||
v: PROTOCOL_VERSION,
|
||||
id: request.id,
|
||||
r#final: false,
|
||||
msg: Message::TurnEvent(event.clone()),
|
||||
},
|
||||
);
|
||||
});
|
||||
let outcome = run_turn(
|
||||
&mut session,
|
||||
&runtime,
|
||||
&turn.content,
|
||||
turn.speaker.as_deref(),
|
||||
&mut |event| {
|
||||
let _ = write_frame(
|
||||
&mut stream,
|
||||
&Envelope {
|
||||
v: PROTOCOL_VERSION,
|
||||
id: request.id,
|
||||
r#final: false,
|
||||
msg: Message::TurnEvent(event.clone()),
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
// 5. Release the session before the final frame, so the next turn does not find it busy.
|
||||
drop(held);
|
||||
|
||||
// A finished turn's records are for `memoryd` to index; best effort, since `memoryd` catches
|
||||
// up at its next start.
|
||||
// up at its next start. The number is this turn's: its `User` record is the last one counted.
|
||||
// A failed turn is not told, as before, though its logged message still counts.
|
||||
if outcome.is_ok()
|
||||
&& let Err(e) = ctx.memory.updated(&turn.session)
|
||||
&& let Err(e) = ctx.memory.updated(&turn.session, session.turns())
|
||||
{
|
||||
eprintln!(
|
||||
"loopd: memoryd was not told about {}: {e}",
|
||||
|
||||
Reference in New Issue
Block a user