import { z } from "zod"; import type { Events } from "./events.js"; import type { Paths } from "./paths.js"; export declare const RunnerNameSchema: z.ZodEnum<{ claude: "claude"; codex: "codex"; shell: "shell"; }>; export type RunnerName = z.infer; /** A command is an executable name/path, or an array whose head is the executable and tail are leading args. */ export declare const CommandSpecSchema: z.ZodUnion]>; export type CommandSpec = z.infer; export declare const ClaudePermissionModeSchema: z.ZodEnum<{ acceptEdits: "acceptEdits"; auto: "auto"; bypassPermissions: "bypassPermissions"; dontAsk: "dontAsk"; manual: "manual"; plan: "plan"; }>; export declare const CodexSandboxSchema: z.ZodEnum<{ "danger-full-access": "danger-full-access"; "read-only": "read-only"; "workspace-write": "workspace-write"; }>; export declare const ClaudeAuthModeSchema: z.ZodEnum<{ api_key: "api_key"; auto: "auto"; login: "login"; }>; export type ClaudeAuthMode = z.infer; export declare const ClaudeRunnerConfigSchema: z.ZodObject<{ command: z.ZodDefault]>>; permission_mode: z.ZodDefault>; args: z.ZodDefault>; auth: z.ZodDefault>; }, z.core.$strict>; export declare const CodexRunnerConfigSchema: z.ZodObject<{ command: z.ZodDefault]>>; sandbox: z.ZodDefault>; network_access: z.ZodDefault; approval_policy: z.ZodDefault; args: z.ZodDefault>; }, z.core.$strict>; /** A name for an account: what `account:` in a skill and `skillhook accounts …` use. */ export declare const AccountNameSchema: z.ZodString; /** * One login of Claude Code or Codex that runs can use (docs/accounts.md). A `login` account is a configuration * directory of its own (`CLAUDE_CONFIG_DIR` / `CODEX_HOME`) logged in with `skillhook accounts login`; a `token` * account is a `claude setup-token` token and an `api_key` account an API key, both kept in `.env`. */ export declare const AccountConfigSchema: z.ZodObject<{ runner: z.ZodEnum<{ claude: "claude"; codex: "codex"; }>; kind: z.ZodDefault>; dir: z.ZodOptional; share_from: z.ZodOptional; secret_env: z.ZodOptional; label: z.ZodOptional; disabled: z.ZodDefault; }, z.core.$strict>; export type AccountConfig = z.infer; /** One account, or a pool of accounts of the same runner tried in turn. */ export declare const AccountRefSchema: z.ZodUnion]>; export type AccountRef = z.infer; export declare const ConfigSchema: z.ZodObject<{ $schema: z.ZodOptional; port: z.ZodDefault; host: z.ZodDefault; public_url: z.ZodOptional; trust_proxy: z.ZodDefault; defaults: z.ZodPrefault>; model: z.ZodOptional; effort: z.ZodOptional; timeout_seconds: z.ZodDefault; cwd: z.ZodOptional; fallback: z.ZodOptional, z.ZodObject<{ runner: z.ZodEnum<{ claude: "claude"; codex: "codex"; shell: "shell"; }>; model: z.ZodOptional; effort: z.ZodOptional; account: z.ZodOptional; }, z.core.$strict>]>>; on: z.ZodOptional>>; }, z.core.$strict>>; accounts: z.ZodOptional]>>; codex: z.ZodOptional]>>; }, z.core.$strict>>; }, z.core.$strict>>; accounts: z.ZodDefault; kind: z.ZodDefault>; dir: z.ZodOptional; share_from: z.ZodOptional; secret_env: z.ZodOptional; label: z.ZodOptional; disabled: z.ZodDefault; }, z.core.$strict>>>; account_policy: z.ZodPrefault>; usage_avoid_percent: z.ZodDefault; failover: z.ZodDefault; limited_cooldown_minutes: z.ZodDefault; usage_poll_minutes: z.ZodDefault; usage_warn_percent: z.ZodDefault; notify: z.ZodDefault>; }, z.core.$strict>>; concurrency: z.ZodDefault; max_body_bytes: z.ZodDefault; max_wait_seconds: z.ZodDefault; rate_limit: z.ZodPrefault; auth_failures_per_minute: z.ZodDefault; }, z.core.$strict>>; runners: z.ZodPrefault]>>; permission_mode: z.ZodDefault>; args: z.ZodDefault>; auth: z.ZodDefault>; }, z.core.$strict>>; codex: z.ZodPrefault]>>; sandbox: z.ZodDefault>; network_access: z.ZodDefault; approval_policy: z.ZodDefault; args: z.ZodDefault>; }, z.core.$strict>>; }, z.core.$strict>>; jobs: z.ZodPrefault; dedupe_window_seconds: z.ZodDefault; dedupe_in_flight: z.ZodDefault; inline_payload_max_bytes: z.ZodDefault; }, z.core.$strict>>; deliveries: z.ZodPrefault; store_bodies: z.ZodDefault; body_max_bytes: z.ZodDefault; }, z.core.$strict>>; health: z.ZodPrefault; probe_timeout_seconds: z.ZodDefault; readiness_cache_seconds: z.ZodDefault; }, z.core.$strict>>; env_passthrough: z.ZodDefault>; projects: z.ZodDefault>; project_refresh: z.ZodDefault>; cloud: z.ZodPrefault; url: z.ZodDefault; machine_id: z.ZodOptional; mode: z.ZodDefault>; allow_commands: z.ZodDefault>; deny_commands: z.ZodDefault>; upload_payloads: z.ZodDefault; public_env: z.ZodDefault>; upload_artifacts: z.ZodDefault; ingress: z.ZodDefault; upload_definitions: z.ZodDefault; managed_skills: z.ZodDefault; require_fresh_definitions: z.ZodDefault; snapshot_interval_seconds: z.ZodDefault; health_interval_seconds: z.ZodDefault; outbox_max_events: z.ZodDefault; }, z.core.$strict>>; log_level: z.ZodDefault>; update_check: z.ZodDefault; auto_update: z.ZodDefault; }, z.core.$strict>; export type Config = z.infer; export type ConfigInput = z.input; export declare function defaultConfig(): Config; export declare class ConfigError extends Error { readonly file: string; constructor(message: string, file: string); } export declare function configExists(paths: Paths): boolean; export declare function loadConfig(paths: Paths): Config; /** Reads the raw (unvalidated, un-defaulted) config object so edits do not bake defaults into the file. */ export declare function readRawConfig(paths: Paths): Record; export declare function writeConfig(paths: Paths, config: ConfigInput | Record): void; /** Sets a dotted key (`defaults.model`) in the raw config file, validating the result. */ export declare function setConfigValue(paths: Paths, dotted: string, value: unknown): Record; export interface ConfigPatch { /** Dotted keys to set (`{"defaults.model": "sonnet", "concurrency": 3}`). */ set?: Record; /** Dotted keys to remove. */ unset?: string[]; } /** Applies several changes to the raw config file in one validated write. `$schema` is not a setting. */ export declare function updateConfig(paths: Paths, patch: ConfigPatch): { raw: Record; config: Config; }; /** Keys that only a restart applies: the bind address. Everything else the running server takes over on reload. */ export declare const RESTART_CONFIG_KEYS: (keyof Config)[]; export declare const HOT_CONFIG_KEYS: (keyof Config)[]; /** Top-level keys whose values differ. */ export declare function diffConfig(before: Config, after: Config): (keyof Config)[]; export interface ConfigReload { changed: (keyof Config)[]; /** Applied to the live config now. */ applied: (keyof Config)[]; /** Changed in the file, effective at the next start. */ restart_required: (keyof Config)[]; pending_restart: (keyof Config)[]; } /** * The running server's config: one object, shared by the server, the queue, the scheduler and every run, patched in * place on `reload()` so nothing needs a new reference. Restart-only keys are remembered as `pendingRestart()`. */ export declare class ConfigRef { private readonly paths; private readonly deps; readonly current: Config; private readonly pending; /** The restart-only values this process started with; a file that returns to them clears the pending restart. */ private readonly startedWith; private stamp; constructor(paths: Paths, initial: Config, deps?: { events?: Events; onChange?: (applied: (keyof Config)[], config: Config) => void; }); get(): Config; pendingRestart(): (keyof Config)[]; private mtime; /** Re-reads the file (throws `ConfigError` when it is invalid; the live config is then untouched). */ reload(): ConfigReload; /** Reloads when the file's mtime changed (what `serve` polls every few seconds); errors go to `onError`. */ poll(onError?: (error: unknown) => void): ConfigReload | undefined; } /** Parses a CLI value: JSON when it looks like JSON, otherwise a string. */ export declare function coerceConfigValue(text: string): unknown;