MOSS: Enabling Code-Driven Evolution and Context Management for AI Agents