import { type CompactionSettings } from '../context/compaction.js'; import { resolveSafeCwd, safeProcessCwd, type SafeCwdResult, type SafeCwdSource } from '../utils/safe-cwd.js'; import { type CliProviderPreset, type ProviderPreset, PROVIDER_PRESETS, parseProviderPreset, normalizeProvider } from '../provider/provider-presets.js'; export { resolveSafeCwd, safeProcessCwd, type SafeCwdResult, type SafeCwdSource, type CliProviderPreset, type ProviderPreset, PROVIDER_PRESETS, parseProviderPreset, normalizeProvider, }; export declare function resolveConfigDir(env?: NodeJS.ProcessEnv): string; export declare function maybeEncryptApiKeyInConfig(config: ConfigFile, configDir: string): ConfigFile; export declare function maybeDecryptApiKeyInConfig(config: ConfigFile, configDir: string): ConfigFile; export interface ConfigFile { profile?: CliConfigProfile | string; provider?: CliProviderPreset | string; apiKey?: string; _apiKeyEncrypted?: boolean; model?: string; baseUrl?: string; workspace?: string; safetyMode?: CliSafetyModeConfig | string; approvalPolicy?: ConfigApprovalPolicy | string; trustedTools?: string[]; deniedTools?: string[]; promptCache?: PromptCacheConfig | boolean; guardrails?: GuardrailsConfig; agent?: AgentRuntimeConfig; mcp?: McpCliConfig; skills?: SkillsCliConfig; hooks?: HooksConfig; _examples?: Record; } export interface LoadedCliConfigFile { config: ConfigFile; configPath: string; projectConfigPath?: string; } export declare class CliConfigFileError extends Error { readonly configPath: string; constructor(configPath: string, reason: string); } export declare class CliConfigWriteError extends Error { readonly configPath: string; constructor(configPath: string, reason: string); } export type CliConfigProfile = 'cautious' | 'balanced' | 'autonomous'; export type CliSafetyModeConfig = 'read-only' | 'workspace-write' | 'full-access'; export type ConfigApprovalPolicy = 'prompt' | 'never'; export interface PromptCacheConfig { enabled?: boolean; debug?: boolean; } export interface TextGuardrailConfig { blockPatterns?: string[]; redactPatterns?: string[]; } export interface GuardrailsConfig { input?: TextGuardrailConfig; output?: TextGuardrailConfig; } export interface AgentRuntimeConfig { maxTurns?: number; contextTokens?: number; /** Max output tokens per LLM response. If unset, moss derives a default from * the probed context window (contextTokens/4, capped to 32k) — NOT a hardcoded * 4096, which truncated long answers on modern large-output models. */ maxOutputTokens?: number; compaction?: Partial>; } export interface SkillsCliConfig { extraRoots?: string[]; } export interface McpCliConfig { enabled?: boolean; configPath?: string; } export interface HookCommandConfig { matcher?: string; command: string; timeoutMs?: number; blocking?: boolean; } export interface HooksConfig { PreToolUse?: HookCommandConfig[]; PostToolUse?: HookCommandConfig[]; SessionStart?: HookCommandConfig[]; } export interface ResolvedTextGuardrailConfig { blockPatterns: string[]; redactPatterns: string[]; } export interface ResolvedGuardrailsConfig { input: ResolvedTextGuardrailConfig; output: ResolvedTextGuardrailConfig; } export interface CliConfigOverrides { profile?: CliConfigProfile; provider?: CliProviderPreset | string; model?: string; baseUrl?: string; workspace?: string; safetyMode?: CliSafetyModeConfig; approvalPolicy?: ConfigApprovalPolicy; trustedTools?: string[]; deniedTools?: string[]; promptCacheEnabled?: boolean; promptCacheDebug?: boolean; maxAgentTurns?: number; contextTokens?: number; maxOutputTokens?: number; } export interface CliProfileDefaults { safetyMode: CliSafetyModeConfig; approvalPolicy: ConfigApprovalPolicy; trustedTools: string[]; promptCacheEnabled: boolean; promptCacheDebug: boolean; } export declare const CLI_PROFILE_DEFAULTS: Record; export declare function resolveConfigPath(configDir?: string, env?: NodeJS.ProcessEnv, argv?: string[]): string; export declare function resolveProjectConfigPath(startDir?: string, maxHops?: number): string | null; export declare function loadConfigFile(configPath?: string): ConfigFile; export declare function mergeConfigFiles(projectConfig: ConfigFile, userConfig: ConfigFile): ConfigFile; export declare function loadCliConfigFile(env?: NodeJS.ProcessEnv, argv?: string[], startDir?: string): LoadedCliConfigFile; export declare function saveConfigFileAtPath(config: ConfigFile, configPath: string): void; export declare function saveConfigFile(config: ConfigFile, configDir?: string): void; export declare function normalizeConfigProfile(value: string | undefined): CliConfigProfile | null; export declare function normalizeSafetyModeConfig(value: string | undefined): CliSafetyModeConfig | null; export declare function normalizeApprovalPolicyConfig(value: string | undefined): ConfigApprovalPolicy | null; export declare function parseConfigBoolean(value: string | undefined): boolean | null; export declare function parseTrustedTools(value: string | string[] | undefined): string[] | undefined; export declare function normalizeGuardrailsConfig(config: ConfigFile['guardrails']): ResolvedGuardrailsConfig; export interface ResolvedCliConfig { profile: CliConfigProfile; profileSource: string; provider: CliProviderPreset; providerSource: string; apiKey: string; apiKeySource: string; usingBundledDefault: boolean; bundledDefaultSuppressedBy?: string; ignoredModelEnvVars: string[]; model: string; modelSource: string; baseUrl: string; baseUrlSource: string; workspace: string; workspaceSource: string; safetyMode: CliSafetyModeConfig; safetyModeSource: string; approvalPolicy: ConfigApprovalPolicy; approvalPolicySource: string; trustedTools: string[]; trustedToolsSource: string; deniedTools: string[]; deniedToolsSource: string; promptCacheEnabled: boolean; promptCacheSource: string; promptCacheDebug: boolean; promptCacheDebugSource: string; guardrails: ResolvedGuardrailsConfig; guardrailsSource: string; maxAgentTurns: number; maxAgentTurnsSource: string; contextTokens: number; contextTokensSource: string; /** Max output tokens per LLM response. undefined → runtime derives from contextTokens. */ maxOutputTokens?: number; compactionSettings: Pick; compactionSettingsSource: string; mcpEnabled: boolean; mcpEnabledSource: string; mcpConfigPath: string; mcpConfigPathSource: string; configPath: string; projectConfigPath?: string; apiKeyEncrypted: boolean; } export type CliConfigAuditSeverity = 'warn'; export interface CliConfigAuditWarning { code: string; severity: CliConfigAuditSeverity; source: string; message: string; } export declare function isBroadTrustedToolPattern(pattern: string): boolean; export declare function auditResolvedCliConfig(config: Pick): CliConfigAuditWarning[]; export declare function hasTrustedToolWildcard(config: Pick): boolean; /** * Conservative fallback context-window size used when the provider's actual * window could not be probed. 32k is small enough not to overrun most models * yet large enough for functional conversations; the user is prompted to set * `agent.contextTokens` explicitly or run `/model` once the value matters. * * This constant is intentionally NOT a guess at any specific model's window — * it means "we don't know, proceed carefully." * * @public */ export declare const CONSERVATIVE_DEFAULT_UNPROBED = 1000000; /** * @deprecated This function maps model name fragments to hardcoded context- * window sizes. Those numbers go stale as models are updated (e.g. * deepseek-v4-flash is 1M, not 64k as the previous table claimed). * * Prefer `resolveContextTokensForModel` from `./model-catalog.js`, which * probes the provider API first. If you need a synchronous fallback, use * `CONSERVATIVE_DEFAULT_UNPROBED` — it is honest about not knowing the real * size, unlike the number this function returns. * * The function is kept exported for backward compatibility with downstream * hosts that may call it. It will be removed in a future minor release. */ export declare function resolveModelContextWindow(model: string | undefined): number; export declare function resolveCliConfig(env?: NodeJS.ProcessEnv, config?: ConfigFile, overrides?: CliConfigOverrides, loadedConfig?: Pick): ResolvedCliConfig; export declare function loadEnvFile(envPath: string): void; export declare function loadEnvFromAncestors(startDir: string, maxHops?: number): void; export declare const PROVIDER: CliProviderPreset; export declare const API_KEY: string; export declare const MODEL: string; export declare const BASE_URL: string; export declare const WORKSPACE: string; export declare const CONFIG_PATH: string; export declare const CONFIG_SOURCE: ResolvedCliConfig; //# sourceMappingURL=config.d.ts.map