Let workers ask each other through the coordinator in chatrooms
A worker asks for another bot's help with ask_crew. The coordinator reads the request, asks the right bot (in a workspace, only its members), and sends the answer back into the asking bot's conversation, waking it. Each exchange is kept as a read-only chatroom: listed in the main rail after the workspaces, or in the workspace's rail for requests made there, with live status rows for each bot while it's open and a Stop button. Room sessions are hidden from every conversation list, other bots' words reach the model fenced as data, and turns, nesting and open rooms are capped. Closed rooms are pruned after a retention period and past a cap per place (Settings > General). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -8,6 +8,8 @@ import insertBotJobUpdate from "./insert-bot-job-update";
|
||||
import recordHookCallResponse from "../bot-hooks/record-hook-call-response";
|
||||
import openBotJobsSql from "./open-bot-jobs-sql";
|
||||
import stoppedJobReport, { pickReportedJobs } from "./stopped-job-report";
|
||||
import grabSessionChatroomId from "../chatrooms/grab-session-chatroom-id";
|
||||
import closeChatroom from "../chatrooms/close-chatroom";
|
||||
|
||||
type Params = {
|
||||
bot_id: number | string;
|
||||
@@ -112,6 +114,18 @@ export default async function stopBotJobs({ bot_id, user_id }: Params): Promise<
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A job it was doing in a chatroom stops the room: the bot that asked
|
||||
* is told, and the room says so.
|
||||
*/
|
||||
for (const job of jobs) {
|
||||
const chatroom_id = await grabSessionChatroomId({ session_id: job.session_id });
|
||||
|
||||
if (chatroom_id) {
|
||||
await closeChatroom({ chatroom_id, status: "stopped", outcome: "" }).catch(() => false);
|
||||
}
|
||||
}
|
||||
|
||||
const messages: BUN_SQLITE_COBBLE_BOT_MESSAGES[] = [];
|
||||
|
||||
for (const [session_id, job] of pickReportedJobs({ jobs })) {
|
||||
|
||||
Reference in New Issue
Block a user