Text this: A legal theory for autonomous artificial agents