import { j as json } from './exports-D1quPX8S.js';
import { R as detectHostOpenCode, ad as hostAkmStashPath, ak as isHostAkmAvailable, H as createLogger } from './src-CidJbygh.js';
import { homedir } from 'node:os';
import './utils-BSRjJDrZ.js';
import './chunk-CLZ62Ad-.js';
import 'node:module';
import './provider-constants-DPrj3yBX.js';
import './dist-DOFcG0Zp.js';
import 'node:fs';
import 'node:path';
import 'buffer';
import 'fs';
import 'path';
import 'node:child_process';
import 'node:url';
import 'node:crypto';
import 'events';
import 'node:events';
import 'node:stream';
import 'node:string_decoder';
import 'assert';
import 'zlib';
import 'node:assert';
import 'node:fs/promises';

//#region src/routes/api/setup/host-status/+server.ts
var logger = createLogger("admin:host-status");
var GET = () => {
	try {
		const status = detectHostOpenCode();
		const home = homedir();
		const akmStashPath = hostAkmStashPath();
		const hostAkmAvailable = isHostAkmAvailable();
		return json({
			detected: status.providerCount > 0 || status.credentialCount > 0,
			providerCount: status.providerCount,
			credentialCount: status.credentialCount,
			modelPreferences: status.modelPreferences,
			imageTag: "latest",
			hostAkmAvailable,
			hostAkmPaths: {
				stash: akmStashPath,
				data: `${home}/.local/share/akm`,
				state: `${home}/.local/state/akm`,
				config: `${home}/.config/akm`
			}
		});
	} catch (err) {
		const message = err instanceof Error ? err.message : String(err);
		const stack = err instanceof Error ? err.stack : void 0;
		logger.warn("failed to detect host openpalm/openpalm state", {
			error: message,
			stack
		});
		return json({
			detected: false,
			providerCount: 0,
			credentialCount: 0,
			imageTag: "latest",
			hostAkmAvailable: false,
			warning: `Could not detect host OpenCode state: ${message}`
		});
	}
};

export { GET };
//# sourceMappingURL=_server.ts-xb_1w1kf.js.map
