/** * Global user configuration (~/.config/zcode-acp/config.json). * * The file is the AUTHORITATIVE source for user preferences that must not * depend on how a process was launched: the hub daemon is idle-exited and * re-spawned by whichever bridge needs it next, so its birth env rotates * between GUI-launched editors (no shell rc vars) and interactive shells. * Every read is live (no cache) — editing the file takes effect on the next * use (e.g. the next remote incubation) without restarting the hub. * * Precedence everywhere: config file > environment variable > built-in * default. Env vars remain fully supported as a fallback for setups without * a file and for one-off/test overrides of unspecified fields. * * Per-process plumbing (ZCODE_ACP_REMOTE_ORIGIN, _PIN_CWD, * ZCODE_ACP_RESUME_SESSION) is deliberately NOT file-configurable — those * carry per-request/per-role state, not user preference. Bootstrap-time * variables (ZCODE_BIN, ZCODE_NODE, ZCODE_HOME, ZCODE_PROVIDER, …) are * resolved once at startup and stay env-only for the same reason. */ /** * Expand a leading `~`/`~/` to the user's home dir. Users naturally write * paths in shell terms; `~` is home-relative (cwd-independent), unlike other * relative spellings, so it is unambiguous to accept. `~otheruser/…` stays * untouched (only the current user's home is knowable without a lookup). */ export declare function expandHomePath(p: string): string; /** Terminal incubation preferences for remote session-create (ADR-0016). */ export interface TerminalPrefs { /** false → remote session-create stays headless (no visible window). */ enabled?: boolean; /** * Ordered terminal preference list — the hub tries them in order (a launch * failure or a window that never registers moves down the list) and only * goes headless once every entry failed. Names resolve like `app`. */ terminals?: string[]; /** Terminal app name (Terminal, iTerm, wezterm, kitty, alacritty, ghostty, …). */ app?: string; /** Shell command template; `{script}` is replaced with the quoted script path. */ command?: string; } /** The `remote` section of the user config file. */ export interface RemoteUserConfig { enabled?: boolean; token?: string; hubPort?: number; hubHost?: string; bridgePort?: number; /** * Absolute path of a web-client build (`dist/`) for the hub to serve * same-origin (empty/unset = static hosting off). A leading `~`/`~/` is * expanded to the home dir; anything else relative is rejected — the hub * daemon's cwd is unpredictable, so it would resolve differently per spawn. */ webDir?: string; /** * Directory roots under which remote clients may start NEW sessions in any * subdirectory (union with the known-project list). Empty/unset = the known * list alone stays the whitelist. Same `~` expansion and absolute-only * rules as webDir. */ projectRoots?: string[]; terminal?: TerminalPrefs; } /** The `quota` section of the user config file. */ export interface QuotaUserConfig { /** * Wait out quota exhaustion and continue automatically (default true): * /auto goal loops re-enter rounds after the usage cap resets, and * quota-stopped workflow runs are resumed from the journal. Set false to * restore the old pause-and-wait-for-a-human behavior. */ autoResume?: boolean; /** Ollama Cloud API key for the `zcode-acp quota` card (cloud.ollama.ai). */ ollamaApiKey?: string; /** Opencode Go workspace id (`wrk_…`) — see the quota CLI docs. */ opencodeGoWorkspaceId?: string; /** Opencode Go `auth` cookie value (`Fe26.2**…`). */ opencodeGoAuthCookie?: string; /** Opencode Go `__Host-console_session` cookie value (`st_…`) — required * since the 2026-09 console migration (the API 401s the auth cookie alone). */ opencodeGoSessionToken?: string; } /** The `session` section: session defaults and output preferences. */ export interface SessionUserConfig { /** Mode a new session starts in (plan/build/edit/yolo/auto — the backend's own modes). */ mode?: string; /** Show successful turn-end status as assistant text (default true). */ showCompletionStatus?: boolean; } /** The `autoCompact` section: threshold-based context compaction. */ export interface AutoCompactUserConfig { /** Absolute token count that triggers compaction after a turn (0/unset = disabled). */ threshold?: number; } /** The `goal` section: bridge-driven goal/auto loop knobs. */ export interface GoalUserConfig { /** Hard round budget before a pause (default 100). */ maxTurns?: number; /** "backend" restores the legacy backend goal mode; anything else uses the bridge loop. */ mode?: "backend"; } /** The `interaction` section: server→client request behavior. */ export interface InteractionUserConfig { /** Wait cap in ms for permission/elicitation requests (0 = wait forever). */ timeoutMs?: number; } /** The `tui` section: Martty TUI presentation preferences. */ export interface TuiUserConfig { /** * Composer-dock segment filter for the TUI's stats view (martty's * `DSH_TUI_STATS` vocabulary): comma-separated segment ids in render * order — `tokens`, `context`, `counts`, `cache`, `time`, `speed`. * `all` spells the full dock out; `none`/`off`/empty hides every * segment; unset keeps the full dock. File-configured so hub-incubated * TUI windows (whose shell inherits launchd's env, not the user's * shell) see the same dock as a direct `zcode-acp` launch. */ stats?: string; } /** The `sandbox` section: global Seatbelt arming switch (per-project stays in sandbox.json). */ export interface SandboxUserConfig { /** true = arm the sandbox globally (same as ZCODE_ACP_SANDBOX=1). */ enabled?: boolean; } /** The `relay` sub-section of `push`: static-IP proxy for the WeCom API. */ export interface PushRelayUserConfig { /** Base URL — the push client calls `${url}/cgi-bin/…` through it. */ url?: string; /** Shared secret sent as `x-relay-token` on every relayed call. */ token?: string; } /** The `notify` sub-section of `push`: per-kind settled-event switches. */ export interface PushNotifyUserConfig { turn?: boolean; goal?: boolean; run?: boolean; task?: boolean; compact?: boolean; /** Pending interaction asks (permission/question): zero-client push + unanswered watchdog. */ ask?: boolean; /** Workflow stage transitions (phase entered / node failed): mid-run digest push. */ workflowStage?: boolean; /** Quota threshold warnings (5h/weekly windows at 60/80/90/95/98/exhausted). */ quota?: boolean; } /** The `push` section: offline WeCom notifications (push-backend-requirements §8). */ export interface PushUserConfig { /** true = push ACTIVE once credentials are complete (default false). */ enabled?: boolean; corpId?: string; agentId?: number; secret?: string; /** WeCom message recipient (user id, "@all", or a |-joined list). Default "@all". */ toUser?: string; /** "minimal" strips business strings from bodies (content transits Tencent). */ contentDetail?: "full" | "minimal"; /** Settled-push quiet window in ms after a user prompt/cancel (0 = always push). */ quietMs?: number; /** Unanswered-ask watchdog delay in ms (0 = push at dispatch time; default 120s). */ askDelayMs?: number; /** Same watchdog for permission asks — a blocked tool call (default 15s). */ permissionAskDelayMs?: number; relay?: PushRelayUserConfig; notify?: PushNotifyUserConfig; } /** The `workflow` section: dynamic-workflow gate override (the App settings toggle). */ export interface WorkflowUserConfig { /** * Local override of the dynamic-workflow remote gate. Domain mirrors upstream * `ZCODE_DYNAMIC_WORKFLOW_MODE` (shared/dynamic-workflow-feature.ts); absent * = follow the remote verdict. Written via PUT /settings/workflow-gate. */ mode?: "disabled" | "onDemand" | "alwaysOn"; } export interface UserConfig { remote?: RemoteUserConfig; quota?: QuotaUserConfig; /** Language of user-facing bridge strings ("zh" | "en"). */ lang?: "zh" | "en"; /** Verbose diagnostic logging (same as ZCODE_ACP_DEBUG=1). */ debug?: boolean; session?: SessionUserConfig; autoCompact?: AutoCompactUserConfig; goal?: GoalUserConfig; interaction?: InteractionUserConfig; sandbox?: SandboxUserConfig; tui?: TuiUserConfig; push?: PushUserConfig; workflow?: WorkflowUserConfig; } /** Resolve the config file path: $XDG_CONFIG_HOME/zcode-acp or ~/.config/zcode-acp. */ export declare function userConfigPath(env?: NodeJS.ProcessEnv): string; /** * Read and validate the user config. Best-effort: a missing file is the * normal no-file path ({}), anything unreadable/malformed warns once and * reads as absent so the env fallback keeps the process working. */ export declare function loadUserConfig(env?: NodeJS.ProcessEnv): UserConfig; //# sourceMappingURL=user-config.d.ts.map