import type { Transport } from "@caupulican/pi-ai"; import { type CostGuardSettings } from "./cost-guard.ts"; import { type WorkerModelPinPolicy, type WorkerModelPinsSettings } from "./orchestration/worker-model-pins.ts"; import { ProfileRegistry } from "./profile-registry.ts"; import type { ToolkitScript } from "./toolkit/script-registry.ts"; export interface CompactionSettings { enabled?: boolean; reserveTokens?: number; keepRecentTokens?: number; triggerPercent?: number; model?: string; } export interface ScoutSettings { enabled?: boolean; model?: string; } export interface SemanticMemoryGcSettings { enabled?: boolean; preserveRecentPages?: number; minChars?: number; markers?: string[]; } export interface ContextGcSettings { enabled?: boolean; preserveRecentMessages?: number; minToolResultChars?: number; tools?: string[]; semanticMemory?: SemanticMemoryGcSettings; } /** * Conservative, opt-in first enforcement pilot for the context-policy layer (observe-only * by default -- see context/context-prompt-enforcement.ts). When enabled, stale * artifact-backed tool_output results outside the recent window are stubbed in place in * the provider-visible prompt only; the transcript/session history is never touched. */ export interface ContextPromptEnforcementSettings { enabled?: boolean; preserveRecentMessages?: number; minChars?: number; } /** * Local memory retrieval (see context/memory-retrieval.ts, context/memory-prompt-block.ts): * default-on for local, safe-auto sources. Prompt inclusion is still budget-gated per turn; * compact models get at most a 10-line/~200-token source-labeled block or no memory block. * External/non-local providers remain blocked unless explicitly allowed by policy. */ export interface MemoryRetrievalSettings { enabled?: boolean; maxResults?: number; includeInPrompt?: boolean; allowExternalEgress?: boolean; } export interface ContextCurationSettings { enabled?: boolean; /** Local model ref ("provider/id" or bare id) used for curation jobs. Required to drain. */ model?: string; maxJobsPerTurn?: number; } export interface ContextPolicySettings { enforcement?: ContextPromptEnforcementSettings; memory?: MemoryRetrievalSettings; curation?: ContextCurationSettings; } export declare const MEMORY_RETRIEVAL_MAX_RESULTS_MIN = 1; export declare const MEMORY_RETRIEVAL_MAX_RESULTS_MAX = 20; export interface BranchSummarySettings { reserveTokens?: number; skipPrompt?: boolean; } export interface ProviderRetrySettings { timeoutMs?: number; maxRetries?: number; maxRetryDelayMs?: number; } export interface StreamStallSettings { connectMs?: number; activeIdleMs?: number; quietIdleMs?: number; } export interface RetrySettings { enabled?: boolean; maxRetries?: number; baseDelayMs?: number; provider?: ProviderRetrySettings; stall?: StreamStallSettings; } export interface TerminalSettings { showImages?: boolean; imageWidthCells?: number; clearOnShrink?: boolean; showTerminalProgress?: boolean; } export interface ImageSettings { autoResize?: boolean; blockImages?: boolean; clipboardDirectory?: string; } export interface ThinkingBudgetsSettings { minimal?: number; low?: number; medium?: number; high?: number; } export interface MarkdownSettings { codeBlockIndent?: string; } export interface WarningSettings { anthropicExtraUsage?: boolean; } export interface SelfModificationSettings { enabled?: boolean; sourcePath?: string; sourcePaths?: string[]; } export type AutoLearnThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra"; export interface AutoLearnSettings { enabled?: boolean; model?: string; thinkingLevel?: AutoLearnThinkingLevel; longSessionMessages?: number; longSessionContextPercent?: number; cooldownMinutes?: number; leaseMinutes?: number; maxConcurrentLearners?: number; applyHighConfidence?: boolean; reflectionReview?: boolean; reflectionMinToolCalls?: number; reflectionCooldownMinutes?: number; complexTaskToolCalls?: number; } export type AutonomyMode = "off" | "safe" | "balanced" | "full"; export declare const DEFAULT_AUTONOMY_MAX_STALL_TURNS = 20; export declare const DEFAULT_AUTONOMY_GOAL_CONTINUE_TURNS = 0; export declare const DEFAULT_AUTONOMY_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES = 0; export declare const DEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE = true; export declare const DEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE_DELAY_MS = 0; export interface AutonomySettings { mode?: AutonomyMode; maxStallTurns?: number; goalContinueTurns?: number; goalContinueMaxWallClockMinutes?: number; goalAutoContinue?: boolean; goalAutoContinueDelayMs?: number; } export interface FailoverSettings { subscriptionHop?: boolean; } export interface ModelRouterSettings { enabled?: boolean; cheapModel?: string; mediumModel?: string; expensiveModel?: string; learningModel?: string; judgeEnabled?: boolean; fitnessGate?: boolean; judgeModel?: string; executorModel?: string; cheapThinking?: ThinkingLevel; mediumThinking?: ThinkingLevel; expensiveThinking?: ThinkingLevel; executorThinking?: ThinkingLevel; judgeThinking?: ThinkingLevel; } export declare const DEFAULT_RESEARCH_LANE_ENABLED = false; export declare const DEFAULT_RESEARCH_LANE_MAX_USD = 0.25; export declare const DEFAULT_RESEARCH_LANE_MAX_SOURCES = 8; export declare const DEFAULT_RESEARCH_LANE_MAX_FINDINGS = 10; export declare const DEFAULT_RESEARCH_LANE_MAX_WALL_CLOCK_MS = 120000; export declare const DEFAULT_RESEARCH_LANE_IDLE_DELAY_MS = 0; export declare const DEFAULT_RESEARCH_LANE_MAX_RUNS_PER_SESSION = 10; export declare const MAX_RESEARCH_LANE_MAX_USD = 5; export declare const MAX_RESEARCH_LANE_MAX_SOURCES = 32; export declare const MAX_RESEARCH_LANE_MAX_FINDINGS = 50; export declare const MAX_RESEARCH_LANE_MAX_WALL_CLOCK_MS = 3600000; export declare const MAX_RESEARCH_LANE_IDLE_DELAY_MS = 300000; export declare const MAX_RESEARCH_LANE_MAX_RUNS_PER_SESSION = 100; export interface ResearchLaneSettings { enabled?: boolean; model?: string; profile?: string; systemPrompt?: string; maxUsd?: number; maxSources?: number; maxFindings?: number; maxWallClockMs?: number; idleDelayMs?: number; maxRunsPerSession?: number; } export type ResolvedResearchLaneSettings = Required> & Pick; export declare const DEFAULT_WORKER_DELEGATION_ENABLED = true; export declare const DEFAULT_WORKER_DELEGATION_MAX_USD = 0; export declare const DEFAULT_WORKER_DELEGATION_MAX_WALL_CLOCK_MS = 0; export declare const DEFAULT_WORKER_DELEGATION_MAX_CONCURRENT = 20; export declare const DEFAULT_WORKER_DELEGATION_WRITE_ENABLED = true; export declare const MAX_WORKER_DELEGATION_MAX_USD: number; export declare const MAX_WORKER_DELEGATION_MAX_WALL_CLOCK_MS: number; export declare const MAX_WORKER_DELEGATION_MAX_CONCURRENT: number; export interface WorkerDelegationSettings { enabled?: boolean; orchestrationProfile?: string; maxUsd?: number; maxWallClockMs?: number; writeEnabled?: boolean; maxConcurrent?: number; modelPins?: WorkerModelPinsSettings; } export type ResolvedWorkerDelegationSettings = Required> & Pick; /** Staleness-propagation policy for worktree-sync; see `core/worktree-sync/codes.ts`. */ export type WorktreeSyncPolicySetting = "on_land_mandatory" | "overlap_mandatory" | "land_time_only"; export interface WorktreeSyncSettings { enabled?: boolean; mainBranch?: string; syncPolicy?: WorktreeSyncPolicySetting; gateCommand?: string; gate?: "on" | "off"; gateTimeoutMs?: number; maxLanes?: number; worktreesRoot?: string; workerLand?: "deny" | "allow"; } export type ResolvedWorktreeSyncSettings = Required> & Pick; export declare const DEFAULT_WORKTREE_SYNC_POLICY: WorktreeSyncPolicySetting; export declare const DEFAULT_WORKTREE_SYNC_GATE_TIMEOUT_MS = 900000; export declare const DEFAULT_WORKTREE_SYNC_MAX_LANES = 5; /** Durable master/worker process-matrix supervision; see `core/process-matrix/`. */ export interface ProcessMatrixSettings { enabled?: boolean; heartbeatMs?: number; adoptionGraceMs?: number; watcherPollMs?: number; } export type ResolvedProcessMatrixSettings = Required; export declare const DEFAULT_PROCESS_MATRIX_HEARTBEAT_MS = 30000; export declare const DEFAULT_PROCESS_MATRIX_ADOPTION_GRACE_MS = 300000; export declare const DEFAULT_PROCESS_MATRIX_WATCHER_POLL_MS = 25000; /** Windows shell contract engine tier (`src/core/tools/windows-shell-engine.ts`). */ export interface WindowsShellSettings { pythonEngine?: boolean; } export type ResolvedWindowsShellSettings = Required; export type LearningPolicyLayer = "memory" | "skill" | "prompt" | "extension" | "tool" | "script" | "settings" | "source"; export declare const DEFAULT_LEARNING_POLICY_ENABLED = true; export declare const DEFAULT_LEARNING_POLICY_AUTO_APPLY_ENABLED = true; export declare const DEFAULT_LEARNING_POLICY_CONFIDENCE_THRESHOLD = 50; export declare const DEFAULT_LEARNING_POLICY_MIN_OBSERVATIONS = 1; export declare const DEFAULT_LEARNING_POLICY_ALLOWED_AUTO_APPLY_LAYERS: readonly LearningPolicyLayer[]; export declare const DEFAULT_LEARNING_POLICY_REFLECTION_SOURCE_CONFIDENCE = 50; export declare const DEFAULT_LEARNING_POLICY_AUTO_APPLY_SUPERSESSIONS = false; export interface LearningPolicySettings { enabled?: boolean; autoApplyEnabled?: boolean; confidenceThreshold?: number; minObservations?: number; allowedAutoApplyLayers?: LearningPolicyLayer[]; requireRollbackPlan?: boolean; reflectionSourceConfidence?: number; autoApplySupersessions?: boolean; } export type ResolvedLearningPolicySettings = Required; export interface ToolkitSettings { /** The blessed daily-ops scripts run_toolkit_script may execute. Nothing else ever runs. */ scripts?: ToolkitScript[]; } export type ModelCapabilityMode = "auto" | "off" | "full" | "lean" | "minimal" | "chat"; export declare const DEFAULT_MODEL_CAPABILITY_MODE: ModelCapabilityMode; export interface ModelCapabilitySettings { /** * default: "auto" — derive the tool/lane surface from the model's context window so small open * models stay usable for chat. "off" disables detection; a class name forces that class. */ mode?: ModelCapabilityMode; } export type BedrockScopeVerification = "identity+control-plane+runtime" | "runtime"; /** User-owned, verified Amazon Bedrock request and model-visibility boundary. */ export interface BedrockScopeSettings { region: string; profile?: string; modelIds: string[]; verifiedAt: string; verification: BedrockScopeVerification; } export type TransportSetting = Transport; /** * Package source for npm/git packages. * - String form: load all resources from the package * - Object form: filter which resources to load */ export type PackageSource = string | { source: string; extensions?: string[]; skills?: string[]; prompts?: string[]; themes?: string[]; }; export type ResourceProfileKind = "extensions" | "skills" | "prompts" | "themes" | "agents" | "tools"; export interface ResourceProfileFilterSettings { /** Allowlist patterns. When non-empty, only matching resources stay available. */ allow?: string[]; /** Blocklist patterns. Applied after allow. */ block?: string[]; } export type ResourceProfileSettings = Partial>; export interface DisabledResourcesSettings { extensions?: string[]; skills?: string[]; prompts?: string[]; themes?: string[]; agents?: string[]; tools?: string[]; } export interface ToolRepairSettings { teach?: boolean; textProtocol?: boolean; logging?: boolean; } export interface Settings { lastChangelogVersion?: string; defaultProvider?: string; defaultModel?: string; defaultThinkingLevel?: ThinkingLevel; /** Provider-scoped fast-mode preferences. Concrete providers own the meaning of enabled. */ fastMode?: Record; transport?: TransportSetting; steeringMode?: "all" | "one-at-a-time"; followUpMode?: "all" | "one-at-a-time"; theme?: string; /** Resource catalog directory (round resource management): the folder pi installs/updates/backs up from. */ catalogDir?: string; compaction?: CompactionSettings; scout?: ScoutSettings; /** Proactive per-turn cost guard (#34). */ costGuard?: Partial; /** Skill curator (#32): auto-archive stale reflection-promoted skills at session start. */ curator?: { autoArchive?: boolean; staleDays?: number; }; contextGc?: ContextGcSettings; contextPolicy?: ContextPolicySettings; branchSummary?: BranchSummarySettings; retry?: RetrySettings; hideThinkingBlock?: boolean; shellPath?: string; quietStartup?: boolean; /** * How to treat repository AGENTS.md/CLAUDE.md/GEMINI.md files. * `"off"` (default): global `~/.pi/agent` files only; do not walk project files. * `"on-demand"`: opt in for this settings scope — list project paths, do not inject contents. * Persist per directory (directory overlay), per project (`.pi/settings.json`), or globally. */ projectContextFiles?: "on-demand" | "off"; shellCommandPrefix?: string; npmCommand?: string[]; collapseChangelog?: boolean; enableInstallTelemetry?: boolean; packages?: PackageSource[]; extensions?: string[]; skills?: string[]; prompts?: string[]; themes?: string[]; externalResourceRoots?: string[]; trustedResourceRoots?: string[]; disabledResources?: DisabledResourcesSettings; resourceProfiles?: Record; activeResourceProfile?: string | string[]; activeResourceProfiles?: string[]; activeOrchestrationProfile?: string; enableSkillCommands?: boolean; terminal?: TerminalSettings; images?: ImageSettings; enabledModels?: string[]; doubleEscapeAction?: "fork" | "tree" | "none"; treeFilterMode?: "default" | "no-tools" | "user-only" | "labeled-only" | "all"; thinkingBudgets?: ThinkingBudgetsSettings; editorPaddingX?: number; autocompleteMaxVisible?: number; showHardwareCursor?: boolean; markdown?: MarkdownSettings; warnings?: WarningSettings; selfModification?: SelfModificationSettings; autonomy?: AutonomySettings; researchLane?: ResearchLaneSettings; workerDelegation?: WorkerDelegationSettings; worktreeSync?: WorktreeSyncSettings; processMatrix?: ProcessMatrixSettings; windowsShell?: WindowsShellSettings; learningPolicy?: LearningPolicySettings; modelCapability?: ModelCapabilitySettings; bedrock?: BedrockScopeSettings; toolkit?: ToolkitSettings; modelRouter?: ModelRouterSettings; toolRepair?: ToolRepairSettings; failover?: FailoverSettings; autoLearn?: AutoLearnSettings; sessionDir?: string; httpIdleTimeoutMs?: number; websocketConnectTimeoutMs?: number; } export interface DirectoryResourceProfileInfo { root: string; hash: string; path: string; } export declare function getDirectoryResourceProfileInfo(cwd: string, agentDir?: string): DirectoryResourceProfileInfo; export declare function matchesResourceProfilePattern(resourcePath: string, patterns: string[], baseDir?: string): boolean; /** Canonical `!`/`+`/`-` precedence for top-level resource selector overrides. */ export declare function isResourceEnabledByTopLevelOverrides(resourcePath: string, entries: string[], baseDir?: string): boolean; export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra"; export interface ProfileDefinitionInput { name?: string; description?: string; model?: string; thinking?: ThinkingLevel; modelRouter?: ModelRouterSettings; /** * Situational identity: a system-prompt prefix injected while this profile is active, so a * profile becomes a full "situation" = soul + capabilities + model/thinking, switched atomically. */ soul?: string; resources: ResourceProfileSettings; } export type ProfilePersistenceScope = "session" | "directory" | "project" | "global" | "reusable-file"; export type SettingsScope = "global" | "project" | "directoryProfile"; export type SettingsErrorScope = SettingsScope; export interface SettingsManagerCreateOptions { projectTrusted?: boolean; } export interface SettingsStorage { withLock(scope: SettingsScope, fn: (current: string | undefined) => string | undefined): void; getProfilesDir?(): string; /** Base directory used to resolve explicit ./ or ../ profile references. */ getProfileResolutionBaseDir?(): string; } export interface SettingsError { scope: SettingsErrorScope; error: Error; } /** In-memory settings generation captured around an atomic runtime reload. */ export interface SettingsReloadSnapshot { globalSettings: Settings; projectSettings: Settings; directoryProfileSettings: Settings; runtimeResourceProfiles: string[] | undefined; inlineResourceProfileDefinitions: Record; discoveredResourceProfileDefinitions: Record; effectiveSettings: Settings; projectTrusted: boolean; modifiedFields: Set; modifiedNestedFields: Map>; modifiedProjectFields: Set; modifiedProjectNestedFields: Map>; globalSettingsLoadError: Error | null; projectSettingsLoadError: Error | null; directoryProfileInfo: DirectoryResourceProfileInfo | null; errors: SettingsError[]; } export interface GlobalResourceProfileConfiguration { resourceProfiles?: Settings["resourceProfiles"]; activeResourceProfile?: Settings["activeResourceProfile"]; activeResourceProfiles?: Settings["activeResourceProfiles"]; externalResourceRoots?: string[]; trustedResourceRoots?: string[]; } export declare class FileSettingsStorage implements SettingsStorage { private profileResolutionBaseDir; private globalSettingsPath; private projectSettingsPath; private directoryProfileInfo; private legacyDirectoryProfilePath; private profilesDir; constructor(cwd: string, agentDir: string); getDirectoryResourceProfileInfo(): DirectoryResourceProfileInfo; getProfilesDir(): string; getProfileResolutionBaseDir(): string; readDirectoryResourceProfile(): string | undefined; private removeMigratedDirectoryProfile; withLock(scope: SettingsScope, fn: (current: string | undefined) => string | undefined): void; } export declare class InMemorySettingsStorage implements SettingsStorage { private global; private project; private directoryProfile; withLock(scope: SettingsScope, fn: (current: string | undefined) => string | undefined): void; } export declare class SettingsManager { private storage; private globalSettings; private projectSettings; private directoryProfileSettings; private runtimeResourceProfiles; private inlineResourceProfileDefinitions; private discoveredResourceProfileDefinitions; settings: Settings; private projectTrusted; private modifiedFields; private modifiedNestedFields; private modifiedProjectFields; private modifiedProjectNestedFields; private globalSettingsLoadError; private projectSettingsLoadError; private directoryProfileInfo; private profileRegistry; private writeQueue; private errors; private readonly changeListeners; private constructor(); private createProfileRegistry; private profileDiagnosticKeys; private reportProfileDiagnostic; private reportWorkerDelegationDiagnostics; private getActiveProfileNamesForDiagnostics; private getExternalRootActiveResourceProfileNames; private refreshProfileRegistry; private resolveProfileFromRegistry; private mergeEffectiveSettings; private recomputeSettings; /** Subscribe to synchronous effective-settings transitions. Listener failures never break persistence. */ subscribeChanges(listener: () => void): () => void; private notifyChanges; /** Create a SettingsManager that loads from files */ static create(cwd: string, agentDir?: string, options?: SettingsManagerCreateOptions): SettingsManager; /** Create a SettingsManager from an arbitrary storage backend */ static fromStorage(storage: SettingsStorage, options?: SettingsManagerCreateOptions): SettingsManager; /** Create an in-memory SettingsManager (no file I/O) */ static inMemory(settings?: Partial): SettingsManager; private static loadFromStorage; private static tryLoadFromStorage; private static tryLoadDirectoryProfileFromStorage; /** Migrate old settings format to new format */ private static migrateSettings; getGlobalSettings(): Settings; getProjectSettings(): Settings; getDirectoryResourceProfileSettings(): Settings; getDirectoryResourceProfileInfo(): DirectoryResourceProfileInfo | null; getProfileRegistry(): ProfileRegistry; getActiveResourceProfileNames(): string[]; hasExplicitActiveResourceProfileSelection(): boolean; /** * Aggregate ONLY the active profiles' contribution to a resource kind's filter — the user's own * legacy `disabledResources` list is not merged in. Includes the strict-UAC deny-all (an * authority-bearing kind no active profile mentions is denied outright); that denial is * profile-driven too. Shared by `getResourceProfileFilter` (which merges the legacy disable list * on top) and `isResourceDeniedByActiveProfile` (which must attribute a denial to the profile * ALONE — a user-only disable must never be reported as "withheld by the active resource * profile"). */ private computeProfileOnlyResourceFilter; getResourceProfileFilter(kind: ResourceProfileKind): Required; /** * Explicit off-switch for passive default-on resources. Unlike the strict profile grant, * an omitted allow entry is not a disable: only disabledResources, the resource selector's * negative filters, or an authored profile block wins. This keeps default-on cosmetic resources * available without weakening the import boundary for ordinary authority-bearing extensions. */ isResourceExplicitlyDisabled(kind: ResourceProfileKind, resourcePath: string, baseDir?: string): boolean; /** * Profile grants the user's own disable list overrides. RATIFIED precedence: a user disable * (`disabledResources` / `!` overrides) is a hard off-switch that always WINS over a profile * allow (the legacy disabled filter merges into every profile filter as a block, and blocks * beat allows). This helper only SURFACES the conflict so a granted-but-disabled resource * doesn't look like a broken grant. */ getProfileGrantsOverriddenByUserDisable(kind: ResourceProfileKind): string[]; isResourceAllowedByProfile(kind: ResourceProfileKind, resourcePath: string, baseDir?: string): boolean; /** * Whether the ACTIVE PROFILE alone denies this resource — the user's own legacy * `disabledResources` list is ignored. A "withheld by the active resource profile" report must * use this, not `isResourceAllowedByProfile`: that check merges the user's own disables in, so a * plain user-disabled resource (no profile even mentioning it) would otherwise be misattributed * to the profile. */ isResourceDeniedByActiveProfile(kind: ResourceProfileKind, resourcePath: string, baseDir?: string): boolean; /** * Situational soul(s) of the currently active profile(s): a system-prompt identity prefix * injected while the profile is active. Multiple active profiles' souls are concatenated. */ getActiveProfileSoul(): string | undefined; isProjectTrusted(): boolean; setProjectTrusted(trusted: boolean): void; reload(): Promise; /** Capture the complete in-memory settings generation before runtime reload mutates it. */ createReloadSnapshot(): SettingsReloadSnapshot; /** Restore a failed runtime reload without changing the on-disk settings generation. */ restoreReloadSnapshot(snapshot: SettingsReloadSnapshot): void; /** Apply additional overrides on top of current settings */ applyOverrides(overrides: Partial): void; /** Select runtime-only resource profiles, e.g. from CLI/subagent launch options. */ setRuntimeResourceProfiles(profileNames: string[]): void; /** Add one-shot profile definitions from CLI/SDK/ephemeral agent launch input. Never writes to disk. */ addInlineResourceProfileDefinitions(profiles: Record): void; /** Replace profile definitions discovered inside loaded resource files. Never writes to disk. */ replaceDiscoveredResourceProfileDefinitions(profiles: Record): void; /** Add profile definitions discovered after resource resolution, e.g. context agent files. Never writes to disk. */ addDiscoveredResourceProfileDefinitions(profiles: Record): void; private normalizeProfileName; private normalizeProfileSelection; private sanitizeProfileResources; private decodeStoredProfileDefinition; private mergeProfileDefinition; private encodeStoredProfileDefinition; private updateStoredProfileDefinition; private renameStoredProfileDefinition; private setActiveProfileInSettings; private rewriteActiveProfileReference; private rewriteReusableProfileSelections; private persistDirectoryProfiles; private getProfileFilePath; /** * Create or update a profile definition in the selected persistence scope. */ setProfileDefinition(profileName: string, definition: ProfileDefinitionInput, scope: ProfilePersistenceScope): void; /** * Delete a profile from the selected scope. */ deleteProfile(profileName: string, scope: ProfilePersistenceScope): void; renameProfile(profileName: string, newProfileName: string, scope: ProfilePersistenceScope): void; /** * Set active profile selection in the selected scope. */ setActiveProfile(profileName: string | undefined, scope: Exclude): void; /** Atomically replace the global profile/authority fields used by config restore and rollback. */ replaceGlobalResourceProfileConfiguration(configuration: GlobalResourceProfileConfiguration): void; /** Restore one profile definition's persistent owner after a post-doctor commit failure. */ restoreProfileDefinitionFromReloadSnapshot(profileName: string, scope: Exclude, snapshot: SettingsReloadSnapshot): void; /** Mark a global field as modified during this session */ private markModified; /** Mark a project field as modified during this session */ private markProjectModified; private assertProjectTrustedForWrite; private recordError; private clearModifiedScope; private enqueueWrite; private cloneModifiedNestedFields; private persistScopedSettings; private save; private saveProjectSettings; private updateProjectSettings; flush(): Promise; drainErrors(): SettingsError[]; getLastChangelogVersion(): string | undefined; setLastChangelogVersion(version: string): void; getSessionDir(): string | undefined; getDefaultProvider(): string | undefined; getDefaultModel(): string | undefined; setDefaultProvider(provider: string): void; setDefaultModel(modelId: string): void; setDefaultModelAndProvider(provider: string, modelId: string): void; getSteeringMode(): "all" | "one-at-a-time"; setSteeringMode(mode: "all" | "one-at-a-time"): void; getFollowUpMode(): "all" | "one-at-a-time"; setFollowUpMode(mode: "all" | "one-at-a-time"): void; getTheme(): string | undefined; setTheme(theme: string): void; /** The configured resource catalog directory, if any (round resource management). */ getCatalogDir(): string | undefined; setCatalogDir(dir: string | undefined): void; getDefaultThinkingLevel(): ThinkingLevel | undefined; setDefaultThinkingLevel(level: ThinkingLevel): void; getFastModeEnabled(provider: string): boolean | undefined; setFastModeEnabled(provider: string, enabled: boolean): void; getTransport(): TransportSetting; setTransport(transport: TransportSetting): void; getCompactionEnabled(): boolean; setCompactionEnabled(enabled: boolean): void; getCompactionReserveTokens(): number; getCompactionKeepRecentTokens(): number; getCompactionTriggerPercent(): number; hasExplicitCompactionTriggerPercent(): boolean; /** * Skill curator (#32). Auto-archive of stale reflection-promoted skills is ON by default (restorable, * announced, promoted-only). Set `autoArchive: false` to make it propose-only (`/curate`). */ getCuratorSettings(): { autoArchive: boolean; staleDays: number; }; /** * Optional per-turn cost guard (#34). Explicit `enabled: true` is mandatory; this keeps positive * thresholds written by older releases dormant instead of silently restoring a spend guard. */ getCostGuardSettings(): CostGuardSettings; setCostGuardSettings(settings: CostGuardSettings, scope?: SettingsScope): void; getFailoverSettings(): Required; private getProfileModelRouterSettings; getModelRouterSettings(): { enabled: boolean; cheapModel?: string; mediumModel?: string; expensiveModel?: string; learningModel?: string; judgeEnabled: boolean; judgeModel?: string; executorModel?: string; fitnessGate: boolean; cheapThinking?: ThinkingLevel; mediumThinking?: ThinkingLevel; expensiveThinking?: ThinkingLevel; executorThinking?: ThinkingLevel; judgeThinking?: ThinkingLevel; }; setModelRouterSettings(settings: ModelRouterSettings, scope?: SettingsScope): void; /** Configured auxiliary summarizer model id, or "auto" (default) to pick the cheapest authed model. */ getCompactionModel(): string; getCompactionSettings(): { enabled: boolean; reserveTokens: number; keepRecentTokens: number; triggerPercent: number; }; getScoutSettings(): { enabled: boolean; model: string; }; setScoutSettings(settings: ScoutSettings, scope?: SettingsScope): void; getContextGcSettings(): { enabled: boolean; preserveRecentMessages: number; minToolResultChars: number; tools: string[]; semanticMemory: { enabled: boolean; preserveRecentPages: number; minChars: number; markers: string[]; }; }; getContextPromptEnforcementSettings(): { enabled: boolean; preserveRecentMessages: number; minChars: number; }; getContextCurationSettings(): { enabled: boolean; model?: string; maxJobsPerTurn: number; }; setContextCurationSettings(settings: ContextCurationSettings, scope?: SettingsScope): void; setContextPromptEnforcementSettings(settings: ContextPromptEnforcementSettings, scope?: SettingsScope): void; getMemoryRetrievalSettings(): { enabled: boolean; maxResults: number; includeInPrompt: boolean; allowExternalEgress: boolean; }; setMemoryRetrievalSettings(settings: MemoryRetrievalSettings, scope?: SettingsScope): void; getBranchSummarySettings(): { reserveTokens: number; skipPrompt: boolean; }; getBranchSummarySkipPrompt(): boolean; getRetryEnabled(): boolean; setRetryEnabled(enabled: boolean): void; getRetrySettings(): { enabled: boolean; maxRetries: number; baseDelayMs: number; }; /** * Stream-stall watchdog bounds (pi-agent-core reliability/watchdogs.ts). Returns only the * fields the user set, validated; unset fields fall back to DEFAULT_STREAM_IDLE at the * wiring site (agent-session constructor). Resolved per request, so edits apply live. */ getStreamStallSettings(): { connectMs?: number; activeIdleMs?: number; quietIdleMs?: number; }; getHttpIdleTimeoutMs(): number; setHttpIdleTimeoutMs(timeoutMs: number): void; getProviderRetrySettings(): { timeoutMs?: number; maxRetries?: number; maxRetryDelayMs: number; }; getWebSocketConnectTimeoutMs(): number | undefined; getHideThinkingBlock(): boolean; setHideThinkingBlock(hide: boolean): void; getShellPath(): string | undefined; setShellPath(path: string | undefined): void; getQuietStartup(): boolean; /** Repository context files are off unless a settings layer opts in. Global agent-dir files always load. */ getProjectContextFiles(): "on-demand" | "off"; /** Which settings layer last set `projectContextFiles`, if any. */ getProjectContextFilesScope(): SettingsScope | undefined; setProjectContextFiles(mode: "on-demand" | "off", scope?: SettingsScope): void; setQuietStartup(quiet: boolean): void; getShellCommandPrefix(): string | undefined; setShellCommandPrefix(prefix: string | undefined): void; getNpmCommand(): string[] | undefined; setNpmCommand(command: string[] | undefined): void; getCollapseChangelog(): boolean; setCollapseChangelog(collapse: boolean): void; getEnableInstallTelemetry(): boolean; setEnableInstallTelemetry(enabled: boolean): void; getPackages(): PackageSource[]; setPackages(packages: PackageSource[]): void; setProjectPackages(packages: PackageSource[]): void; getExtensionPaths(): string[]; setExtensionPaths(paths: string[]): void; setProjectExtensionPaths(paths: string[]): void; getSkillPaths(): string[]; setSkillPaths(paths: string[]): void; setProjectSkillPaths(paths: string[]): void; getPromptTemplatePaths(): string[]; setPromptTemplatePaths(paths: string[]): void; setProjectPromptTemplatePaths(paths: string[]): void; getThemePaths(): string[]; setThemePaths(paths: string[]): void; setProjectThemePaths(paths: string[]): void; getEnableSkillCommands(): boolean; setEnableSkillCommands(enabled: boolean): void; getThinkingBudgets(): ThinkingBudgetsSettings | undefined; getShowImages(): boolean; setShowImages(show: boolean): void; getImageWidthCells(): number; setImageWidthCells(width: number): void; getClearOnShrink(): boolean; setClearOnShrink(enabled: boolean): void; getShowTerminalProgress(): boolean; setShowTerminalProgress(enabled: boolean): void; getImageAutoResize(): boolean; setImageAutoResize(enabled: boolean): void; getBlockImages(): boolean; setBlockImages(blocked: boolean): void; getClipboardImageDirectory(): string | undefined; setClipboardImageDirectory(directory: string | undefined): void; getEnabledModels(): string[] | undefined; setEnabledModels(patterns: string[] | undefined): void; getDoubleEscapeAction(): "fork" | "tree" | "none"; setDoubleEscapeAction(action: "fork" | "tree" | "none"): void; getTreeFilterMode(): "default" | "no-tools" | "user-only" | "labeled-only" | "all"; setTreeFilterMode(mode: "default" | "no-tools" | "user-only" | "labeled-only" | "all"): void; getShowHardwareCursor(): boolean; setShowHardwareCursor(enabled: boolean): void; getEditorPaddingX(): number; setEditorPaddingX(padding: number): void; getAutocompleteMaxVisible(): number; setAutocompleteMaxVisible(maxVisible: number): void; getCodeBlockIndent(): string; getWarnings(): WarningSettings; setWarnings(warnings: WarningSettings): void; getSelfModificationSettings(): { enabled: boolean; sourcePath?: string; sourcePaths?: string[]; }; setSelfModificationSettings(settings: SelfModificationSettings, scope?: SettingsScope): void; getAutonomySettings(): Required; setAutonomySettings(settings: AutonomySettings, scope?: SettingsScope): void; getResearchLaneSettings(): ResolvedResearchLaneSettings; setResearchLaneSettings(settings: ResearchLaneSettings, scope?: SettingsScope): void; getWorktreeSyncSettings(): ResolvedWorktreeSyncSettings; getProcessMatrixSettings(): ResolvedProcessMatrixSettings; getWindowsShellSettings(): ResolvedWindowsShellSettings; getWorkerDelegationSettings(): ResolvedWorkerDelegationSettings; getWorkerModelPinPolicy(): WorkerModelPinPolicy; getActiveOrchestrationProfile(): string | undefined; setWorkerDelegationSettings(settings: WorkerDelegationSettings, scope?: SettingsScope): void; getLearningPolicySettings(): ResolvedLearningPolicySettings; getToolkitScripts(): ToolkitScript[]; setToolkitSettings(settings: ToolkitSettings, scope?: SettingsScope): void; getModelCapabilitySettings(): Required; setModelCapabilitySettings(settings: ModelCapabilitySettings, scope?: SettingsScope): void; getBedrockScopeSettings(): BedrockScopeSettings | undefined; setBedrockScopeSettings(scope: BedrockScopeSettings): void; clearBedrockScopeSettings(): void; setLearningPolicySettings(settings: LearningPolicySettings, scope?: SettingsScope): void; getAutoLearnSettings(): AutoLearnSettings; setAutoLearnSettings(settings: AutoLearnSettings, scope?: SettingsScope): void; getExternalResourceRoots(): string[]; setExternalResourceRoots(roots: string[], scope?: SettingsScope): void; getTrustedResourceRoots(): string[]; setTrustedResourceRoots(roots: string[], scope?: SettingsScope): void; addTrustedResourceRoot(path: string, scope?: SettingsScope): void; canonicalizePath(p: string): string | null; getEffectiveExternalResourceRoots(): string[]; } //# sourceMappingURL=settings-manager.d.ts.map