Skip to content

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

2.2 KB
Raw Blame
// Pure identifiers and wire types for app_settings without zod schemas, so light boot entries can read SKIN_IDS / FONT_IDS
// without bundling zod.

export type SettingTier = "safe" | "secret" | "owner-only";

/** On a card: display values only, never a key. */
export interface AppSettingRequest {
  settingId: string;
  label: string;
  before?: string;
  after: string;
  tier: SettingTier;
}
export interface AppSettingCardField {
  /** A bot's change to one of the app's own settings, applied with Undo. */
  appSettingRequest?: AppSettingRequest;
}

/** Settings a bot can ask the app to show in chat as the real control. Adding one here, in the server's SETTINGS_CARDS
 * and in the window's card list is the whole registration. */
export const SETTINGS_CARD_IDS = ["other-computers", "ai-sign-in"] as const;
export type SettingsCardId = (typeof SETTINGS_CARD_IDS)[number];
export const isSettingsCardId = (id: unknown): id is SettingsCardId =>
  typeof id === "string" && (SETTINGS_CARD_IDS as readonly string[]).includes(id);

/** Security invariant: a settings card row names the setting only. What the control shows (a code, a link, an address)
 * is read by the window from the app itself and is never stored on the row or sent to a bot. */
export interface SettingsCardData {
  id: SettingsCardId;
}

export const SKIN_IDS = [
  "midnight",
  "atelier",
  "foundry",
  "lagoon",
  "graphite",
  "linen",
  "dusk",
  "daylight",
  "meadow",
  "pop",
  "halloween",
  "diwali",
  "aurora",
] as const;
export const FONT_IDS = ["skin", "system", "inter", "poppins", "serif"] as const;
export const CHAT_WIDTH_IDS = ["standard", "wide", "full"] as const;
/** The Enter-adds-a-line modes are for input methods that confirm a conversion with Enter (Japanese). */
export const SEND_KEYS = ["enter", "shift-enter", "mod-enter"] as const;
export const PLACE_SWATCHES = ["blue", "green", "amber", "rose", "violet", "slate"] as const;
export const TALK_KEYS = ["ctrl-opt-space", "ctrl-shift-space", "opt-shift-space"] as const;
/** The composer's end buttons, by name, in the order Advanced mode may draw them; today's order is the default. */
export const COMPOSER_BUTTONS = ["stop", "context", "mic", "call", "send"] as const;
export const USAGE_INDICATORS = ["bars", "ring"] as const;