Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:777genius Agent teams ai CliInstallerService getStatus

From Leeroopedia
Knowledge Sources
Domains Runtime_Detection, Provider_Management
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete tool for detecting and reporting CLI runtime installation and authentication status across Claude, Codex, and OpenCode, provided by the Agent Teams application.

Description

The CliInstallerService.getStatus() method gathers installation and authentication status for all CLI providers. It creates an initial status snapshot, runs concurrent status gathering with an overall timeout, projects the result through `projectStatusAuthority()` for authoritative authentication state, and schedules a diagnostic NDJSON log write.

Key behaviors:

  • Timeout-bounded gathering: `Promise.race()` between `gatherStatus()` and a timeout; on timeout, returns partial results gathered so far.
  • Authority projection: Raw results are passed through `projectStatusAuthority()` to derive authoritative `authLoggedIn`, `authMethod`, and per-provider `teamLaunch` capability.
  • Diagnostic logging: Each `getStatus()` call appends one NDJSON line to `claude-cli-auth-diag.ndjson` (capped at 512 KiB, truncated before next append).
  • Generation tracking: A `statusGatherGeneration` counter prevents stale in-flight gathering from overwriting newer results.
  • IPC deduplication: The `cliInstaller:getStatus` IPC handler deduplicates calls with a 5-second TTL.

Usage

  • UI status refresh: Call `getStatus()` on app launch and periodically to update the provider onboarding UI.
  • Pre-launch check: Call `getStatus({ providerStatusMode: 'passive' })` for a lightweight check before attempting a team launch.
  • Install decision: Use the returned `CliInstallationStatus` to determine whether a provider binary needs installation.

Code Reference

Source Location

  • Repository: agent-teams
  • File: src/main/services/infrastructure/CliInstallerService.ts

Signature

export interface CliInstallerGetStatusOptions {
  providerStatusMode?: 'full' | 'passive';
}

export class CliInstallerService {
  async getStatus(
    options?: CliInstallerGetStatusOptions
  ): Promise<CliInstallationStatus>;

  async getProviderStatus(
    providerId: CliProviderId,
    options?: CliProviderStatusRequestOptions
  ): Promise<CliProviderStatus>;

  async install(): Promise<void>;
}

Import

import { CliInstallerService } from '@main/services/infrastructure/CliInstallerService';

I/O Contract

Inputs

Name Type Required Description
options.providerStatusMode 'passive' No (default 'full') 'full' gathers all provider status; 'passive' does a lighter check

Outputs

Name Type Description
return Promise<CliInstallationStatus> Aggregated status for all providers
CliInstallationStatus.providers CliProviderStatus[] Per-provider status (Claude, Codex, OpenCode)
CliInstallationStatus.authLoggedIn boolean Whether any frontend provider is authenticated
CliInstallationStatus.authMethod null Authentication method of the selected frontend provider
CliProviderStatus.authenticated boolean Whether this provider is authenticated
CliProviderStatus.capabilities.teamLaunch boolean Whether this provider can launch teams

Usage Examples

Full Status Check

import { CliInstallerService } from '@main/services/infrastructure/CliInstallerService';

const service = new CliInstallerService();

const status = await service.getStatus();
for (const provider of status.providers) {
  console.log(
    `${provider.providerId}: installed=${provider.installed}, ` +
    `authenticated=${provider.authenticated}, ` +
    `teamLaunch=${provider.capabilities.teamLaunch}`
  );
}

Passive Check Before Launch

// Lightweight check — does not trigger heavy provider probing
const status = await service.getStatus({ providerStatusMode: 'passive' });

const claude = status.providers.find((p) => p.providerId === 'claude');
if (!claude?.authenticated) {
  throw new Error('Claude CLI is not authenticated');
}

Installing a Missing Binary

// If getStatus reports a provider as not installed, install it
if (!status.providers.find((p) => p.providerId === 'opencode')?.installed) {
  await service.install();
  // Re-check status after installation
  const updated = await service.getStatus();
}

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment