Skip to content

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

3.5 KB
Raw Blame
import { toolsOffFromEnv, type ToolGroup } from "../../shared/tool-groups.ts";

// The OMB_* switches the harness gives the agents proxy, read into the profile agents-catalog.ts lists tools for.

/** Which tools a conversation is shown, the same on every one of its turns. Presentation only: the server still
 * 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.
   * Absent means off. */
  xResearch?: boolean;
  /** As xResearch, and research works for that credential (the person's treg key, or a plan whose relay has research
   * on): research_search, research_endpoint and research_call are mounted too. Absent means off. */
  research?: boolean;
  cloudHome: boolean;
  memoryEnabled?: boolean;
  /** The section's Chief of Staff; the server refuses Chief-only tools to every other bot. */
  chief: boolean;
  /** Only for Watcher's own tool. Never written into a schema: a list that names its bot can't share a prompt cache with other bots. */
  botId: string;
  /** A Team Cloud: message_person is mounted. */
  team?: boolean;
  /** A Team Cloud with its board on: board_add, board_list and board_update are mounted. Absent means off. */
  board?: boolean;
  /** The person's MausBot with a Chief's powers: its notification tools are mounted. */
  mausbot?: boolean;
  /** A direct chat whose bot may pick where it works (Works on is not Off and no team computer is its own): select_computer
   * is mounted, and the harness refuses a pick on any turn but a person's own message. */
  computerSelection?: boolean;
  /** This server can give a bot a Local VM: a supported container runtime is installed on the host.
   * Absent means it can. */
  localVm?: boolean;
  /** A room's thread: the wait tools are not mounted, since a room holds no wait. */
  room?: boolean;
  imageGeneration?: boolean;
  /** A cloud computer can be had here (Boat): the meeting tools and reset_cloud_computer are mounted. */
  meetings?: boolean;
  /** The plan's included app hosting reaches this server: publish_app is mounted. */
  appHosting?: boolean;
  /** The tool groups this bot's person turned off: none of their tools is mounted. */
  toolsOff?: readonly ToolGroup[];
}

/** Everything is off unless the harness says "1". */
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",
    research: env.OMB_RESEARCH === "1",
    cloudHome: env.OMB_CLOUD_HOME === "1",
    memoryEnabled: env.OMB_MEMORY_ENABLED !== "0",
    chief: env.OMB_CHIEF_OF_STAFF === "1",
    botId: env.OMB_BOT_ID ?? "",
    team: env.OMB_TEAM_PEOPLE === "1",
    board: env.OMB_TEAM_BOARD === "1",
    mausbot: env.OMB_MAUSBOT === "1",
    computerSelection: env.OMB_COMPUTER_SELECTION === "1",
    localVm: env.OMB_LOCAL_VM !== "0",
    room: env.OMB_ROOM === "1",
    imageGeneration: env.OMB_IMAGE_GENERATION === "1",
    meetings: env.OMB_MEETINGS === "1",
    appHosting: env.OMB_APP_HOSTING === "1",
    toolsOff: toolsOffFromEnv(env.OMB_TOOLS_OFF),
  };
}