Implementation:777genius Agent teams ai projectProviderAuthority
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Authentication, Provider_Management |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Concrete tool for projecting raw CLI provider status into authoritative authentication state, provided by the Agent Teams application.
Description
The projectProviderAuthority() function takes a raw `CliProviderStatus` and projects it into an authoritative state. It sanitizes the status, checks model catalog freshness, derives the `teamLaunch` capability from multiple conditions, and marks stale catalogs.
Key behaviors:
- Sanitization: `sanitizeProviderStatusAuthority()` clones and cleans the provider status.
- Catalog freshness: `isProviderModelCatalogExactReady()` checks if the model catalog is fresh; stale catalogs are marked with `status: 'stale'` and `modelCatalogRefreshState: 'error'`.
- Team launch derivation: `teamLaunch` is true only when the provider has authoritative evidence, is authenticated, has `teamLaunch` capability, and has a fresh catalog.
- Aggregate projection: `projectStatusAuthority()` applies per-provider projection and then derives `authLoggedIn` and `authMethod` from the authenticated frontend provider.
Usage
- Status post-processing: Called by `CliInstallerService.getStatus()` after raw gathering to produce the authoritative status.
- UI gating: The UI uses the projected `teamLaunch` capability to enable/disable team launch buttons.
Code Reference
Source Location
- Repository: agent-teams
- File: src/main/services/infrastructure/cliInstallerStatusAuthority.ts
Signature
export function projectProviderAuthority(
provider: CliProviderStatus,
now: number
): CliProviderStatus;
export function projectStatusAuthority(
status: CliInstallationStatus,
now: number,
cloneStatus: CloneInstallationStatus
): CliInstallationStatus;
export function filterFrontendProviders(
providers: CliProviderStatus[]
): CliProviderStatus[];
Import
import { projectProviderAuthority, projectStatusAuthority } from '@main/services/infrastructure/cliInstallerStatusAuthority';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| provider | CliProviderStatus | Yes | Raw provider status from getStatus |
| now | number | Yes | Current timestamp for freshness check |
Outputs
| Name | Type | Description |
|---|---|---|
| return | CliProviderStatus | Projected provider with authoritative teamLaunch capability |
| return.capabilities.teamLaunch | boolean | True if provider can launch teams |
| return.modelCatalog.status | string | 'stale' if catalog is not fresh |
Usage Examples
Projecting a Single Provider
import { projectProviderAuthority } from '@main/services/infrastructure/cliInstallerStatusAuthority';
const projected = projectProviderAuthority(rawClaudeStatus, Date.now());
console.log(`Team launch: ${projected.capabilities.teamLaunch}`);
console.log(`Catalog: ${projected.modelCatalog?.status ?? 'none'}`);
Projecting Full Installation Status
import { projectStatusAuthority } from '@main/services/infrastructure/cliInstallerStatusAuthority';
const authoritative = projectStatusAuthority(
rawStatus,
Date.now(),
(s) => structuredClone(s)
);
console.log(`Auth logged in: ${authoritative.authLoggedIn}`);
console.log(`Auth method: ${authoritative.authMethod}`);
for (const provider of authoritative.providers) {
console.log(` ${provider.providerId}: teamLaunch=${provider.capabilities.teamLaunch}`);
}
Related Pages
Implements Principle
- Principle:777genius_Agent_teams_ai_CLI_Runtime_Detection
- Principle:777genius_Agent_teams_ai_Provider_Authentication_Authority
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment