import { type AccountMcp } from "./account-mcp.js"; import { AccountStateStore, type AccountIdentity, type AccountKind, type AccountRunner, type AccountState, type AccountUsage, type ResolvedAccount } from "./accounts.js"; import type { Config, RunnerName } from "./config.js"; import type { Secrets } from "./env.js"; import type { Events } from "./events.js"; import type { JobStore } from "./jobs.js"; import { type ReadinessCache, type RunnerReadiness } from "./readiness.js"; import type { Skill } from "./skills.js"; export type AccountStatus = "ready" | "limited" | "expired" | "needs_login" | "missing_secret" | "not_installed" | "disabled" | "unknown"; export interface AccountAttention { level: "fail" | "warn" | "info"; code: "disabled" | "not_installed" | "login_expired" | "not_logged_in" | "missing_secret" | "dir_missing" | "limited" | "usage_high" | "auth_failed" | "duplicate_login" | "unused" | "probe_failed" | "mcp_needs_auth" | "mcp_failed" | "mcp_missing"; message: string; /** The command that fixes it. */ fix?: string; } export interface AccountJobCounts { total: number; succeeded: number; failed: number; usage_limit: number; auth: number; cost_usd: number; } export interface AccountView { name: string; runner: AccountRunner; kind: AccountKind; label?: string; dir: string; default_dir: boolean; managed: boolean; secret_env?: string; disabled: boolean; status: AccountStatus; ready: boolean; detail: string; identity?: AccountIdentity; usage?: AccountUsage; limited_until?: string; limited_reason?: string; last_used_at?: string; last_success_at?: string; last_failure?: AccountState["last_failure"]; /** Jobs that ran on this account in the last 24 hours. */ jobs_24h: AccountJobCounts; /** Skills whose pool names it (directly or through `defaults.accounts`). */ skills: string[]; /** Runners whose `defaults.accounts` names it. */ default_for: RunnerName[]; attention: AccountAttention[]; readiness: RunnerReadiness; /** Its MCP servers, connectors and plugins (only with `mcp`). */ mcp?: AccountMcp; } export interface AccountsReport { accounts: AccountView[]; /** Skills naming accounts that do not exist or do not match their runner. */ problems: { skill: string; message: string; }[]; /** Accounts whose attention has a `fail` or `warn`. */ needs_attention: string[]; generated_at: string; } export interface CollectAccountsInput { config: Config; /** The skillhook directory (`/accounts/` is where managed accounts live). */ home: string; secrets: Secrets; /** The environment the probes start from (`baseRunEnv`). */ baseEnv: Record; skills: Skill[]; store?: Pick; states: AccountStateStore; /** The server's readiness cache, when there is one (shared with the queue's pre-flight). */ readiness?: ReadinessCache; refresh?: boolean; /** Also ask each account's CLI for its identity and usage windows (one process per account) and keep the answer. */ usage?: boolean; /** Also ask each account's CLI which MCP servers, connectors and plugins its runs get, and whether they connect (slow: they all connect). */ mcp?: boolean; /** Only this account. */ only?: string; events?: Events; timeoutMs?: number; } /** What needs a person about one account, most serious first. */ export declare function accountAttention(account: ResolvedAccount, readiness: RunnerReadiness, state: AccountState, config: Config, context: { skills: string[]; defaultFor: RunnerName[]; duplicateOf?: string; now?: number; }): AccountAttention[]; /** * What needs a person about an account's MCP servers: servers that need authentication (their tools are missing from * its runs until someone logs them in as this account), servers that fail to connect, and (info) servers the machine's * own login has that this account lacks (`baseline`: that login's server names; connectors are per account, never compared). */ export declare function mcpAttention(account: Pick, mcp: AccountMcp, baseline?: string[]): AccountAttention[]; /** Every account (or `only`), probed with its own environment, with what runs taught and what needs a person. */ export declare function collectAccounts(input: CollectAccountsInput): Promise; /** "in 2h 5m", "in 3d" — how far away an instant is. */ export declare function untilText(iso: string | undefined, now?: number): string; /** "5h 42% · weekly 80%" for the table. */ export declare function usageText(usage: AccountUsage | undefined): string; /** The nearest reset among the windows that are fullest. */ export declare function nextResetText(usage: AccountUsage | undefined, now?: number): string; export declare const STATUS_TEXT: Record; export declare function describeAccountDir(view: Pick): string;