How are composite aircraft canopies constructed that sit flush with the fuselage?
That is a complicated process. You need:

A positive mold (mandrel) for the canopy.
A negative mold for the canopy frame. For a single prototype you can also use the unfinished fuselage itself.
A fuselage mold with a molded window sill.

First the fuselage positive mold core is built. From that the negative mold is taken, but also a negative mold only for the canopy area. From that negative mold the mandrel for canopy manufacture is built. If you have enough money, you can of course CNC mill the mandrel directly from a large block of aluminium.
The plexiglass canopy is deep-drawn over this mandrel by the canopy manufacturer, e.g. Mecaplex. There aren't many who get this process right!
Meanwhile, the window sill has been added to the fuselage mold and can be used for manufacturing the canopy frame mold. Once that is finished, the canopy frame is built by first lining the mold with diagonal weave fabric (glass or carbon, as you like) and filling the core of the frame with unidirectional rovings. Then another couple of diagonal weave layers is added on top. After removal from the mold the frame is trimmed and now the transparent part is added. The frame has a recess where the plexiglass fits in and the plexiglass is fixed to the frame with a special polyurethane adhesive. A couple of screws make sure it stays in the correct location.
To finish the canopy, the fittings are added and the frame is painted.