export declare const AGENT_MESSAGE_TYPE = "pi-roost-agent-message"; export declare const MESSAGE_MAX = 8000; export declare const RESULT_MAX = 6000; /** Agent items waiting for one job (user replies have their own cap). */ export declare const MAX_PENDING_AGENT = 20; export declare const MESSAGES_PER_MINUTE = 30; /** M43: the same text to the same session again within this window is dropped (two sessions repeating themselves stop). */ export declare const DUPLICATE_WINDOW_MS = 60000; export declare const SPAWNS_PER_MINUTE = 10; /** M43: a watch (notify me when it is idle / ended) that never fires expires after this. */ export declare const WATCH_TTL_MS: number; /** M43: watches one session may hold at a time. */ export declare const MAX_WATCHES = 20; export type Relation = "parent" | "child" | "sibling" | "tree" | "external"; /** message: roost_send; report: a child's hand-back; notice (M43): a watch fired; digest (M44): the concierge's wake. */ export type AgentKind = "message" | "report" | "notice" | "digest"; export declare const isAgentKind: (k: unknown) => k is AgentKind; /** Where a session sits in a spawn tree (keys are session files, or `peer:` without one). */ export interface TreeNode { key: string; parent: string | null; root: string; } export declare function relationOf(from: TreeNode, to: TreeNode): Relation; /** A name for an envelope attribute: no quotes, angle brackets or control characters. */ export declare function sanitizeName(name: string): string; /** The body may not open or close an envelope of its own. */ export declare function neutralize(body: string): string; export interface EnvelopeInput { from: string; id: string; relation: Relation; kind: AgentKind; body: string; } export declare function envelope(m: EnvelopeInput): string; /** A child's report to its parent, as the envelope body. */ export declare function reportBody(r: { state: string; result?: string | null; question?: string | null; error?: string | null; }): string; /** M43: what a watch says when it fires, as the envelope body. */ export declare function noticeBody(n: { when: "idle" | "ended"; state: string; waitingFor?: string | null; question?: string | null; summary?: string | null; error?: string | null; }): string; export declare function clipEnd(text: string, max: number): string; /** At most `limit` events per window per key. */ export declare class RateLimiter { private hits; private limit; private windowMs; private now; constructor(limit: number, windowMs?: number, now?: () => number); take(key: string): boolean; } /** A foreground peer's id: stable for a session file, random without one. */ export declare function foregroundPeerId(session: string | undefined, hash: (s: string) => string, random: () => string): string;