Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

1.0 KB
Raw Blame
// Browser tab title: "Avibe - <name>", where <name> is the configured
// ``ui.instance_name`` or, when blank, the server-computed default instance
// name. Older servers may only provide system_hostname. Falls back to plain
// "Avibe" when neither is available.
const BASE_TITLE = 'Avibe';

export function computeAppTitle(config: unknown): string {
  const ui = (config as { ui?: Record<string, unknown> } | null | undefined)?.ui ?? {};
  const configured = typeof ui.instance_name === 'string' ? ui.instance_name.trim() : '';
  const defaultName = typeof ui.default_instance_name === 'string' ? ui.default_instance_name.trim() : '';
  const hostname = typeof ui.system_hostname === 'string' ? ui.system_hostname.trim() : '';
  const name = configured || defaultName || hostname;
  return name ? `${BASE_TITLE} - ${name}` : BASE_TITLE;
}

export function applyAppTitle(config: unknown): void {
  try {
    document.title = computeAppTitle(config);
  } catch {
    // document may be unavailable in non-DOM contexts (SSR/tests); ignore.
  }
}