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]>
29 lines
1023 B
TypeScript
29 lines
1023 B
TypeScript
import type { ChatroomStatus } from "@/src/dict/chatroom-dict";
|
|
|
|
type Params = {
|
|
chatroom_id: number | string;
|
|
title?: string | null;
|
|
status: ChatroomStatus;
|
|
outcome?: string | null;
|
|
};
|
|
|
|
/**
|
|
* The message that brings a room's outcome back to the bot that asked,
|
|
* naming the request and linking the room.
|
|
*/
|
|
export default function chatroomOutcomeMessage({ chatroom_id, title, status, outcome }: Params) {
|
|
const request = `"${(title || "your request").trim()}" ([room:${chatroom_id}])`;
|
|
const body = (outcome || "").trim();
|
|
|
|
const heading =
|
|
status == "answered"
|
|
? `The coordinator answered your request ${request}:`
|
|
: status == "refused"
|
|
? `The coordinator turned down your request ${request}:`
|
|
: status == "stopped"
|
|
? `Your request ${request} was stopped by the user.`
|
|
: `Your request ${request} couldn't be answered:`;
|
|
|
|
return body && status != "stopped" ? `${heading}\n\n${body}` : heading;
|
|
}
|