import { g as getCleoHome$1 } from './paths-2M_UxD_H.js';
import './dist4-CiQ5cizO.js';
import { existsSync } from 'node:fs';
import { join } from 'node:path';

//#region src/lib/server/cleo-home.ts
/**
* Resolves CLEO home and project data paths for the studio server.
*
* Resolution order:
*   1. CLEO_HOME env var — explicit override
*   2. OS-appropriate data path via `@cleocode/core` → `env-paths`
*      (XDG on Linux, `~/Library/Application Support/cleo` on macOS,
*      `%LOCALAPPDATA%\cleo\Data` on Windows)
*
* Project data (tasks.db, brain.db) is resolved from:
*   1. CLEO_ROOT env var (project root)
*   2. process.cwd()/.cleo/
*
* Previously this module hand-rolled platform detection which caused a
* Windows path mismatch (see brain/src/cleo-home.ts for details).
* Fixed in T1874 (Closes #102, supersedes #103) by delegating to
* `@cleocode/core`'s canonical `getCleoHome` which uses env-paths.
*
* @task T1874
*/
/**
* Returns the CLEO home directory (where global DBs live).
*
* Delegates to `@cleocode/core`'s `getCleoHome` which uses `env-paths`
* for OS-appropriate, XDG-compliant path resolution.
*
* @returns Absolute path to the global CLEO data directory
*
* @example
* ```typescript
* const home = getCleoHome(); // e.g. "/home/user/.local/share/cleo"
* ```
*/
function getCleoHome() {
	return getCleoHome$1();
}
/**
* Returns the project's `.cleo/` directory.
* Resolved from `CLEO_ROOT` env var, falling back to `process.cwd()`.
*/
function getCleoProjectDir() {
	return join(process.env["CLEO_ROOT"] ?? process.cwd(), ".cleo");
}
/** Returns the absolute path to the global nexus.db file. */
function getNexusDbPath() {
	return join(getCleoHome(), "nexus.db");
}
/** Returns the absolute path to the global signaldock.db file. */
function getAgentRegistryDbPath() {
	return join(getCleoHome(), "signaldock.db");
}
/** Returns true when the given DB file exists on disk. */
function dbExists(dbPath) {
	return existsSync(dbPath);
}

export { getCleoProjectDir as a, getAgentRegistryDbPath as b, getNexusDbPath as c, dbExists as d, getCleoHome as g };
//# sourceMappingURL=cleo-home-BCqJ5rg1.js.map
