import "./paths-C9FmTW1x.js";
import "./agent-paths-BySKyq9I.js";
import { r as listAgentIds } from "./agent-scope-CLn_Ws3B.js";
import "./errors-Dx3S3Nrp.js";
import "./github-copilot-token-BA45-q56.js";
import "./chat-envelope-D_wSv26N.js";
import "./ip-D_T5zbZS.js";
import "./fetch-guard-hWUtz61M.js";
import "./ssrf-Blf4NrHS.js";
import { n as resolveMemoryBackendConfig, t as getMemorySearchManager } from "./memory-e9aOXNx1.js";
import { t as resolveMemorySearchConfig } from "./memory-search-B8y2GTeB.js";
import "./manager-DI2w66Ae.js";
import "./query-expansion-BdzehFyx.js";

//#region src/gateway/server-startup-memory.ts
async function startGatewayMemoryBackend(params) {
	const agentIds = listAgentIds(params.cfg);
	for (const agentId of agentIds) {
		if (!resolveMemorySearchConfig(params.cfg, agentId)) continue;
		const resolved = resolveMemoryBackendConfig({
			cfg: params.cfg,
			agentId
		});
		if (resolved.backend !== "qmd" || !resolved.qmd) continue;
		const { manager, error } = await getMemorySearchManager({
			cfg: params.cfg,
			agentId
		});
		if (!manager) {
			params.log.warn(`qmd memory startup initialization failed for agent "${agentId}": ${error ?? "unknown error"}`);
			continue;
		}
		params.log.info?.(`qmd memory startup initialization armed for agent "${agentId}"`);
	}
}

//#endregion
export { startGatewayMemoryBackend };