UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

5 lines • 1.96 kB
import{C as resolveIsNixMode,S as resolveIsConfigReadOnly}from"./paths-D_FOvGon.mjs"; //!src/config/config-write-guard.ts const NIX_OPENCLAW_AGENT_FIRST_URL=`https://github.com/openclaw/nix-openclaw#quick-start`;const NIX_OVERVIEW_URL=`https://docs.openclaw.ai/install/nix`;var ConfigReadOnlyError=class extends Error{constructor(e={}){super(["Config is externally managed (`OPENCLAW_CONFIG_READONLY=1`), so OpenClaw treats openclaw.json as immutable.",...e.configPath?[`Config path: ${e.configPath}`]:[],`Edit the config in your external deployment source, then redeploy or restart OpenClaw as needed.`].join(` `));this.code=`OPENCLAW_CONFIG_READONLY`;this.name=`ConfigReadOnlyError`}};var NixModeConfigMutationError=class extends Error{constructor(e={}){super(["Config is managed by Nix (`OPENCLAW_NIX_MODE=1`), so OpenClaw treats openclaw.json as immutable.",`This usually means nix-openclaw, the first-party Nix distribution, or another Nix-managed package set this mode.`,...e.configPath?[`Config path: ${e.configPath}`]:[],`Do not run setup, onboarding, openclaw update, plugin install/update/uninstall/enable, doctor repair/token-generation, or config set against this file.`,"Edit the Nix source for this install instead. For nix-openclaw, edit `programs.openclaw.config` or `instances.<name>.config`, then rebuild with Home Manager or NixOS.",`Agent-first Nix setup: ${NIX_OPENCLAW_AGENT_FIRST_URL}`,`OpenClaw Nix overview: ${NIX_OVERVIEW_URL}`].join(` `));this.code=`OPENCLAW_NIX_MODE_CONFIG_IMMUTABLE`;this.name=`NixModeConfigMutationError`}};function assertConfigWriteAllowedInCurrentMode(e={}){if(!resolveIsConfigReadOnly(e.env))return;throw createConfigMutationError(e)}function createConfigMutationError(e={}){return resolveIsNixMode(e.env)?new NixModeConfigMutationError(e):new ConfigReadOnlyError(e)}export{createConfigMutationError as i,NixModeConfigMutationError as n,assertConfigWriteAllowedInCurrentMode as r,ConfigReadOnlyError as t};