UNPKG

@phren/cli

Version:

Knowledge layer for AI agents - CLI, MCP server, and data layer

40 lines (39 loc) • 2.02 kB
/** What this computer can take right now. */ export interface Pressure { totalBytes: number; availableBytes?: number; load1: number; cores: number; } /** * The per-machine budget for agent work. Measured on a 31 GB Linux box * (2026-11-15): a worker with its full vitest run takes 2 to 8 GB and an app * stack 0.6 to 1 GB, so about one worker per 7 GB and one heavy job (a full * test run, a native build) per 12 GB keep it out of swap. */ export interface Budget { /** Agent workers started through `phren fanout run` at once. */ workers: number; /** Jobs run through `phren heavy` at once. */ heavySlots: number; /** Below this much available memory nothing new starts while another holds a slot. */ minFreeBytes: number; /** Above this one-minute load per core nothing new starts while another holds a slot. */ maxLoadPerCore: number; } export declare const budgetKeys: { readonly workers: "PHREN_FANOUT_WORKERS"; readonly heavySlots: "PHREN_HEAVY_SLOTS"; readonly minFreeGB: "PHREN_MIN_FREE_GB"; readonly maxLoadPerCore: "PHREN_MAX_LOAD_PER_CORE"; }; /** `$XDG_CONFIG_HOME/phren/budget.yaml`: this computer's own budget, never synced with the store. */ export declare function budgetFile(env?: NodeJS.ProcessEnv): string; export declare function defaultBudget(totalBytes: number): Budget; /** Defaults from the memory size, then budget.yaml, then the environment. Invalid values are ignored. */ export declare function readBudget(totalBytes: number, env?: NodeJS.ProcessEnv, file?: string): Budget; /** Memory comes from the resources gauge's reader (bridge/resources.ts), so the budget and the Hook's gauge agree. */ export declare function readPressure(platform?: NodeJS.Platform): Promise<Pressure>; /** Why nothing new should start now, or undefined when the computer has room. */ export declare function pressureReason(pressure: Pressure, budget: Budget): string | undefined; export declare function describePressure(pressure: Pressure): string;