Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Refuse moving a routine with a kept computer to a bot on its team's computer
AdityaUmale12dc8570283f
diff --git a/server/routine-computer.test.ts b/server/routine-computer.test.tsindex a58244e247..f713f126ef 100644--- a/server/routine-computer.test.ts+++ b/server/routine-computer.test.ts@@ -156,6 +156,13 @@ describe("a routine's own computer", () => {expect(routines.update(routine.id, { computer: null })).not.toHaveProperty("computer");});+ it("refuses moving a routine with a kept computer to a bot on its team's computer, unless the move clears it", () => {+ const { routines } = manager(["bot-a"]);+ const routine = routines.create({ ...base, botId: "bot-b", computer: "vm" });+ expect(() => routines.update(routine.id, { botId: "bot-a" })).toThrow(TEAM_COMPUTER_REFUSAL);+ expect(routines.update(routine.id, { botId: "bot-a", computer: null })).not.toHaveProperty("computer");+ });+it("loads a kept computer and drops one that is unknown or on a room goal", () => {const saved: Routine = { ...manager().routines.create(base), computer: "vm" };expect(loadRoutine(saved, START)?.computer).toBe("vm");diff --git a/server/routines.ts b/server/routines.tsindex e87ca0446d..23354f878e 100644--- a/server/routines.ts+++ b/server/routines.ts@@ -628,7 +628,7 @@ export class RoutineManager {deliver: Object.hasOwn(patch, "deliver") ? patch.deliver : routine.deliver, computer: Object.hasOwn(patch, "computer") ? patch.computer : routine.computer,}, now);clean.schedule = this.timedSchedule(clean.schedule, routine.id);- if (this.targetState(clean) === "missing") throw new Error(this.missingTargetMessage(clean.target)); if (patch.computer) refuseKeptComputer(clean, this.options.teamComputer);+ if (this.targetState(clean) === "missing") throw new Error(this.missingTargetMessage(clean.target)); if (patch.computer || clean.botId !== routine.botId) refuseKeptComputer(clean, this.options.teamComputer);const scheduleChanged = JSON.stringify(clean.schedule) !== JSON.stringify(routine.schedule);const enabledChanged = clean.enabled !== routine.enabled;if (enabledChanged && clean.enabled && clean.schedule.type === "once" && clean.schedule.at <= now) throw new RoutineScheduleError("Its time has passed. Edit it to pick a new time.");