Lifecycle, context, and sharding
The application lifecycle validates, starts owned resources in order, and stops them in reverse. Concurrent calls share the same start or stop promise. Partial startup triggers cleanup, while shutdown drains active tasks and then releases timers, servers, listeners, plugins, storage clients, logs, and Discord.
Pop, EventPop, ComponentPop, and TaskPop expose only the state appropriate to their execution. Plugins may augment these types and add scoped context values in onContextCreate.
Shard requests and broadcasts use versioned Zod-validated envelopes. Include a unique request ID and bounded reply timeout. Payloads must be serializable; do not send clients, database handles, or secrets between shards.