Add workspaces, computers, bot memory and the bots queue
- Schema: workspaces (+ workspace_bots, workspace_computers), containers, computers, bot_computers, bots.memory, workspaces.system_prompt, and bots_queue as a bun-sqlite isQueue table - Main computer (and its container record) ensured with the coordinator on signup, seed and /admin/bots; the coordinator's access to it is locked - Effective computer access: direct grants plus workspace computers - Full bot prompt: core instructions, workspace prompts, then memory; bots can rewrite their memory and system prompt - Queue helpers on the native BunSQLite.queue API, plus a handler that heartbeats, serializes per computer, recovers after restarts, reports lost jobs, supports cancelling and pushes outcomes over the WebSocket - Enable SQLite foreign keys at startup so schema cascades fire - Prune finished jobs daily Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import grabUnreportedFailedBotJobs from "@/src/functions/backend/db/bots-queue/grab-unreported-failed-bot-jobs";
|
||||
import notifyBotJobFailed from "@/src/functions/backend/db/bots-queue/notify-bot-job-failed";
|
||||
import pushBotNotice from "./push-bot-notice";
|
||||
|
||||
/**
|
||||
* Tells the user about jobs that ran out of attempts by going silent
|
||||
* (bun-sqlite fails those itself, without a message).
|
||||
*/
|
||||
export default async function reportLostBotJobs() {
|
||||
const jobs = await grabUnreportedFailedBotJobs();
|
||||
|
||||
for (const job of jobs) {
|
||||
if (!job.bot_id) continue;
|
||||
|
||||
const notice = await notifyBotJobFailed({
|
||||
job,
|
||||
failure_message: `I lost track of "${job.title || "the job"}" and couldn't finish it.`,
|
||||
});
|
||||
|
||||
await pushBotNotice({ bot_id: job.bot_id, ...notice });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user