/**
* Config.toml generator/merger for oh-my-codex
* Merges OMX MCP server entries and feature flags into existing config.toml
*
* TOML structure reminder: bare key=value pairs after a [table] header belong
* to that table. Top-level (root-table) keys MUST appear before the first
* [table] header. This generator therefore splits its output into:
* 1. Top-level keys (notify, model_reasoning_effort, developer_instructions)
* 2. [features] flags
* 3. [table] sections (shell_environment_policy.set, mcp_servers, tui)
*/
import type { UnifiedMcpRegistryServer } from "./mcp-registry.js";
import { type CodexHookFeatureFlag } from "./codex-feature-flags.js";
import { type ManagedCodexHookTrustState, type ManagedCodexHookOptions } from "./codex-hooks.js";
import type { HudPreset } from "../hud/types.js";
interface MergeOptions {
includeTui?: boolean;
codexHooksFile?: string;
codexHomeDir?: string;
hookCommandPlatform?: ManagedCodexHookOptions["platform"];
codexHookFeatureFlag?: CodexHookFeatureFlag;
modelOverride?: string;
sharedMcpServers?: UnifiedMcpRegistryServer[];
sharedMcpRegistrySource?: string;
verbose?: boolean;
statusLinePreset?: HudPreset;
forceStatusLinePreset?: boolean;
notifyCommand?: string[] | false;
includeFirstPartyMcp?: boolean;
preserveExistingFirstPartyMcp?: boolean;
}
export interface ModelContextRecommendation {
model: string;
modelContextWindow: number;
modelAutoCompactTokenLimit: number;
}
export declare const DEFAULT_SETUP_MODEL = "gpt-5.5";
export declare const DEFAULT_SETUP_MODEL_CONTEXT_WINDOW = 250000;
export declare const DEFAULT_SETUP_MODEL_AUTO_COMPACT_TOKEN_LIMIT = 200000;
export declare function getModelContextRecommendation(model: string): ModelContextRecommendation | null;
export declare const OMX_DEVELOPER_INSTRUCTIONS = "You have oh-my-codex installed. AGENTS.md is the orchestration brain and main control surface. Follow AGENTS.md for skill/keyword routing, $name workflow invocation, and role-specialized subagents; when spawning native subagents, set `agent_type` to an installed role and never omit it for OMX work. Use outcome-first, concise progress updates: state the target result, constraints, validation evidence, and stop condition before adding process detail. Native subagents live in .codex/agents and may handle independent parallel subtasks within one Codex session or team pane. Skills load from .codex/skills, not native-agent TOMLs. Treat installed prompts as narrower execution surfaces under AGENTS.md authority.";
export declare const OMX_PLUGIN_DEVELOPER_INSTRUCTIONS = "You have oh-my-codex installed through Codex plugin mode. AGENTS.md is the orchestration brain and main control surface. Follow AGENTS.md for skill/keyword routing and $name workflow invocation. When spawning native subagents, set `agent_type` to an installed role and never omit it for OMX work. Registered Codex plugin marketplace surfaces supply OMX workflows and plugin-scoped companion resources when the plugin is installed; native agent roles are installed as setup-owned Codex agent TOML files in plugin mode so agent_type routing works. User-installed skills may still live under ~/.codex/skills. Use outcome-first, concise progress updates: state the target result, constraints, validation evidence, and stop condition before adding process detail.";
export declare const STATUS_LINE_PRESETS: Record;
export declare const DEFAULT_STATUS_LINE_PRESET: HudPreset;
export declare function statusLineForPreset(preset?: HudPreset): string;
export declare function stripCodexModelAvailabilityNux(config: string): string;
export declare function cleanCodexModelAvailabilityNuxIfNeeded(configPath: string): Promise;
export declare function hasLegacyOmxTeamRunTable(config: string): boolean;
export declare function getRootModelName(config: string): string | undefined;
export declare function formatTomlStringArray(values: readonly string[]): string;
export declare function getRootTomlArray(config: string, key: string): string[] | null;
export declare function isOmxManagedNotifyCommand(command: readonly string[] | null | undefined, pkgRoot?: string): boolean;
export declare function sanitizePreviousNotifyCommand(command: readonly string[] | null | undefined, pkgRoot?: string): string[] | null;
export declare function stripOmxSeededBehavioralDefaults(config: string): string;
/**
* Remove any existing OMX-owned top-level keys so we can re-insert them
* cleanly. Also removes the comment line that precedes them.
*/
export declare function stripOmxTopLevelKeys(config: string): string;
/**
* Repairs project configs from the 0.18.3 relaunch regression where a
* project-synced trust block could duplicate setup-owned hook trust tables and
* make the next runtime CODEX_HOME config.toml invalid before Codex started.
*/
export declare function repairProjectScopeTrustStateForLaunch(projectConfig: string, projectHooksPath: string): string;
/**
* Project-scope launches mirror the durable project config.toml into an
* ephemeral runtime CODEX_HOME. Codex writes its workspace-trust ledger and
* hook trust ledger into the runtime config.toml during the session. Without
* persistence, those entries die with the runtime, so Codex prompts to trust
* the workspace and hooks on every launch (issue #2470).
*
* This function extracts only trust-state tables (`[projects.""]` and
* `[hooks.state.":..."]`) from the runtime config.toml and
* upserts them into the durable project config.toml inside a marker-fenced
* block, preserving any surrounding user-managed content and comments and
* ignoring Codex's NUX counters or other ephemeral runtime-only writes.
*/
export declare function syncProjectScopeTrustStateFromRuntime(projectConfig: string, runtimeConfig: string, projectHooksPath: string): string;
type ManagedCodexHookTrustStateMap = Record;
export declare function stripManagedCodexHookTrustState(config: string, options?: {
managedTrustState?: ManagedCodexHookTrustStateMap;
}): string;
export declare function upsertManagedCodexHookTrustState(config: string, pkgRoot: string, codexHooksFile: string | undefined, options?: ManagedCodexHookOptions): string;
export declare function upsertPluginModeRuntimeFeatureFlags(config: string, codexHookFeatureFlag?: CodexHookFeatureFlag, options?: {
pluginScopedHooks?: boolean;
}): string;
/**
* Remove OMX-owned feature flags from the [features] section.
* If the section becomes empty after removal, remove the section header too.
*/
export declare function stripOmxFeatureFlags(config: string): string;
/**
* Preserve native Codex hook enablement without re-adding other OMX feature
* flags. Used by uninstall when user-owned hooks remain in hooks.json.
*/
export declare function upsertCodexHooksFeatureFlag(config: string, codexHookFeatureFlag?: CodexHookFeatureFlag): string;
export declare function stripOmxEnvSettings(config: string): string;
export declare function hasFirstPartyOmxMcpRegistrations(config: string): boolean;
export declare function extractFirstPartyOmxMcpSections(config: string): string;
export declare function stripFirstPartyOmxMcpSections(config: string): string;
export declare function stripExistingOmxBlocks(config: string): {
cleaned: string;
removed: number;
};
export declare function stripExistingSharedMcpRegistryBlock(config: string): {
cleaned: string;
removed: number;
};
export declare function extractSharedMcpRegistryServersFromConfig(config: string): {
servers: UnifiedMcpRegistryServer[];
sourcePath?: string;
};
export declare function mergeSharedMcpRegistryBlock(config: string, servers: UnifiedMcpRegistryServer[], sourcePath?: string): string;
/**
* Merge OMX config into existing config.toml
* Preserves existing user settings, appends OMX block if not present.
*
* Layout:
* 1. OMX top-level keys (notify, model_reasoning_effort, developer_instructions)
* 2. [features] with multi_agent + child_agents_md + hooks + goals
* 3. [shell_environment_policy.set] with defaulted deprecated explore-routing opt-out
* 4. … user sections …
* 5. OMX [table] sections (mcp_servers, tui)
*/
export declare function buildMergedConfig(existingConfig: string, pkgRoot: string, options?: MergeOptions): string;
/**
* Detect and repair upgrade-era managed config incompatibilities in config.toml.
*
* After an omx version upgrade the OLD setup code (still loaded in memory)
* may leave a config with duplicate [tui] sections or the retired
* [mcp_servers.omx_team_run] table. Codex rejects duplicate tables and newer
* OMX builds no longer ship the team MCP entrypoint, so we repair both before
* the CLI is spawned.
*
* Returns `true` if a repair was performed.
*/
export declare function repairConfigIfNeeded(configPath: string, pkgRoot: string, options?: MergeOptions): Promise;
export declare function mergeConfig(configPath: string, pkgRoot: string, options?: MergeOptions): Promise;
export {};
//# sourceMappingURL=generator.d.ts.map