import { type Config, type Prompts } from "acp-kernel"; /** Delegate sub-agent configuration. */ export interface DelegateConfig { /** Enable acp_delegate tools (delegate/wait/cancel) and their system-prompt * section. Default: true. Set `enabled: false` to skip registering them. */ enabled?: boolean; /** How delegate usage is reported back to the main session. * "separate" (default) — delegate tokens tracked in a separate accumulator; * main session totals stay clean, delegate usage shows as its own block in * acp_status (excluded from main totals). * "merged" — delegate token usage folded into the tool-result usage field, * counted as part of the main session totals. */ displayUsage?: "merged" | "separate"; } /** Fold-state persistence (issue #130): checkpoint the live fold slot to * disk so a restarted session restores its compression blocks without * waiting for the first provider request to refold the wire. */ export interface FoldPersistenceConfig { /** Default: enabled. `false` keeps the fold memory-only — restart falls * back to the primeFold mirror. */ enabled?: boolean; /** Directory for fold checkpoints. Default `~/.omp/acp-omp-folds/` * (env `ACP_OMP_FOLD_DIR` overrides). */ dir?: string; } /** Compression tuning. All fields accept a ratio (0.75) or percent string * ("75%") where noted. */ export interface CompressConfig { maxContextLimit?: number | string; emergencyThresholdPercent?: number | string; nudgeGrowthTokens?: number; /** Model for /compact summaries, as "provider:modelId" (e.g. * "zhipuai:glm-5.2"). Omit to use the current session model. */ compressModel?: string; } /** * Adapter configuration. Maps onto acp-kernel's `Config` plus Pi-specific knobs * (live model context window, protected tools, state persistence). */ export interface AdapterConfig { /** When omitted, the adapter reads `ctx.model.contextWindow` live each turn. * Set explicitly for tests/headless runs. */ modelContextLimit?: number; protectedTools?: string[]; preserveRecentMessages?: number; /** Check npm for a newer billion-context-omp on startup and auto-install it. Default: true. * Disable via `autoUpdate: false` or env `ACP_AUTO_UPDATE=0` to avoid all * network calls on startup. */ autoUpdate?: boolean; /** Enable debug-level events in the ACP log file (default ~/.omp/acp-omp.log). * Always-on events (session/turn/compress/delegate lifecycle, all errors and * warnings) are written regardless; `debug` only adds verbose diagnostics. * Default: false (or env ACP_DEBUG=1/true). */ debug?: boolean; /** Default timeout in seconds injected into the bash tool when the model * omits `timeout`. Pi has NO built-in default, so without this a command * that the model forgets to time out can hang for thousands of seconds. * Default: 60 (catches hangs quickly). On timeout the model is guided to * re-run with a larger `timeout`. Set to 0 to disable (restore Pi's * unbounded behavior). */ toolBashDefaultTimeout?: number; /** Hard byte cap applied to tool result text via the `tool_result` hook. * Default: 200000 (~200KB, roughly 5000 lines at ~40 bytes/line) — a * generous ceiling that stops runaway output. Pi already caps bash/read/grep * at 50KB/2000 lines (bash full output is saved to a temp file), so this * default mainly caps tools Pi doesn't cap. Set lower (e.g. 8192) for a * tighter context budget, or 0 to disable. When capped, oversized text is * head-truncated with a notice telling the model how to see the full output * (bash: read BashToolDetails.fullOutputPath). */ toolOutputMaxBytes?: number; /** Delegate sub-agent config. Accepts a boolean shorthand (`true` * `{ enabled: true }`, `false` → `{ enabled: false }`) or a DelegateConfig * object. Default: enabled. */ delegate?: boolean | DelegateConfig; /** Fold-state persistence (issue #130). Accepts a boolean shorthand (`true` * → `{ enabled: true }`, `false` → `{ enabled: false }`) or a * FoldPersistenceConfig object. Default: enabled. */ foldPersistence?: boolean | FoldPersistenceConfig; /** Compression tuning. */ compress?: CompressConfig; /** Legacy flat alias for `delegate.displayUsage`. Kept for backward * compatibility with existing acp-omp.json files. Prefer `delegate.displayUsage`. */ displayUsage?: "merged" | "separate"; /** Override acp-kernel's load-bearing compression prompt rules (the 4 * Prompts fields). Each set field replaces the kernel default verbatim. * Requires acknowledgePromptsRisk: true — without it, overrides are dropped * (defaults used) and a warning is logged. Set via ~/.omp/acp-omp.json. */ prompts?: Partial; /** Must be true for `prompts` overrides to take effect. Acknowledges that * replacing the kernel's tuned compression rules may reduce summary quality * (lost paths/signatures/decisions → worse retrieval). */ acknowledgePromptsRisk?: boolean; coreOverrides?: Partial; } export declare const DEFAULT_TOOL_BASH_TIMEOUT = 60; export declare const DEFAULT_TOOL_OUTPUT_MAX_BYTES = 200000; /** Resolve delegate config from the adapter, handling the boolean shorthand * and the legacy flat `displayUsage` alias. * * Forward-compatible: not yet wired (AGENTS.md §7 — delegates deferred). * Retained so future wiring can consume it without re-deriving the logic. */ export declare function resolveDelegate(adapter: AdapterConfig): { enabled: boolean; displayUsage: "merged" | "separate"; }; /** Resolve fold persistence config from the adapter, handling the boolean * shorthand. */ export declare function resolveFoldPersistence(adapter: AdapterConfig): { enabled: boolean; dir?: string; }; export declare function resolveConfig(adapter: AdapterConfig, liveContextLimit: number): Config; export declare function parsePercent(v: number | string): number;