export function emitProgress(context, event) {
    context.progressCallback?.(event);
}
export async function withProgress(context, action, source, message, operation) {
    emitProgress(context, { type: "start", action, source, message });
    try {
        await operation();
        emitProgress(context, { type: "complete", action, source });
    }
    catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        emitProgress(context, { type: "error", action, source, message: errorMessage });
        throw error;
    }
}
//# sourceMappingURL=package-manager-progress.js.map