//#region src/chat-commands/config-paths.ts
function parseConfigPath(raw) {
	const parts = raw.trim().split(".").map((p) => p.trim());
	if (parts.some((p) => !p)) return {
		ok: false,
		error: "Invalid path. Use dot notation (e.g. agents.defaults.model)."
	};
	return {
		ok: true,
		path: parts
	};
}
function getConfigValueAtPath(root, path) {
	let cursor = root;
	for (const key of path) {
		if (typeof cursor !== "object" || cursor === null) return void 0;
		cursor = cursor[key];
	}
	return cursor;
}
function setConfigValueAtPath(root, path, value) {
	let cursor = root;
	for (let i = 0; i < path.length - 1; i++) {
		const key = path[i];
		if (typeof cursor[key] !== "object" || cursor[key] === null) cursor[key] = {};
		cursor = cursor[key];
	}
	cursor[path[path.length - 1]] = value;
}
function unsetConfigValueAtPath(root, path) {
	let cursor = root;
	for (let i = 0; i < path.length - 1; i++) {
		const next = cursor[path[i]];
		if (typeof next !== "object" || next === null) return false;
		cursor = next;
	}
	const leaf = path[path.length - 1];
	if (!(leaf in cursor)) return false;
	delete cursor[leaf];
	return true;
}
//#endregion
export { getConfigValueAtPath, parseConfigPath, setConfigValueAtPath, unsetConfigValueAtPath };

//# sourceMappingURL=config-paths.js.map