Regarding the first question, here's a fail-safe alternative that covers trust and plant errors and has a function that will clean up your brick.You can get the client by doing
%obj.client, but keep in mind that there's cases where this field isn't set, so it's a good idea to check if the client exists before doing any client-specific operations.
The duplicator makes this slightly difficult to work with, though.
onTrustCheckFinished will catch the bricks being planted by it, though it's not a good idea to remove them with the aforementioned
%obj.TrustCheckFailed() because it will definitely screw up the client's undo stack. In that case just call
%obj.schedule(0, delete); (schedule because the duplicator will do more operations after
onTrustCheckFinished and deleting it directly will cause problems). This requires hooking duplicator-related functions in order to know if the brick comes from the duplicator. Try packaging
createFromStr(%str, %client) and setting a global variable before and after to determine that.
Edit:
createFromStr() also returns the brick the duplicator just created (and error codes otherwise), so it's better to just package the function and get the brick from what the parent returns, then do specific operations afterwards. Delete and return 0 for failure.