import { g as resolveStateDir } from "./paths-mmi2xb99.js";
import "./subsystem-D4e4nOE7.js";
import "./utils-DLd4fFd2.js";
import "./boolean-Djq1Hgv8.js";
import "./env-Bdq5Y-tD.js";
import "./config-C9wUwpYY.js";
import "./agent-scope-BcV171ci.js";
import "./exec-B_ziy0Fn.js";
import "./edwinpai-root-BaNzp4sP.js";
import "./model-selection-ChysOie6.js";
import "./github-copilot-token-D-EydSr2.js";
import "./command-format-XQlUKdf6.js";
import "./manifest-registry-DThGPzHr.js";
import fs from "node:fs";
import path from "node:path";

//#region ../../src/infra/desktop-identity.ts
function resolveIdentityKeyPath(stateDir) {
	const resolvedStateDir = stateDir ?? resolveStateDir(process.env);
	return path.join(resolvedStateDir, "identity-key");
}
function loadDesktopIdentityKey(stateDir) {
	const keyPath = resolveIdentityKeyPath(stateDir);
	if (!fs.existsSync(keyPath)) return null;
	try {
		const raw = fs.readFileSync(keyPath, "utf-8").trim();
		if (/^[0-9a-fA-F]{64}$/.test(raw)) return raw.toLowerCase();
		return null;
	} catch {
		return null;
	}
}

//#endregion
export { loadDesktopIdentityKey };