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.

718 B
Raw Blame
export type McpOauthMode = 'direct' | 'paste';

export type McpAddOauthAction =
  | { kind: 'assign'; name: string }
  | { kind: 'list'; names: string[] }
  | { kind: 'none' };

/** After a successful add, decide same-tab start vs a result list of login links. */
export function mcpAddOauthAction(input: {
  names: string[];
  failedCount: number;
  oauthMode: McpOauthMode;
  desktopShell: boolean;
}): McpAddOauthAction {
  const names = input.names.filter(Boolean);
  if (names.length === 0) return { kind: 'none' };
  if (names.length === 1 && input.failedCount === 0 && input.oauthMode === 'direct' && !input.desktopShell) {
    return { kind: 'assign', name: names[0] };
  }
  return { kind: 'list', names };
}