@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
67 lines • 3.25 kB
TypeScript
import type { Credential } from "@earendil-works/pi-ai";
import { type Component } from "@earendil-works/pi-tui";
import type { AgentSession } from "../../../core/agent-session.ts";
import type { ReadonlyFooterDataProvider } from "../../../core/footer-data-provider.ts";
/**
* Format token counts for footer display using oh-my-pi-style K/M/B abbreviation.
* Examples: "999", "6.8K", "546K", "1M", "1.5M", "2B".
*/
export declare function formatTokens(count: number): string;
/**
* Mirrors the provider-shown-only-when->1 rule for accounts: the active account
* name appears only when the provider actually pools more than one slot. The
* pick shown is the effective pin (CLI > settings > stored, senpi#5983) when
* present, else the first account of the user order (senpi#3591), else the
* session's HRW winner - the same ranking the rotation engine uses, so the
* footer names the slot that will serve. The effective pin only reaches the
* footer for the Anthropic subscription provider (senpi#6222 review); other
* pooled providers keep their stored pin even when a slot shares the pin's
* name. A blocked pin (blockedUntil in the
* future) is skipped for the first usable slot in that ranking, and the
* suffix marks the blocked pin (`@B (A blocked until 14:00)`); when every
* slot is blocked it names the top-ranked slot and marks it blocked instead
* of silently naming a slot that cannot serve. Block state rides on the
* stored slots (SlotBlockState); slots without it are treated as usable.
*/
export type AccountFooterOptions = {
/** Effective pin from CLI/settings, outranking the stored pin (senpi#5983). */
pinnedAccount?: string;
/** Override for "now" (tests); defaults to `Date.now()`. */
now?: number;
};
export declare function accountFooterSuffix(credential: Credential | undefined, sessionId: string, options?: AccountFooterOptions): string;
export declare function formatCwdForFooter(cwd: string, home: string | undefined): string;
/**
* Footer component that shows pwd, token stats, and context usage.
* Computes token/context stats from session, gets git branch and extension statuses from provider.
*/
export declare class FooterComponent implements Component {
private session;
private footerData;
private autoCompactEnabled;
private compactionDelegated;
private resolveAccountPin;
constructor(session: AgentSession, footerData: ReadonlyFooterDataProvider, options?: {
resolveAccountPin?: (sessionId: string) => string | undefined;
});
setSession(session: AgentSession): void;
setAutoCompactEnabled(enabled: boolean): void;
/**
* Marks the context meter while an external owner (the Claude Agent SDK)
* manages compaction natively, so a saturated meter reads as delegated
* rather than stalled.
*/
setCompactionDelegated(delegated: boolean): void;
/**
* No-op: git branch caching now handled by provider.
* Kept for compatibility with existing call sites in interactive-mode.
*/
invalidate(): void;
/**
* Clean up resources.
* Git watcher cleanup now handled by provider.
*/
dispose(): void;
render(width: number): string[];
}
//# sourceMappingURL=footer.d.ts.map