```python
def replay_buffer(ops: list, capacity: int) -> dict:
    if not isinstance(capacity, int) or capacity <= 0:
        raise ValueError("capacity must be a positive integer")
    held = []
    taken = []
    for op in ops:
        if op.startswith("add:"):
            if len(held) == capacity:
                raise ValueError("buffer is full")
            held.append(op[4:])
        elif op.startswith("take"):
            if not held:
                raise ValueError("buffer is empty")
            taken.append(held.pop(0))
        else:
            raise ValueError("invalid operation")
    return {"held": held, "taken": taken}
```