- 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]>
127 lines
2.3 KiB
TypeScript
127 lines
2.3 KiB
TypeScript
/**
|
|
* Bot identity hues. A bot keeps its hue for life; a hue never means state.
|
|
* The coordinator has no hue.
|
|
*/
|
|
export const BotHues = [
|
|
{
|
|
title: "Ember",
|
|
value: "ember",
|
|
},
|
|
{
|
|
title: "Amber",
|
|
value: "amber",
|
|
},
|
|
{
|
|
title: "Moss",
|
|
value: "moss",
|
|
},
|
|
{
|
|
title: "Teal",
|
|
value: "teal",
|
|
},
|
|
{
|
|
title: "Cobalt",
|
|
value: "cobalt",
|
|
},
|
|
{
|
|
title: "Violet",
|
|
value: "violet",
|
|
},
|
|
{
|
|
title: "Rose",
|
|
value: "rose",
|
|
},
|
|
] as const;
|
|
|
|
export type BotHue = (typeof BotHues)[number]["value"];
|
|
|
|
export const BotKinds = [
|
|
{
|
|
title: "Worker",
|
|
value: "worker",
|
|
},
|
|
{
|
|
title: "Coordinator",
|
|
value: "coordinator",
|
|
},
|
|
] as const;
|
|
|
|
export type BotKind = (typeof BotKinds)[number]["value"];
|
|
|
|
/**
|
|
* Every user has exactly one coordinator, created with the account. It
|
|
* coordinates the crew and hands work to the other bots.
|
|
*/
|
|
export const CoordinatorBotName = "Coordinator";
|
|
|
|
/**
|
|
* A bot's face is its status. There are no badges or spinners.
|
|
*/
|
|
export const BotFaces = [
|
|
{
|
|
title: "Idle",
|
|
value: "idle",
|
|
},
|
|
{
|
|
title: "Working",
|
|
value: "working",
|
|
},
|
|
{
|
|
title: "Done",
|
|
value: "done",
|
|
},
|
|
{
|
|
title: "Asleep",
|
|
value: "asleep",
|
|
},
|
|
{
|
|
title: "Needs you",
|
|
value: "needs-you",
|
|
},
|
|
] as const;
|
|
|
|
export type BotFace = (typeof BotFaces)[number]["value"];
|
|
|
|
export const BotMessageAuthors = [
|
|
{
|
|
title: "Bot",
|
|
value: "bot",
|
|
},
|
|
{
|
|
title: "User",
|
|
value: "user",
|
|
},
|
|
] as const;
|
|
|
|
export type BotMessageAuthor = (typeof BotMessageAuthors)[number]["value"];
|
|
|
|
export const BotTaskStatuses = [
|
|
{
|
|
title: "Active",
|
|
value: "active",
|
|
},
|
|
{
|
|
title: "Done",
|
|
value: "done",
|
|
},
|
|
] as const;
|
|
|
|
export type BotTaskStatus = (typeof BotTaskStatuses)[number]["value"];
|
|
|
|
export const BotTaskStepStates = [
|
|
{
|
|
title: "Done",
|
|
value: "done",
|
|
},
|
|
{
|
|
title: "Active",
|
|
value: "active",
|
|
},
|
|
{
|
|
title: "Pending",
|
|
value: "pending",
|
|
},
|
|
] as const;
|
|
|
|
export type BotTaskStepState = (typeof BotTaskStepStates)[number]["value"];
|