anchor.diff:      send_message(Message, Vat).
   
   %% ===================================================================
  +handle_finish(Finish, Vat) ->
  +    Id = ecapnp:get(questionId, Finish),
  +    Release = ecapnp:get(releaseResultCaps, Finish),
  +    gen_server:call(Vat, {finish, Id, Release}).
  +
  +%% ===================================================================
  +handle_release(Release, Vat) ->
  +    Id = ecapnp:get(id, Release),
  +    Count = ecapnp:get(referenceCount, Release),
  +    gen_server:call(Vat, {release, Id, Count}).
  +
  +%% ===================================================================
   
   %% ===================================================================
   %% common utils
  
positive.code: export(Cap, State) ->
      case lists:keyfind(Cap, 3, State#state.exports#exports.caps) of
          {Id, RefCount, Cap} ->
              do_export(Id, Cap, RefCount, State);
          false ->
              {Id, State1} = get_next_export_id(State),
              do_export(Id, Cap, 0, State1)
      end.
  
  do_export(Id, Cap, RefCount, #state{ exports = #exports{ caps = Cs }=Es }=State) ->
      {Id, State#state{
             exports = Es#exports{
                         caps = lists:keystore(Id, 1, Cs, {Id, RefCount + 1, Cap})
                        }}
      }.
  
  get_next_export_id(#state{ exports = #exports{
                                          next_id = Id
                                         }=Es }=State) ->
  
negative.code:                                  }}}.
  
  %% ===================================================================
  release_caps(Caps, State0) ->
      Vat = self(),
      lists:foldl(
        fun (Cap, State) ->
                case Cap of
                    #capability{ id = {local, {Id, Vat}} } ->
                        release_export(Id, all, State);
                    _ ->
                        %% TODO: how do we release the other capabilities..
                        State
                end
        end, State0, Caps).
  
  %% ===================================================================
  
  %% ===================================================================
  %% process messages, these are run in their own processes
  %% ===================================================================
  
  %% ===================================================================
  -spec handle_message_process(Message::ecapnp:object(), Vat::pid()) -> ok.
  handle_message_process(Message, Vat) ->
      case ecapnp:get(Message) of
          {call, Call} -> handle_call(Call, Vat);
          {return, Return} -> handle_return(Return, Vat);
          {restore, Restore} -> handle_restore(Restore, Vat);
          {finish, Finish} -> handle_finish(Finish, Vat);
          {release, Release} -> handle_release(Release, Vat);
          _ ->
              {ok, Reply} = ecapnp:set_root('Message', rpc_capnp),
              ecapnp:set({unimplemented, Message}, Reply),
  