import { CONTROL_PLANE_HOST, CONTROL_PLANE_PORT } from "@pocketcoder/shared";
import { isDaemonRunning } from "./commands/start.js";
/**
 * Notify the running daemon to send a project_added message to the gateway.
 * Silently skips if daemon is not running or not connected to gateway.
 */
export async function notifyDaemonProjectAdded(projectId, name, path) {
    const running = await isDaemonRunning();
    if (!running)
        return;
    try {
        const url = `http://${CONTROL_PLANE_HOST}:${CONTROL_PLANE_PORT}/project-added`;
        await fetch(url, {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify({ projectId, name, path }),
            signal: AbortSignal.timeout(5000),
        });
    }
    catch {
        // Silently ignore - daemon may not be running or endpoint may not be available
    }
}
/**
 * Notify the running daemon to send a project_removed message to the gateway.
 * Silently skips if daemon is not running or not connected to gateway.
 */
export async function notifyDaemonProjectRemoved(projectId) {
    const running = await isDaemonRunning();
    if (!running)
        return;
    try {
        const url = `http://${CONTROL_PLANE_HOST}:${CONTROL_PLANE_PORT}/project-removed`;
        await fetch(url, {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify({ projectId }),
            signal: AbortSignal.timeout(5000),
        });
    }
    catch {
        // Silently ignore - daemon may not be running or endpoint may not be available
    }
}
//# sourceMappingURL=notify-project-sync.js.map