/** * CleoOS agent monitor — agent activity TUI + Circle of Eleven status. * * CANONICAL LOCATION: `packages/cleo-os/extensions/cleo-agent-monitor.ts` * * Installed to: $XDG_DATA_HOME/cleo/extensions/cleo-agent-monitor.js * Loaded by: Pi via `--extension ` injected by CleoOS cli.ts * * T442 deliverables: * - `/cleo:agents` command: shows current agent activity in a TUI panel * - `before_agent_start` hook: tracks agent spawns with tier-aware prefixes * - `/cleo:circle` command: renders Circle of Eleven status from CLEO CLI data * * Requirements: * - Pi coding agent runtime (`@mariozechner/pi-coding-agent`) * - Optional: `cleo` CLI on PATH for `/cleo:circle` data * * Guardrails: * - Best-effort: if `cleo` CLI is not available, `/cleo:circle` shows * static fallback data. NEVER crash Pi. * - NO top-level await; all work happens inside event handlers. * * @packageDocumentation */ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent"; /** Tier role of an agent in the 3-tier hierarchy. */ type AgentTierRole = "orchestrator" | "lead" | "worker"; /** A tracked agent activity entry. */ interface AgentActivity { /** ISO-8601 timestamp of the activity. */ timestamp: string; /** Agent name. */ name: string; /** Agent tier role. */ role: AgentTierRole; /** Activity description (e.g. "spawned", "completed"). */ action: string; } /** * Return the tier prefix for an agent role. * * Uses design system colors: * - `[O]` orchestrator — accent-success (#22c55e) * - `[L]` lead — accent-warning (#f59e0b) * - `[W]` worker — tier-worker blue (#5fafff) * * @param role - The agent's tier role. * @returns The styled tier prefix string. */ export declare function tierPrefix(role: AgentTierRole): string; /** * Format a single agent activity for TUI display. * * @param activity - The activity to format. * @returns A formatted single-line string with ANSI styling. */ export declare function formatActivity(activity: AgentActivity): string; /** * Parsed dashboard data from `cleo dash --json`. * * Each field is optional because the CLI output format may vary or the * CLI may not be available. Fields are sourced from the `data` envelope * of `cleo dash --json` output. */ interface DashData { /** Number of active tasks (summary.active). */ activeTasks?: number; /** Number of pending tasks (summary.pending). */ pendingTasks?: number; /** Number of completed tasks (summary.done). */ doneTasks?: number; /** Total tasks across all statuses. */ totalTasks?: number; /** Number of blocked tasks (blockedTasks.count). */ blockedTasks?: number; /** Number of high-priority tasks (highPriority.count). */ highPriorityTasks?: number; /** Top labels from the project (topLabels[].label). */ topLabels?: string[]; } /** * Parsed session data from `cleo session status --json`. * * Each field is optional; the CLI may not be available or the * response format may vary. */ interface SessionData { /** Whether a session is currently active. */ hasActiveSession?: boolean; /** Active session ID. */ sessionId?: string; /** Active session name. */ sessionName?: string; /** Number of tasks completed in the current session. */ tasksCompleted?: number; /** Number of focus changes in the current session. */ focusChanges?: number; } /** * Combined data for Circle of Eleven rendering. * * Merges dashboard data, session data, and any in-memory * extension state (e.g. CANT bundle counts from the bridge). */ interface CircleData { dash: DashData; session: SessionData; /** Number of tools from the CANT bundle (populated by bridge). */ cantTools?: number; /** Number of agents from the CANT bundle (populated by bridge). */ cantAgents?: number; } /** * Build the Circle of Eleven status display lines. * * Each Circle aspect is shown with a filled (active) or hollow (inactive) * dot and a brief status summary. Data is wired from live CLI sources * where available, with explicit "not wired" labels where the data * source does not yet exist. * * Design system colors: * - Filled dot: accent-success (#22c55e) for active zones * - Warning dot: accent-warning (#f59e0b) for zones with alerts * - Error dot: accent-error (#ef4444) for blocked/failed zones * - Hollow dot: text-secondary (#94a3b8) for inactive/offline zones * * @param data - Combined Circle data from CLI sources and extension state. * @returns Array of ANSI-styled lines for TUI display. */ export declare function buildCircleOfTenStatus(data: CircleData): string[]; /** * Pi extension factory for the CleoOS agent monitor. * * Registers agent activity tracking, the `/cleo:agents` command, and the * `/cleo:circle` Circle of Eleven status command. * * @param pi - The Pi extension API instance. */ export default function (pi: ExtensionAPI): void; export {}; //# sourceMappingURL=cleo-agent-monitor.d.ts.map