Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge pull request #5947 from jagtapazad/feat/pause-department-or-bot

milind-soni72bc4989f042
diff --cc packages/phone-protocol/src/bot-limit.ts
index 93d3bcb270,0000000000..ebd921af7e
mode 100644,000000..100644
--- a/packages/phone-protocol/src/bot-limit.ts
+++ b/packages/phone-protocol/src/bot-limit.ts
@@@ -1,13 -1,0 +1,16 @@@
+import type { DefaultBotFields } from "./default-bot.ts";
+
+/** The code on a creation an older server refused, `409 { error, code }`, when Starter capped how many bots it made. No server
+ * sends it now; clients still read it from one that does. `error` is plain text any client can show. */
+export const BOT_LIMIT_CODE = "bot_limit";
+
+/** The code on a turn refused because its bot is paused: a Starter Cloud keeps only so many bots awake. */
+export const BOT_PAUSED_CODE = "bot_paused";
+
++/** The code on a turn refused because the person paused its bot, or its department (Pause in the sidebar menus). */
++export const BOT_HELD_CODE = "bot_held";
++
+/** The bots a plan's awake limit counts. A place's MausBot comes with it; an archived bot or one that moved away isn't at work here. */
+export function botsTowardLimit(bots: ReadonlyArray<Pick<DefaultBotFields, "defaultBot"> & { hidden?: boolean; movedTo?: unknown }>): number {
+ return bots.filter((bot) => !bot.defaultBot && !bot.hidden && !bot.movedTo).length;
+}