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.1 KB
Raw Blame
import { showPageEmbeddedPath, showPagePrivatePath } from '../../apps/showPageAvatar';

export type ShowPageWindowStatus = 'loading' | 'ready' | 'missing';

/** Apply a silent session read without withdrawing a working frame on transient errors. */
export function showPageWindowStatusAfterRead(
  current: ShowPageWindowStatus,
  result: { status: number | null; session: unknown },
): ShowPageWindowStatus {
  if (result.status === 404) return 'missing';
  const session = result.session;
  if (!session || typeof session !== 'object' || typeof (session as { id?: unknown }).id !== 'string') {
    return current === 'ready' ? 'ready' : 'missing';
  }
  return (session as { status?: unknown }).status === 'archived' ? 'missing' : 'ready';
}

/** The framed page and its parent-owned controls share one lifecycle source. */
export function showPageWindowSource(
  sessionId: string,
  status: ShowPageWindowStatus,
  archived: boolean,
): string | null {
  if (!sessionId || status === 'missing' || archived) return null;
  return showPageEmbeddedPath(showPagePrivatePath(sessionId));
}