UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

75 lines 3.41 kB
/** * AGENTS.md size validation and auto-split (PUW-029 / #1130). * * Per ADR-1 §6: when AGENTS.md content exceeds the 30KB warn threshold or * Codex's 32KB hard cap, auto-split moves entries to the spillover block in * AGENTS.override.md. The cap (32KB) comes from `codex-rs/config_toml.rs:68`. * AGENTS.override.md takes precedence at load time (`agents_md.rs:65`). * * Priority semantics: * - 1 (high): pinned to AGENTS.md; never moves to spillover * - 2 (medium): default; moves second * - 3 (low): moves first * - safety-critical: always pinned to priority 1, regardless of manifest * * If priority-1 alone exceeds 32KB, that is a hard error (per ADR-1 §6 — * operator must split the framework, not silently lose safeguards). */ import type { AgentsMdSection, IndexEntry } from './types.js'; export declare const SOFT_WARN_BYTES: number; export declare const HARD_ERROR_BYTES: number; export declare const SPILLOVER_START = "<!-- spillover-from-AGENTS.md:START -->"; export declare const SPILLOVER_END = "<!-- spillover-from-AGENTS.md:END -->"; /** * Operator-declared priority map keyed by artifact id. * * Special key `*` is the default for any id not explicitly listed. * Values are 1 (high; pinned), 2 (medium; default), 3 (low; first to overflow). * Per ADR-1 §6 the canonical home for this is each framework/addon's * `manifest.json:overflow_priority`. Callers merge maps from all installed * manifests when assembling the AGENTS.md content. */ export type OverflowPriorityMap = Record<string, 1 | 2 | 3>; /** * Errors emitted when the safety-critical floor cannot fit. * * Thrown rather than silently truncating safeguards. Operator must break * the framework into smaller bundles. */ export declare class SafetyCriticalOverflowError extends Error { readonly bytes: number; constructor(bytes: number); } /** * Partition all sections into "in main" vs "in spillover" entry lists, * preserving safety-critical pinning and respecting the priority map. * * Strategy: each section is split independently using a per-section budget * proportional to the total budget. This is intentionally conservative — * we'd rather overflow a few low-priority entries from each section than * preferentially overflow one whole section. * * Throws SafetyCriticalOverflowError when priority-1 alone exceeds the * hard cap. Otherwise returns the partition. */ export declare function partitionForOverflow(sections: AgentsMdSection[], priorityMap: OverflowPriorityMap, totalBudgetBytes?: number, estimateEntry?: (entry: IndexEntry) => number): { mainSections: AgentsMdSection[]; spilloverSections: AgentsMdSection[]; estimatedMainBytes: number; estimatedSpilloverBytes: number; splitOccurred: boolean; }; /** * Inject or update the spillover block within an existing AGENTS.override.md * content string. Operator-authored content (everything outside the spillover * markers) is preserved byte-for-byte. * * Returns the updated content. The caller writes this back to disk. */ export declare function injectSpilloverBlock(existingContent: string, spilloverMarkdown: string): string; /** * Extract the operator-authored portion of AGENTS.override.md (everything * outside the spillover block). Used for hash-protection diffs. */ export declare function extractNonSpillover(content: string): string; //# sourceMappingURL=overflow.d.ts.map