Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Features switches: Skill Burger and thread tabs in config.json, device switches, and the useFeature hook
milind-sonid3ea34a727c2
diff --git a/server/agents-turn.ts b/server/agents-turn.tsindex df02729a98..57b8b2cfa2 100644--- a/server/agents-turn.ts+++ b/server/agents-turn.ts@@ -18,7 +18,7 @@ export interface AgentsConversation {botDriven?: boolean;/** `x`: a research credential is held (a treg key or a plan's); `research`: research works for it too; `appHosting`:* the plan's included app hosting reaches this server. */- host: { skillAuthoring: boolean; sharedComputers: boolean; cloudHome: boolean; team: boolean; voiceNotes: boolean; x: boolean; research: boolean; imageGeneration: boolean; meetings?: boolean; appHosting?: boolean; localVm: boolean };+ host: { skillAuthoring: boolean; skillBurger?: boolean; sharedComputers: boolean; cloudHome: boolean; team: boolean; voiceNotes: boolean; x: boolean; research: boolean; imageGeneration: boolean; meetings?: boolean; appHosting?: boolean; localVm: boolean };}/** What one turn may do. Its bearer carries this to the harness, which checks it on every call. */@@ -42,6 +42,7 @@ export function agentsServerEnv(conversation: AgentsConversation, turn: AgentsTuOMB_THREAD_ID: conversation.threadId,OMB_COMMS_TOKEN: bearer(turn),OMB_SKILL_AUTHORING_ENABLED: flag(host.skillAuthoring),+ OMB_SKILL_BURGER: flag(host.skillBurger !== false),OMB_MEMORY_ENABLED: flag(bot.memoryEnabled !== false),OMB_SHARED_COMPUTERS_ENABLED: flag(host.sharedComputers),OMB_CLOUD_HOME: flag(host.cloudHome), OMB_TEAM_PEOPLE: flag(host.team), OMB_ROOM: flag(conversation.room),diff --git a/server/config.ts b/server/config.tsindex 7faa3c3b8f..08ed3234a7 100644--- a/server/config.ts+++ b/server/config.ts@@ -226,7 +226,7 @@ const featureConfigSchema = z.object({/** Room jobs to several members run side by side, each in a thread of its own. On unless false. */parallelRoomJobs: z.boolean().optional(),acpPlanLines: z.boolean().optional(), // An ACP agent's plan as activity lines. Off unless true.-}).extend({ agentsToolBridge: z.boolean().optional(), savedSteps: z.boolean().optional(), usbPhoneTakeover: z.boolean().optional(), cloudComputerAutoReplace: z.boolean().optional(), phonePush: z.boolean().optional() }); // cloudComputerAutoReplace: set a dead or silent cloud computer aside (kept seven days with its files) and give its bot a new one by itself, on unless false (OMB_CLOUD_COMPUTER_AUTO_REPLACE wins); agentsToolBridge: the find_tool / use_tool bridge, off unless true; savedSteps: repeat a computer task from its saved steps, on unless false; usbPhoneTakeover: watch and take over the bots' USB phone, off unless true; phonePush: wake a paired phone whose app is closed through the hosted push relay, off unless true (OMB_PHONE_PUSH wins)+}).extend({ agentsToolBridge: z.boolean().optional(), savedSteps: z.boolean().optional(), usbPhoneTakeover: z.boolean().optional(), cloudComputerAutoReplace: z.boolean().optional(), phonePush: z.boolean().optional(), skillBurger: z.boolean().optional(), threadTabs: z.boolean().optional() }); // skillBurger: Skill Burgers in chat, the side menu and the bot panel, and the tools that run them, on unless false; threadTabs: a bot's threads as tabs above its chat, off unless true; cloudComputerAutoReplace: set a dead or silent cloud computer aside (kept seven days with its files) and give its bot a new one by itself, on unless false (OMB_CLOUD_COMPUTER_AUTO_REPLACE wins); agentsToolBridge: the find_tool / use_tool bridge, off unless true; savedSteps: repeat a computer task from its saved steps, on unless false; usbPhoneTakeover: watch and take over the bots' USB phone, off unless true; phonePush: wake a paired phone whose app is closed through the hosted push relay, off unless true (OMB_PHONE_PUSH wins)const onboardingConfigSchema = z.object({completedAt: z.string().trim().max(40).optional(),version: z.number().int().min(0).max(1000).optional(),@@ -467,7 +467,7 @@ export interface AppConfig extends HelperConfig {context?: { rebuildBytes?: number; compactAt?: number; autoCompact?: boolean; roomCompactAt?: number; roomSessions?: boolean; replayToolHistory?: boolean };memory?: { captureQuietMs?: number; tidyHour?: number };localVm?: { mode?: "shared" | "per-bot" | "pool"; maxInstances?: number; idleTimeoutMinutes?: number; preserveInstalledApps?: boolean; memoryGb?: number; cpus?: number };- features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; llmThreadTitles?: boolean; smartSetupChoices?: boolean; autoRecall?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; parallelRoomJobs?: boolean; acpPlanLines?: boolean; agentsToolBridge?: boolean; savedSteps?: boolean; usbPhoneTakeover?: boolean; cloudComputerAutoReplace?: boolean; phonePush?: boolean };+ features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; llmThreadTitles?: boolean; smartSetupChoices?: boolean; autoRecall?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; parallelRoomJobs?: boolean; acpPlanLines?: boolean; agentsToolBridge?: boolean; savedSteps?: boolean; usbPhoneTakeover?: boolean; cloudComputerAutoReplace?: boolean; phonePush?: boolean; skillBurger?: boolean; threadTabs?: boolean };onboarding?: { completedAt?: string; version?: number; reelSeen?: boolean; hintsSeen?: string[]; firstTurnAt?: string };browserProfiles?: BrowserProfile[];browserEngine?: BrowserEngineConfig;diff --git a/server/drivers/agents-catalog-profile.ts b/server/drivers/agents-catalog-profile.tsindex c442eaaff7..b1df4a3bf0 100644--- a/server/drivers/agents-catalog-profile.ts+++ b/server/drivers/agents-catalog-profile.ts@@ -6,6 +6,8 @@ import { toolsOffFromEnv, type ToolGroup } from "../../shared/tool-groups.ts";* authenticates and scopes every call. */export interface CatalogProfile {skillAuthoring: boolean;+ /** Skill Burgers are on here: run_workflow and workflow_edit are mounted. Absent means on. */+ skillBurger?: boolean;sharedComputers: boolean;voiceNotes: boolean;/** A treg key or a Cloud plan's research credential is held and this bot's research switch is on: x_search is mounted.@@ -45,6 +47,7 @@ export interface CatalogProfile {export function catalogProfileFromEnv(env: NodeJS.ProcessEnv): CatalogProfile {return {skillAuthoring: env.OMB_SKILL_AUTHORING_ENABLED === "1",+ skillBurger: env.OMB_SKILL_BURGER !== "0",sharedComputers: env.OMB_SHARED_COMPUTERS_ENABLED === "1",voiceNotes: env.OMB_VOICE_NOTES === "1",xResearch: env.OMB_X_RESEARCH === "1",diff --git a/server/drivers/agents-catalog.ts b/server/drivers/agents-catalog.tsindex 1e10edb9ce..e60df38b9c 100644--- a/server/drivers/agents-catalog.ts+++ b/server/drivers/agents-catalog.ts@@ -12,7 +12,7 @@ import { USAGE_LIMITS_TOOL_DEFINITION } from "./agents-usage-tool.ts";import { APP_SETTINGS_TOOL_DEFINITION } from "./agents-app-settings-tool.ts";import { THREAD_POST_TOOL_DEFINITION } from "./agents-thread-post-tool.ts";import { RENAME_THREAD_TOOL_DEFINITION } from "./agents-thread-title-tool.ts";-import { WORKFLOW_TOOL_DEFINITIONS } from "./agents-workflow-tool.ts";+import { WORKFLOW_TOOL_DEFINITIONS, WORKFLOW_TOOL_NAMES } from "./agents-workflow-tool.ts";import { WAIT_TOOL_DEFINITIONS, WAIT_TOOL_NAMES } from "./agents-wait-tools.ts"; import { CHECK_BACK_TOOL_DEFINITIONS, CHECK_BACK_TOOL_NAMES } from "./agents-check-back-tool.ts";import { COMPUTER_ASK_TOOL_DEFINITIONS, COMPUTER_ASK_TOOL_NAMES } from "./agents-computer-ask-tool.ts";import { IMAGE_TOOL_DEFINITIONS, IMAGE_TOOL_NAMES } from "./agents-image-tools.ts";@@ -860,7 +860,8 @@ function catalogTools(profile: CatalogProfile) {(profile.computerSelection === true || tool.name !== "select_computer") &&(profile.room !== true || !ROOM_REFUSED_TOOL_NAMES.has(tool.name)) &&(profile.imageGeneration === true || !IMAGE_TOOL_NAMES.has(tool.name)) && (profile.appHosting === true || !HOSTING_TOOL_NAMES.has(tool.name)) &&- (profile.meetings === true || (!MEETING_TOOL_NAMES.has(tool.name) && tool.name !== "reset_cloud_computer")));+ (profile.meetings === true || (!MEETING_TOOL_NAMES.has(tool.name) && tool.name !== "reset_cloud_computer")) &&+ (profile.skillBurger !== false || !WORKFLOW_TOOL_NAMES.has(tool.name)));const AUTHORING_TOOLS = profile.skillAuthoring? BOT_SCOPED_TOOLS: BOT_SCOPED_TOOLS.filter((tool) => !SKILL_TOOL_NAMES.has(tool.name));diff --git a/server/host/skills-library.ts b/server/host/skills-library.tsindex 19c243c01c..0ba1136d78 100644--- a/server/host/skills-library.ts+++ b/server/host/skills-library.ts@@ -16,7 +16,7 @@ import { nativeSkillListing, nativeSkills, projectSkillListing, projectSkills, pimport { redactSecretsInText } from "../redact.ts";import { readSectionContext } from "../section-context.ts";import { librarySkillFilePath, librarySkillOptOuts, listLibrarySkills, readLibrarySkillFile, readSkillLibraryIndex, skillsLibraryEnabled } from "../skill-library.ts";-import { findWorkflowSkill, workflowSkillsPrompt } from "../skill-burger/store.ts";+import { findWorkflowSkill, skillBurgerEnabled, workflowSkillsPrompt } from "../skill-burger/store.ts";import { librarySkillFiles, ownSkillFiles, type StoredSkillFiles } from "../skill-side-files.ts";import {conversationAssignedSkills,@@ -311,7 +311,7 @@ export function createSkillsLibraryHost(deps: SkillsLibraryHostDeps) {const project = thread ? projectInUse(bot, thread, cwd, instance, assigned) : [];return skillsSystemPrompt(bot.id, assigned, threadId === undefined ? undefined : conversationStartedAt(threadId)) +importedSkillsPrompt(listed, available.length - listed.length) + projectSkillsPrompt(project) +- (skillsLibraryEnabled(cfg) ? "" : workflowSkillsPrompt(bot.id)); // with the library on, saved workflows are every-bot library skills already+ (skillsLibraryEnabled(cfg) || !skillBurgerEnabled(cfg) ? "" : workflowSkillsPrompt(bot.id)); // with the library on, saved workflows are every-bot library skills already},/** The imported skills a turn links into its task folder: the same ones its index lists, so an engine that loads@@ -353,7 +353,7 @@ export function createSkillsLibraryHost(deps: SkillsLibraryHostDeps) {}if (files.size < mentioned.length) add(projectInUse(bot, threadId, cwd, instance, assigned).filter((skill) => !skill.modelOnly));// A Skill Burger runs exactly with run_workflow, whether it is the bot's own or used in every chat.- const burgers = mentioned.flatMap((name) => { const found = findWorkflowSkill(bot.id, name); return found ? [{ name, found }] : []; });+ const burgers = !skillBurgerEnabled(cfg) ? [] : mentioned.flatMap((name) => { const found = findWorkflowSkill(bot.id, name); return found ? [{ name, found }] : []; });for (const { name, found } of burgers) if (!files.has(name) && "everyChat" in found.place) files.set(name, librarySkillFilePath(name));const expanded = skillCommandTurnText(text, files, typed, ownStart);return burgers.length ? `${expanded}\n\n${burgers.map(({ name }) => `/${name} is a saved Skill Burger: run it with the run_workflow tool (name "${name}"), filling its args from the request, rather than by hand.`).join(" ")}` : expanded;diff --git a/server/index.ts b/server/index.tsindex c0eb9ac604..a2d6ac1f2b 100644--- a/server/index.ts+++ b/server/index.ts@@ -318,7 +318,7 @@ import {import * as tts from "./tts/index.ts";import { voiceNoteFailure } from "./tts/errors.ts";import { createDecider, deciderReady, describeDecider } from "./decider/index.ts"; import { createExtractor, describeHelpers } from "./extractor/index.ts";-import { createStopLineRoutes } from "./routes/stop-line.ts"; import { createSkillBurgerRoutes } from "./skill-burger/routes.ts"; import { createSkillBurgerRuns } from "./skill-burger/runs.ts"; import { decideRoomResponder } from "./decider/room-routing.ts"; import { roomRoutingInput } from "./host/room-routing-input.ts";+import { createStopLineRoutes } from "./routes/stop-line.ts"; import { createSkillBurgerRoutes } from "./skill-burger/routes.ts"; import { createSkillBurgerRuns } from "./skill-burger/runs.ts"; import { skillBurgerEnabled } from "./skill-burger/store.ts"; import { decideRoomResponder } from "./decider/room-routing.ts"; import { roomRoutingInput } from "./host/room-routing-input.ts";import { autoRoomDefault, roomTurnMembers } from "./room-routing-members.ts";import { liveHistoryFrom, LiveSessionError, type LiveBot, type LiveHistoryMessage } from "./live-call.ts";import { LiveCallController, LiveCallSignedOutError } from "./live-call-controller.ts"; import { liveSessionWiring } from "./live-session-wiring.ts";@@ -1798,7 +1798,7 @@ function agentsIntegration() {const bot = store.bot(botId), speaking = botForThread(botId, threadId) ?? bot;// Only advertises the tools; the routes behind them refuse regardless.- const host = { skillAuthoring: skillAuthoringEnabled(cfg), sharedComputers: botLending(), cloudHome: Boolean(CLOUD_HOME), team: Boolean(CLOUD_TEAM),+ const host = { skillAuthoring: skillAuthoringEnabled(cfg), skillBurger: skillBurgerEnabled(cfg), sharedComputers: botLending(), cloudHome: Boolean(CLOUD_HOME), team: Boolean(CLOUD_TEAM),voiceNotes: tts.voiceReady(cfg, speaking?.voice) && speaking?.voiceNotes !== false, x: Boolean(researchCredential(cfg.treg?.key)), research: researchAvailability.available(), imageGeneration: imageGenerationReady(cfg), meetings: boat.boatConfigured(cfg), appHosting: hostingCredential() !== null, localVm: localVmAvailability.available() };return { ...agentsProxyLaunch(), env: agentsServerEnv({ threadId, bot: bot ?? { id: botId }, room: Boolean(store.groupByThread(threadId)), teamComputer: Boolean(bot && inheritedTeamComputer(bot)), botDriven: automated || botDrivenConversation(store.taskByThread(botId, threadId)), host },{ generation, depth, skillAuthoring, roomHandoffId, ...(hostFiles && !CLOUD_HOME && !HOSTED_WORKSPACE ? { deliversSavedFiles: true } : {}) },@@ -11644,7 +11644,7 @@ function configStatus() {autoRecall: autoRecallEnabled(cfg),roomMemoryCapture: roomMemoryCaptureEnabled(cfg),parallelRoomJobs: parallelRoomJobsEnabled(cfg),- savedSteps: savedStepsEnabled(cfg), savedStepsHere: savedSteps.here(),+ savedSteps: savedStepsEnabled(cfg), savedStepsHere: savedSteps.here(), skillBurger: skillBurgerEnabled(cfg), threadTabs: cfg.features?.threadTabs === true,usbPhoneTakeover: HAS_USB_PORT ? usbPhoneTakeoverEnabled(cfg) : undefined,},onboarding: {diff --git a/server/skill-burger/store.ts b/server/skill-burger/store.tsindex 9d54c039a9..a62d1c79df 100644--- a/server/skill-burger/store.ts+++ b/server/skill-burger/store.ts@@ -19,6 +19,11 @@ export type { SavedWorkflow };const PROMPT_MAX_SKILLS = 20;const PROMPT_MAX_BYTES = 2_000;+/** Skill Burgers are on unless `features.skillBurger` is false; off, saved ones stay where they are. */+export function skillBurgerEnabled(cfg: { features?: { skillBurger?: boolean } }): boolean {+ return cfg.features?.skillBurger !== false;+}+/** Where a saved burger is: one bot's own skills, or the shared library. */export type BurgerPlace = { botId: string } | { everyChat: true };type Failure = { error: string; taken?: true };diff --git a/src/lib/feature-flags.ts b/src/lib/feature-flags.tsindex 8893112860..bcaa38e47a 100644--- a/src/lib/feature-flags.ts+++ b/src/lib/feature-flags.ts@@ -1,7 +1,7 @@import { t } from "./i18n";export interface FeatureFlagConfig {- features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean };+ features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean };browserEngine?: { kind: "engine" | "unavailable"; reason?: string; installable?: boolean; installing?: boolean; installError?: string };}@@ -97,3 +97,11 @@ export function savedStepsHere(config: FeatureFlagConfig | null | undefined): boexport function usbPhoneTakeoverEnabled(config: FeatureFlagConfig | null | undefined): boolean {return config?.features?.usbPhoneTakeover === true;}++export function skillBurgerEnabled(config: FeatureFlagConfig | null | undefined): boolean {+ return config?.features?.skillBurger !== false;+}++export function threadTabsEnabled(config: FeatureFlagConfig | null | undefined): boolean {+ return config?.features?.threadTabs === true;+}diff --git a/src/lib/feature-switches.ts b/src/lib/feature-switches.tsnew file mode 100644index 0000000000..d0623a5b14--- /dev/null+++ b/src/lib/feature-switches.ts@@ -0,0 +1,64 @@+import { useSyncExternalStore } from "react";++/** Switches on Settings → Features that only change how this device shows things, kept in this device's storage. */+export type DeviceFeature = "mascotMotion" | "threadNotes";++const KEYS: Record<DeviceFeature, string> = {+ mascotMotion: "omb-feature-mascot-motion",+ threadNotes: "omb-feature-thread-notes",+};++const sessionChoice = new Map<DeviceFeature, boolean>();+const listeners = new Set<() => void>();++function storage(): Storage | undefined {+ try {+ return globalThis.localStorage;+ } catch {+ return undefined;+ }+}++export function readDeviceFeature(name: DeviceFeature): boolean {+ const chosen = sessionChoice.get(name);+ if (chosen !== undefined) return chosen;+ try {+ return storage()?.getItem(KEYS[name]) !== "0";+ } catch {+ return true;+ }+}++function notify() {+ for (const listener of listeners) listener();+}++function onStorage(event: StorageEvent) {+ if (event.key !== null && !Object.values(KEYS).includes(event.key)) return;+ if (event.storageArea && event.storageArea !== storage()) return;+ sessionChoice.clear();+ notify();+}++function subscribe(listener: () => void): () => void {+ listeners.add(listener);+ if (listeners.size === 1 && typeof window !== "undefined") window.addEventListener("storage", onStorage);+ return () => {+ listeners.delete(listener);+ if (listeners.size === 0 && typeof window !== "undefined") window.removeEventListener("storage", onStorage);+ };+}++export function setDeviceFeature(name: DeviceFeature, enabled: boolean): void {+ sessionChoice.set(name, enabled);+ try {+ storage()?.setItem(KEYS[name], enabled ? "1" : "0");+ } catch {+ }+ notify();+}++export function useDeviceFeature(name: DeviceFeature): boolean {+ const read = () => readDeviceFeature(name);+ return useSyncExternalStore(subscribe, read, read);+}diff --git a/src/lib/use-feature.ts b/src/lib/use-feature.tsnew file mode 100644index 0000000000..4c3a911209--- /dev/null+++ b/src/lib/use-feature.ts@@ -0,0 +1,22 @@+import { skillBurgerEnabled, threadTabsEnabled } from "@/lib/feature-flags";+import { useDeviceFeature, type DeviceFeature } from "@/lib/feature-switches";+import type { ConfigStatus } from "@/state/store";+import { useStoreSelector } from "@/state/store-select";++/** Switches on Settings → Features kept in the place's config.json (`features.<name>`), so its server reads them too. */+export type PlaceFeature = "skillBurger" | "threadTabs";+export type Feature = PlaceFeature | DeviceFeature;++const PLACE_FEATURES: Record<PlaceFeature, (config: ConfigStatus | null | undefined) => boolean> = {+ skillBurger: skillBurgerEnabled,+ threadTabs: threadTabsEnabled,+};++export const isPlaceFeature = (name: Feature): name is PlaceFeature => Object.hasOwn(PLACE_FEATURES, name);++/** Whether a switch on Settings → Features is on. */+export function useFeature(name: Feature): boolean {+ const place = useStoreSelector((state) => (isPlaceFeature(name) ? PLACE_FEATURES[name](state.config) : false));+ const device = useDeviceFeature(isPlaceFeature(name) ? "mascotMotion" : name);+ return isPlaceFeature(name) ? place : device;+}diff --git a/src/state/config-status.ts b/src/state/config-status.tsindex 997bf566ec..0c597e8acf 100644--- a/src/state/config-status.ts+++ b/src/state/config-status.ts@@ -169,7 +169,7 @@ export interface ConfigStatus {/** What a paired phone calls this computer; "" uses the default. */computerName?: string;/** Opt-in flags. Absent means off. */- features?: { skillAuthoring: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean };+ features?: { skillAuthoring: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean };/** First-run progress: whether the welcome tour was finished and which* one-time hints were dismissed. Server-owned so it follows the workspace. */onboarding?: OnboardingStatus;