Files
cobble/src/functions/backend/db/bots-queue/job-plan-mode.ts
T
tben e3439fb3d1 Offer a one-click way out of Plan mode under the answer
A reply that ran in Plan mode now records bot_messages.plan_mode (from the
job's params) and shows a Turn Plan mode off button under it while the
conversation is still in the mode: one click turns it off and puts
"Plan mode is off, go ahead." in the composer, never sending it.

The planning prompt, the tool gate's refusal and the file-escape review
fault now point at that button, so a bot says what it will do once the
mode is off instead of handing the work back to the user to paste.
2026-11-21 17:38:31 +01:00

15 lines
555 B
TypeScript

import type { BUN_SQLITE_COBBLE_BOTS_QUEUE } from "@/db/types/db";
import parseJobJson from "@/src/bots-queue/parse-job-json";
type Params = {
job: Pick<BUN_SQLITE_COBBLE_BOTS_QUEUE, "params">;
};
/**
* The reply behind a job ran in Plan mode (`params.plan_mode`, set from the
* user's message or a card asked in it). Its answer is recorded with the
* flag, so the thread can offer to leave the mode under it.
*/
export default function jobPlanMode({ job }: Params): boolean {
return Boolean(parseJobJson({ text: job.params })?.plan_mode);
}