Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

729 B
Raw Blame
import { selectOpenBotInboxItems, type BotInboxItem } from "@akeru/client-runtime/bot-inbox";

export type SettingsInboxQuery = {
  readonly error: string | null;
  readonly data: ReadonlyArray<BotInboxItem> | null;
};

export type SettingsInboxView =
  | { readonly kind: "error"; readonly message: string }
  | { readonly kind: "loading" }
  | { readonly kind: "ready"; readonly items: ReadonlyArray<BotInboxItem> };

export function settingsInboxView(query: SettingsInboxQuery): SettingsInboxView {
  if (query.error !== null) {
    return { kind: "error", message: query.error };
  }

  if (query.data === null) {
    return { kind: "loading" };
  }

  return { kind: "ready", items: selectOpenBotInboxItems(query.data) };
}