/** * CleoOS branded startup extension. * * CANONICAL LOCATION: `packages/cleo-os/extensions/cleo-startup.ts` * * Installed to: $XDG_DATA_HOME/cleo/extensions/cleo-startup.js * Loaded by: Pi via `--extension ` injected by CleoOS cli.ts * * On `session_start`, displays a branded CleoOS welcome panel with: * - Project name and CLEO task summary (pending / active / done) * - Current focused task (if any) * - Last session handoff note from the memory bridge * * All data is fetched via the `cleo` CLI (best-effort). If any call * fails, the banner degrades gracefully — Pi is never crashed. * * Design system: * - accentPrimary (purple #a855f7) — banner chrome, icons * - accentSuccess (green #22c55e) — active counts * - accentWarning (amber #f59e0b) — pending counts, handoff note * - textSecondary (gray #94a3b8) — body text, labels * - bold — headings, task title * - Box-drawing constants from tui-theme for Forge aesthetic * * Guardrails: * - Best-effort: all CLEO CLI calls wrapped in try/catch * - NO top-level await; all work inside event handlers * - NEVER modify system prompt (startup display only) * - NEVER crash Pi * * @packageDocumentation */ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent"; /** * Task summary counts parsed from `cleo dash --json`. */ interface TaskSummary { /** Number of active (in-progress) tasks. */ active: number; /** Number of pending tasks. */ pending: number; /** Number of completed tasks. */ done: number; /** Total task count. */ total: number; /** Number of blocked tasks. */ blocked: number; } /** * Current session data parsed from `cleo session status --json`. */ interface SessionInfo { /** Whether a session is currently active. */ active: boolean; /** Session ID (short form). */ id: string; /** Session display name. */ name: string; /** ID of the focused task, or null. */ currentTaskId: string | null; /** Handoff note from the previous session end, or null. */ handoffNote: string | null; } /** * Current task info parsed from `cleo current --json`. */ interface CurrentTask { /** Task ID. */ id: string; /** Task title. */ title: string; /** Task status. */ status: string; } /** * Parse task summary from `cleo dash --json` output. * * @param stdout - Raw stdout from the CLI call. * @returns Parsed task summary, defaulting all counts to 0 on failure. */ export declare function parseDashSummary(stdout: string): TaskSummary; /** * Parse session info from `cleo session status --json` output. * * Extracts active state, session ID/name, current task, and the last * handoff note left at session end. * * @param stdout - Raw stdout from the CLI call. * @returns Parsed session info. */ export declare function parseSessionInfo(stdout: string): SessionInfo; /** * Parse current task info from `cleo current --json` output. * * @param stdout - Raw stdout from the CLI call. * @returns Parsed current task, or null if none active. */ export declare function parseCurrentTask(stdout: string): CurrentTask | null; /** * Read the last session handoff note from `.cleo/memory-bridge.md`. * * Falls back to null if the file does not exist or parsing fails. * Prefers the `## Last Session` section's `Note:` line. * * @param projectDir - The project root directory. * @returns The last session note, or null. */ export declare function readMemoryBridgeNote(projectDir: string): string | null; /** * Build the full CleoOS startup banner. * * Renders a box-drawing widget with: * - Branded header with forge icon * - Task counts (active / pending / done / blocked) * - Current task title (if any) * - Session info (name + ID) * - Last session handoff note (from memory-bridge.md or session data) * * @param tasks - Task summary counts. * @param session - Current session state. * @param currentTask - Currently focused task, or null. * @param handoffNote - Last session handoff note, or null. * @param projectName - Project display name. * @returns Array of ANSI-styled banner lines. */ export declare function buildStartupBanner(tasks: TaskSummary, session: SessionInfo, currentTask: CurrentTask | null, handoffNote: string | null, projectName: string): string[]; /** * Detect the project name for display in the startup banner. * * Resolution order: * 1. `name` field from the committed `.cleo/project.json` (T12716) * 2. `name` field from `.cleo/project-info.json` (legacy, pre-migration) * 3. `name` field from `package.json` in `projectDir` * 4. Last path segment of `projectDir` * * @param projectDir - The project root directory. * @returns The resolved project display name. */ export declare function detectProjectName(projectDir: string): string; /** * Pi extension factory for the CleoOS branded startup experience. * * Registers a `session_start` handler that: * 1. Fetches project, task, and session data via `cleo` CLI in parallel * 2. Reads the memory-bridge.md handoff note * 3. Renders the branded startup banner as a Pi UI widget * * All operations are best-effort — failures are silently swallowed so Pi * is never blocked by CLEO unavailability. * * @param pi - The Pi extension API instance. */ export default function (pi: ExtensionAPI): void; export {}; //# sourceMappingURL=cleo-startup.d.ts.map