A production run kept a verdict the user had overruled while it worked, and the reply to the correction queued a second run that redid the first. - Task runs the user follows take in what they write in the conversation since the run was queued: at the start, between steps, past a report not yet out, and by the wrap up (no steps left: the report says what it changes). A correction changes the work; anything else is left to the chat, and crew messages to the reply they wake. Routines, hook calls and rooms are unchanged. - runTextLoop takes the caller's notes for what came in (incoming_notes) and, with a wrap_up note, reads it before the wrap up too. - A reply is told which of the bot's runs are open in its session and hear the user, so a correction never starts another; start_task's open-run refusal says the same. - The reply's message-to-turn reading is shared (messagesToTurns). Co-Authored-By: Claude Opus 5.5 <[email protected]>
23 lines
762 B
TypeScript
23 lines
762 B
TypeScript
import type { SqlCondition } from "@/src/utils/crew-access/types";
|
|
|
|
type Params = {
|
|
session_id: number | string;
|
|
/**
|
|
* When the run was queued (`bots_queue.created_at`, ms).
|
|
*/
|
|
queued_at: number;
|
|
};
|
|
|
|
/**
|
|
* The SQL for the newest message a session had when a run was queued:
|
|
* what the user writes after it is new to the run, however long it waited
|
|
* for its computer or how often it was tried. Selects one `id` column, 0
|
|
* for an empty session.
|
|
*/
|
|
export default function taskIncomingBaselineSql({ session_id, queued_at }: Params): SqlCondition {
|
|
return {
|
|
sql: `SELECT COALESCE(MAX(id), 0) AS id FROM bot_messages WHERE session_id = ? AND created_at <= ?`,
|
|
values: [Number(session_id), Number(queued_at)],
|
|
};
|
|
}
|