import { type AftConfigFileMigrationResult, type ConfigTier } from "@cortexkit/aft-bridge"; import { z } from "zod"; export type Formatter = "biome" | "oxfmt" | "prettier" | "deno" | "ruff" | "black" | "rustfmt" | "goimports" | "gofmt" | "none"; export type Checker = "tsc" | "tsgo" | "biome" | "pyright" | "ruff" | "cargo" | "go" | "staticcheck" | "none"; /** How configure-time missing-tool warnings are delivered by the Pi plugin. */ export type ConfigureWarningsDelivery = "toast" | "log" | "chat"; export type SemanticBackend = "fastembed" | "openai_compatible" | "ollama" | "synapse"; export interface BridgeConfig { request_timeout_ms?: number; hang_threshold?: number; } export interface SubcConfig { /** * Absolute path to the Subconscious (subc) daemon connection file. PRESENT * (non-empty) ⇒ talk to AFT as a daemon-supervised module over subc; ABSENT ⇒ * standalone NDJSON (default). USER/global-tier ONLY (a project must not * redirect transport). No auto-derive. macOS default: * `~/.local/share/cortexkit/run/subc-connection.json`. */ connection_file?: string; /** User-tier root-reaper switch; project config cannot set or override it. */ client_reaper?: boolean; } export interface GhShimConfig { /** Deprecated alias for github.shim; removed in v0.57.0. */ enabled?: boolean; /** User-tier AFT image used by the managed `gh` entry. Defaults to the running image. */ binary_path?: string; } export interface GithubConfig { /** Master switch for every GitHub integration. Default: true. */ enabled?: boolean; /** Interpose the governed `gh` shim in agent child PATHs. Default: true. */ shim?: boolean; /** Allow structured issue:// and pr:// reads. Default: false. */ read?: boolean; /** Allow issue and pull-request comment writes. Default: false. */ write?: boolean; } export interface GhReadConfig { /** Deprecated alias for github.read; removed in v0.57.0. */ enabled?: boolean; } export interface GitConfig { /** "off" (default), "auto", or an explicit "Name " identity. */ co_author?: string; } export type PiToolPresentation = "top_level" | "host_default"; export interface PiConfig { /** * Tool presentation on Pi and OMP harnesses. * - "top_level": registers tools with `loadMode: "essential"` on OMP so they appear at top level. (default) * - "host_default": leaves tool presentation to host defaults (on OMP, tools mount under xd://). */ tool_presentation?: PiToolPresentation; } export interface IndexRootConfig { path: string; indexes: Array<"search" | "semantic" | "callgraph">; } export interface IndexConfig { roots?: IndexRootConfig[]; } export interface SemanticConfig { backend?: SemanticBackend; model?: string; base_url?: string; api_key_env?: string; /** * Background embedding request floor in milliseconds. HTTP batch deadlines * scale above it from the successful per-item latency EMA. */ timeout_ms?: number; query_timeout_ms?: number; query_instruction?: string; max_batch_size?: number; max_input_tokens?: number; max_files?: number; } export interface LspServerConfig { id: string; /** Omitted when overriding a built-in server to inherit its extensions. */ extensions?: string[]; /** Omitted when overriding a built-in server to inherit its binary. */ binary?: string; args: string[]; root_markers: string[]; disabled: boolean; env?: Record; initialization_options?: unknown; } export interface InspectConfig { enabled?: boolean; diagnostics_timeout_ms?: number; tier2_idle_minutes?: number; tier2_pass_timeout_ms?: number; categories?: Record; tier2_soft_deadline_ms?: number; max_drill_down_items?: number; duplicates?: { expected_mirrors?: [string, string][]; }; } export interface IdleConfig { /** Unbound-root artifact eviction idle window in minutes. Default 30; clamped to 5..=30. */ root_ttl_minutes?: number; /** Language-server idle window in minutes. Default 10; clamped to 1..=10. */ lsp_ttl_minutes?: number; } export declare const DEFAULT_INSPECT_DIAGNOSTICS_TIMEOUT_MS = 120000; export declare const MIN_INSPECT_DIAGNOSTICS_TIMEOUT_MS = 10000; export declare const MAX_INSPECT_DIAGNOSTICS_TIMEOUT_MS = 600000; /** Resolve the blocking diagnostics deadline for tools that wait on `aft_inspect`. */ export declare function resolveInspectDiagnosticsTimeoutMs(config: AftConfig): number; export interface BackupConfig { enabled?: boolean; max_depth?: number; max_file_size?: number; } export interface LspConfig { servers?: Record>; disabled?: string[]; python?: "pyright" | "ty" | "auto"; /** Restore legacy inline LSP waits on edit/write unless the tool call overrides diagnostics. */ diagnostics_on_edit?: boolean; auto_install?: boolean; grace_days?: number; versions?: Record; } export interface ExperimentalConfig { bash?: { rewrite?: boolean; compress?: boolean; background?: boolean; long_running_reminder_enabled?: boolean; long_running_reminder_interval_ms?: number; }; lsp_ty?: boolean; } export interface ConfigureLspOverrides { experimental_lsp_ty?: boolean; lsp_servers?: LspServerConfig[]; disabled_lsp?: string[]; } export interface ConfigureExperimentalOverrides { experimental_bash_rewrite?: boolean; experimental_bash_compress?: boolean; experimental_bash_background?: boolean; bash_long_running_reminder_enabled?: boolean; bash_long_running_reminder_interval_ms?: number; experimental_lsp_ty?: boolean; } export type ToolSurface = "minimal" | "recommended" | "all"; /** Sandbox settings for first-party Pi processes. */ export interface SandboxConfig { /** Enable native containment for first-party bash and PTY processes. Default: false. */ enabled?: boolean; /** Additional absolute directories where sandboxed commands may write. User config only. */ write_allow?: string[]; /** Additional absolute paths sandboxed commands may not read. Project config may add entries. */ read_deny?: string[]; } /** * Graduated `bash` config. It accepts `true`, `false`, or an object whose * omitted fields use the normal bash defaults during resolution. */ export interface BashConfig { rewrite?: boolean; compress?: boolean; background?: boolean; /** Permit per-command host fallback after AFT transport failure. Default false. */ host_fallback?: boolean; /** Allow subagents to use background bash; when false, requests block to completion. Default true. */ subagent_background?: boolean; /** Detach wait:true bash calls on user messages; `&detach` overrides, is stripped before delivery, and a token-only message gets a minimal replacement. */ detach_on_user_message?: boolean; long_running_reminder_enabled?: boolean; long_running_reminder_interval_ms?: number; /** * How long foreground bash blocks before auto-promoting to background. * Default 15000ms; values below the 5000ms floor are clamped up. */ foreground_wait_window_ms?: number; /** Maximum synchronous bash_watch wait; values outside 1000..1800000 are clamped. Default 120000. */ watch_sync_max_ms?: number; /** Linux-only user-tier opt-in for transient systemd user scopes. Default false. */ linux_scope?: boolean; /** Manual fallback for Pi versions that do not expose enabled default tools. */ powershell_tool?: boolean; } export interface ResolvedGithubConfig { enabled: boolean; shim: boolean; read: boolean; write: boolean; } /** Resolve master/feature precedence and the write-implies-read safety rule. */ export declare function resolveGithubConfig(config: AftConfig): ResolvedGithubConfig; export declare function toolEnabled(config: AftConfig, toolName: string): boolean; export interface ViewsConfig { /** Enable content-addressed index views. Default: false. */ enabled?: boolean; } export interface AftConfig { /** * Optional JSON Schema URL for editor tooling. Runtime no-op — only present * so VS Code/Cursor/etc. pick up the published schema for autocomplete + * validation. `aft setup` auto-inserts this. */ $schema?: string; /** Master switch for AFT. Default true. Project config may set it because turning AFT off is not a privilege escalation. */ enabled?: boolean; /** Select the edit/read surface. `hashline` exposes tagged reads and `{ patch }` edits. */ edit_mode?: "default" | "hashline"; format_on_edit?: boolean; /** Maximum formatter subprocess wallclock seconds. Bounded 1..=600. Default 10. */ formatter_timeout_secs?: number; validate_on_edit?: "syntax" | "full"; formatter?: Record; checker?: Record; /** Configure-time missing-tool warning delivery. Default: toast. */ configure_warnings_delivery?: ConfigureWarningsDelivery; /** Replace host-native read/write/edit/grep/bash with AFT tools. Default: true; false registers AFT's replacements under aft_ names. */ hoist_builtin_tools?: boolean; tool_surface?: ToolSurface; disabled_tools?: string[]; restrict_to_project_root?: boolean; search_index?: boolean; /** User-tier standing roots; project config cannot configure this machine state. */ index?: IndexConfig; semantic_search?: boolean; /** Content-addressed index views. Disabled by default. */ views?: ViewsConfig; callgraph_store?: boolean; /** Number of files to parse in a single batch during callgraph store cold build. Lower values reduce peak memory during cold build. Default: 100. */ callgraph_chunk_size?: number; /** Codebase health inspection config. Enabled by default; set inspect.enabled=false to hide aft_inspect. */ inspect?: InspectConfig; /** Idle reclamation windows for unbound-root artifacts and language servers. */ idle?: IdleConfig; /** Undo backup config. User-only: project config cannot disable or shrink a user's safety net. */ backup?: BackupConfig; /** * Linked-worktree RAM overlay. Default off. A repo may opt its worktrees * in at project tier; it only spends that machine's RAM. */ worktree?: { /** Apply local watcher events to the in-RAM trigram delta. Never writes shared artifacts. */ ram_overlay?: boolean; }; /** Native first-party bash sandbox. Write allowances are user-only; a project may enable but never disable. */ sandbox?: SandboxConfig; /** * Bash tool family (hoist + rewrite + compress + background execution). * Default on for `tool_surface: recommended`/`all`, off for `minimal`. * Graduated from `experimental.bash.*` in v0.27.2; the legacy nested * form is still accepted for backward compat. * * - `true` — all sub-features on, hoist enabled * - `false` — hoist disabled entirely; Pi's native bash stays * - `{ rewrite?, compress?, background?, ... }` — partial override; * missing sub-keys default to `true` */ bash?: boolean | BashConfig; experimental?: ExperimentalConfig; lsp?: LspConfig; url_fetch_allow_private?: boolean; semantic?: SemanticConfig; bridge?: BridgeConfig; subc?: SubcConfig; github?: GithubConfig; /** Legacy shim config. gh_shim.enabled aliases github.shim until v0.57.0; binary_path remains supported. */ gh_shim?: GhShimConfig; /** Deprecated alias block for github.read; removed in v0.57.0. */ gh_read?: GhReadConfig; git?: GitConfig; /** Pi and OMP harness-specific configuration. */ pi?: PiConfig; /** Per-harness config overrides; nested harnesses are ignored. */ harnesses?: Record>; } /** * Resolved bash config: every flag has an explicit boolean. */ export interface ResolvedBashConfig { enabled: boolean; rewrite: boolean; compress: boolean; background: boolean; /** Emergency local execution gate. Default false, including for `bash: true`. */ host_fallback: boolean; /** Allow subagents to use background bash; default true. */ subagent_background: boolean; /** Detach wait:true bash calls on user messages; `&detach` overrides, is stripped before delivery, and a token-only message gets a minimal replacement. */ detach_on_user_message: boolean; long_running_reminder_enabled?: boolean; long_running_reminder_interval_ms?: number; /** * Foreground poll window before auto-promotion to background, in ms. * Always resolved: defaults to 15000, floored at 5000. */ foreground_wait_window_ms: number; /** Maximum synchronous bash_watch wait. Defaults to 120000 and is clamped to 1000..1800000. */ watch_sync_max_ms: number; /** Manual PowerShell registration fallback. Default false. */ powershell_tool: boolean; } /** Default foreground wait-window before auto-promotion (ms). */ export declare const FOREGROUND_WAIT_WINDOW_DEFAULT_MS = 15000; /** Minimum allowed foreground wait-window (ms); smaller values clamp up. */ export declare const FOREGROUND_WAIT_WINDOW_MIN_MS = 5000; /** Default maximum synchronous bash_watch wait (ms). */ export declare const DEFAULT_BASH_WATCH_SYNC_MAX_MS = 120000; /** Minimum synchronous bash_watch wait cap (ms). */ export declare const MIN_BASH_WATCH_SYNC_MAX_MS = 1000; /** Static schema maximum and hard upper bound for synchronous bash_watch waits (ms). */ export declare const MAX_BASH_WATCH_SYNC_MAX_MS = 1800000; export declare function clampBashWatchSyncMaxMs(value: number | undefined): number; /** * Single source of truth for bash config across the Pi plugin. Resolution * order (highest priority wins): * * 1. Top-level `bash: false` → fully disabled (sub-features all false) * 2. Top-level `bash: true` → fully enabled (sub-features all true) * 3. Top-level `bash: { ... }` → enabled; each sub-feature defaults true * when not specified * 4. Top-level `bash` absent + any `experimental.bash.*` set → legacy * fallback; sub-features take their explicit values (default false * to preserve pre-v0.27.2 behavior — that block was opt-in) * 5. Top-level `bash` absent + no experimental → tool_surface default: * - "minimal" → disabled * - "recommended" or "all" → enabled with all sub-features on * * Mirrors OpenCode's resolver exactly. Reminder tuning rides through from * whichever surface specified it (top-level wins, legacy fills the gap). */ export declare function resolveBashConfig(config: AftConfig): ResolvedBashConfig; export declare const AftConfigSchema: z.ZodPreprocess; enabled: z.ZodOptional; edit_mode: z.ZodOptional>; format_on_edit: z.ZodOptional; formatter_timeout_secs: z.ZodOptional; validate_on_edit: z.ZodOptional>; formatter: z.ZodOptional>>; checker: z.ZodOptional>>; configure_warnings_delivery: z.ZodOptional>; hoist_builtin_tools: z.ZodOptional; tool_surface: z.ZodOptional>; disabled_tools: z.ZodOptional>; restrict_to_project_root: z.ZodOptional; search_index: z.ZodOptional; index: z.ZodOptional>; }, z.core.$strip>, z.ZodTransform<{ path: string; indexes: ("search" | "semantic" | "callgraph")[]; }, { path: string; indexes: ("search" | "semantic" | "callgraph")[]; }>>>>; }, z.core.$strip>>; semantic_search: z.ZodOptional; views: z.ZodOptional; }, z.core.$strip>>; callgraph_store: z.ZodOptional; callgraph_chunk_size: z.ZodOptional; inspect: z.ZodOptional; diagnostics_timeout_ms: z.ZodPipe, z.ZodTransform>; tier2_idle_minutes: z.ZodOptional; tier2_pass_timeout_ms: z.ZodOptional; categories: z.ZodOptional>; tier2_soft_deadline_ms: z.ZodOptional; max_drill_down_items: z.ZodOptional; duplicates: z.ZodOptional>>; }, z.core.$strip>>; }, z.core.$strip>>; idle: z.ZodOptional, z.ZodTransform>; lsp_ttl_minutes: z.ZodPipe, z.ZodTransform>; }, z.core.$strip>>; backup: z.ZodOptional; max_depth: z.ZodOptional; max_file_size: z.ZodOptional; }, z.core.$strip>>; worktree: z.ZodOptional; }, z.core.$strip>>; sandbox: z.ZodOptional; write_allow: z.ZodOptional>; read_deny: z.ZodOptional>; }, z.core.$strip>>; bash: z.ZodOptional; compress: z.ZodOptional; background: z.ZodOptional; host_fallback: z.ZodOptional; subagent_background: z.ZodOptional; detach_on_user_message: z.ZodOptional; long_running_reminder_enabled: z.ZodOptional; long_running_reminder_interval_ms: z.ZodOptional; foreground_wait_window_ms: z.ZodOptional; watch_sync_max_ms: z.ZodOptional; linux_scope: z.ZodOptional; powershell_tool: z.ZodOptional; }, z.core.$strip>]>>; experimental: z.ZodOptional; compress: z.ZodOptional; background: z.ZodOptional; long_running_reminder_enabled: z.ZodOptional; long_running_reminder_interval_ms: z.ZodOptional; }, z.core.$strip>>; lsp_ty: z.ZodOptional; }, z.core.$strip>>; lsp: z.ZodOptional>; binary: z.ZodOptional; args: z.ZodDefault>>; root_markers: z.ZodDefault>>; disabled: z.ZodDefault>; env: z.ZodOptional>; initialization_options: z.ZodOptional; }, z.core.$strip>>>; disabled: z.ZodOptional>; python: z.ZodOptional>; diagnostics_on_edit: z.ZodOptional; auto_install: z.ZodOptional; grace_days: z.ZodOptional; versions: z.ZodOptional>; }, z.core.$strip>>; url_fetch_allow_private: z.ZodOptional; semantic: z.ZodOptional>; model: z.ZodOptional; base_url: z.ZodOptional; api_key_env: z.ZodOptional; timeout_ms: z.ZodOptional; query_timeout_ms: z.ZodOptional; query_instruction: z.ZodOptional; max_batch_size: z.ZodOptional; max_input_tokens: z.ZodOptional; max_files: z.ZodOptional; }, z.core.$strip>>; bridge: z.ZodOptional; hang_threshold: z.ZodOptional; }, z.core.$strip>>; subc: z.ZodOptional; connection_file: z.ZodOptional; }, z.core.$strip>>; github: z.ZodOptional; shim: z.ZodOptional; read: z.ZodOptional; write: z.ZodOptional; }, z.core.$strip>>; gh_shim: z.ZodOptional; binary_path: z.ZodOptional; }, z.core.$strip>>; gh_read: z.ZodOptional; }, z.core.$strip>>; git: z.ZodOptional; }, z.core.$strip>>; harnesses: z.ZodOptional; enabled: z.ZodOptional; edit_mode: z.ZodOptional>; format_on_edit: z.ZodOptional; formatter_timeout_secs: z.ZodOptional; validate_on_edit: z.ZodOptional>; formatter: z.ZodOptional>>; checker: z.ZodOptional>>; configure_warnings_delivery: z.ZodOptional>; hoist_builtin_tools: z.ZodOptional; tool_surface: z.ZodOptional>; disabled_tools: z.ZodOptional>; restrict_to_project_root: z.ZodOptional; search_index: z.ZodOptional; index: z.ZodOptional>; }, z.core.$strip>, z.ZodTransform<{ path: string; indexes: ("search" | "semantic" | "callgraph")[]; }, { path: string; indexes: ("search" | "semantic" | "callgraph")[]; }>>>>; }, z.core.$strip>>; semantic_search: z.ZodOptional; views: z.ZodOptional; }, z.core.$strip>>; callgraph_store: z.ZodOptional; callgraph_chunk_size: z.ZodOptional; inspect: z.ZodOptional; diagnostics_timeout_ms: z.ZodPipe, z.ZodTransform>; tier2_idle_minutes: z.ZodOptional; tier2_pass_timeout_ms: z.ZodOptional; categories: z.ZodOptional>; tier2_soft_deadline_ms: z.ZodOptional; max_drill_down_items: z.ZodOptional; duplicates: z.ZodOptional>>; }, z.core.$strip>>; }, z.core.$strip>>; idle: z.ZodOptional, z.ZodTransform>; lsp_ttl_minutes: z.ZodPipe, z.ZodTransform>; }, z.core.$strip>>; backup: z.ZodOptional; max_depth: z.ZodOptional; max_file_size: z.ZodOptional; }, z.core.$strip>>; worktree: z.ZodOptional; }, z.core.$strip>>; sandbox: z.ZodOptional; write_allow: z.ZodOptional>; read_deny: z.ZodOptional>; }, z.core.$strip>>; bash: z.ZodOptional; compress: z.ZodOptional; background: z.ZodOptional; host_fallback: z.ZodOptional; subagent_background: z.ZodOptional; detach_on_user_message: z.ZodOptional; long_running_reminder_enabled: z.ZodOptional; long_running_reminder_interval_ms: z.ZodOptional; foreground_wait_window_ms: z.ZodOptional; watch_sync_max_ms: z.ZodOptional; linux_scope: z.ZodOptional; powershell_tool: z.ZodOptional; }, z.core.$strip>]>>; experimental: z.ZodOptional; compress: z.ZodOptional; background: z.ZodOptional; long_running_reminder_enabled: z.ZodOptional; long_running_reminder_interval_ms: z.ZodOptional; }, z.core.$strip>>; lsp_ty: z.ZodOptional; }, z.core.$strip>>; lsp: z.ZodOptional>; binary: z.ZodOptional; args: z.ZodDefault>>; root_markers: z.ZodDefault>>; disabled: z.ZodDefault>; env: z.ZodOptional>; initialization_options: z.ZodOptional; }, z.core.$strip>>>; disabled: z.ZodOptional>; python: z.ZodOptional>; diagnostics_on_edit: z.ZodOptional; auto_install: z.ZodOptional; grace_days: z.ZodOptional; versions: z.ZodOptional>; }, z.core.$strip>>; url_fetch_allow_private: z.ZodOptional; semantic: z.ZodOptional>; model: z.ZodOptional; base_url: z.ZodOptional; api_key_env: z.ZodOptional; timeout_ms: z.ZodOptional; query_timeout_ms: z.ZodOptional; query_instruction: z.ZodOptional; max_batch_size: z.ZodOptional; max_input_tokens: z.ZodOptional; max_files: z.ZodOptional; }, z.core.$strip>>; bridge: z.ZodOptional; hang_threshold: z.ZodOptional; }, z.core.$strip>>; subc: z.ZodOptional; connection_file: z.ZodOptional; }, z.core.$strip>>; github: z.ZodOptional; shim: z.ZodOptional; read: z.ZodOptional; write: z.ZodOptional; }, z.core.$strip>>; gh_shim: z.ZodOptional; binary_path: z.ZodOptional; }, z.core.$strip>>; gh_read: z.ZodOptional; }, z.core.$strip>>; git: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strict>>>>; }, z.core.$strict>>; export declare function resolveLspConfigForConfigure(config: AftConfig): ConfigureLspOverrides; /** * Build the configure overrides that can legitimately differ per project. * * Pi runs one project per plugin process today, but keeping this shape in * parity with OpenCode's `resolveProjectOverridesForConfigure` prevents drift * in the Rust configure payload and keeps project-safe config forwarding in one * place. */ export declare function resolveProjectOverridesForConfigure(config: AftConfig): Record; export declare function resolveExperimentalConfigForConfigure(config: AftConfig): ConfigureExperimentalOverrides; type Logger = { log: (message: string) => void; warn: (message: string) => void; }; export declare function migrateAftConfigFile(configPath: string, logger?: Logger): { migrated: boolean; oldKeys: string[]; }; export type ConfigLoadError = { path: string; message: string; }; export declare function getConfigLoadErrors(): readonly ConfigLoadError[]; export declare function formatConfigParseFailureMessage(configPath: string, errorMessage: string): string; /** Defaults for bridge transport when omitted from config. */ export declare const DEFAULT_BRIDGE_REQUEST_TIMEOUT_MS = 30000; export declare const DEFAULT_BRIDGE_HANG_THRESHOLD = 2; /** Default the client-side root reaper to disabled when no user configuration is provided; production deployments may enable it through their own configuration. */ export declare const DEFAULT_SUBC_CLIENT_REAPER = false; export declare function resolveSubcClientReaper(config: AftConfig): boolean; /** Resolved pool/bridge options from `config.bridge` (defaults 30000 / 2). */ export declare function resolveBridgePoolTransportOptions(config: AftConfig): { timeoutMs: number; hangThreshold: number; }; export interface ResolvedAftConfigPaths { userConfigPath: string; projectConfigPath: string; } export declare function migrateAftConfigLocations(projectDirectory: string, logger?: Logger): AftConfigFileMigrationResult[]; export declare function resolveAftConfigPaths(projectDirectory: string): ResolvedAftConfigPaths; export declare function buildConfigTierConfigureParams(projectDirectory: string, processState?: Record): Record & { config: ConfigTier[]; cortexkit_user_config_path: string; subc_client_reaper?: boolean; }; export declare function loadAftConfig(projectDirectory: string): AftConfig; export {}; //# sourceMappingURL=config.d.ts.map