import { init_agent_scope, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
import { init_paths, resolveExtensionsDir, resolveWorkspaceExtensionsDir } from "../config/paths.js";
import { discoverExtensionsFromDisk } from "./discover-extensions.js";
import { ManifestRegistry } from "./manifest-registry.js";
//#region src/extensions/extension-metadata-snapshot.ts
init_agent_scope();
init_paths();
/**
* Scan extension directories once and build a manifest registry snapshot.
* Pass the result to {@link ExtensionLoader.setManifestSnapshot} to avoid rediscovery.
*/
function buildExtensionMetadataSnapshot(options, config) {
	const discovered = discoverExtensionsFromDisk(options, config);
	return {
		discovered,
		manifestRegistry: ManifestRegistry.fromDiscovered(discovered)
	};
}
/**
* Resolve loader options from app config when caller omits workspace paths.
*/
function resolveExtensionLoaderOptionsFromConfig(config) {
	const cfg = config;
	const aid = resolveDefaultAgentId(cfg);
	return {
		workspaceDir: resolveAgentWorkspaceDir(cfg, aid),
		extensionsDir: resolveExtensionsDir(),
		workspaceExtensionsDir: resolveWorkspaceExtensionsDir(cfg, aid)
	};
}
//#endregion
export { buildExtensionMetadataSnapshot, resolveExtensionLoaderOptionsFromConfig };

//# sourceMappingURL=extension-metadata-snapshot.js.map