import { f as resolveIsNixMode } from "./paths-ZwPDM6zn.js";
//#region src/config/nix-mode-write-guard.ts
const NIX_DAOCORE_AGENT_FIRST_URL = "https://github.com/openclaw/nix-daocore#quick-start";
const DAOCORE_NIX_OVERVIEW_URL = "https://docs.openclaw.ai/install/nix";
var NixModeConfigMutationError = class extends Error {
	constructor(params = {}) {
		super(formatNixModeConfigMutationMessage(params));
		this.code = "DAOCORE_NIX_MODE_CONFIG_IMMUTABLE";
		this.name = "NixModeConfigMutationError";
	}
};
function formatNixModeConfigMutationMessage(params = {}) {
	return [
		"Config is managed by Nix (`DAOCORE_NIX_MODE=1`), so DaoCore treats daocore.json as immutable.",
		"This usually means nix-daocore, the first-party Nix distribution, or another Nix-managed package set this mode.",
		...params.configPath ? [`Config path: ${params.configPath}`] : [],
		"Do not run setup, onboarding, daocore 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-daocore, edit `programs.daocore.config` or `instances.<name>.config`, then rebuild with Home Manager or NixOS.",
		`Agent-first Nix setup: ${NIX_DAOCORE_AGENT_FIRST_URL}`,
		`DaoCore Nix overview: ${DAOCORE_NIX_OVERVIEW_URL}`
	].join("\n");
}
function assertConfigWriteAllowedInCurrentMode(params = {}) {
	if (!resolveIsNixMode(params.env)) return;
	throw new NixModeConfigMutationError({ configPath: params.configPath });
}
//#endregion
export { assertConfigWriteAllowedInCurrentMode as n, NixModeConfigMutationError as t };
