import { t as resolveNodmixPackageRoot } from "./nodmix-root-DFuWr6Ye.js";
import fs from "node:fs";
import path from "node:path";
//#region src/agents/docs-path.ts
const NODMIX_DOCS_URL = "https://docs.nodmix.ai";
const NODMIX_SOURCE_URL = "https://github.com/nodmix/openclaw";
function isUsableDocsDir(docsDir) {
	return fs.existsSync(path.join(docsDir, "docs.json"));
}
function isGitCheckout(rootDir) {
	return fs.existsSync(path.join(rootDir, ".git"));
}
async function resolveNodmixDocsPath(params) {
	const workspaceDir = params.workspaceDir?.trim();
	if (workspaceDir) {
		const workspaceDocs = path.join(workspaceDir, "docs");
		if (isUsableDocsDir(workspaceDocs)) return workspaceDocs;
	}
	const packageRoot = await resolveNodmixPackageRoot({
		cwd: params.cwd,
		argv1: params.argv1,
		moduleUrl: params.moduleUrl
	});
	if (!packageRoot) return null;
	const packageDocs = path.join(packageRoot, "docs");
	return isUsableDocsDir(packageDocs) ? packageDocs : null;
}
async function resolveNodmixSourcePath(params) {
	const packageRoot = await resolveNodmixPackageRoot({
		cwd: params.cwd,
		argv1: params.argv1,
		moduleUrl: params.moduleUrl
	});
	if (!packageRoot || !isGitCheckout(packageRoot)) return null;
	return packageRoot;
}
async function resolveNodmixReferencePaths(params) {
	const [docsPath, sourcePath] = await Promise.all([resolveNodmixDocsPath(params), resolveNodmixSourcePath(params)]);
	return {
		docsPath,
		sourcePath
	};
}
//#endregion
export { resolveNodmixSourcePath as a, resolveNodmixReferencePaths as i, NODMIX_SOURCE_URL as n, resolveNodmixDocsPath as r, NODMIX_DOCS_URL as t };
