- 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]>
33 lines
993 B
TypeScript
33 lines
993 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import isLockedComputerAccess from "./is-locked-computer-access";
|
|
|
|
describe("isLockedComputerAccess", () => {
|
|
test("locks the coordinator to the main computer", () => {
|
|
expect(
|
|
isLockedComputerAccess({
|
|
bot_kind: "coordinator",
|
|
computer_kind: "main",
|
|
}),
|
|
).toBe(true);
|
|
});
|
|
|
|
test("leaves every other pair removable", () => {
|
|
expect(
|
|
isLockedComputerAccess({ bot_kind: "worker", computer_kind: "main" }),
|
|
).toBe(false);
|
|
expect(
|
|
isLockedComputerAccess({
|
|
bot_kind: "coordinator",
|
|
computer_kind: "sandbox",
|
|
}),
|
|
).toBe(false);
|
|
expect(
|
|
isLockedComputerAccess({
|
|
bot_kind: "worker",
|
|
computer_kind: "sandbox",
|
|
}),
|
|
).toBe(false);
|
|
expect(isLockedComputerAccess({})).toBe(false);
|
|
});
|
|
});
|