Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
ModelGo's card follows the launch's first notice, so everyone sees it on their first launch
Milind Sonie431a8284439
diff --git a/src/components/AppNotices.test.ts b/src/components/AppNotices.test.tsindex 1b1bc1d829..a976937fe2 100644--- a/src/components/AppNotices.test.ts+++ b/src/components/AppNotices.test.ts@@ -1455,4 +1455,78 @@ describe("ModelGo's sponsor card", () => {expect(await relaunch(), "a Team Cloud's rules are no organization-managed desktop").toContain(TITLE);});+ it("after an update, What's new takes the launch and the card follows it in that same launch once it closes, then never again", async () => {+ returning(); desk.saved = null; storage.delete(WHATS_NEW_NOTICE);+ const first = await launch();+ expect(first).toContain("Meet the new MausBot Cloud"); expect(first, "never two at once").not.toContain(TITLE);+ expect(events()).toEqual([]);+ press("Not now"); await flush();+ const after = await settle();+ expect(after, "right after What's new closes").toContain(TITLE); expect(after).not.toContain("Meet the new MausBot Cloud");+ expect(events()).toEqual([{ action: "shown", place: "popup" }]);+ expect(launchNotice(), "What's new keeps the launch").toBe(WHATS_NEW_NOTICE);+ expect(await launch(), "a reload in the same launch").toContain(TITLE);+ press("Not now"); await flush();+ await gone();+ });++ it("follows the product-updates question when that follows What's new", async () => {+ desk.saved = null; storage.delete(WHATS_NEW_NOTICE);+ const prefs = createDesktopPrefs({ read: () => null, write: () => {} });+ const client = { state: vi.fn(() => account), updatesConsent: vi.fn(async () => ({ cloudContractVersion: 1, consent: null })), recordUpdatesConsent: vi.fn(async () => {}),+ updatesConsentByEmail: vi.fn(async () => "R".repeat(43)), withdrawUpdatesConsent: vi.fn(async () => {}) };+ registerUpdatesConsent({ ipcMain: { handle: (channel, handler) => void desk.handlers.set(channel, handler as Handler) }, page: event => (event as { page: Page }).page,+ consent: createUpdatesConsent({ prefs, account: () => client as never, available: async () => true, now: () => now }) });+ await launch(); press("Not now"); await flush();+ const question = await settle();+ expect(question).toContain("Get MausBot updates?"); expect(question).not.toContain(TITLE);+ press("No thanks"); await flush();+ expect(await settle(), "then the card, in the same launch").toContain(TITLE);+ });++ it("a notice to act on keeps its place: the move popup or a trial's notice comes first, and the card follows it once closed", async () => {+ storage.delete(GROK_MOVE_NOTICE); returning();+ vi.stubGlobal("document", { activeElement: null, body: null, documentElement: { dataset: {} }, getElementById: () => null,+ querySelector: (selector: string) => selector === "[data-grok-move-popup]" ? { querySelectorAll: () => [] } : null, querySelectorAll: () => [] });+ const grok = await launch();+ expect(grok).toContain("data-grok-move-popup"); expect(grok).not.toContain(TITLE);+ press("Not now"); await flush();+ expect(await settle(), "after the move's popup").toContain(TITLE);+ due(); session.clear(); f.values = [];+ const running = trial("active");+ account = paid({ trial: running }); snapshot = { status: "paid", tier: "pro", trial: running, notice: "active" }; offer = { ...PLAIN_OFFER };+ const notice = await relaunch();+ expect(notice).toContain("Your free trial ends on"); expect(notice).not.toContain(TITLE);+ expect(await settle(), "it stays up alone").not.toContain(TITLE);+ press("Manage subscription"); await flush();+ expect(await settle(), "after the trial's notice").toContain(TITLE);+ });++ it("a card left up keeps the corner: the card waits for it to close", async () => {+ returning(); storage.delete(STAR_NOTICE); storage.set(CLOUD_INTRO, "1"); storage.set(MODELGO_OFFER_NOTICE, "1");+ expect(await launch()).toContain("Enjoying MausBot?");+ due();+ expect(await settle(), "the star took the launch and is still up").not.toContain(TITLE);+ press("Not now"); await flush();+ expect(await settle()).toContain(TITLE);+ });++ it("follows a closed notice only where it may show at all: not on a branded build, an organization that refuses it, a move to My Cloud or a call", async () => {+ returning(); desk.saved = null; storage.delete(WHATS_NEW_NOTICE);+ f.state.config.managedPolicy = { organizationName: "Acme", companyModelsOnly: true, allowedEngines: "all" };+ await launch(); press("Not now"); await flush();+ expect(await settle(), "an organization that refuses it").toBe("");+ f.state.config.managedPolicy = undefined; f.brand = "file";+ expect(await launch(), "a branded build").toBe("");+ f.brand = "default"; f.state.liveCall = { status: "active" };+ expect(await launch(), "a live call").toBe("");+ f.state.liveCall = undefined;+ const line = (move: unknown) => desk.handlers.set("cloud-send:notice", () => ({ ready: true, bots: [], move }));+ line({ phase: "copy", chats: { done: 1, total: 5 } });+ expect(await launch(), "while the bots move to My Cloud").toBe("");+ line(undefined); now += DAY;+ expect(await launch(), "then, still in the launch What's new took").toContain(TITLE);+ expect(launchNotice()).toBe(WHATS_NEW_NOTICE);+ });+});diff --git a/src/components/AppNotices.tsx b/src/components/AppNotices.tsxindex 879db88cca..622ae6f495 100644--- a/src/components/AppNotices.tsx+++ b/src/components/AppNotices.tsx@@ -204,8 +204,9 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { qconst modelgoNow = !modelgoHere || moving || welcomeFinishedThisLaunch() || launchDialogShown() === "mausbot" || desktopState?.seen.includes(MODELGO_OFFER_NOTICE) ? false: organization === null || moving === null || firstChat === null || mausBotFirst || (state.liveCall && state.liveCall.status !== "ended") || (desktop && !desktopState) ? null : true;const launch = launchNotice();- // After a closed popup only the product-updates question may follow in this launch; nothing else does.- const notice = waits ? null : closed ? (consentNow === true ? UPDATES_CONSENT_NOTICE : null)+ // After a closed popup only the product-updates question and ModelGo's card may follow in this launch (nextNotice's+ // FOLLOWERS); nothing else does.+ const notice = waits ? null: firstChatQuiet(state) ? (grokNow === true && (launch === null || launch === GROK_MOVE_NOTICE) ? GROK_MOVE_NOTICE : null): cards || whatsNewHere || consentHere || simpleDue || boatHere || modelgoHere || twoFact !== false || grokNow !== false ? nextNotice({[GROK_MOVE_NOTICE]: grokNow,@@ -226,7 +227,7 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { q: organization === null || moving === null || afterWelcome === null || mausBotFirst || (desktop && !desktopState) ? null : !organization,[STAR_NOTICE]: !bridge || moving || brandStatus().source === "file" || !usedBefore(state.bots) ? false : moving === null ? null : true,}, id => id === CLOUD_INTRO ? stage === "done" && !introOpen- : id === STAR_NOTICE || id === PRODUCT_HUNT_NOTICE || id === BOAT_OFFER_NOTICE || id === MODELGO_OFFER_NOTICE ? noticeSeen(record, id) : false, launch) : null;+ : id === STAR_NOTICE || id === PRODUCT_HUNT_NOTICE || id === BOAT_OFFER_NOTICE || id === MODELGO_OFFER_NOTICE ? noticeSeen(record, id) : false, launch, closed) : null;const shownKey = notice === CLOUD_TRIAL_NOTICE ? key : notice;useEffect(() => {diff --git a/src/lib/notices.test.ts b/src/lib/notices.test.tsindex ac811670f3..aba81242bf 100644--- a/src/lib/notices.test.ts+++ b/src/lib/notices.test.ts@@ -2,8 +2,9 @@ import { afterEach, beforeEach, expect, it, vi } from "vitest";import { EMPTY_ONBOARDING, type OnboardingStatus } from "@/lib/onboarding";import { withTourReset } from "@/lib/guided-tour";import { DESKTOP_NOTICES } from "../../electron/desktop-prefs.mjs";-import { BOAT_OFFER_NOTICE, CLOUD_INTRO, CLOUD_NOTICE, CLOUD_TRIAL_NOTICE, dismissNotice, GROK_MOVE_NOTICE, introShown, introStage, launchNotice, localDay, markLaunchNotice, MODELGO_OFFER_NOTICE, nextNotice, noticeSeen,- NOTICES, OLD_PRO_DISMISSALS, PRODUCT_HUNT_NOTICE, SIMPLE_MODE_NOTICE, STAR_NOTICE, TWO_PLACES_NOTICE, UPDATES_CONSENT_NOTICE, usedBefore, WHATS_NEW_NOTICE, type NoticeFacts } from "./notices";+import { BOAT_OFFER_NOTICE, CLOUD_INTRO, CLOUD_NOTICE, CLOUD_TRIAL_NOTICE, dismissNotice, FOLLOWERS, GROK_MOVE_NOTICE, introShown, introStage, launchNotice, localDay, markLaunchNotice, MODELGO_OFFER_NOTICE, MUST_ACT,+ nextNotice, noticeSeen, NOTICES, OLD_PRO_DISMISSALS, PRODUCT_HUNT_NOTICE, SIMPLE_MODE_NOTICE, STAR_NOTICE, TWO_PLACES_NOTICE, UPDATES_CONSENT_NOTICE, usedBefore, WHATS_NEW_NOTICE, type NoticeFacts,+ type NoticeId } from "./notices";let storage: Map<string, string>, session: Map<string, string>;beforeEach(() => {@@ -185,3 +186,32 @@ it("ModelGo's card follows update consent and the account's notices, and goes beexpect(nextNotice(modelgo({}), id => id === MODELGO_OFFER_NOTICE), "seen once, then Boat").toBe(BOAT_OFFER_NOTICE);expect(MODELGO_OFFER_NOTICE).toBe("modelgo-offer-2026-11");});++it("ModelGo's card follows the launch's notice in the same launch once it is closed, after the question, never ahead of a notice to act on", () => {+ expect([...FOLLOWERS]).toEqual([UPDATES_CONSENT_NOTICE, MODELGO_OFFER_NOTICE]);+ expect([...MUST_ACT]).toEqual([GROK_MOVE_NOTICE, CLOUD_TRIAL_NOTICE, CLOUD_NOTICE]);+ const due = ({ popup = true, consent = false, trial = false, cloud = false, grok = false, intro = false, two = false }: Partial<Record<"popup" | "trial" | "cloud" | "grok" | "intro" | "two", boolean | null>> & { consent?: boolean | null }) =>+ facts(intro, trial, cloud, true, false, popup, consent, false, true, two, grok, true);+ const popupSeen = (id: NoticeId) => id === WHATS_NEW_NOTICE;+ expect(nextNotice(due({}), none), "What's new goes first").toBe(WHATS_NEW_NOTICE);+ expect(nextNotice(due({}), none, WHATS_NEW_NOTICE), "a reload while it is up").toBe(WHATS_NEW_NOTICE);+ expect(nextNotice(due({}), popupSeen, WHATS_NEW_NOTICE, true), "closed: the card follows").toBe(MODELGO_OFFER_NOTICE);+ expect(nextNotice(due({ popup: false }), none, WHATS_NEW_NOTICE), "and after a reload").toBe(MODELGO_OFFER_NOTICE);+ expect(nextNotice(due({}), id => id === WHATS_NEW_NOTICE || id === MODELGO_OFFER_NOTICE, WHATS_NEW_NOTICE, true), "once: Boat still waits").toBeNull();+ expect(nextNotice(due({ consent: true }), popupSeen, WHATS_NEW_NOTICE, true), "the question goes first").toBe(UPDATES_CONSENT_NOTICE);+ expect(nextNotice(due({ consent: null }), popupSeen, WHATS_NEW_NOTICE, true), "and holds it while unanswered").toBeNull();+ expect(nextNotice(due({ intro: true, two: true }), popupSeen, WHATS_NEW_NOTICE, true), "promotions left for later don't hold it").toBe(MODELGO_OFFER_NOTICE);+ for (const [name, held] of [["grok", due({ grok: true })], ["trial", due({ trial: true })], ["cloud", due({ cloud: true })], ["trial unknown", due({ trial: null })]] as const)+ expect(nextNotice(held, popupSeen, WHATS_NEW_NOTICE, true), `${name}: it waits for that notice's launch`).toBeNull();+ expect(nextNotice(due({ popup: false, trial: true }), none), "that launch: the trial's notice first").toBe(CLOUD_TRIAL_NOTICE);+ expect(nextNotice(due({ popup: false, trial: true }), none, CLOUD_TRIAL_NOTICE), "while it is up").toBe(CLOUD_TRIAL_NOTICE);+ expect(nextNotice(due({ popup: false, trial: true }), none, CLOUD_TRIAL_NOTICE, true), "closed, its facts unchanged: the card follows").toBe(MODELGO_OFFER_NOTICE);+ expect(nextNotice(due({ popup: false, grok: true }), none, GROK_MOVE_NOTICE, true), "after the move popup too").toBe(MODELGO_OFFER_NOTICE);+ const star = facts(false, false, false, true, false, false, false, false, false, false, false, true);+ expect(nextNotice(star, none, STAR_NOTICE), "a card still up keeps the corner").toBe(STAR_NOTICE);+ expect(nextNotice(star, id => id === STAR_NOTICE, STAR_NOTICE, true), "then the card").toBe(MODELGO_OFFER_NOTICE);+ expect(nextNotice(due({ popup: false, trial: true }), none, MODELGO_OFFER_NOTICE), "a notice due later never takes the card's own launch from it").toBe(MODELGO_OFFER_NOTICE);+ expect(nextNotice(due({ popup: false }), none, null, true), "a closed notice with no launch kept: the card, and nothing else").toBe(MODELGO_OFFER_NOTICE);+ expect(nextNotice({ ...due({}), [MODELGO_OFFER_NOTICE]: false }, popupSeen, WHATS_NEW_NOTICE, true), "where it may not show: nothing").toBeNull();+ expect(nextNotice({ ...due({}), [MODELGO_OFFER_NOTICE]: null }, popupSeen, WHATS_NEW_NOTICE, true), "while unknown: nothing yet").toBeNull();+});diff --git a/src/lib/notices.ts b/src/lib/notices.tsindex 17072de0c0..915bf1732c 100644--- a/src/lib/notices.ts+++ b/src/lib/notices.ts@@ -17,12 +17,13 @@ export const PRODUCT_HUNT_UNTIL = Date.UTC(2026, 10, 1);export const BOAT_OFFER_NOTICE = "boat-credit-2026-11";/** The Move from Grok Bot popup: each person sees it once, first of all, after their welcome. */export const GROK_MOVE_NOTICE = "grok-move-2026-11";-/** The sponsor's card for ModelGo: each person sees it once, on every page but a branded build or a desktop whose organization refuses it. */+/** The sponsor's card for ModelGo: each person sees it once, on every page but a branded build or a desktop whose organization+ * refuses it, and on the first launch it may show in: first when nothing else is due, else right after the launch's notice. */export const MODELGO_OFFER_NOTICE = "modelgo-offer-2026-11";/**- * Every notice, in the order a launch asks them: one launch shows one notice, the first one due, and only the product-updates- * question may follow it there. The rest wait for later launches, in this order.+ * Every notice, in the order a launch asks them: one launch shows one notice first, the first one due, and only FOLLOWERS may+ * come after it there. The rest wait for later launches, in this order.*/export const NOTICES = [GROK_MOVE_NOTICE,@@ -43,11 +44,26 @@ export type NoticeId = (typeof NOTICES)[number];export type NoticeFacts = Record<NoticeId, boolean | null>;-/** `launch`: the notice this launch already showed (launchNotice), the only one besides the product-updates question that- * may show again in it. */-export function nextNotice(facts: NoticeFacts, seen: (id: NoticeId) => boolean, launch: NoticeId | null = null): NoticeId | null {+/** What may still come in a launch another notice took: the product-updates question, and the sponsor's card, which everyone+ * is to see on the first launch it may show in. Each in its place in NOTICES. */+export const FOLLOWERS: readonly NoticeId[] = [UPDATES_CONSENT_NOTICE, MODELGO_OFFER_NOTICE];+/** Notices the person has to act on. The sponsor's card never goes ahead of one, even one left for a later launch: it waits+ * for that launch and follows it there. */+export const MUST_ACT: readonly NoticeId[] = [GROK_MOVE_NOTICE, CLOUD_TRIAL_NOTICE, CLOUD_NOTICE];++/** `launch`: the notice this launch already showed (launchNotice), the only one besides FOLLOWERS that may show again in it.+ * `closed`: that notice was closed in this page, so it doesn't come back however its facts read. The sponsor's card follows+ * only once the launch's notice is gone, so two cards never share the corner. */+export function nextNotice(facts: NoticeFacts, seen: (id: NoticeId) => boolean, launch: NoticeId | null = null, closed = false): NoticeId | null {+ const launchUp = launch !== null && !closed && !seen(launch) && facts[launch] !== false;+ let held = false;for (const id of NOTICES) {- if (seen(id) || (launch !== null && id !== launch && id !== UPDATES_CONSENT_NOTICE)) continue;+ if (seen(id)) continue;+ if ((closed || (launch !== null && id !== launch)) && !FOLLOWERS.includes(id)) {+ if (id !== launch && MUST_ACT.includes(id) && facts[id] !== false) held = true;+ continue;+ }+ if (id === MODELGO_OFFER_NOTICE && id !== launch && (held || launchUp)) continue;if (facts[id] === null) return null;if (facts[id]) return id;}